/// <summary> /// 取回玩家光線飛車仓库密码 /// </summary> /// <returns></returns> public Message Get_WarehousePassword() { int operateUserID = 0; string serverIP = null; string account = null; string passwd = null; string email = null; int characterID = 0; int result = -1; try { TLV_Structure strut = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); operateUserID = (int)strut.toInteger(); serverIP = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.RayCity_ServerIP).m_bValueBuffer); account = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.RayCity_NyUserID).m_bValueBuffer); email = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.SDO_Email).m_bValueBuffer); string signpasswd = MD5EncryptAPI.nextID(6); MD5Encrypt st = new MD5Encrypt(); passwd = st.getMD5ofStr(signpasswd).ToLower(); strut = new TLV_Structure(TagName.RayCity_CharacterID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.RayCity_CharacterID).m_bValueBuffer); characterID = (int)strut.toInteger(); SqlHelper.log.WriteLog(lg.API_Look + lg.RayCityAPI_Name + "+>" + lg.RayCityAPI_Address + CommonInfo.serverIP_Query(serverIP) + lg.RayCityAPI_Set + lg.RayCityAPI_Account + characterID + lg.RayCityAPI_WarehousePassword); Console.WriteLine(DateTime.Now + lg.API_Look + lg.RayCityAPI_Name + "+>" + lg.RayCityAPI_Address + CommonInfo.serverIP_Query(serverIP) + lg.RayCityAPI_Set + lg.RayCityAPI_Account + characterID + lg.RayCityAPI_WarehousePassword); result = GlobalAccount.Get_WarehousePassword(operateUserID, serverIP, characterID, account, signpasswd, passwd); if (result == 1) { if (sendRayCityMail("*****@*****.**", email, account, signpasswd) == 1) { return(Message.COMMON_MES_RESP("SCUESS", Msg_Category.RAYCITY_ADMIN, ServiceKey.RayCity_WareHousePwd_Update_Resp)); } else { return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.RAYCITY_ADMIN, ServiceKey.RayCity_WareHousePwd_Update_Resp)); } } else { return(Message.COMMON_MES_RESP(lg.API_Error, Msg_Category.RAYCITY_ADMIN, ServiceKey.RayCity_WareHousePwd_Update_Resp, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { SqlHelper.errLog.WriteLog("伺服器IP" + serverIP + ex.Message); return(Message.COMMON_MES_RESP(lg.API_Error, Msg_Category.RAYCITY_ADMIN, ServiceKey.RayCity_WareHousePwd_Update_Resp, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 反馈玩家的密码 /// </summary> /// <param name="serverIP"></param> /// <param name="account"></param> /// <returns></returns> public static int sendEmailPasswd(int userByID, string account, string email, string password) { XmlDocument xmlfile = new XmlDocument(); string pwd = null; int result = -1; SqlParameter[] paramCode; /* * try * { * pwd = MD5EncryptAPI.MDString(password); * paramCode = new SqlParameter[4]{ * new SqlParameter("@GM_UserID",SqlDbType.Int), * new SqlParameter("@SDO_UserID",SqlDbType.VarChar,20), * new SqlParameter("@9YOU_PWD",SqlDbType.VarChar,32), * new SqlParameter("@result",SqlDbType.Int)}; * paramCode[0].Value = userByID; * paramCode[1].Value = account; * paramCode[2].Value = pwd; * paramCode[3].Direction = ParameterDirection.ReturnValue; * result = SqlHelper.ExecSPCommand("SDO_EmailPWD_Update", paramCode); * if (result==0) * { * if(1==sendMail("*****@*****.**", email, account+"玩家密码", password)) * return 1; * } * else * return 0; * }*/ try { pwd = MD5EncryptAPI.nextID(6); string md5string = MD5EncryptAPI.MDString(account + "HAOHAOXUEXI"); string serverIP = ""; System.Data.DataSet ds = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999"); if (ds != null && ds.Tables[0].Rows.Count > 0) { serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString(); string url = "http://" + serverIP + "/gmtools?req=updatePassword&type=0&userid=" + account + "&newPassword="******"&s=" + md5string; HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); //request.Method="Post"; request.KeepAlive = false; WebResponse resp = request.GetResponse(); StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream()); xmlfile.Load(sr); XmlNode state = xmlfile.SelectSingleNode("you9/state"); sr.Close(); if (Convert.ToInt32(state.InnerText.ToString()) == 0) { //判断发送EMAIL是否成功 if (1 == sendMail("*****@*****.**", email, account, pwd)) { result = 1; } else { result = 0; } //记录日志 paramCode = new SqlParameter[4] { new SqlParameter("@GM_UserID", SqlDbType.Int), new SqlParameter("@SDO_UserID", SqlDbType.VarChar, 20), new SqlParameter("@9YOU_PWD", SqlDbType.VarChar, 32), new SqlParameter("@result", SqlDbType.Int) }; paramCode[0].Value = userByID; paramCode[1].Value = account; paramCode[2].Value = pwd; paramCode[3].Value = result; SqlHelper.ExecSPCommand("SDO_EmailPWD_Update", paramCode); return(result); } else { return(0); } } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(0); } return(0); }