Exemple #1
0
        /// <summary>
        /// 投资请求
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqInvestMsg(object msg)
        {
            Dictionary <string, string> t = new Dictionary <string, string>();

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            t.Add("investId", msg.ToString());
            messageData.Change("consumer/player", "playerInvest", t);
            socketMsg.Change(LoginInfo.ClientId, "投资请求", messageData);
            return(socketMsg);
        }
 /// <summary>
 /// 商会请求加入消息
 /// </summary>
 /// <param name="msg"></param>
 /// <returns></returns>
 public SocketMsg <ReqCommerceInfo> ReqComeCommerceMsg(object msg)
 {
     if (msg == null || msg.Equals(""))
     {
         //TODO提示
         promptMsg.Change("null", Color.white);
         return(null);
     }
     reqCommerceInfo.Change(null, null, msg.ToString(), null, null);
     //t.Add("commerce_name");
     //t.Add("username", PlayerPrefs.GetString("username"));
     //t.Add("token",PlayerPrefs.GetString("token"));
     messageData.Change("consumer/tree", "commerce_in", reqCommerceInfo);
     socketMsg.Change(LoginInfo.ClientId, "商会请求加入消息", messageData);
     return(socketMsg);
 }
Exemple #3
0
        /// <summary>
        /// 设置交易密码
        /// </summary>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqExPwShopMsg(object msg)
        {
            UserInfo userinfo = msg as UserInfo;

            Dictionary <string, string> t = new Dictionary <string, string>
            {
                ["pwshop"] = userinfo.Password,
                ["code"]   = userinfo.Identity,
                ["invite"] = userinfo.InviteCode
            };

            t.Add("username", PlayerPrefs.GetString("username"));
            t.Add("token", PlayerPrefs.GetString("token"));
            messageData.model = "consumer";
            messageData.type  = "expwshop";
            messageData.Change("consumer/player", "expwshop", t);
            socketMsg.Change(LoginInfo.ClientId, "注册操作", messageData);
            return(socketMsg);
        }
 /// <summary>
 /// 转账请求消息
 /// </summary>
 /// <param name="msg"></param>
 /// <returns></returns>
 public SocketMsg <TransferInfo> ReqTransferMsg(object msg)
 {
     //msg金额todo
     if (msg == null)
     {
         return(null);
     }
     transferData.Change("consumer/player", "transferaccount", msg as TransferInfo);
     transferSocketMsg.Change(LoginInfo.ClientId, "转账请求消息", transferData);
     return(transferSocketMsg);
 }
        /// <summary>
        /// 申请消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public SocketMsg <Dictionary <string, string> > ReqAddFriendMsg(object msg)
        {
            string applyUserName = msg.ToString();
            // ApplyInfo.applyList.Add(applyUserName);
            Dictionary <string, string> t = new Dictionary <string, string>
            {
                ["friendId"] = applyUserName,
                ["username"] = PlayerPrefs.GetString("username"),
                ["token"]    = PlayerPrefs.GetString("token")
                               //["token"] = CacheData.Instance().Token
            };

            t.Add("playerId", PlayerPrefs.GetString("playerId"));
            messageData.Change("consumer/player/friend", SocketEventType.AddFriend, t);
            socketMsg.Change(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.red);
                Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg);
                return(null);
            }
            if (!MsgTool.CheckMobile(loginInfo.UserName))
            {
                promptMsg.Change("请输入正确的手机号码", Color.red);
                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.model = "consumer";
            messageData.type  = "pwlog";
            messageData.Change("consumer/player", "login", t);
            socketMsg.Change(LoginInfo.ClientId, "登入操作", messageData);
            PlayerPrefs.SetString("username", loginInfo.UserName);
            CacheData.Instance().Username = loginInfo.UserName;
            return(socketMsg);
        }
        public SocketMsg <Dictionary <string, string> > ReqTokenLoginMsg(object msg)
        {
            Dictionary <string, string> t = new Dictionary <string, string>()
            {
                ["token"] = msg.ToString()
            };

            messageData.Change("consumer/player", SocketEventType.PassWordLogin, t);
            socketMsg.Change(LoginInfo.ClientId, "登入操作", messageData);
            return(socketMsg);
        }