Пример #1
0
        public ActionResult Login(CCY_Client client)
        {
            if (string.IsNullOrEmpty(client.sUnionid) || string.IsNullOrEmpty(client.sOpenId))
            {
                result.info = "参数错误";
                return(Json(result));
            }
            var procedureResult = Manager.Login(client);

            if (procedureResult.iCode == 100)
            {
                client = JsonHelper.Deserialize <CCY_Client>(JsonHelper.ToJsonString(procedureResult.sData));
                if (client.iStatus == 0)
                {
                    LoginStatus        = new ClientCacheInfo();
                    LoginStatus.ID     = client.ID;
                    LoginStatus.sToken = GuidHelper.NewGuidString();
                    RedisHelper.SetKey(RedisCacheType.ClientInfo, LoginStatus.ID, LoginStatus, 60 * 24 * 7);
                    result.code = ResultStatus.Success;
                    result.data = new
                    {
                        ID         = LoginStatus.ID,
                        sToken     = LoginStatus.sToken,
                        sNickName  = client.sNickName,
                        sPhone     = client.sPhone,
                        sHeadImg   = client.sHeadImg,
                        sWeiXinNo  = client.sWeiXinNo,
                        sPhotoName = client.sPhotoName,
                        sIntroduce = client.sIntroduce
                    };
                }
                else
                {
                    result.info = "该账号已被冻结,请联系管理员";
                }
            }
            else
            {
                result.info = "登录失败";
            }
            return(Json(result));
        }
Пример #2
0
        public ActionResult LoginByPhone(string sPhone, string sPassword)
        {
            if (string.IsNullOrEmpty(sPhone) || string.IsNullOrEmpty(sPassword))
            {
                result.info = "手机号和密码不能为空";
                return(Json(result));
            }
            var client = Manager.LoginByPhone(sPhone, sPassword);

            if (client != null)
            {
                if (client.iStatus == 0)
                {
                    LoginStatus        = new ClientCacheInfo();
                    LoginStatus.ID     = client.ID;
                    LoginStatus.sToken = GuidHelper.NewGuidString();
                    RedisHelper.SetKey(RedisCacheType.ClientInfo, LoginStatus.ID, LoginStatus, 60 * 24 * 7);
                    result.code = ResultStatus.Success;
                    result.data = new
                    {
                        ID         = LoginStatus.ID,
                        sToken     = LoginStatus.sToken,
                        sNickName  = client.sNickName,
                        sPhone     = client.sPhone,
                        sHeadImg   = client.sHeadImg,
                        sWeiXinNo  = client.sWeiXinNo,
                        sPhotoName = client.sPhotoName,
                        sIntroduce = client.sIntroduce
                    };
                }
                else
                {
                    result.info = "该账号已被冻结,请联系管理员";
                }
            }
            else
            {
                result.info = "用户名或密码错误";
            }
            return(Json(result));
        }