示例#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);
        }
示例#2
0
        private void btntime1_Click(object sender, RoutedEventArgs e)
        {
            long time1 = ConvertHelper.ConvertToLong(txttime1.Text, 0);

            if (time1 <= 0)
            {
                ShowMessage("请输入要对比的时间.");
                return;
            }
            txttime3.Text = ShareUtil.GetTime(time1).ToString("yyyy-MM-dd HH:mm:ss:fffff");
        }
示例#3
0
        public void Testw1()
        {
            //sign + "|" + billingId + "|" + price + "|" + playerId + "|" + serverId + "|" + goodsId + "|" + orderId + "|" + payTime + "|" + goodsNumber
            var sign        = "f5adb9b5eb1fd40854ea694724186e4c";
            var billingId   = "42336448584246664645744563464E4D48513D3D";
            var playerId    = "c9cccd5811332272216ee6e6cdf2bd91";
            var price       = "1";
            var payTime     = "1468405081";
            var serverId    = "1";
            var goodsId     = "70101";
            var goodsNumber = "1";
            var orderId     = "80302016071318141411292487";
            var cryptKey    = "3pN9Z25DPp1smngw6g84b";

            orderId = "42336448584246664645744664464A4D48773D3D";
            var id    = "c9cccd5811332272216ee6e6cdf2bd91";
            var money = 1;
            var time  = 1468463343;

            serverId    = "1";
            goodsId     = "70101";
            goodsNumber = "1";
            var ext = "80302016071414580708529147";

            sign = "6377fa0b69a0ef2da66bc1351a4f2d38";
            var    r         = "";
            string signParam =
                ShareUtil.GetMD5("ext=80302016071318141411292487goodsId=70101goodsNumber=1id=c9cccd5811332272216ee6e6cdf2bd91money=1orderId=42336448584246664645744563464E4D48513D3DserverId=1time=14684633433pN9Z25DPp1smngw6g84b");

            if (sign == signParam)
            {
                r = "09";
            }
            long     time1      = ConvertHelper.ConvertToLong(payTime, 0);
            DateTime sourceTime = ShareUtil.GetTime(time1 * 1000);
            DateTime nowTime    = DateTime.Now;
            //检查时间是否过期
            long _timeout30min = 1800000;

            if (sourceTime.AddSeconds(_timeout30min) < nowTime ||
                sourceTime.AddSeconds(-_timeout30min) > nowTime)
            {
                //记录详细的错误日志
                r = "{\"code\":-1,\"msg\":\"响应超时\"}";
            }
            r = "" + MallCore.Instance.BuyPointShipments(playerId, ext, orderId, money, 70101).Code;
            var rr  = r;
            var rrr = rr;
        }
示例#4
0
        public void BindManagerInfo(NBManagerInfoData managerData)
        {
            ApiTestCore.CurManager      = managerData.Manager;
            ApiTestCore.CurManagerExtra = managerData.ManagerExtra;
            ApiTestCore.CurPoint        = managerData.Point;
            ApiTestCore.ServerTime      = managerData.ServerTime;
            lblManagerName.Content      = ApiTestCore.CurManager.Name;
            logoUserControl1.SetLogo(ApiTestCore.CurManager.Logo);
            UpdateLevel();
            UpdateExp();
            UpdateCoin();
            lblManagerVip.Content = "Vip" + ApiTestCore.CurManager.VipLevel;
            UpdatePoint();
            lblManagerStamina.Content       = "体力:" + string.Format("{0}/{1}", ApiTestCore.CurManagerExtra.Stamina, ApiTestCore.CurManagerExtra.StaminaMax);
            lblManagerStaminaResume.Content = "恢复:" +
                                              ShareUtil.GetTime(managerData.ManagerExtra.ResumeStaminaTimeTick)
                                              .ToString("MM-dd HH:mm:ss.fff");

            _serverTime = ShareUtil.GetTime(ApiTestCore.ServerTime);
            _countdownTimer.Start();
            _heartTimer.Start();
            ApiTestCore.UpdateTask();
        }
示例#5
0
        /// <summary>
        /// a8充值(1)
        /// </summary>
        /// <returns></returns>
        private string Charge()
        {
            try
            {
                /*${payNotifyURL}?sign=96d740ea416b8bf118ead1c49c9a1eda&goodsId=105&price=29&game
                 * OrderId=8a71d1a4-fc36-4487-9577-0b3a3b848b65&payResult=0&playerId=h5_a89e3df51e43f8
                 * 4002b843ecd16fd59617&channelAlias=h5_a8&state=&serverId=default&payTime=1449475293
                 * 422&orderId=1751615
                 * 返回值:{"ret":"success","msg":"ok"}*/

                string sign         = GetParam("sign");
                string orderId      = GetParam("orderId");
                string gameOrderId  = GetParam("gameOrderId");
                string price        = GetParam("price");
                string channelAlias = GetParam("channelAlias");
                string playerId     = GetParam("playerId");
                string serverId     = GetParam("serverId");
                string goodsId      = GetParam("goodsId");
                string payResult    = GetParam("payResult");
                string state        = GetParam("state");
                string payTime      = GetParam("payTime");

                if (string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(orderId) ||
                    string.IsNullOrEmpty(gameOrderId) ||
                    string.IsNullOrEmpty(price) ||
                    string.IsNullOrEmpty(channelAlias) ||
                    string.IsNullOrEmpty(playerId) ||
                    string.IsNullOrEmpty(serverId) ||
                    string.IsNullOrEmpty(goodsId) ||
                    string.IsNullOrEmpty(payResult) ||
                    string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(payTime)
                    )
                {
                    return("{\"ret\":\"fail\",\"msg\":\"参数为空\"}");
                }
                if (int.Parse(payResult) == 0)
                {
                    return("{\"ret\":\"fail\",\"msg\":\"没有付款成功\"}");
                }
                //Sign = Md5(orderId + gameOrderId + price + channelAlias + playerId+ serverId + goodsId + payResult + state + payTime + PayKey).toLowerCase();
                long     time1      = ConvertHelper.ConvertToLong(payTime, 0);
                DateTime sourceTime = ShareUtil.GetTime(time1);
                DateTime nowTime    = DateTime.Now;
                //检查时间是否过期
                if (sourceTime.AddSeconds(UAFactory.Instance.Timeout30min) < nowTime ||
                    sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime)
                {
                    //记录详细的错误日志
                    return("{\"ret\":\"fail\",\"msg\":\"响应超时\"}");
                }

                var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey);
                if (channelAliasEntity == null)
                {
                    return("{\"ret\":\"fail\",\"msg\":\"channelAlias错误\"}");
                }

                string cryptKey  = channelAliasEntity.ChargeKey;
                string signParam =
                    CryptHelper.GetMD5(orderId + gameOrderId + price + channelAlias + playerId + serverId + goodsId +
                                       payResult + state + payTime + cryptKey).ToLower();
                if (sign != signParam)
                {
                    return("{\"ret\":\"fail\",\"msg\":\"sign错误\"}");
                }

                decimal cash      = ConvertHelper.ConvertToDecimal(price, 0) / 100; //a8价格单位是  分
                Guid    managerId = Guid.Empty;
                try
                {
                    managerId = new Guid(playerId);
                }
                catch
                {
                    return("{\"ret\":\"fail\",\"msg\":\"未找到角色\"}");
                }
                var result = WebServerHandler.BuyPointShipments(platFormKey, "" + serverId, playerId,
                                                                gameOrderId, orderId,
                                                                cash, ConvertHelper.ConvertToInt(goodsId));
                if (result == 0)
                {
                    return("{\"ret\":\"success\",\"msg\":\"ok\"}");
                }
                switch (result)
                {
                case 2062:
                    return("{\"ret\":\"fail\",\"msg\":\"未找到角色\"}");

                case 5211:
                    return("{\"ret\":\"fail\",\"msg\":\"未找到订单\"}");

                case 151:
                    return("{\"ret\":\"fail\",\"msg\":\"物品ID错误\"}");

                default:
                    return("{\"ret\":\"fail\",\"msg\":\"系统内部错误\"}");
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("a8 dologinnew", ex);
                return("{\"ret\":\"fail\",\"msg\":\"系统内部错误2\"}");
            }
        }
示例#6
0
        /// <summary>
        /// egret充值(1)
        /// </summary>
        /// <returns></returns>
        private string Charge()
        {
            try
            {
                string sign        = GetParam("sign");
                string billingId   = GetParam("orderId");
                string price       = GetParam("money");
                string playerId    = GetParam("id");
                string serverId    = GetParam("serverId");
                string goodsId     = GetParam("goodsId");
                string orderId     = GetParam("ext");
                string payTime     = GetParam("time");
                string goodsNumber = GetParam("goodsNumber");


                if (string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(orderId) ||
                    string.IsNullOrEmpty(price) ||
                    string.IsNullOrEmpty(playerId) ||
                    string.IsNullOrEmpty(serverId) ||
                    string.IsNullOrEmpty(goodsId) ||
                    string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(payTime) ||
                    string.IsNullOrEmpty(billingId)
                    )
                {
                    return("{\"code\":-1,\"msg\":\"参数为空\"}");
                }
                //var  strs = orderId.Split('|');
                //var zone = "";
                //if (strs.Count() >= 2)
                //    zone = strs[0];

                long     time1      = ConvertHelper.ConvertToLong(payTime, 0);
                DateTime sourceTime = ShareUtil.GetTime(time1 * 1000);
                DateTime nowTime    = DateTime.Now;
                //检查时间是否过期
                if (sourceTime.AddSeconds(UAFactory.Instance.Timeout30min) < nowTime ||
                    sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime)
                {
                    //记录详细的错误日志
                    return("{\"code\":-1,\"msg\":\"响应超时\"}");
                }
                var platFormentity = UAFactory.Instance.GetPlatform(platFormKey);
                if (platFormentity == null)
                {
                    return("{\"code\":-1,\"msg\":\"platFormentity错误\"}");
                }

                string cryptKey = platFormentity.ChargeKey;

                string signParam =
                    CryptHelper.GetMD5(string.Format(@"ext={0}goodsId={1}goodsNumber={2}id={3}money={4}orderId={5}serverId={6}time={7}{8}",
                                                     orderId, goodsId, goodsNumber, playerId, price, billingId, serverId, payTime, cryptKey));
                if (sign != signParam)
                {
                    return("{\"code\":-1,\"msg\":\"sign错误\"}");
                }
                decimal cash = ConvertHelper.ConvertToDecimal(price, 0);  //egret价格单位是  元
                //var zone = "";
                //if (serverId == "1002")
                //    zone = "bls2";
                //else
                //{
                //    zone = "bls1";
                //}
                //var list = NbManagerMgr.GetByAccount(playerId,zone);
                //if(list==null)
                //    return "{\"code\":-1,\"msg\":\"未找到角色\"}";
                //var manager = list[0];

                var result = 0;
                try
                {
                    result = WebServerHandler.BuyPointShipments(platFormKey, "" + serverId, "" + playerId,
                                                                orderId, billingId, cash, ConvertHelper.ConvertToInt(goodsId));//白鹭传account
                }
                catch (Exception)
                {
                }

                if (result == 0)
                {
                    return("{\"code\":0,\"msg\":\"ok\"}");
                }
                switch (result)
                {
                case 2062:
                    return("{\"code\":-1,\"msg\":\"未找到角色\"}");

                case 5211:
                    return("{\"code\":-1,\"msg\":\"未找到订单\"}");

                case 151:
                    return("{\"code\":-1,\"msg\":\"物品ID错误\"}");

                default:
                    return("{\"code\":-1,\"msg\":\"系统内部错误\"" + result + "}");
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("h5_egret Charge", ex);
                return("{\"code\":-1,\"msg\":\"系统内部错误2\"}");
            }
        }
示例#7
0
 public static DateTime GetServerTime()
 {
     return(ShareUtil.GetTime(ServerTime));
 }