Exemplo n.º 1
0
        /// <summary>
        /// a8读取用户数据(7)
        /// </summary>
        /// <returns></returns>
        private String IsRegist()
        {
            string openId   = GetParam("openId");
            string serverNo = GetParam("serverNo");
            string pf       = GetParam("pf");
            string time     = GetParam("time");
            string sign     = GetParam("sign");

            if (string.IsNullOrEmpty(openId) ||
                string.IsNullOrEmpty(serverNo) ||
                string.IsNullOrEmpty(pf) ||
                string.IsNullOrEmpty(time) ||
                string.IsNullOrEmpty(sign)
                )
            {
                return(UAErrorCode.ErrDataOP);
            }
            long     time1      = ConvertHelper.ConvertToLong(time, 0);
            DateTime sourceTime = ShareUtil.GetTime((time1));

            DateTime nowTime = DateTime.Now;

            //检查时间是否过期
            if (sourceTime.AddSeconds(UAFactory.Instance.Timeout24Hour) < nowTime ||
                sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime)
            {
                //记录详细的错误日志

                return(UAErrorCode.ErrTimeout);
            }

            var channelAliasEntity = UAFactory.Instance.GetPlatform("" + A8csdkEnum.h5_a8);

            if (channelAliasEntity == null)
            {
                return(UAErrorCode.ErrPlatform);
            }

            string cryptKey  = channelAliasEntity.LoginKey;
            string signParam =
                CryptHelper.GetMD5(openId + serverNo + pf + time + cryptKey).ToLower();

            if (sign != signParam)
            {
                return(UAErrorCode.ErrCheckSign);
            }

            var entity = WebServerHandler.IsRegist("" + A8csdkEnum.h5_a8, "" + serverNo, openId);

            if (entity == null)
            {
                return(UAErrorCode.ErrNoUser);
            }
            Response.Write("{\"ret\":\"success\",\"msg\":\"ok\",\"roleId\":\"" + entity.Idx + "\",\"roleName\":\"" +
                           entity.Account + "\",\"roleLevel\":\"" + entity.Level + "\"" +
                           ",\"serverNo\":" + serverNo + "\"\",\"serverId\":\" " + serverNo + " \",\"serverName\":\"" +
                           serverNo + " \"}");
            return(UAErrorCode.ErrOK);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增查询
        /// </summary>
        /// <returns></returns>
        public string OtherOne()
        {
            // {code:0, uid:xxx,uname:xxxx,roleid:xxxx,rolename:xxxx,vip:xxx,sword:xxx,rolelevel:xxxx}
            try
            {
                var openId   = GetParamNOUrlDecode("uid");
                var serverid = GetParam("serverid");
                var sign     = GetParam("sign");
                if (string.IsNullOrEmpty(openId) || string.IsNullOrEmpty(sign))
                {
                    UAHelper.WriteLog("ret", "参数不正确");
                    return(UAErrorCode.ErrDataOP);
                }

                var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey);
                if (channelAliasEntity == null)
                {
                    return(UAErrorCode.ErrNoUser);
                }
                string cryptKey  = channelAliasEntity.LoginKey;
                var    signParam = CryptHelper.GetMD5(openId + serverid + cryptKey)
                                   .ToLower();

                if (sign != signParam)
                {
                    UAHelper.WriteLog("ret", "sign错误");
                    return(UAErrorCode.ErrCheckSign);
                }

                var manager = WebServerHandler.IsRegist(platFormKey, serverid, openId);
                var oId     = UAHelper.StrToUtf8(openId);

                if (manager != null && !string.IsNullOrEmpty(manager.Name))
                {
                    Response.Write("{\"code\":0,\"uname\":\"" + openId + "\",\"sword\":\"" + manager.Kpi +
                                   "\",\"uid\":\"" + oId + "\",\"rolename\":\"" + manager.Name + "\"" +
                                   ",\"roleid\":\"" + manager.Account + "\"" +
                                   ",\"vip\":\"" + manager.VipLevel + "\",\"rolelevel\":\"" + manager.Level + "\"}");
                }
                else
                {
                    return(UAErrorCode.ErrNoManager);
                }
                return(UAErrorCode.ErrOK);
            }
            catch (Exception)
            {
                return(UAErrorCode.ErrException);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// a8查询战斗力接口9
        /// </summary>
        private string PowerValue()
        {
            try
            {
                var openId   = GetParam("roleid");
                var serverid = GetParam("serverid");
                var sign     = GetParam("sign");
                if (string.IsNullOrEmpty(openId) || string.IsNullOrEmpty(sign))
                {
                    UAHelper.WriteLog("ret", "参数不正确");
                    return(UAErrorCode.ErrDataOP);
                }

                var channelAliasEntity = UAFactory.Instance.GetPlatform("" + A8csdkEnum.txh5_a8);
                if (channelAliasEntity == null)
                {
                    return(UAErrorCode.ErrNoUser);
                }
                string cryptKey  = channelAliasEntity.LoginKey;
                var    signParam = CryptHelper.GetMD5(openId + serverid + cryptKey)
                                   .ToLower();

                if (sign != signParam)
                {
                    UAHelper.WriteLog("ret", "sign错误");
                    return(UAErrorCode.ErrCheckSign);
                }

                var manager = WebServerHandler.IsRegist("" + A8csdkEnum.txh5_a8, "" + serverid, openId);
                //第一个枚举枚举参数修改腾讯,第二个枚举参数作废可以不改
                var oId = UAHelper.StrToUtf8(openId);

                if (manager != null && !string.IsNullOrEmpty(manager.Name))
                {
                    Response.Write("{\"code\":0,\"data\":{\"uname\":\"" + openId + "\",\"sword\":\"" + manager.Kpi +
                                   "\",\"uid\":\"" +
                                   oId + "\",\"rolename\":\"" + manager.Name + "\"" +
                                   ",\"vip\":" + manager.VipLevel + "\"\",\"rolelevel\":\" " + manager.Level + " \"}}");
                }
                else
                {
                    return(UAErrorCode.ErrNoManager);
                }
                return(UAErrorCode.ErrOK);
            }
            catch (Exception)
            {
                return(UAErrorCode.ErrException);
            }
        }