Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            string   id      = context.Request["id"];
            int      is_lock = Convert.ToInt32(context.Request["is_lock"]);
            UserInfo curUser = bllUser.GetColByKey <UserInfo>("AutoID", id,
                                                              "AutoID,UserID,TrueName,Phone",
                                                              websiteOwner: bllUser.WebsiteOwner);
            string event_name = is_lock == 1?"锁定":"解锁";

            if (bllUser.Update(new UserInfo(),
                               string.Format("IsLock={0}", is_lock),
                               string.Format("WebsiteOwner='{0}' And AutoID={1} ", bllUser.WebsiteOwner, curUser.AutoID)) > 0)
            {
                string addNote = string.Format("{0}会员{1}[{2}]", event_name, curUser.TrueName, curUser.Phone);
                bllLog.Add(EnumLogType.ShMember, EnumLogTypeAction.Update, currentUserInfo.UserID, addNote, targetID: curUser.UserID);
                apiResp.status = true;
                apiResp.msg    = event_name + "成功";
                apiResp.code   = (int)APIErrCode.IsSuccess;
            }
            else
            {
                apiResp.msg  = event_name + "失败";
                apiResp.code = (int)APIErrCode.OperateFail;
            }
            bllUser.ContextResponse(context, apiResp);
        }
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            //string openid = context.Request["openid"];
            string phone = context.Request["phone"];
            string code  = context.Request["code"];
            string msg   = "";

            if (!bllUser.SmsLogin(phone, code, out msg))
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = msg;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            string   unionid      = context.Request["unionid"];
            string   websiteOwner = bllUser.WebsiteOwner;
            UserInfo user         = bllUser.GetUserInfoByPhone(phone, websiteOwner);

            if (user == null)
            {
                user              = new UserInfo();
                user.UserID       =
                    user.UserID   = string.Format("Phone{0}", Guid.NewGuid().ToString());
                user.Phone        = phone;
                user.Password     = ZentCloud.Common.Rand.Str_char(12);
                user.UserType     = 2;
                user.WebsiteOwner = websiteOwner;
                user.Regtime      = DateTime.Now;
                user.RegIP        = ZentCloud.Common.MySpider.GetClientIP();
            }
            string oUnionid  = user.WXUnionID;
            string oNickname = user.WXNickname;
            bool   hasOther  = (user.AutoID != 0 && oUnionid != unionid);

            string password   = context.Request["password"];
            string city       = context.Request["city"];
            string country    = context.Request["country"];
            string headimgurl = context.Request["headimgurl"];
            string nickname   = context.Request["nickname"];
            string privilege  = context.Request["privilege"];
            string province   = context.Request["province"];
            string sex        = context.Request["sex"];

            user.Password = password.Trim();
            if (string.IsNullOrWhiteSpace(user.Password))
            {
                user.Password = ZentCloud.Common.Rand.Str_char(6);
            }
            user.WXCity       = city;
            user.WXCountry    = country;
            user.WXHeadimgurl = headimgurl;
            user.WXNickname   = nickname;
            user.WXPrivilege  = ZentCloud.Common.JSONHelper.ObjectToJson(privilege);
            user.WXProvince   = province;
            user.WXSex        = Convert.ToInt32(sex);
            user.WXUnionID    = unionid;

            user.LastLoginIP     = ZentCloud.Common.MySpider.GetClientIP();
            user.LastLoginDate   = DateTime.Now;
            user.LoginTotalCount = user.LoginTotalCount + 1;

            bool status = false;

            if (user.AutoID == 0)
            {
                //更新微信授权信息
                status = bllUser.Add(user);
            }
            else
            {
                status = bllUser.Update(user);
            }

            if (status)
            {
                if (hasOther)
                {
                    BLLLog bllLog = new BLLLog();
                    string rmk    = string.Format("账号({0})绑定信息变更,微信UnionID:[{1}-{2}],昵称:[{3}-{4}]", user.AutoID, oUnionid, unionid, oNickname, nickname);
                    bllLog.Add(ZentCloud.BLLJIMP.Enums.EnumLogType.OAuthBind, ZentCloud.BLLJIMP.Enums.EnumLogTypeAction.SignIn, user.UserID, rmk);
                }

                context.Session[SessionKey.UserID]     = user.UserID;
                context.Session[SessionKey.LoginStatu] = 1;
                context.Response.Cookies.Add(bllUser.CreateLoginCookie(user.UserID, user.WXOpenId, user.WXNickname));

                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "授权绑定手机完成";
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "授权绑定手机失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            RequestModel requestModel = new RequestModel();

            try
            {
                requestModel = bllUser.ConvertRequestToModel <RequestModel>(requestModel);
            }
            catch (Exception ex)
            {
                apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "参数错误";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            UserInfo updateUser = bllUser.GetUserInfoByAutoID(requestModel.id);

            if (updateUser == null)
            {
                apiResp.msg  = "会员未找到";
                apiResp.code = (int)APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            string remark     = "修改会员信息:";
            bool   updateName = false;
            string oldName    = "";

            if (updateUser.TrueName != requestModel.name)
            {
                remark             += string.Format(" 姓名[{0}-{1}]", updateUser.TrueName, requestModel.name);
                oldName             = updateUser.TrueName;
                updateUser.TrueName = requestModel.name;
                updateName          = true;
            }
            if (updateUser.Phone1 != requestModel.phone1)
            {
                remark           += string.Format(" 联系手机[{0}-{1}]", updateUser.Phone1, requestModel.phone1);
                updateUser.Phone1 = requestModel.phone1;
            }
            if (updateUser.IdentityCard != requestModel.idcard)
            {
                remark += string.Format(" 身份证[{0}-{1}]", updateUser.IdentityCard, requestModel.idcard);
                updateUser.IdentityCard = requestModel.idcard;
            }
            if (updateUser.Province != requestModel.province || updateUser.City != requestModel.city ||
                updateUser.District != requestModel.district || updateUser.Town != requestModel.town)
            {
                string[] li1   = new string[] { updateUser.Province, updateUser.City, updateUser.District, updateUser.Town };
                string[] li2   = new string[] { requestModel.province, requestModel.city, requestModel.district, requestModel.town };
                string   ostr1 = string.Join(" ", li1.Where(p => !string.IsNullOrWhiteSpace(p)).ToList());
                string   ostr2 = string.Join(" ", li2.Where(p => !string.IsNullOrWhiteSpace(p)).ToList());
                remark += string.Format(" 所在地[{0}-{1}]", ostr1, ostr2);
                updateUser.Province     = requestModel.province;
                updateUser.ProvinceCode = requestModel.province_code;
                updateUser.City         = requestModel.city;
                updateUser.CityCode     = requestModel.city_code;
                updateUser.District     = requestModel.district;
                updateUser.DistrictCode = requestModel.district_code;
                updateUser.Town         = requestModel.town;
                updateUser.TownCode     = requestModel.town_code;
            }
            int stock = requestModel.stock.HasValue ? requestModel.stock.Value : 0;

            if (updateUser.Stock != stock)
            {
                remark          += string.Format(" 股权数[{0}-{1}]", updateUser.Stock, stock);
                updateUser.Stock = stock;
            }
            if (updateUser.Address != requestModel.address)
            {
                remark            += string.Format(" 地址[{0}-{1}]", updateUser.Address, requestModel.address);
                updateUser.Address = requestModel.address;
            }
            List <string> oEx = new List <string>();

            if (!string.IsNullOrWhiteSpace(updateUser.Ex1))
            {
                oEx.Add(updateUser.Ex1);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex2))
            {
                oEx.Add(updateUser.Ex2);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex3))
            {
                oEx.Add(updateUser.Ex3);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex4))
            {
                oEx.Add(updateUser.Ex4);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex5))
            {
                oEx.Add(updateUser.Ex5);
            }
            List <string> nEx = new List <string>();

            if (!string.IsNullOrWhiteSpace(requestModel.ex1))
            {
                nEx.Add(requestModel.ex1);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex2))
            {
                nEx.Add(requestModel.ex2);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex3))
            {
                nEx.Add(requestModel.ex3);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex4))
            {
                nEx.Add(requestModel.ex4);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex5))
            {
                nEx.Add(requestModel.ex5);
            }
            string oExStr = ZentCloud.Common.MyStringHelper.ListToStr(oEx, "", ",");
            string nExStr = ZentCloud.Common.MyStringHelper.ListToStr(nEx, "", ",");

            if (oExStr != nExStr)
            {
                remark        += string.Format(" 执照[{0} 改为{1}]", oExStr, nExStr);
                updateUser.Ex1 = string.IsNullOrWhiteSpace(requestModel.ex1) ? null : requestModel.ex1;
                updateUser.Ex2 = string.IsNullOrWhiteSpace(requestModel.ex2) ? null : requestModel.ex2;
                updateUser.Ex3 = string.IsNullOrWhiteSpace(requestModel.ex3) ? null : requestModel.ex3;
                updateUser.Ex4 = string.IsNullOrWhiteSpace(requestModel.ex4) ? null : requestModel.ex4;
                updateUser.Ex5 = string.IsNullOrWhiteSpace(requestModel.ex5) ? null : requestModel.ex5;
            }
            oEx = new List <string>();
            if (!string.IsNullOrWhiteSpace(updateUser.Ex6))
            {
                oEx.Add(updateUser.Ex6);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex7))
            {
                oEx.Add(updateUser.Ex7);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex8))
            {
                oEx.Add(updateUser.Ex8);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex9))
            {
                oEx.Add(updateUser.Ex9);
            }
            if (!string.IsNullOrWhiteSpace(updateUser.Ex10))
            {
                oEx.Add(updateUser.Ex10);
            }
            nEx = new List <string>();
            if (!string.IsNullOrWhiteSpace(requestModel.ex6))
            {
                nEx.Add(requestModel.ex6);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex7))
            {
                nEx.Add(requestModel.ex7);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex8))
            {
                nEx.Add(requestModel.ex8);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex9))
            {
                nEx.Add(requestModel.ex9);
            }
            if (!string.IsNullOrWhiteSpace(requestModel.ex10))
            {
                nEx.Add(requestModel.ex10);
            }
            oExStr = ZentCloud.Common.MyStringHelper.ListToStr(oEx, "", ",");
            nExStr = ZentCloud.Common.MyStringHelper.ListToStr(nEx, "", ",");
            if (oExStr != nExStr)
            {
                remark         += string.Format(" 凭证[{0} 改为{1}]", oExStr, nExStr);
                updateUser.Ex6  = string.IsNullOrWhiteSpace(requestModel.ex6) ? null : requestModel.ex6;
                updateUser.Ex7  = string.IsNullOrWhiteSpace(requestModel.ex7) ? null : requestModel.ex7;
                updateUser.Ex8  = string.IsNullOrWhiteSpace(requestModel.ex8) ? null : requestModel.ex8;
                updateUser.Ex9  = string.IsNullOrWhiteSpace(requestModel.ex9) ? null : requestModel.ex9;
                updateUser.Ex10 = string.IsNullOrWhiteSpace(requestModel.ex10) ? null : requestModel.ex10;
            }
            if (bllUser.Update(updateUser))
            {
                if (remark != "修改会员信息:")
                {
                    bllLog.Add(EnumLogType.ShMember, EnumLogTypeAction.Update, currentUserInfo.UserID, remark, targetID: updateUser.UserID);
                }
                if (updateName)
                {
                    //异步修改积分明细表
                    Thread th1 = new Thread(delegate()
                    {
                        bllUser.Update(new UserScoreDetailsInfo(),
                                       string.Format("[AddNote] = REPLACE([AddNote],'{0}[{1}]','{2}[{1}]')", oldName, updateUser.Phone, updateUser.TrueName),
                                       string.Format(" WebsiteOwner='{2}' And ScoreType='TotalAmount' And [AddNote] like '%{0}[{1}]%' ", oldName, updateUser.Phone, bllUser.WebsiteOwner));
                        bllUser.Update(new UserScoreDetailsInfo(),
                                       string.Format("[AddNote] = REPLACE([AddNote],'{0}','{1}')", oldName, updateUser.TrueName),
                                       string.Format(" WebsiteOwner='{1}' And ScoreType='TotalAmount' And [AddNote] like '%{0}%' ", oldName, bllUser.WebsiteOwner));
                    });
                    th1.Start();
                }
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "修改会员信息完成";
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "修改会员信息失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            ShUpdate.RequestModel requestModel = new ShUpdate.RequestModel();
            try
            {
                requestModel = bllUser.ConvertRequestToModel <ShUpdate.RequestModel>(requestModel);
            }
            catch (Exception ex)
            {
                apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "参数错误";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            UserInfo updateUser = bllUser.GetUserInfoByAutoID(requestModel.id);

            if (updateUser == null)
            {
                apiResp.msg  = "会员未找到";
                apiResp.code = (int)APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            UserInfo otherUser = bllUser.GetUserInfoByPhone(requestModel.phone, bllUser.WebsiteOwner);

            if (otherUser != null && otherUser.AutoID != updateUser.AutoID)
            {
                apiResp.msg  = "该登录手机已有账号使用";
                apiResp.code = (int)APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            string remark   = "修改会员登录手机:";
            string oldPhone = "";

            if (updateUser.Phone != requestModel.phone)
            {
                remark          += string.Format(" 登录手机[{0}-{1}]", updateUser.Phone, requestModel.phone);
                oldPhone         = updateUser.Phone;
                updateUser.Phone = requestModel.phone;
            }
            if (bllUser.Update(updateUser))
            {
                if (remark == "修改会员登录手机:")
                {
                    remark += "仅保存,信息未检测到更改";
                }
                bllLog.Add(EnumLogType.ShMember, EnumLogTypeAction.Update, currentUserInfo.UserID, remark, targetID: updateUser.UserID);

                //异步修改积分明细表
                Thread th1 = new Thread(delegate()
                {
                    bllUser.Update(new UserScoreDetailsInfo(),
                                   string.Format("[AddNote] = REPLACE([AddNote],'[{0}]','[{1}]')", oldPhone, updateUser.Phone),
                                   string.Format(" WebsiteOwner='{1}' And ScoreType='TotalAmount' And [AddNote] like '%[{0}]%' ", oldPhone, bllUser.WebsiteOwner));
                });
                th1.Start();

                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "修改会员登录手机完成";
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "修改会员登录手机失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }