Example #1
0
 public ReturnResult GetUserAccountNumer()
 {
     try
     {
         int number = new BLL.FX_Agent().GetUserAccountNumer();
         if (number > 0)
         {
             return(new ReturnResult()
             {
                 code = ReturnCode.Success,
                 data = new
                 {
                     number = number
                 },
                 desc = ""
             });
         }
         else
         {
             return(new ReturnResult()
             {
                 code = ReturnCode.Error,
                 data = "",
                 desc = "未知错误"
             });
         }
     }
     catch (Exception err)
     {
         return(new ReturnResult()
         {
             code = ReturnCode.Error,
             data = "",
             desc = err.Message
         });
     }
 }
Example #2
0
        /// <summary>
        /// 获取我的团队推荐信息
        /// </summary>
        /// <param name="agentId"></param>
        /// <returns></returns>
        public IntroduceReturn GetMyTeam(int agentId)
        {
            Model.FX_Agent agentModel = new BLL.FX_Agent().GetModelByAgentId(agentId);
            if (agentModel == null)
            {
                return(null);
            }
            IntroduceReturn introduceList = new IntroduceReturn()
            {
                parentAgentInfo = new IntroduceDetail(),
                childAgentList  = new List <IntroduceDetail>(),
            };

            introduceList.agentLevel = agentModel.AgentLevel.Value;
            //代理商本身信息
            introduceList.agentInfo = new IntroduceDetail()
            {
                id          = agentModel.AgentId,
                parentId    = agentModel.ParentId.ToInt32(),
                name        = agentModel.TrueName,
                mobile      = agentModel.Mobile,
                picUrl      = agentModel.FacePic,
                policyAmout = new BLL.FX_Policy().GetMonthPolicy(agentModel.AgentId)
            };
            StringBuilder strWhere = new StringBuilder();

            //非三级代理商增加子集信息
            if (agentModel.AgentLevel != AgentLevelEnum.ThirdAgent.GetHashCode())
            {
                strWhere = new StringBuilder();
                strWhere.AppendFormat(" CHARINDEX(',{0},',ParentList)>0 and AgentLevel={1}", agentModel.AgentId, (agentModel.AgentLevel.ToInt32() + 1));
                List <Model.FX_Agent> agentList = new BLL.FX_Agent().GetList(strWhere.ToString()).Tables[0].ToEntityList <Model.FX_Agent>();
                if (agentList != null && agentList.Count > 0)
                {
                    agentList = agentList.OrderBy(exp => exp.TrueName).ToList();
                    introduceList.childAgentList = new List <IntroduceDetail>();
                    foreach (Model.FX_Agent info in agentList)
                    {
                        introduceList.childAgentList.Add(new IntroduceDetail()
                        {
                            id          = info.AgentId,
                            parentId    = info.ParentId.ToInt32(),
                            name        = info.TrueName,
                            mobile      = info.Mobile,
                            picUrl      = info.FacePic,
                            policyAmout = new BLL.FX_Policy().GetMonthPolicy(info.AgentId)
                        });
                    }
                }
            }
            //非一级加载推荐人信息
            if (agentModel.AgentLevel != AgentLevelEnum.FirstAgent.GetHashCode())
            {
                Model.FX_Agent parentAgentModel = new BLL.FX_Agent().GetModelByAgentId(agentModel.ParentId.ToInt32());
                if (parentAgentModel != null)
                {
                    introduceList.parentAgentInfo = new IntroduceDetail()
                    {
                        id          = parentAgentModel.AgentId,
                        name        = parentAgentModel.TrueName,
                        parentId    = parentAgentModel.ParentId.ToInt32(),
                        mobile      = parentAgentModel.Mobile,
                        picUrl      = parentAgentModel.FacePic,
                        policyAmout = new BLL.FX_Policy().GetMonthPolicy(parentAgentModel.AgentId)
                    };
                }
            }
            return(introduceList);
        }
Example #3
0
        public ReturnResult Register()
        {
            try
            {
                string name   = Request.Param("name").ToStringEx();   //用户名
                string number = Request.Param("number").ToStringEx(); //身份证号
                string phone  = Request.Param("phone").ToStringEx();  //手机号码
                string code   = Request.Param("code").ToStringEx();   //短信验证码
                string zcode  = Request.Param("zcode").ToStringEx();  //代理商邀请码

                if (name.IsNullOrWhiteSpace())
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.NullOrEmpty,
                        data = "",
                        desc = "用户名为必填项"
                    });
                }

                if (number.IsNullOrWhiteSpace())
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.NullOrEmpty,
                        data = "",
                        desc = "身份证号为必填项"
                    });
                }

                if (phone.IsNullOrWhiteSpace())
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.NullOrEmpty,
                        data = "",
                        desc = "手机号码为必填项"
                    });
                }

                if (code.IsNullOrWhiteSpace())
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.NullOrEmpty,
                        data = "",
                        desc = "验证码为必填项"
                    });
                }

                if (zcode.IsNullOrWhiteSpace())
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.NullOrEmpty,
                        data = "",
                        desc = "邀请码为必填项"
                    });
                }

                Model.FX_Agent agentModel = new Model.FX_Agent()
                {
                    TrueName         = name,
                    IDNO             = number,
                    Mobile           = phone,
                    OpenId           = "",
                    WXName           = "",
                    FacePic          = "",
                    ParentId         = 0,
                    ParentList       = ",",
                    TotalAmout       = 0,
                    AvailableAmount  = 0,
                    CreateTime       = DateTime.Now,
                    IsDelete         = false,
                    IsUse            = true,
                    ComeFrom         = 1,
                    UserAccountNumer = new BLL.FX_Agent().GetUserAccountNumer().ToStringEx()
                };

                Model.FX_Agent agentParentModel = new BLL.FX_Agent().GetModelByZCode(zcode);
                if (agentParentModel != null)
                {
                    agentModel.CityCode = agentParentModel.CityCode;
                    if (agentParentModel.AgentLevel == 1)
                    {
                        agentModel.ParentList += agentParentModel.AgentId + ",";
                        agentModel.AgentLevel  = 2;
                    }
                    else
                    {
                        Model.FX_Agent agentFirstParent = new BLL.FX_Agent().GetModelByZCode(agentParentModel.ParentId.Value.ToStringEx());
                        if (agentFirstParent != null)
                        {
                            agentModel.ParentList += agentFirstParent.AgentId + ",";
                            agentModel.ParentList += agentParentModel.AgentId + ",";
                            agentModel.AgentLevel  = 3;
                        }
                    }
                }

                if (new BLL.FX_Agent().RegisterAgent(agentModel))
                {
                    //LogHelper.WriteLog(CZB.Common.Enums.LogEnum.Api, agentModel.ToJson());
                    return(new ReturnResult()
                    {
                        code = ReturnCode.Success,
                        data = "",
                        desc = "注册成功"
                    });
                }
                else
                {
                    return(new ReturnResult()
                    {
                        code = ReturnCode.Error,
                        data = "",
                        desc = "注册失败"
                    });
                }
            }
            catch (Exception err)
            {
                return(new ReturnResult()
                {
                    code = ReturnCode.Error,
                    data = "",
                    desc = err.Message
                });
            }
        }
Example #4
0
        /// <summary>
        /// 用户登录返回信息
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public UserLoginReturn UserLogin(string phone)
        {
            var returnModel = new UserLoginReturn();
            var model       = new BLL.FX_Agent().GetModelByPhone(phone);

            if (model != null)
            {
                //用户基本信息
                int level   = model.AgentLevel.ToInt32();
                int agentId = model.AgentId.ToInt32();
                returnModel.userInfo = new UserInfo()
                {
                    headImg     = model.FacePic,
                    id          = agentId.ToStringEx(),
                    level       = level,
                    money       = model.TotalAmout.ToStringEx(),
                    levelName   = level == 1 ? "一级代理商" : level == 2 ? "二级代理商" : "三级代理商",
                    name        = model.TrueName,
                    phone       = model.Mobile,
                    cityCode    = model.CityCode,
                    code        = model.UserAccountNumer,
                    thirdOpenId = model.ThirdOpenId
                };
                //中部菜单信息
                var Menulist = new List <ShowMenuList>();

                var _shouyi_title = "0";
                var _shouyi       = new BLL.FX_IncomeRecord().GetIncomeRecord(agentId);
                if (_shouyi.Tables[0].Rows.Count > 0)
                {
                    if (_shouyi.Tables[0].Rows[0]["num"] != null && _shouyi.Tables[0].Rows[0]["num"].ToStringEx() != "")
                    {
                        _shouyi_title = _shouyi.Tables[0].Rows[0]["num"].ToString();
                    }
                }
                var _baofei_all_title = "0";
                var _baofei_all       = new BLL.FX_Policy().GetPolicyAll(agentId);
                if (_baofei_all.Tables[0].Rows.Count > 0)
                {
                    if (_baofei_all.Tables[0].Rows[0]["num"] != null && _baofei_all.Tables[0].Rows[0]["num"].ToStringEx() != "")
                    {
                        _baofei_all_title = _baofei_all.Tables[0].Rows[0]["num"].ToStringEx();
                    }
                }

                Menulist.Add(new ShowMenuList()
                {
                    showMenuName   = "总收益/总保费",
                    showMenuNumber = _shouyi_title + "/" + _baofei_all_title
                });

                //当月销售
                string moneySaler = "0";
                var    info       = new BLL.FX_Policy().GetPolicyMonth(agentId);
                if (info != null && info.Tables[0] != null && info.Tables[0].Rows.Count > 0 && info.Tables[0].Rows[0]["num"] != null)
                {
                    if (info.Tables[0].Rows[0]["num"].ToStringEx() != "")
                    {
                        moneySaler = info.Tables[0].Rows[0]["num"].ToStringEx();
                    }
                }
                //目标

                //当月目标
                string paraCode = "CP008";
                switch (model.AgentLevel)
                {
                case 1:
                    paraCode = "CP008";
                    break;

                case 2:
                    paraCode = "CP009";
                    break;

                case 3:
                    paraCode = "CP010";
                    break;
                }
                string cityParaDetailName  = string.Empty;
                var    cityParaDetailModel = new BLL.FX_CityParaDetails().GetListByCode(model.CityCode, paraCode).Tables[0].ToEntity <Model.FX_CityParaDetails>();
                if (cityParaDetailModel != null)
                {
                    cityParaDetailName = cityParaDetailModel.ParaValue;
                }
                Menulist.Add(new ShowMenuList()
                {
                    showMenuName   = "当月销售/目标",
                    showMenuNumber = moneySaler + "/" + cityParaDetailName
                });

                if (level == 1 || level == 2)
                {
                    int parentAgentCount    = new BLL.FX_Agent().GetCountParent(agentId);
                    var _shouyi_daili_title = "0";
                    var _shouyi_daili       = new BLL.FX_IncomeRecord().GetCommissionAmount(agentId);
                    if (_shouyi_daili.Tables[0].Rows.Count > 0)
                    {
                        if (_shouyi_daili.Tables[0].Rows[0]["num"] != null && _shouyi_daili.Tables[0].Rows[0]["num"].ToStringEx() != "")
                        {
                            _shouyi_daili_title = _shouyi_daili.Tables[0].Rows[0]["num"].ToString();
                        }
                    }
                    Menulist.Add(new ShowMenuList()
                    {
                        showMenuName   = "代理数/代理收益",
                        showMenuNumber = parentAgentCount + "/" + _shouyi_daili_title
                    });
                    Menulist.Add(new ShowMenuList()
                    {
                        showMenuName   = "我的积分",
                        showMenuNumber = "0"
                    });
                }
                returnModel.showMenuList = Menulist;

                //保单信息
                var orderList  = new List <OrderList>();
                var _orderList = new BLL.FX_Policy().GetListByAgentId(agentId).Tables[0];

                orderList.Add(new OrderList()
                {
                    orderStateName   = "待报价",
                    orderStateNumber = _orderList.Select("PolicyState=1").Length.ToStringEx()
                });
                orderList.Add(new OrderList()
                {
                    orderStateName   = "待支付",
                    orderStateNumber = _orderList.Select("PolicyState=2").Length.ToStringEx()
                });
                orderList.Add(new OrderList()
                {
                    orderStateName   = "已生效",
                    orderStateNumber = _orderList.Select("PolicyState= 3  and EndTime >='" + DateTime.Now.ToString() + "' ").Length.ToStringEx()
                });
                orderList.Add(new OrderList()
                {
                    orderStateName   = "已过期",
                    orderStateNumber = _orderList.Select("PolicyState= 3  and  EndTime <'" + DateTime.Now.ToString() + "'").Length.ToStringEx()
                });
                orderList.Add(new OrderList()
                {
                    orderStateName   = "已拒绝",
                    orderStateNumber = _orderList.Select("PolicyState='-1' ").Length.ToStringEx()
                });



                returnModel.orderList = orderList;
            }
            return(returnModel);
        }