Example #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string sessionkey = filterContext.HttpContext.Request.Form["sessionkey"] ?? filterContext.HttpContext.Request.QueryString["sessionkey"];
            string appid      = filterContext.HttpContext.Request.Form["appid"] ?? filterContext.HttpContext.Request.QueryString["appid"];

            //兼容旧接口
            if (string.IsNullOrEmpty(sessionkey))
            {
                if (string.IsNullOrWhiteSpace(appid))
                {
                    filterContext.Result = new JsonResult()
                    {
                        Data = new
                        {
                            isok    = false,
                            msg     = "参数:appid,为空",
                            errcode = 500,
                        },
                        JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    };
                    base.OnActionExecuting(filterContext);
                    return;
                }
                string redis_loginSessionKey = CheckLoginClass.GetLoginSessionKey(appid);
                if (redis_loginSessionKey == null || redis_loginSessionKey.Length == 0)
                {
                    filterContext.Result = new JsonResult()
                    {
                        Data = new
                        {
                            isok    = false,
                            msg     = "登陆秘钥过期",
                            errcode = 200,
                        },
                        JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    };
                    base.OnActionExecuting(filterContext);
                    return;
                }
            }
            else
            {
                UserSession usersession = RedisUtil.Get <UserSession>(string.Format(CheckLoginClass._redis_loginSessionOpenIdKey, sessionkey));
                if (usersession == null)
                {
                    filterContext.Result = new JsonResult()
                    {
                        Data = new
                        {
                            isok    = false,
                            msg     = "登陆秘钥过期",
                            errcode = 200,
                        },
                        JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    };
                    base.OnActionExecuting(filterContext);
                    return;
                }
            }
        }
Example #2
0
        public ActionResult TiXian(int id = 0, string openId = "", string phone = "", string testappid = "")
        {
            if (string.IsNullOrEmpty(testappid))
            {
                testappid = _pxhAppId;
            }
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModelByTelephone_appid(phone, testappid);//_pxhAppId

            if (userinfo == null)
            {
                return(Content("无效用户"));
            }
            if (id <= 0)
            {
                return(Content("无效用户id"));
            }
            userinfo.zbSiteId = id;

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(userinfo.appId);

            if (xcxrelation == null)
            {
                return(Content("无效模板"));
            }

            //获取登陆秘钥
            string utoken = CheckLoginClass.GetLoginSessionKey("1", userinfo.OpenId);

            ViewBag.utoken = utoken;

            //是否为代理
            PinAgent agent = PinAgentBLL.SingleModel.GetModelByUserId(userinfo.Id);

            ViewBag.isAgent = agent != null ? 1 : 0;

            //店铺
            PinStore store = PinStoreBLL.SingleModel.GetModelByAid_UserId(xcxrelation.Id, userinfo.Id);

            ViewBag.storeId = store != null ? store.id : 0;

            return(View(userinfo));
        }
Example #3
0
        public Return_Msg_APP WxLogin(string code = "", string appid = "", int needappsr = 0, int storeId = 0)
        {
            returnObj = new Return_Msg_APP();
            if (string.IsNullOrEmpty(code))
            {
                returnObj.Msg = "登陆凭证不能为空";
                return(returnObj);
            }
            if (string.IsNullOrEmpty(appid))
            {
                returnObj.Msg = "appid不能为空";
                return(returnObj);
            }
            BaseResult baseResult = CheckLoginClass.WxLogin(code, appid, needappsr, storeId);

            returnObj.Msg     = baseResult.msg;
            returnObj.dataObj = baseResult.obj;
            returnObj.code    = baseResult.errcode.ToString();
            returnObj.isok    = baseResult.result;
            return(returnObj);
        }
Example #4
0
        public ActionResult MyAgentInfo(int id = 0, string openId = "", string phone = "", string testpxhappid = "", string utoken = "")
        {
            if (string.IsNullOrEmpty(testpxhappid))
            {
                testpxhappid = _pxhAppId;
            }
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModelByTelephone_appid(phone, testpxhappid);//_pxhAppId

            if (userinfo == null)
            {
                return(Content("无效用户"));
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(userinfo.appId);

            if (xcxrelation == null)
            {
                return(Content("无效模板"));
            }

            if (id <= 0)
            {
                return(Content("无效用户id"));
            }

            //获取登陆秘钥
            utoken = CheckLoginClass.GetLoginSessionKey("1", userinfo.OpenId);


            if (string.IsNullOrEmpty(utoken))
            {
                return(Content("utoken无效,请重新登录"));
            }

            PinAgent agent = PinAgentBLL.SingleModel.GetModelByUserId(userinfo.Id);

            userinfo.zbSiteId = id;
            agent.userInfo    = userinfo;

            agent.First = new AgentDistributionDetail()
            {
                AgentCount    = PinAgentBLL.SingleModel.GetAgentCount(agent.aId, agent.userId, 0),
                AgentSumMoney = PinAgentIncomeLogBLL.SingleModel.GetIncomeSum(agent.id, 0, 0),
                OrderSum      = PinAgentIncomeLogBLL.SingleModel.GetIncomeSum(agent.id, 1, 0),
                StoreCount    = PinStoreBLL.SingleModel.GetStoreCount(agent.id, 0)
            };

            agent.Second = new AgentDistributionDetail()
            {
                AgentCount    = PinAgentBLL.SingleModel.GetAgentCount(agent.aId, agent.userId, 1),
                AgentSumMoney = PinAgentIncomeLogBLL.SingleModel.GetIncomeSum(agent.id, 0, 1),
                OrderSum      = PinAgentIncomeLogBLL.SingleModel.GetIncomeSum(agent.id, 1, 1),
                StoreCount    = PinStoreBLL.SingleModel.GetStoreCount(agent.id, 1)
            };
            PinAgentLevelConfig pinAgentLevelConfig = PinAgentLevelConfigBLL.SingleModel.GetPinAgentLevelConfig(agent.AgentLevel, agent.aId);

            if (pinAgentLevelConfig != null)
            {
                agent.AgentLevelName = pinAgentLevelConfig.LevelName;//等级名称
            }


            ViewBag.utoken = utoken;
            ViewBag.openId = openId;
            return(View(agent));
        }
Example #5
0
 public BaseResult CheckUserLoginNoappsr(string code, string iv, string data, string signature, string appid, int isphonedata = 0, int storeId = 0)
 {
     return(CheckLoginClass.CheckUserLoginNoappsr(storeId, code, iv, data, appid, signature, isphonedata, 0));
 }