/// <summary> /// 注册消息 /// </summary> /// <param name="msg"></param> /// <returns></returns> public SocketMsg <Dictionary <string, string> > ReqRegMsg(object msg) { UserInfo userinfo = msg as UserInfo; if (userinfo.Phone == "" || userinfo.Password == "") { // promptMsg.Change("请输入用户名和验证码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("404", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckMobile(userinfo.Phone)) { // promptMsg.Change("请输入正确的手机号码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("402", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckPass(userinfo.Password)) { // promptMsg.Change("8-16位字符,可包含数字,字母,下划线", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("408", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckNickName(userinfo.NickName)) { // promptMsg.Change("2-10位字符,可包含数字,字母,下划线,汉字", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("405", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } Dictionary <string, string> t = new Dictionary <string, string> { ["username"] = userinfo.Phone, ["userpass"] = MsgTool.MD5Encrypt(userinfo.Password), ["code"] = userinfo.Identity, ["nick"] = userinfo.NickName, ["invite"] = userinfo.InviteCode }; messageData.Change("consumer/player", SocketEventType.Regist, t); Debug.LogError(LoginInfo.ClientId); socketMsg.Change(LoginInfo.ClientId, "注册操作", messageData); return(socketMsg); }
/// <summary> /// 注册消息 /// </summary> /// <param name="msg"></param> /// <returns></returns> public SocketMsg ReqRegMsg(object msg) { UserInfo userinfo = msg as UserInfo; if (userinfo.Phone == "" || userinfo.Password == "") { promptMsg.Change("请输入用户名和验证码", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckMobile(userinfo.Phone)) { promptMsg.Change("请输入正确的手机号码", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckPass(userinfo.Password)) { promptMsg.Change("8-16位字符,可包含数字,字母,下划线", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckNickName(userinfo.NickName)) { promptMsg.Change("2-10位字符,可包含数字,字母,下划线,汉字", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } MessageData messageData = new MessageData(); messageData.t = new Dictionary <string, string> { ["username"] = userinfo.Phone, ["userpass"] = userinfo.Password, ["code"] = userinfo.Identity, ["nick"] = userinfo.NickName, ["invite"] = userinfo.InviteCode }; messageData.model = "consumer"; messageData.type = "reg"; Debug.LogError(LoginInfo.ClientId); SocketMsg socketMsg = new SocketMsg(LoginInfo.ClientId, "注册操作", messageData); return(socketMsg); }
/// <summary> /// 修改密码消息 /// </summary> /// <param name="msg"></param> /// <returns></returns> public SocketMsg <Dictionary <string, string> > ReqPWChangeMsg(object msg) { Dictionary <string, string> t = msg as Dictionary <string, string>; //todo配置 if (t["oldpw"].IsNullOrEmpty()) { // promptMsg.Change("请输入当前密码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("417", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (t["newpw"].IsNullOrEmpty()) { // promptMsg.Change("请输入新密码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("418", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (t["code"].IsNullOrEmpty()) { //promptMsg.Change("请输入验证码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("404", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckPass(t["newpw"])) { promptMsg.Change(LanguageService.Instance.GetStringByKey("408", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } t["oldpw"] = MsgTool.MD5Encrypt(t["oldpw"]); t["newpw"] = MsgTool.MD5Encrypt(t["newpw"]); t.Add("username", PlayerPrefs.GetString("username")); t.Add("token", PlayerPrefs.GetString("token")); t.Add("playerId", PlayerPrefs.GetString("playerId")); messageData.Change("consumer/player", SocketEventType.ChangPassWord, t); socketMsg.Change(LoginInfo.ClientId, "修改登入密码操作", messageData); return(socketMsg); }