public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; RetureCode newRetureCode = new RetureCode(); Stream sm = context.Request.InputStream; StreamReader inputData = new StreamReader(sm); string DataString = inputData.ReadToEnd(); try { CSubmitMsg newPhoneLoginInfo = LitJson.JsonMapper.ToObject <CSubmitMsg>(DataString); // newPhoneLoginInfo.CreateTime = DateTime.Now.ToString(); var prams = new List <DbParameter>(); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("intUserId", newPhoneLoginInfo.UserId)); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("intMsgStatus", 0)); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("stringCreateTime", DateTime.Now.ToString())); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("stringMsgContent", newPhoneLoginInfo.MsgContent)); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("stringMsgTiltle", newPhoneLoginInfo.MsgTiltle)); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("intMsgType", newPhoneLoginInfo.MsgType)); prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("strErrorDescribe", "suss")); FacadeManage.aideAccountsFacade.DataProvider.GetDbHelper().RunProc("GSP_GP_SubmintClientMsg", prams); newRetureCode.code = 0; } catch (Exception exp) { Debug.LogException(exp); newRetureCode.code = 1; newRetureCode.msg = LitJson.JsonMapper.ToJson(new CSubmitMsg()); newRetureCode.msg += exp.Message.ToString() + exp.StackTrace.ToString();; } context.Response.Write(LitJson.JsonMapper.ToJson(newRetureCode)); }
protected void Page_Load(HttpContext context) { RetureCode newCode = new RetureCode(); try { Stream sm = context.Request.InputStream; StreamReader inputData = new StreamReader(sm); string DataString = inputData.ReadToEnd(); // Debug.Log("AppleInapp", DataString); ReceiptDataJson _ReceiptDataJson = LitJson.JsonMapper.ToObject <ReceiptDataJson>(DataString); newCode.data.userId = _ReceiptDataJson.UserId; float xx = 0; float.TryParse(_ReceiptDataJson.AppVersion, out xx); string msg = ""; if (PostInApp((int)(xx * 1000) > (int)((3.18f) * 1000), _ReceiptDataJson.UserId, _ReceiptDataJson.receiptData, out newCode.data.sorce, out msg)) { newCode.code = 0; } else { newCode.code = 1; } newCode.msg = msg; } catch (Exception exp) { newCode.code = 2; newCode.msg = exp.Message.ToString() + "\n" + exp.StackTrace.ToString(); Debug.LogException(exp); } WebApplication1.Phone.SendStringToClient(httpContext, LitJson.JsonMapper.ToJson(newCode)); }
protected void Page_Load(HttpContext e) { RetureCode newRetureCode = new RetureCode(); try { Stream sm = e.Request.InputStream; StreamReader inputData = new StreamReader(sm); string DataString = inputData.ReadToEnd(); PhoneGetCodeInfo newPhoneLoginInfo = LitJson.JsonMapper.ToObject <PhoneGetCodeInfo>(DataString); if (newPhoneLoginInfo.OptionType == 1) { if (PhoneBind.HaveBind(newPhoneLoginInfo.PhoneNum, newRetureCode)) { newRetureCode.code = 1; newRetureCode.msg = "此手机已经绑定了账号"; SendStringToClient(e, newRetureCode); Debug.Log("GetPhoneCode", "此手机已经绑定了账号:" + newPhoneLoginInfo.PhoneNum); return; } } Send(newPhoneLoginInfo, e); } catch (Exception exp) { newRetureCode.code = 100; newRetureCode.msg = exp.Message.ToString(); SendStringToClient(e, newRetureCode); Debug.LogException(exp); } }
public static void SendStringToClient(HttpContext hd, int codeId, string Msg) { RetureCode code = new RetureCode(); code.code = codeId; code.msg = Msg; SendStringToClient(hd, code); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var userId = context.Request["userId"]; var newsId = context.Request["newsId"]; FacadeManage.aideNativeWebFacade.UpdateNewsState(Convert.ToInt32(userId), Convert.ToInt32(newsId)); var ret = new RetureCode(); ret.msg = ""; ret.code = 0; context.Response.Write(LitJson.JsonMapper.ToJson(ret)); }
public static void Send(PhoneGetCodeInfo newPhoneLoginInfo, HttpContext page) { RetureCode newRetureCode = new RetureCode(); try { string Ps = CreatePassWord(); if (newPhoneLoginInfo != null) { string str = string.Format("【TT棋牌】您的验证码是:{0}。如非本人操作,请忽略本短信", Ps); String singleSenderResult = send(0, newPhoneLoginInfo.CountryCode, newPhoneLoginInfo.PhoneNum, str, "", ""); if (singleSenderResult.Contains("\"errmsg\":\"OK\"") || newPhoneLoginInfo.CountryCode != "999") { Ps = GetMD5Hash(Ps); if (AddAccount(newPhoneLoginInfo.PhoneNum, Ps, newPhoneLoginInfo.Mac, newRetureCode)) { newRetureCode.code = 0; } else { newRetureCode.code = 4; } if (newPhoneLoginInfo.CountryCode != "999") { newRetureCode.msg = Ps; } SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } else { newRetureCode.code = 1; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } } else { newRetureCode.code = 2; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } } catch (Exception ep) { newRetureCode.code = 3; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } }
public static void Send(PhoneGetCodeInfo newPhoneLoginInfo, HttpContext page) { RetureCode newRetureCode = new RetureCode(); try { CodeData OldData = PhoneCode.GPhoneCode.FindCode(newPhoneLoginInfo.CountryCode, newPhoneLoginInfo.PhoneNum); string Ps = CreatePassWord(); if (OldData != null) { Ps = OldData.CodeNum; } if (newPhoneLoginInfo != null) { if (AliProgram.Send(newPhoneLoginInfo.PhoneNum, Ps)) { newRetureCode.code = 0; newRetureCode.msg = Ps; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); CodeData Data = new CodeData(); Data.CountryCode = newPhoneLoginInfo.CountryCode; Data.PhoneNum = newPhoneLoginInfo.PhoneNum; Data.CodeNum = Ps; PhoneCode.GPhoneCode.Add(newPhoneLoginInfo.CountryCode + newPhoneLoginInfo.PhoneNum, Data); } else { newRetureCode.code = 1; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } } else { newRetureCode.code = 2; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); Debug.LogError("GetPhoneCode", LitJson.JsonMapper.ToJson(newRetureCode)); } } catch (Exception ep) { newRetureCode.code = 3; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); Debug.LogException(ep); } }
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)); }
protected void Page_Load(object sender, EventArgs e) { Stream sm = Request.GetBufferedInputStream(); StreamReader inputData = new StreamReader(sm); string DataString = inputData.ReadToEnd(); Debug.Log("AppleInapp", DataString); ReceiptDataJson _ReceiptDataJson = LitJson.JsonMapper.ToObject <ReceiptDataJson>(DataString); RetureCode newCode = new RetureCode(); newCode.data.userId = _ReceiptDataJson.UserId; if (PostInApp(_ReceiptDataJson.UserId, _ReceiptDataJson.receiptData, out newCode.data.sorce)) { Debug.Log("AppleInapp", "", true); newCode.code = 0; } else { Debug.Log("AppleInapp", "", false); newCode.code = 1; } WebApplication.PhoneLogin.SendStringToClient(this, LitJson.JsonMapper.ToJson(newCode)); }
public static bool HaveBind(string PhoneName, RetureCode newRetureCode) { string MyConn = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"]; // string MyConn = "Data Source=.; Initial Catalog=RYAccountsDB; User ID=sa_games; Password=sa_gamesluatest; Pooling=true"; SqlConnection MyConnection = new SqlConnection(MyConn); try { MyConnection.Open(); { string selStr = "select Accounts from AccountsInfo where Accounts='" + PhoneName + "'"; SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); SqlDataReader _Reader = MyCommand.ExecuteReader(); if (_Reader.HasRows) { _Reader.Close(); return(true); } } return(false); } catch (Exception ex) { newRetureCode.code = 5; newRetureCode.msg = ex.Message.ToString(); Console.WriteLine("{0} Exception caught.", ex); return(true); } finally { if (MyConnection != null) { MyConnection.Close(); } } }
public static void Send(PhoneGetCodeInfo newPhoneLoginInfo, System.Web.UI.Page page) { RetureCode newRetureCode = new RetureCode(); try { string Ps = CreatePassWord(); if (newPhoneLoginInfo != null) { String singleSenderResult = send(0, newPhoneLoginInfo.CountryCode, newPhoneLoginInfo.PhoneNum, "【Kewail科技】尊敬的用户:您的验证码:" + Ps + ",工作人员不会索取,请勿泄漏。", "", ""); if (singleSenderResult.Contains("\"errmsg\":\"OK\"")) { Ps = GetMD5Hash(Ps); AddAccount(newPhoneLoginInfo.PhoneNum, Ps, newPhoneLoginInfo.Mac); newRetureCode.code = 0; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } else { newRetureCode.code = 1; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } } else { newRetureCode.code = 2; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } } catch (Exception ep) { newRetureCode.code = 3; SendStringToClient(page, LitJson.JsonMapper.ToJson(newRetureCode)); } }
public static bool AddAccount(string PhoneName, string Password, string Mac, RetureCode newRetureCode) { string insetsql = ""; { { insetsql = string.Format(@"INSERT INTO [RYAccountsDB].[dbo].[AccountsInfo] ([ProtectID] ,[PasswordID] ,[SpreaderID] ,[Accounts] ,[NickName] ,[RegAccounts] ,[UnderWrite] ,[PassPortID] ,[Compellation] ,[LogonPass] ,[InsurePass] ,[DynamicPass] ,[DynamicPassTime] ,[FaceID] ,[CustomID] ,[Present] ,[UserMedal] ,[Experience] ,[GrowLevelID] ,[LoveLiness] ,[UserRight] ,[MasterRight] ,[ServiceRight] ,[MasterOrder] ,[MemberOrder] ,[MemberOverDate] ,[MemberSwitchDate] ,[CustomFaceVer] ,[Gender] ,[Nullity] ,[NullityOverDate] ,[StunDown] ,[MoorMachine] ,[IsAndroid] ,[WebLogonTimes] ,[GameLogonTimes] ,[PlayTimeCount] ,[OnLineTimeCount] ,[LastLogonIP] ,[LastLogonDate] ,[LastLogonMobile] ,[LastLogonMachine] ,[RegisterIP] ,[RegisterDate] ,[RegisterMobile] ,[RegisterMachine] ,[RegisterOrigin] ,[PlatformID] ,[UserUin] ,[RankID] ,[AgentID]) VALUES( 0, 0, 0, '{0}', '{1}', '', '', '', '', '{2}', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', '', '', '', '{0}', '{3}', 0, 0, '', 0, 0)", PhoneName, PhoneName, Password, Mac); } } string MyConn = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"]; // string MyConn = "Data Source=.; Initial Catalog=RYAccountsDB; User ID=sa_games; Password=sa_gamesluatest; Pooling=true"; //string MyConn = "server=103.105.58.140;uid=testdb;pwd=123abc;database=RYAccountsDB;Trusted_Connection=no"; SqlConnection MyConnection = new SqlConnection(MyConn); try { MyConnection.Open(); { string selStr = "select Accounts from AccountsInfo where Accounts='" + PhoneName + "'"; SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); SqlDataReader _Reader = MyCommand.ExecuteReader(); if (!_Reader.HasRows) { _Reader.Close(); } else { _Reader.Close(); string updateSql = " update AccountsInfo set LogonPass='******'"; updateSql += " where Accounts='" + PhoneName + "'"; SqlCommand UpdateCommand = new SqlCommand(updateSql, MyConnection); return(UpdateCommand.ExecuteNonQuery() > 0); } } { SqlCommand UpdateCommand = new SqlCommand(insetsql, MyConnection); return(UpdateCommand.ExecuteNonQuery() > 0); } } catch (Exception ex) { newRetureCode.msg = ex.Message.ToString(); Console.WriteLine("{0} Exception caught.", ex); } finally { if (MyConnection != null) { MyConnection.Close(); } } return(false); }
public static bool BindAccount(int AccountId, string PhoneName, string Password, string Mac, RetureCode newRetureCode) { string MyConn = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"]; // string MyConn = "Data Source=.; Initial Catalog=RYAccountsDB; User ID=sa_games; Password=sa_gamesluatest; Pooling=true"; SqlConnection MyConnection = new SqlConnection(MyConn); try { MyConnection.Open(); // { // string selStr = "select Accounts from AccountsInfo where Accounts='" + PhoneName + "'"; // SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); // SqlDataReader _Reader = MyCommand.ExecuteReader(); // if (_Reader.HasRows) // { // _Reader.Close(); // return false; // } // } { string updateSql = " update AccountsInfo set LogonPass='******',"; updateSql += "Accounts='" + PhoneName + "'"; updateSql += " where UserID=" + AccountId + " and Accounts<> '" + PhoneName + "'"; SqlCommand UpdateCommand = new SqlCommand(updateSql, MyConnection); return(UpdateCommand.ExecuteNonQuery() > 0); } } catch (Exception ex) { newRetureCode.code = 5; newRetureCode.msg = ex.Message.ToString(); Console.WriteLine("{0} Exception caught.", ex); } finally { if (MyConnection != null) { MyConnection.Close(); } } return(false); }
public static bool AddAccount(string PhoneName, string Password, string Mac, RetureCode newRetureCode, out int IntId) { IntId = -1; string insetsql = ""; { { insetsql = string.Format(@"INSERT INTO [RYAccountsDB].[dbo].[AccountsInfo] ([ProtectID] ,[PasswordID] ,[SpreaderID] ,[Accounts] ,[NickName] ,[RegAccounts] ,[UnderWrite] ,[PassPortID] ,[Compellation] ,[LogonPass] ,[InsurePass] ,[DynamicPass] ,[DynamicPassTime] ,[FaceID] ,[CustomID] ,[Present] ,[UserMedal] ,[Experience] ,[GrowLevelID] ,[LoveLiness] ,[UserRight] ,[MasterRight] ,[ServiceRight] ,[MasterOrder] ,[MemberOrder] ,[MemberOverDate] ,[MemberSwitchDate] ,[CustomFaceVer] ,[Gender] ,[Nullity] ,[NullityOverDate] ,[StunDown] ,[MoorMachine] ,[IsAndroid] ,[WebLogonTimes] ,[GameLogonTimes] ,[PlayTimeCount] ,[OnLineTimeCount] ,[LastLogonIP] ,[LastLogonDate] ,[LastLogonMobile] ,[LastLogonMachine] ,[RegisterIP] ,[RegisterDate] ,[RegisterMobile] ,[RegisterMachine] ,[RegisterOrigin] ,[PlatformID] ,[UserUin] ,[RankID] ,[AgentID]) VALUES( 0, 0, 0, '{0}', '{1}', '', '', '', '', '{2}', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', '', '', '', '{0}', '{3}', 0, 0, '', 0, 0)", PhoneName, "游客", Password, Mac); } } string MyConn = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"]; SqlConnection MyConnection = new SqlConnection(MyConn); try { MyConnection.Open(); { string selStr = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'"; SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); SqlDataReader _Reader = MyCommand.ExecuteReader(); if (!_Reader.Read()) { _Reader.Close(); } else { IntId = _Reader.GetInt32(0); _Reader.Close(); string updateSql = " update AccountsInfo set LogonPass='******'"; updateSql += " where Accounts='" + PhoneName + "'"; SqlCommand UpdateCommand = new SqlCommand(updateSql, MyConnection); UpdateCommand.ExecuteNonQuery(); return(true); } } { SqlCommand cmd = new SqlCommand(); cmd.Connection = MyConnection; cmd.CommandText = "NET_PM_AddAccount"; cmd.Parameters.Add(new SqlParameter("@strAccounts", PhoneName)); cmd.Parameters.Add(new SqlParameter("@strNickName", "游客")); cmd.Parameters.Add(new SqlParameter("@strLogonPass", Password)); cmd.Parameters.Add(new SqlParameter("@strInsurePass", "")); cmd.Parameters.Add(new SqlParameter("@strDynamicPass", "")); cmd.Parameters.Add(new SqlParameter("@strRegisterMachine", Mac)); cmd.Parameters.Add(new SqlParameter("@IsAndroid", "0")); cmd.Parameters.Add(new SqlParameter("@dwFaceID", "0")); cmd.Parameters.Add(new SqlParameter("@dwPhoneLoginScore", 300)); cmd.Parameters.Add(new SqlParameter("@strErrorDescribe", "")); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } { string selStr = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'"; SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); SqlDataReader _Reader = MyCommand.ExecuteReader(); if (!_Reader.Read()) { Debug.Log("error", "error new phone login " + PhoneName); _Reader.Close(); } else { IntId = _Reader.GetInt32(0); Debug.Log("suss", "suss new phone login " + IntId); _Reader.Close(); } JsonEMail newJsonEMail = new JsonEMail(); newJsonEMail.dwUserID = IntId; newJsonEMail.nStatus = 0; newJsonEMail.szTitle = "绑定成功"; newJsonEMail.szMessage = "绑定成功手机号,赠送3.00"; newJsonEMail.szSender = "系统"; newJsonEMail.nType = 0; newJsonEMail.nStatus = 0; EmailAdd.AddEmail(newJsonEMail); } // { // SqlCommand UpdateCommand = new SqlCommand(insetsql, MyConnection); // UpdateCommand.ExecuteNonQuery(); // { // string selStr = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'"; // SqlCommand MyCommand = new SqlCommand(selStr, MyConnection); // SqlDataReader _Reader = MyCommand.ExecuteReader(); // if (_Reader.Read()) // { // IntId = _Reader.GetInt32(0); // } // _Reader.Close(); // } MyConnection.Close(); MyConnection = null; // AppleInapp.AddScore(300, IntId); // } return(true); } catch (Exception ex) { newRetureCode.msg = ex.Message.ToString(); } finally { if (MyConnection != null) { MyConnection.Close(); } } return(false); }