Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            RetureCode   newRetureCode = new RetureCode();
            Stream       sm            = context.Request.InputStream;
            StreamReader inputData     = new StreamReader(sm);
            string       DataString    = inputData.ReadToEnd();

            try
            {
                BindPhoneNum newPhoneLoginInfo = LitJson.JsonMapper.ToObject <BindPhoneNum>(DataString);
                CodeData     _CodeData         = PhoneCode.GPhoneCode.CheckCode(newPhoneLoginInfo.CountryCode,
                                                                                newPhoneLoginInfo.PhoneNum, newPhoneLoginInfo.PhoneCode);
                if (_CodeData == null)
                {
                    newRetureCode.code = 4;
                    newRetureCode.msg  = "无效验证码";
                    PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
                    return;
                }
                string Passw = CommonTools.CreatePassWord(12);
                if (BindAccount(newPhoneLoginInfo.AccountId,
                                _CodeData.PhoneNum, CommonTools.GetMD5Hash(Passw), newPhoneLoginInfo.Mac, newRetureCode))
                {
                    newRetureCode.code = 0;
                    newRetureCode.msg  = Passw;
                    AppleInapp.AddScoreByBinding(300, newPhoneLoginInfo.AccountId);
                    JsonEMail newJsonEMail = new JsonEMail();
                    newJsonEMail.dwUserID  = newPhoneLoginInfo.AccountId;
                    newJsonEMail.nStatus   = 0;
                    newJsonEMail.szTitle   = "绑定成功";
                    newJsonEMail.szMessage = "绑定成功手机号,赠送3.00";
                    newJsonEMail.szSender  = "系统";
                    newJsonEMail.nType     = 0;
                    newJsonEMail.nStatus   = 0;
                    EmailAdd.AddEmail(newJsonEMail);
                }
            }
            catch (Exception exp)
            {
                newRetureCode.code = 100;
                newRetureCode.msg  = DataString + "--" + exp.Message.ToString() + "-" + exp.StackTrace;
            }
            PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            Stream          sm            = context.Request.InputStream;
            StreamReader    inputData     = new StreamReader(sm);
            string          DataString    = inputData.ReadToEnd();
            LoginReturnCode newRetureCode = new LoginReturnCode();

            try
            {
                CheckPhoneLoginInfo newPhoneLoginInfo = LitJson.JsonMapper.ToObject <CheckPhoneLoginInfo>(DataString);
                CodeData            _CodeData         = PhoneCode.GPhoneCode.CheckCode(newPhoneLoginInfo.CountryCode,
                                                                                       newPhoneLoginInfo.PhoneNum, newPhoneLoginInfo.PhoneCode);
                if (_CodeData == null)
                {
                    newRetureCode.code = 4;
                    newRetureCode.msg  = "无效验证码";
                    PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
                    return;
                }
                string Passw  = CommonTools.CreatePassWord(12);
                int    UserId = -1;
                if (AddAccount(_CodeData.PhoneNum, CommonTools.GetMD5Hash(Passw), newPhoneLoginInfo.Mac, newRetureCode,
                               out UserId))
                {
                    //AppleInapp.AddScore(600, UserId);
                    newRetureCode.code = 0;
                    newRetureCode.msg  = Passw;
                }
            }
            catch (Exception exp)
            {
                newRetureCode.code = 100;
                newRetureCode.msg  = DataString + "--" + exp.Message.ToString() + "-" + exp.StackTrace;
            }
            PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
        }