예제 #1
0
    public override string doDyop(object param)
    {
        ParamUnLockPlayer p = (ParamUnLockPlayer)param;

        bool cres = createGMUser(p);

        if (!cres)
        {
            return(Helper.genJsonStr(m_retData));
        }

        if (!p.checkSign(m_gmUser))
        {
            m_retData.Add("result", RetCode.RET_SIGN_ERROR);
            return(Helper.genJsonStr(m_retData));
        }

        Player player = new Player(p.m_playerAcc, m_gmUser);

        if (!player.m_isExists)
        {
            m_retData.Add("result", RetCode.RET_NO_PLAYER);
            return(Helper.genJsonStr(m_retData));
        }
        if (!player.isOwner(m_gmUser.m_acc))
        {
            m_retData.Add("result", RetCode.RET_NO_RIGHT);
            return(Helper.genJsonStr(m_retData));
        }
        if (player.isInGame()) // 玩家在游戏内
        {
            m_retData.Add("result", RetCode.RET_SUCCESS);
            return(Helper.genJsonStr(m_retData));
        }
        unlock(p.m_playerAcc);

        /* string url = string.Format(CONST.URL_UNLOCK_PLAYER, p.m_playerAcc);
         * var ret = HttpPost.Get(new Uri(url));
         * if (ret != null)
         * {
         *   string retStr = Encoding.UTF8.GetString(ret);
         *   Dictionary<string, object> retData =
         *       JsonHelper.ParseFromStr<Dictionary<string, object>>(retStr);
         *   if (retData.ContainsKey("result"))
         *   {
         *       int retCode = Convert.ToInt32(retData["result"]);
         *
         *       m_retData.Add("result", retCode);
         *
         *       if (retCode == RetCode.RET_SUCCESS &&
         *           retData.ContainsKey("info"))
         *       {
         *           string retURL = string.Format(CONST.URL_UNLOCK_PLAYER_RET, p.m_playerAcc, retData["info"]);
         *           HttpPost.Get(new Uri(retURL));
         *       }
         *   }
         * }*/

        return(Helper.genJsonStr(m_retData));
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            ParamUnLockPlayer param = new ParamUnLockPlayer();

            param.m_gmAccount = Request.QueryString["gmAcc"];
            param.m_gmPwd     = Request.QueryString["gmPwd"];
            param.m_playerAcc = Request.QueryString["playerAcc"];
            param.m_sign      = Request.QueryString["sign"];

            if (!param.isParamValid())
            {
                Dictionary <string, object> data = new Dictionary <string, object>();
                data.Add("result", RetCode.RET_PARAM_NOT_VALID);
                Response.Write(Helper.genJsonStr(data));
                return;
            }

            DyOpUnLockPlayer dy     = new DyOpUnLockPlayer();
            string           retStr = dy.doDyop(param);

            Response.Write(retStr);
        }