/// <summary>
        /// 忘记密码消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqForgetMsg(object msg)
        {
            LoginInfo loginInfo = msg as LoginInfo;

            if (loginInfo.UserName == "")
            {
                promptMsg.Change(LanguageService.Instance.GetStringByKey("401", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            if (!MsgTool.CheckMobile(loginInfo.UserName))
            {
                promptMsg.Change(LanguageService.Instance.GetStringByKey("402", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            string userpass = MsgTool.MD5Encrypt(loginInfo.Password);
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                // ["IsIdentityLog"] = loginInfo.Identity,
                ["username"] = loginInfo.UserName,
                ["newpw"]    = userpass,
                ["code"]     = loginInfo.Identity,
                ["token"]    = PlayerPrefs.GetString("token"),
            };

            messageData.Change("consumer/player", SocketEventType.ForgerPassWord, t);
            socketMsg.Change(LoginInfo.ClientId, "忘记密码消息", messageData);
            return(socketMsg);
        }
        public SocketMsg <Dictionary <string, string> > ReqJoinCommerceMsg(object msg)
        {
            UserInfo userinfo = msg as UserInfo;

            //TODO 校验交易密码
            if (!MsgTool.CheckExPass(userinfo.Password))
            {
                promptMsg.Change(LanguageService.Instance.GetStringByKey("", string.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                ["pwshop"] = MsgTool.MD5Encrypt(userinfo.Password),
                ["code"]   = userinfo.Identity,
                ["invite"] = userinfo.InviteCode
            };

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("playerId", PlayerPrefs.GetString("playerId"));
            messageData.Change("consumer/player", SocketEventType.JoinCommerce, t);
            socketMsg.Change(LoginInfo.ClientId, "注册操作", messageData);
            return(socketMsg);
        }
Beispiel #3
0
        /// <summary>
        /// 经营许可证
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <ReqCommerceInfo> ReqPermissionCommerceMsg(object msg)
        {
            string pass = MsgTool.MD5Encrypt(msg.ToString());

            reqCommerceInfo.Change(null, null, null, null, null, pass);
            messageData.Change("consumer/tree", SocketEventType.JoinCommerce, reqCommerceInfo);
            socketMsg.Change(LoginInfo.ClientId, "商会请求经营许可消息", messageData);
            return(socketMsg);
        }
 public void Change(double money, string moneyaddress, string oldpwshop)
 {
     this.money     = money;
     this.accAddr   = moneyaddress;
     this.oldpwshop = MsgTool.MD5Encrypt(oldpwshop);
     this.username  = PlayerPrefs.GetString("username");
     token          = PlayerPrefs.GetString("token");
     playerId       = PlayerPrefs.GetString("playerId");
 }
        /// <summary>
        /// 校验交易密码
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqCheckPass(object msg)
        {
            Dictionary <string, string> t = new Dictionary <string, string>();

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("playerId", PlayerPrefs.GetString("playerId"));
            t.Add("confirmPass", MsgTool.MD5Encrypt(msg.ToString()));
            messageData.Change("consumer/tree", SocketEventType.ConfirmPass, t);
            socketMsg.Change(LoginInfo.ClientId, "核对密码请求", messageData);
            return(socketMsg);
        }
        /// <summary>
        /// 修改交易密码消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqPWShopChangeMsg(object msg)
        {
            Dictionary <string, string> t = msg as Dictionary <string, string>;

            //todo配置
            if (t["oldpwshop"].IsNullOrEmpty())
            {
                //promptMsg.Change("请输入当前密码", Color.white);
                promptMsg.Change(LanguageService.Instance.GetStringByKey("请输入当前交易密码", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            if (t["newpwshop"].IsNullOrEmpty())
            {
                // promptMsg.Change("请输入新密码", Color.white);
                promptMsg.Change(LanguageService.Instance.GetStringByKey("请输入新交易密码", 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("请输入验证码", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }

            if (CacheData.Instance().Mt < CacheData.Instance().ChangExPassWordMt)
            {
                //promptMsg.Change("你的MT不足", Color.white);
                promptMsg.Change(LanguageService.Instance.GetStringByKey("你的MT不足", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            //TODO 校验交易密码
            if (!MsgTool.CheckExPass(t["newpwshop"]))
            {
                promptMsg.Change(LanguageService.Instance.GetStringByKey("417", string.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            t["oldpwshop"] = MsgTool.MD5Encrypt(t["oldpwshop"]);
            t["newpwshop"] = MsgTool.MD5Encrypt(t["newpwshop"]);
            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("playerId", PlayerPrefs.GetString("playerId"));
            messageData.Change("consumer/player", SocketEventType.ChangeShopPass, t);
            socketMsg.Change(LoginInfo.ClientId, "修改交易密码操作", messageData);
            return(socketMsg);
        }
        /// <summary>
        /// 忘记密码消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqForgetMsg(object msg)
        {
            LoginInfo loginInfo           = msg as LoginInfo;
            string    userpass            = MsgTool.MD5Encrypt(loginInfo.Password);
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                // ["IsIdentityLog"] = loginInfo.Identity,
                ["username"] = loginInfo.UserName,
                ["newpw"]    = userpass,
                ["code"]     = loginInfo.Identity,
                ["token"]    = PlayerPrefs.GetString("token"),
            };

            messageData.Change("consumer/palyer", "pwforget", t);
            socketMsg.Change(LoginInfo.ClientId, "忘记密码消息", messageData);
            return(socketMsg);
        }
        /// <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);
        }
Beispiel #9
0
    /// <summary>
    /// 忘记密码消息
    /// </summary>
    /// <param name="msg"></param>
    /// <returns></returns>
    public SocketMsg ReqPWChangeMsg(object msg)
    {
        LoginInfo   loginInfo   = msg as LoginInfo;
        MessageData messageData = new MessageData();
        string      userpass    = MsgTool.MD5Encrypt(loginInfo.Password);

        messageData.t = new Dictionary <string, string>
        {
            // ["IsIdentityLog"] = loginInfo.Identity,
            ["username"] = loginInfo.UserName,
            ["userpass"] = userpass,
            ["Identity"] = loginInfo.Identity,
            ["token"]    = PlayerPrefs.GetString("token")
        };
        messageData.model = "set";
        messageData.type  = "expw";
        SocketMsg socketMsg = new SocketMsg(LoginInfo.ClientId, "修改登入密码操作", messageData);

        return(socketMsg);
    }
        /// <summary>
        /// 设置交易密码
        /// </summary>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqExPwShopMsg(object msg)
        {
            string pass = msg.ToString();

            if (!MsgTool.CheckExPass(pass))
            {
                promptMsg.Change(LanguageService.Instance.GetStringByKey("417", string.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                ["newpwshop"] = MsgTool.MD5Encrypt(pass),
            };

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("playerId", PlayerPrefs.GetString("playerId"));
            messageData.Change("consumer/player", SocketEventType.ChangeShopPass, t);
            socketMsg.Change(LoginInfo.ClientId, "设置交易密码", messageData);
            return(socketMsg);
        }
        /// <summary>
        /// 密码登入消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqPWLoginMsg(object msg)
        {
            //登入检验TODO
            LoginInfo loginInfo = msg as LoginInfo;

            if (loginInfo.UserName == "" || loginInfo.Password == "")
            {
                //promptMsg.Change("请输入用户名和密码", Color.white);
                promptMsg.Change(LanguageService.Instance.GetStringByKey("401", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            if (!MsgTool.CheckMobile(loginInfo.UserName))
            {
                //promptMsg.Change("请输入正确的手机号码", Color.white);
                promptMsg.Change(LanguageService.Instance.GetStringByKey("402", String.Empty), Color.white);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            //string userpass = loginInfo.Password;
            string userpass = MsgTool.MD5Encrypt(loginInfo.Password);
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                // ["IsIdentityLog"] = loginInfo.Identity,
                ["username"] = loginInfo.UserName,
                ["userpass"] = userpass,
                //["Identity"] = loginInfo.Identity
            };

            messageData.Change("consumer/player", SocketEventType.PassWordLogin, t);
            socketMsg.Change(LoginInfo.ClientId, "登入操作", messageData);
            PlayerPrefs.SetString("username", loginInfo.UserName);
            CacheData.Instance().Username = loginInfo.UserName;
            if (PlayerPrefs.HasKey("token"))
            {
                PlayerPrefs.DeleteKey("token");
            }
            return(socketMsg);
        }