Exemplo n.º 1
0
        public ActionResult GetUserData()
        {
            Return_Msg           msg   = new Return_Msg();
            ViewModelMyWorkbench model = new ViewModelMyWorkbench();

            model._Member  = MemberBLL.SingleModel.GetModel(string.Format("AccountId='{0}'", dzuserId));
            model._Account = AccountBLL.SingleModel.GetModel(dzuserId);
            if (model._Member != null)
            {
                if (model._Account != null)
                {
                    Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(model._Account.Id.ToString());
                    msg.isok    = true;
                    msg.Msg     = "成功";
                    msg.dataObj = new { userinfo = model._Account, agentinfo = agentinfo, isagent = agentinfo != null ? 1 : 0 };
                    return(Json(msg, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    CookieHelper.Remove("dz_UserCookieNew");
                    return(RedirectToAction("Login", "dzhome"));
                }
            }
            else
            {
                CookieHelper.Remove("dz_UserCookieNew");
                return(RedirectToAction("Login", "dzhome"));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询用户身份
        /// </summary>
        protected ViewModelMyWorkbench GetUserInfo(int aid = 0, int pageType = 0)
        {
            ViewModelMyWorkbench model = new ViewModelMyWorkbench();

            try
            {
                if (pageType == -1)
                {
                    model._Member  = MemberBLL.SingleModel.GetModel(string.Format("AccountId='{0}'", agentuserId));
                    model._Account = AccountBLL.SingleModel.GetModel(agentuserId);
                }
                else
                {
                    model._Member  = MemberBLL.SingleModel.GetModel(string.Format("AccountId='{0}'", dzuserId));
                    model._Account = AccountBLL.SingleModel.GetModel(dzuserId);
                }

                if (model._Member != null)
                {
                    if (model._Account != null)
                    {
                        //获取用户是否有设置自定义水印
                        int bottomlogocount = ConfParamBLL.SingleModel.GetCustomConfigCount(model._Account.Id.ToString(), "'agentcustomlogo'");
                        model.BottomLogoCount = bottomlogocount;
                        if (aid > 0)
                        {
                            List <ConfParam> confparamlist = ConfParamBLL.SingleModel.GetListByRId(aid, "'agentsystemlogo'");
                            model.CustomLogo = confparamlist == null || confparamlist.Count <= 0 ? "" : confparamlist[0].Value;//"https://gss0.bdstatic.com/5bVWsj_p_tVS5dKfpU_Y_D3/res/r/image/2017-09-27/297f5edb1e984613083a2d3cc0c5bb36.png";
                        }
                        //判断该用户是否是代理商开发的
                        //XcxAppAccountRelation xcxmodel = XcxAppAccountRelationBLL.SingleModel.CheckAgentOpenCustomer(model._Account.Id.ToString());
                        List <AgentCustomerRelation> agentCustomerRelation = AgentCustomerRelationBLL.SingleModel.GetListByAccountId(model._Account.Id.ToString());
                        model.IsAgentCustomer = agentCustomerRelation != null && agentCustomerRelation.Count > 0;
                        if (!model.IsAgentCustomer)
                        {
                            model.IsAgentCustomer = XcxAppAccountRelationBLL.SingleModel.EsitPlatChild(51, model._Account.Id.ToString());
                        }
                        model.IsDistributioner = agentCustomerRelation.Where(w => w.QrcodeId > 0 && w.OpenExtension >= 0)?.ToList().Count > 0;
                        //代理商信息
                        model.Agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(model._Account.Id.ToString());

                        if (model.Agentinfo != null)
                        {
                            model.Agentinfo.IsAgentDistribution = new AgentDistributionRelationBLL().GetCountByAgentId(model.Agentinfo.id) > 0;
                            if (agentinfo != null)
                            {
                                if (agentinfo.id != model.Agentinfo.id)
                                {
                                    model.Agentinfo = null;
                                }
                            }
                        }

                        //校验用户身份
                        //if (model._Account != null)
                        //{
                        //    //判断手机号是否加密,加密则更新为不加密
                        //    if (model._Account.ConsigneePhone.Length > 11)
                        //    {
                        //        model._Account.ConsigneePhone = DESEncryptTools.GetMd5Base32(model._Account.ConsigneePhone);
                        //        AccountBLL.SingleModel.Update(model._Account, "ConsigneePhone");
                        //    }

                        //    if (!string.IsNullOrEmpty(model._Account.ConsigneePhone))
                        //    {
                        //        ViewBag.Phone = model._Account.ConsigneePhone;
                        //    }
                        //}
                    }
                }
            }
            catch (Exception)
            {
            }

            return(model);
        }
Exemplo n.º 3
0
        public ActionResult CaseTemplate()
        {
            int opensinglepagefree = Context.GetRequestInt("opensinglepagefree", 0);

            ViewBag.testxcxType = _testxcxtype;
            ViewBag.freexcxType = _freexcxtype;
            ViewBag.Phone       = "未绑定";
            ViewBag.BindPhone   = 0;

            Return_Msg           msg   = new Return_Msg();
            ViewModelMyWorkbench model = GetUserInfo();

            if (opensinglepagefree > 0)
            {
                TestTemplate();
            }

            if (model._Member == null || model._Account == null)
            {
                CookieHelper.Remove("dz_UserCookieNew");
                return(Redirect("/dzhome/Login"));
            }

            //判断是否子帐号登陆
            AuthRole role = RouteAuthCheck.GetAdminAuth();

            if (role != null)
            {
                int    pageType    = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(role.AId);
                string redirectUrl = string.Empty;
                Dictionary <int, string> pageTypeIndex = new Dictionary <int, string>
                {
                    { (int)TmpType.小程序专业模板, $"/SubAccount/Welcome?appId={role.AId}&pageType={pageType}" },
                    { (int)TmpType.小未平台, $"/Plat/admin/Index?Id={role.AId}&appId={role.AId}&pageType={pageType}" },
                    { (int)TmpType.拼享惠, $"/Pin/main/Index?Id={role.AId}&appId={role.AId}&pageType={pageType}" },
                };
                //禁止专业版子帐号,进入小程序管理列表页
                if (pageTypeIndex.TryGetValue(pageType, out redirectUrl) && !string.IsNullOrWhiteSpace(redirectUrl))
                {
                    return(Redirect(redirectUrl));
                }
            }

            //判断是否是代理商
            Agentinfo agentmodel = AgentinfoBLL.SingleModel.GetModelByAccoundId(model._Account.Id.ToString());//GetModel($"useraccountid='{model._Account.Id.ToString()}'");

            if (agentmodel != null)
            {
                //赠送一年免费的平台版
                if (agentmodel.userLevel == 0 && agentmodel.addtime <= DateTime.Parse("2018-06-21"))
                {
                    XcxAppAccountRelationBLL.SingleModel.AddTemplate(model._Account, agentmodel);
                }
                return(View(model));
            }

            //判断是否是代理商开通的用户
            AgentCustomerRelation agentcutomer = AgentCustomerRelationBLL.SingleModel.GetModel($"useraccountid='{model._Account.Id.ToString()}'");

            if (agentcutomer != null)
            {
                return(View(model));
            }

            //判断是否有用户未绑定手机号码
            if (string.IsNullOrEmpty(model._Account.ConsigneePhone))
            {
                ViewBag.BindPhone = 1;
            }
            else
            {
                //用户已绑定手机号,判断是否有单页版
                XcxAppAccountRelation usertemplate = XcxAppAccountRelationBLL.SingleModel.GetModel($"accountid='{model._Account.Id}'");
                if (usertemplate == null)
                {
                    //免费开通单页版
                    XcxAppAccountRelationBLL.SingleModel.AddFreeTemplate(model._Account);
                }
            }

            return(View(model));
        }