Example #1
0
        public override void doCharge()
        {
            var result = Charge();

            UAHelper.WriteLog("DoCharge", result);
            UAHelper.WriteError(result);
        }
Example #2
0
        private string CheckActive()
        {
            try
            {
                string uid      = HttpContext.Current.Request["username"];
                string platform = HttpContext.Current.Request["platform"];

                if (string.IsNullOrEmpty(uid) ||
                    string.IsNullOrEmpty(platform))
                {
                    return(UAErrorCode.ErrPara);
                }

                var platformEntity = UAFactory.Instance.GetPlatform(platform);
                if (platformEntity == null)
                {
                    return(UAErrorCode.ErrPlatform);
                }
                return(UAHelper.CheckActive(UAFactory.Instance.ZoneName, uid));
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("Gov CheckActive", ex);
                return(UAErrorCode.ErrOther);
            }
        }
Example #3
0
        public override int doLoginNew()
        {
            string openid   = GetParam("openid");
            string openkey  = GetParam("openkey");
            string pf       = GetParam("pf");
            string pfkey    = GetParam("pfkey");
            var    serverId = GetParam("serverid");

            var platform = GetParam("platform");

            if (string.IsNullOrEmpty(pf))
            {
                pf = "wanba_ts";
            }

            openid = UAHelper.StrToUtf8(openid);
            if (string.IsNullOrEmpty(openid) ||
                string.IsNullOrEmpty(openkey) ||
                string.IsNullOrEmpty(serverId) ||
                string.IsNullOrEmpty(pf) ||
                string.IsNullOrEmpty(platform))
            {
                return((int)MessageCode.LoginError);
            }
            if (string.IsNullOrEmpty(serverId))
            {
                HttpContext.Current.Response.Redirect(
                    string.Format(
                        "Index.aspx?pf={0}&ck=default&openid={1}&openkey={2}&pfkey={3}&serverId={4}&platform={5}", pf, openid,
                        openkey, pfkey, serverId, platform));
                HttpContext.Current.Response.End();
            }
            return((int)MessageCode.Success);
        }
Example #4
0
        /// <summary>
        /// a8用户数据采集
        /// </summary>
        /// <param name="dataType"></param>
        /// <param name="openId"></param>
        public static void UserAction(string dataType, string openId = "", string session = "", string server = "",
                                      NbManagerEntity managerEntity  = null)
        {
            //"{dataType,sessionId,gameNum,channelAlias,channelId,deviceId,model,release,uid,uname,serverId,serverName,roleId,roleName,roleLevel,ext,sdkVersion}";
            NbManagerEntity manager = null;

            if (managerEntity == null)
            {
                var list = NbManagerMgr.GetByAccount(openId, ShareUtil.ZoneName);
                if (list != null && list.Count > 0)
                {
                    manager = list[0];
                }
            }
            else
            {
                manager = managerEntity;
            }
            var postDataStr = "";

            if (manager == null)
            {
                postDataStr = "dataType=" + dataType;
            }
            else
            {
                var ip = "";
                try
                {
                    ip = UAHelper.GetRealIP();
                }
                catch (Exception)
                {
                }
                var ext          = "";
                var channelAlias = "";
                var sessionId1   = "";
                var entity       = WebServerHandler.GetStartgameEntity(openId, ShareUtil.PlatformCode,
                                                                       ShareUtil.PlatformZoneName);
                if (entity != null)
                {
                    var serverId = entity.ServerId;
                    ext          = entity.State;
                    channelAlias = entity.Pf;
                    sessionId1   = entity.SessionId;
                    //release=1   暂留,没有实际意义
                    postDataStr = "dataType=" + dataType + "&sessionId=" +
                                  sessionId1
                                  + "&gameNum=" + (int)A8csdkEnum.csdkId + "&channelAlias=" + channelAlias +
                                  "&channelId=" + entity.JsNeed + "&deviceId=" + ip + "&model=" + "&release=1" +
                                  "&channelAlias=" + channelAlias + "&subChannel=" + "&serverId=" + serverId +
                                  "&uid=" + openId + "&uname=" + "&serverId=" + serverId + "&serverName=" +
                                  serverId + "&roleId=" + openId +
                                  "&roleName=" + manager.Name + "&roleLevel=" + manager.Level + "&ext=" + ext +
                                  "&sdkVersion=";
                }
            }
            var url       = UAFactory.Instance.GetRedirectURL(ShareUtil.PlatformCode, "useraction");
            var retString = UAHelper.HttpPost(url, postDataStr);
        }
Example #5
0
        public void doCheckAward()
        {
            UAHelper.WriteLog("CheckAward", "start");
            var ret = CheckAward();

            UAHelper.WriteLog("CheckAward", "end. ret:" + ret);
            UAHelper.WriteError(ret);
        }
Example #6
0
        public override void doCharge()
        {
            UAHelper.WriteChargeLog("Charge Start", "");
            string returnCode = Charge();

            UAHelper.WriteChargeLog("Charge", returnCode);
            UAHelper.WriteError(returnCode);
        }
Example #7
0
        string Charge()
        {
            try
            {
                //uid=50469470&order_amount=10&order_id=test1056&server_id=S1&agentid=??&sign=7439fb6fa5f82104c107648e9ac77d76
                string platform = GetParam("platform");
                string uid      = GetParam("username");
                string sign     = GetParam("sign");
                string time     = GetParam("time");
                int    money    = GetParamInt("money");
                string orderid  = GetParam("orderid");
                if (string.IsNullOrEmpty(uid) ||
                    string.IsNullOrEmpty(platform) ||
                    string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(time) ||
                    money <= 0)
                {
                    return(UAErrorCode.ErrPara);
                }
                DateTime sourceTime;
                if (!DateTime.TryParseExact(time, "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.None, out sourceTime))
                {
                    //记录详细的错误日志
                    return(UAErrorCode.ErrPara);
                }
                DateTime nowTime = DateTime.Now;
                //检查时间是否过期
                if (sourceTime.AddSeconds(UAFactory.Instance.Timeout) < nowTime ||
                    sourceTime.AddSeconds(-UAFactory.Instance.Timeout) > nowTime)
                {
                    //记录详细的错误日志
                    return(UAErrorCode.ErrTimeout);
                }

                var platformEntity = UAFactory.Instance.GetPlatform(platform);
                if (platformEntity == null)
                {
                    return(UAErrorCode.ErrPlatform);
                }

                string cryptKey  = platformEntity.ChargeKey;
                string signParam = "platform=" + platform + "&username="******"&money=" + money + "&orderid=" +
                                   orderid + "&time=" + time + "&key=" + cryptKey;
                string cryptParam = CryptHelper.GetSHA1(signParam);
                if (sign != cryptParam)
                {
                    return(UAErrorCode.ErrCheckSign);
                }
                int point = money * platformEntity.ExchangeRate;
                int cash  = money * platformEntity.CashRate;
                return(UAHelper.SaveChargeData(platform, UAFactory.Instance.ZoneName, uid, cash, point, orderid));
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("Gov Charge", ex);
                return(UAErrorCode.ErrOther);
            }
        }
Example #8
0
        private string Login()
        {
            try
            {
                string platform = GetParam("platform");
                string uid      = GetParam("username");
                string sign     = GetParam("sign");
                string time     = GetParam("time");

                if (string.IsNullOrEmpty(uid) ||
                    string.IsNullOrEmpty(platform) ||
                    string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(time))
                {
                    return(UAErrorCode.ErrPara);
                }

                DateTime sourceTime;
                if (!DateTime.TryParseExact(time, "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.None, out sourceTime))
                {
                    //记录详细的错误日志
                    return(UAErrorCode.ErrPara);
                }
                DateTime nowTime = DateTime.Now;
                //检查时间是否过期
                if (sourceTime.AddSeconds(UAFactory.Instance.Timeout) < nowTime ||
                    sourceTime.AddSeconds(-UAFactory.Instance.Timeout) > nowTime)
                {
                    //记录详细的错误日志
                    return(UAErrorCode.ErrTimeout);
                }

                var platformEntity = UAFactory.Instance.GetPlatform(platform);
                if (platformEntity == null)
                {
                    return(UAErrorCode.ErrPlatform);
                }

                string cryptKey      = platformEntity.LoginKey;
                string signParam     = "platform=" + platform + "&username="******"&time=" + time + "&key=" + cryptKey;
                string calcSignature = CryptHelper.GetSHA1(signParam);
                if (calcSignature != sign)
                {
                    return(UAErrorCode.ErrCheckSign);
                }
                this.SetPlatSession();
                string returnCode = UAHelper.SaveLogindata(uid);
                return(returnCode);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("Gov dologin", ex);
                return(UAErrorCode.ErrOther);
            }
        }
Example #9
0
        private void UserActionNew(string dataType, string sessionId, string channelAlias, string openId, string jsNeed, string serverId, string state)
        {
            //"{dataType,sessionId,gameNum,channelAlias,channelId,deviceId,model,release,uid,uname,serverId,serverName,roleId,roleName,roleLevel,ext,sdkVersion}";
            NbManagerEntity manager = null;
            var             name    = "";
            var             level   = 1;

            try
            {
                var list = NbManagerMgr.GetByAccount(openId, ShareUtil.ZoneName);
                if (list != null && list.Count > 0)
                {
                    manager = list[0];
                    name    = manager.Name;
                    level   = manager.Level;
                }
            }
            catch (Exception ex)
            {
            }

            var postDataStr = "";

            if (manager == null)
            {
                postDataStr = "dataType=" + dataType;
            }
            else
            {
                var ip = "";
                try
                {
                    ip = UAHelper.GetRealIP();
                }
                catch (Exception)
                {
                }
                var oId = UAHelper.StrToUtf8(openId);


                //release=1   暂留,没有实际意义
                postDataStr = "dataType=" + dataType + "&sessionId=" +
                              sessionId
                              + "&gameNum=" + (int)A8csdkEnum.csdkId + "&channelAlias=" + channelAlias +
                              "&channelId=" + jsNeed + "&deviceId=" + ip + "&model=" + "&release=1" +
                              "&channelAlias=" + channelAlias + "&subChannel=" + "&serverId=" + serverId +
                              "&uid=" + oId + "&uname=" + "&serverId=" + serverId + "&serverName=" +
                              serverId + "&roleId=" + openId +
                              "&roleName=" + name + "&roleLevel=" + level + "&ext=" + state +
                              "&sdkVersion=";     //第一个枚举参数不变     第二个枚举参数作废不更改
            }
            var url       = UAFactory.Instance.GetRedirectURL(ShareUtil.PlatformCode, "useraction");
            var retString = UAHelper.HttpPost(url, postDataStr);
        }
Example #10
0
        public override int doLoginNew()
        {
            string openid       = GetParam("openid");
            string state        = GetParam("state");
            string serverId     = GetParam("serverId");
            string nowTimestamp = GetParam("nowTimestamp");
            string pf           = GetParam("pf");
            string sessionId    = GetParam("sessionId");
            string sign         = GetParam("sign");
            string jsNeed       = GetParam("jsNeed");
            string nickName     = GetParam("nickName");
            string qqOpenid     = GetParam("qqopenid");
            string qqOpenkey    = GetParam("qqopenkey");
            string qqPf         = GetParam("qqpf");
            string platform     = GetParam("platform");
            string share        = GetParam("share");
            string shareType    = GetParam("shareType");


            var result = LoginCheckNew(openid, state, serverId, nowTimestamp, pf, sessionId, sign, qqOpenid, qqOpenkey,
                                       qqPf, platform);

            if (result != MessageCode.Success)
            {
                return((int)result);
            }
            if (serverId == "default")
            {
                openid = UAHelper.StrToUtf8(openid);
                HttpContext.Current.Response.Redirect(
                    string.Format(
                        "Index.aspx?pf={0}&ck=default&openid={1}&state={2}&nowTimestamp={3}&sessionId={4}&sign={5}&jsNeed={6}&nickName={7}&qqopenid={8}&qqopenkey={9}&qqpf={10}&platform={11}&share={12}&shareType={13}",
                        pf, openid, state, nowTimestamp, sessionId, sign, jsNeed, nickName, qqOpenid, qqOpenkey,
                        qqPf, platform, share, shareType));
                HttpContext.Current.Response.End();
            }
            else
            {
                var strCommon = qqOpenid + "|" + qqOpenkey + "|" + qqPf + "|" + platform;
                SetVipInfo(openid, qqOpenid, qqOpenkey, qqPf, platform);

                var str = StartGameNew(openid, state, serverId, pf, sessionId, jsNeed, nickName,
                                       strCommon);
                try
                {
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("txLogin", ex.Message);
                }
                return((int)str);
            }
            return((int)MessageCode.Success);
        }
Example #11
0
 private string Login(string userName)
 {
     try
     {
         this.SetPlatSession();
         return(UAHelper.SaveLogindata(userName));
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("h5_a8 dologin", ex);
         return(UAErrorCode.ErrOther);
     }
 }
Example #12
0
        public override void doLogin()
        {
            string openid       = GetParam("openid");
            string state        = GetParam("state");
            string serverId     = GetParam("serverId");
            string nowTimestamp = GetParam("nowTimestamp");
            string pf           = GetParam("pf");
            string sessionId    = GetParam("sessionId");
            string sign         = GetParam("sign");
            string jsNeed       = GetParam("jsNeed");
            string nickName     = GetParam("nickName");
            string qqOpenid     = GetParam("qqopenid");
            string qqOpenkey    = GetParam("qqopenkey");
            string qqPf         = GetParam("qqpf");
            string platform     = GetParam("platform");
            string share        = GetParam("share");
            string shareType    = GetParam("shareType");
            var    result       = LoginCheck(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName,
                                             qqOpenid, qqOpenkey, qqPf, platform);

            SystemlogMgr.Info("ceshi", "ceshi:" + Request.Url.AbsoluteUri);

            if (result != "0")
            {
                LoginResponse(result, pf, false);
            }
            else
            {
                if (serverId == "default")
                {
                    openid = UAHelper.StrToUtf8(openid);
                    HttpContext.Current.Response.Redirect(
                        string.Format(
                            "Index.aspx?pf={0}&ck=default&openid={1}&state={2}&nowTimestamp={3}&sessionId={4}&sign={5}&jsNeed={6}&nickName={7}&qqopenid={8}&qqopenkey={9}&qqpf={10}&platform={11}&share={12}&shareType={13}",
                            pf, openid, state, nowTimestamp, sessionId, sign, jsNeed, nickName, qqOpenid, qqOpenkey,
                            qqPf, platform, share, shareType));
                    HttpContext.Current.Response.End();
                }
                else
                {
                    //用  |   连接qqOpenid, qqOpenkey, qqPf, platform,nickName5个参数放在公共参数Common里
                    var strCommon = qqOpenid + "|" + qqOpenkey + "|" + qqPf + "|" + platform;
                    var str       = UAErrorCode.ErrTxException;
                    SetVipInfo(openid, qqOpenid, qqOpenkey, qqPf, platform);

                    str = StartGame(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName,
                                    strCommon);
                    LoginResponse(str, pf, true);
                }
            }
        }
Example #13
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);
            }
        }
Example #14
0
        private string LoginCheck(string openid, string state, string serverId, string nowTimestamp, string pf,
                                  string sessionId, string sign, string jsNeed, string nickName, string qqOpenid, string qqOpenkey,
                                  string qqPf, string platform)
        {
            if (string.IsNullOrEmpty(openid) ||
                string.IsNullOrEmpty(state) ||
                string.IsNullOrEmpty(serverId) ||
                string.IsNullOrEmpty(nowTimestamp) ||
                string.IsNullOrEmpty(pf) ||
                string.IsNullOrEmpty(sessionId) ||
                string.IsNullOrEmpty(sign) ||
                string.IsNullOrEmpty(qqOpenid) ||
                string.IsNullOrEmpty(qqOpenkey) ||
                string.IsNullOrEmpty(qqPf) ||
                string.IsNullOrEmpty(platform))
            {
                UAHelper.WriteLog("ret", "参数为空");
                return(UAErrorCode.ErrDataOP);
            }

            if (nowTimestamp.IndexOf(' ') >= 0)
            {
                var times = nowTimestamp.Split(' ');
                if (times.Length > 0)
                {
                    nowTimestamp = times[0];
                }
            }
            var channelAliasEntity = UAFactory.Instance.GetPlatform("" + A8csdkEnum.txh5_a8); //枚举参数修改腾讯key

            if (channelAliasEntity == null)
            {
                UAHelper.WriteLog("ret", "登录渠道无效");
                return(UAErrorCode.ErrPlatform);
            }
            //md5(openid+state+serverId+nowTimestamp+pf+sessionId+nickName+md5Key).tolowcase()
            string cryptKey     = channelAliasEntity.LoginKey;
            string signParam    = "";
            string signserverId = "default";

            signParam =
                CryptHelper.GetMD5(openid + state + signserverId + nowTimestamp + pf + sessionId + cryptKey).ToLower();

            if (sign != signParam)
            {
                UAHelper.WriteLog("ret", "fail");
                return(UAErrorCode.ErrCheckSign);
            }
            return("0");
        }
Example #15
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);
            }
        }
Example #16
0
        private void LoginResponse(string str, bool isRediect)
        {
            switch (str)
            {
            case UAErrorCode.ErrDataOP:
                UAHelper.WriteLog("ret", "参数不正确");

                Response.Write("{\"ret\":\"fail\",\"msg\":\"参数不正确\"}");
                break;

            case UAErrorCode.ErrOther:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"其他\"}");
                break;

            case UAErrorCode.ErrTimeout:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"链接超时\"}");
                break;

            case UAErrorCode.ErrPlatform:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"pf错误}");
                break;

            case UAErrorCode.ErrCheckSign:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"sign错误\"}");
                break;

            case UAErrorCode.ErrNoUser:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"读取错误\"}");
                break;

            case UAErrorCode.ErrException:
                Response.Write("{\"ret\":\"fail\",\"msg\":\"throw\"}");
                break;

            case UAErrorCode.ErrOK:
                Response.Write("{\"ret\":\"success\",\"msg\":\"ok\"}");
                break;

            default:
                Response.Write(str);
                break;
            }
            if (isRediect)
            {
                HttpContext.Current.Response.Redirect("Index.aspx?ck=" +
                                                      Response.Cookies[FormsAuthentication.FormsCookieName].Value);
            }
            Response.End();
        }
Example #17
0
        string CheckAward()
        {
            try
            {
                var openid = GetParam("openid");
                var appid  = GetParam("appid");

                var pf          = GetParam("pf");
                var ts          = GetParam("ts");
                var version     = GetParam("version");
                var discountid  = GetParam("discountid");
                var token       = GetParam("token");
                var payitem     = GetParam("payitem");
                var billno      = GetParam("billno");
                var zoneid      = GetParam("zoneid");
                var providetype = GetParam("providetype");

                var sig = GetParam("sig");
                Dictionary <string, string> param = new Dictionary <string, string>();
                param.Add("openid", openid);
                param.Add("appid", appid);
                param.Add("ts", ts);
                param.Add("payitem", payitem);
                param.Add("discountid", discountid);
                param.Add("token", token);
                param.Add("billno", billno);
                param.Add("version", version);
                param.Add("zoneid", zoneid);
                param.Add("providetype", providetype);

                //购买礼包
                var responseCode = ActivityCore.Instance.TxTaskStep(openid, 100, 1, "award", billno, "");
                if (responseCode.Code == 0)
                {
                    return(UAErrorCode.ErrOK);
                }
                else
                {
                    UAHelper.WriteError("error");
                    return(UAErrorCode.ErrOther);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                return(UAErrorCode.ErrOther);
            }
        }
Example #18
0
        public override void doLogin()
        {
            string accessToken = GetParam("accessToken");

            var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey);

            if (channelAliasEntity == null)
            {
                return;
            }

            string userUrl = channelAliasEntity.UserActionUrl + "&accessToken=" + accessToken;
            var    result  = UAHelper.HttpGet(userUrl);
            //{"code":0,"res":{"openid":"fd0cbdc745910707bdb8fd038296e724","name":"\u8bf8\u845b\u6653\u535a","sex":1,"face":"","city":""},"time":1.1,"sys_time":1468577559}
            var resp = new BearId();

            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                resp = serializer.Deserialize <BearId>(result);
            }
            catch (Exception e)
            {
                UAHelper.WriteLog("Dologin", "解析json失败|" + result + "|" + accessToken);
                return;
            }


            long   sys_time = resp.Sys_time;
            string openid   = resp.Res.Openid;
            string name     = resp.Res.Name;
            int    sex      = resp.Res.Sex;
            string face     = resp.Res.Face;
            string city     = resp.Res.City;



            HttpContext.Current.Response.Redirect(
                string.Format(
                    "Index.aspx?pf={0}&openid={1}&name={2}&sex={3}&face={4}&city={5}&ck=default&appId={6}",
                    platFormKey, openid, name, sex, face, city, gameAppId));
            HttpContext.Current.Response.End();


            //serverId = "1";
            //var str = StartGame(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName);
            //LoginResponse(str, pf, true);
        }
Example #19
0
        public override void doLogin()
        {
            string returnCode = Login();
            string platform   = GetParam("platform");

            UAHelper.WriteLog("Login", returnCode);
            if (returnCode == UAErrorCode.ErrOK)
            {
                HttpContext.Current.Response.Redirect("Index.aspx");
                HttpContext.Current.Response.End();
            }
            else
            {
                ShowError(platform, returnCode);
            }
        }
Example #20
0
        public override void doCheckActive()
        {
            //uid=28318249&server_id=S1&agentid=??
            var returnCode = CheckActive();

            UAHelper.WriteLog("CheckActive", returnCode);
            if (returnCode == UAErrorCode.ErrOK)
            {
                returnCode = "1";
            }
            else
            {
                returnCode = "0";
            }
            //已经激活过该分区返回1,否则返回0
            UAHelper.WriteError(returnCode);
        }
Example #21
0
        public override void doLogin()
        {
            string openid   = GetParam("openid");
            string openkey  = GetParam("openkey");
            string pf       = GetParam("pf");
            string pfkey    = GetParam("pfkey");
            var    serverId = GetParam("serverid");
            var    platform = GetParam("platform");

            if (string.IsNullOrEmpty(pf))
            {
                pf = "wanba_ts";
            }
            openid = UAHelper.StrToUtf8(openid);
            if (string.IsNullOrEmpty(openid) ||
                string.IsNullOrEmpty(openkey)
                //|| string.IsNullOrEmpty(platform)
                //|| string.IsNullOrEmpty(pfkey)
                )
            {
                Response.Write("{\"ret\":\"fail\",\"msg\":\"参数不正确\"}");
                Response.End();
            }
            if (string.IsNullOrEmpty(serverId))
            {
                HttpContext.Current.Response.Redirect(
                    string.Format(
                        "Index.aspx?pf={0}&ck=default&openid={1}&openkey={2}&pfkey={3}&serverId={4}&platform={5}", pf, openid, openkey, pfkey, serverId, platform));
                HttpContext.Current.Response.End();
            }

            try
            {
                //登录
                var result = Login(openid);
                LoginResponse(result, pf, true);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("txwb StartGame", ex);
                Response.Write("{\"ret\":\"fail\",\"msg\":\"系统异常" + ex + "\"}");
                Response.End();
            }
        }
Example #22
0
        private bool SetVipInfo(string openid, string qqOpenid, string qqOpenkey, string qqPf, string platform)
        {
            var url = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.TxWb_FindVipUrl); //txh5_a8查询达人接口
            var str = "";

            str = "qqopenid=" + qqOpenid + "&qqopenkey=" + qqOpenkey + "&qqpf=" + qqPf + "&platform=" + platform;
            var result = UAHelper.HttpPost(url, str);

            //{'ret':'success', 'code':'0', 'message':'', 'data': {"is_vip":"1", "vip_level": "8", "score": "1000", "expiredtime": "1407312182"}}
            if (!string.IsNullOrEmpty(result))
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                try
                {
                    var json = serializer.Deserialize <TxVipJsonResult>(result);


                    if (json != null)
                    {
                        var ret = json.ret;
                        if (string.IsNullOrEmpty(ret) || ret == "fail")
                        {
                            return(false);
                        }
                        else if (ret == "success")
                        {
                            var json2 = serializer.Deserialize <InnerData>(json.data);

                            bool flag     = json2.is_vip.ToLower() == "true";
                            int  vipLevel = (int)ConvertHelper.ConvertToDouble(json2.vip_level);
                            var  str1     = json2.score + "|" + json2.expiredtime;
                            return(TxYellowvipMgr.Add(openid, flag, false, false, vipLevel, str1, null,
                                                      "" + ShareUtil.ZoneName));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("{\"ret\":\"fail\",\"msg\":\"" + ex.Message + "}");
                }
            }

            return(false);
        }
Example #23
0
        /// <summary>
        /// 最新登录
        /// </summary>
        /// <returns></returns>
        public override int doLoginNew()
        {
            string openid       = GetParam("openid");
            string state        = GetParam("state");
            string serverId     = GetParam("serverId");
            string nowTimestamp = GetParam("nowTimestamp");
            string pf           = GetParam("pf");
            string sessionId    = GetParam("sessionId");
            string sign         = GetParam("sign");
            string jsNeed       = GetParam("jsNeed");
            string nickName     = GetParam("nickName");
            string isSubscribe  = GetParam("isSubscribe");
            var    result       = LoginCheckNew(openid, state, serverId, nowTimestamp, pf, sessionId, sign);

            if (result != MessageCode.Success)
            {
                return((int)result);
            }
            if (serverId == "default")
            {
                openid = UAHelper.StrToUtf8(openid);
                HttpContext.Current.Response.Redirect(
                    string.Format(
                        "Index.aspx?pf={0}&ck=default&openid={1}&state={2}&nowTimestamp={3}&sessionId={4}&sign={5}&jsNeed={6}&nickName={7}&isSubscribe={8}",
                        pf, openid, state, nowTimestamp, sessionId, sign, jsNeed, nickName, isSubscribe));
                HttpContext.Current.Response.End();
            }
            else
            {
                var str = StartGameNew(openid, state, serverId, pf, sessionId, jsNeed, nickName);

                try
                {
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("txLogin", ex.Message);
                }

                return((int)str);
            }
            return((int)MessageCode.Success);
        }
Example #24
0
        public override void doLogin()
        {
            string openid       = GetParamNOUrlDecode("openid");
            string state        = GetParam("state");
            string serverId     = GetParam("serverId");
            string nowTimestamp = GetParam("nowTimestamp");
            string pf           = GetParam("pf");
            string sessionId    = GetParam("sessionId");
            string sign         = GetParam("sign");
            string jsNeed       = GetParam("jsNeed");
            string nickName     = GetParam("nickName");
            string isSubscribe  = GetParam("isSubscribe");
            string isShare      = GetParam("isShare");
            var    result       = LoginCheck(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName);

            if (result != "0")
            {
                LoginResponse(result, pf, false);
            }
            else
            {
                if (serverId == "default")
                {
                    openid = UAHelper.StrToUtf8(openid);
                    HttpContext.Current.Response.Redirect(
                        string.Format(
                            "Index.aspx?pf={0}&ck=default&openid={1}&state={2}&nowTimestamp={3}&sessionId={4}&sign={5}&jsNeed={6}&nickName={7}&isSubscribe={8}&isShare={9}",
                            pf, openid, state, nowTimestamp, sessionId, sign, jsNeed, nickName, isSubscribe, isShare));
                    HttpContext.Current.Response.End();
                }
                else
                {
                    var str = StartGame(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName);
                    LoginResponse(str, pf, true);
                }
                //serverId = "1";
                //var str = StartGame(openid, state, serverId, nowTimestamp, pf, sessionId, sign, jsNeed, nickName);
                //LoginResponse(str, pf, true);
            }
        }
Example #25
0
        private string Login(string userName, string platform)
        {
            try
            {
                this.SetPlatSession();
                string returnCode = UAHelper.SaveLogindata(userName);

                try
                {
                    UserAction("entergame", userName);
                }
                catch (Exception ex)
                {
                }
                return(returnCode);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("h5_a8 dologin", ex);
                return(UAErrorCode.ErrOther);
            }
        }
Example #26
0
        /// <summary>
        /// a8读取用户数据(7)
        /// </summary>
        /// <returns></returns>
        private String IsRegist()
        {
            string openId   = GetParamNOUrlDecode("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(platFormKey);

            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 || string.IsNullOrEmpty(entity.Name))
            {
                return(UAErrorCode.ErrNoUser);
            }
            var oId = UAHelper.StrToUtf8(openId);

            Response.Write("{\"ret\":\"success\",\"msg\":\"ok\",\"roleId\":\"" + entity.Idx + "\",\"roleName\":\"" +
                           oId + "\",\"roleLevel\":\"" + entity.Level + "\"" +
                           ",\"serverNo\":" + serverNo + "\"\",\"serverId\":\" " + serverNo + " \",\"serverName\":\"" +
                           serverNo + " \"}");
            return(UAErrorCode.ErrOK);
        }