Exemplo n.º 1
0
 protected void btnGmCharge_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckManager())
         {
             var count = ConvertHelper.ConvertToInt(txtGmPoint.Text);
             if (count < 0)
             {
                 ShowMessage("数量不能小于0");
                 return;
             }
             if (count > 5000)
             {
                 ShowMessage("一次发送不能超过5000");
                 return;
             }
             string billingId = Guid.NewGuid().ToString();
             var    code      = WebServerHandler.Charge(_account.ZoneId, _account.Account, EnumChargeSourceType.GmCharge, 0, 0, count, billingId);
             if (code == 0)
             {
                 SaveAdminLog(EnumAdminOperationType.GmCharge, string.Format("gm charge,Count:{0},BillingId:{1}", count, billingId));
             }
             ShowMessage("Gm充值:" + code);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         ShowMessage(ex.Message);
     }
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 protected void btnSendCoin_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckManager())
         {
             var count = ConvertHelper.ConvertToInt(txtCoinCount.Text);
             if (count < 0)
             {
                 ShowMessage("数量不能小于0");
                 return;
             }
             if (count > 100000)
             {
                 ShowMessage("一次发送不能超过100000");
                 return;
             }
             var code = WebServerHandler.AddCoin(_account.ZoneId, _account.ManagerId, count);
             if (code == 0)
             {
                 SaveAdminLog(EnumAdminOperationType.SendCoin, string.Format("Coin:{0}", count));
             }
             ShowMessage("添加金币:" + code);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         ShowMessage(ex.Message);
     }
 }
Exemplo n.º 4
0
        public WebThread(WebServerHandler handler, TcpSocket socket)
        {
            String req = new String();

            byte[] ch = new byte[1];
            while (true)
            {
                int read = socket.Read(ch, 0, 1);
                if (read == 1)
                {
                    req.Append((char)ch[0]);
                }
                if (req.EndsWith("\r\n\r\n"))
                {
                    String[]   lns     = req.Split("\r\n");
                    String[]   pts     = lns[0].Split(' '); //method url HTTP/version
                    String     method  = pts[0];
                    String     url     = pts[1];
                    WebRequest request = new WebRequest(new Url(url));
                    request.SetMethod(WebRequest.GetMethod(method));
                    WebReply  reply = new WebServerReply();
                    ByteArray post  = socket.ReadAll();
                    request.SetData(post);
                    handler.Process(request, reply);
                    String headerarray = reply.GetHeaders();
                    byte[] headerdata  = headerarray.ToByteArray();
                    socket.Write(headerdata, 0, headerdata.Length);
                    ByteArray outarraydata = reply.GetData();
                    byte[]    outdata      = outarraydata.ToArray();
                    socket.Write(outdata, 0, outdata.Length);
                    req.Length = 0;
                }
            }
        }
Exemplo n.º 5
0
        private string StartGame(string openid, string state, string serverId, string nowTimestamp, string pf,
                                 string sessionId, string sign, string jsNeed, string nickName, string strCommon = "")
        {
            try
            {
                /* download-wyfth5.3333.cn/wyft1758/index.html?openid=pf+gid&state=xxx&serverId=8001&nowTimestamp=46546461321&pf=1758&sessionId&sign=xxx&jsNeed=0&nickName=xxx*/

                if (WebServerHandler.SetStartGameEntity(ShareUtil.PlatformCode, ShareUtil.PlatformZoneName, openid,
                                                        state,
                                                        serverId, pf, sessionId, jsNeed, nickName, strCommon))
                {
                    ;
                }
                {
                    return(UAErrorCode.ErrOther);
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("txa8 Charge", ex);
                Response.Write("{\"ret\":\"fail\",\"msg\":\"系统异常" + ex + "\"}");
                return(UAErrorCode.ErrException);
            }
            return(UAErrorCode.ErrOK);
        }
Exemplo n.º 6
0
 protected void btnReceive_OnClick(object sender, EventArgs e)
 {
     try
     {
         var s        = txtRecordId.Text.Trim();
         var recordId = ConvertHelper.ConvertToInt(s);
         if (recordId <= 0)
         {
             Master.ShowMessage("序号必须大于0.");
             return;
         }
         var mail = MailInfoMgr.GetById(recordId, Master.ZoneId);
         if (!mail.HasAttach)
         {
             Master.ShowMessage("该邮件没有附件.");
             return;
         }
         var code = WebServerHandler.AttachmentReceive(Master.ZoneId, mail.ManagerId, mail.Idx);
         if (code == 0)
         {
             Master.ShowMessage("收取成功");
         }
         else
         {
             Master.ShowMessage("收取失败:" + code);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         Master.ShowMessage("出错了:" + ex.Message);
     }
 }
Exemplo n.º 7
0
 protected void btnSendPoint_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckManager())
         {
             var count = ConvertHelper.ConvertToInt(txtPointCount.Text);
             if (count < 0)
             {
                 ShowMessage("数量不能小于0");
                 return;
             }
             if (count > 5000)
             {
                 ShowMessage("一次发送不能超过5000");
                 return;
             }
             var code = WebServerHandler.Charge(_account.ZoneId, _account.Account, EnumChargeSourceType.AdminSend, 0, 0, count, Guid.NewGuid().ToString());
             if (code == 0)
             {
                 SaveAdminLog(EnumAdminOperationType.SendPoint, string.Format("Point:{0}", count));
             }
             ShowMessage("添加点券:" + code);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         ShowMessage(ex.Message);
     }
 }
Exemplo n.º 8
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.º 9
0
        /// <summary>
        /// 渠道发送分享物品
        /// </summary>
        /// <returns></returns>
        public string SendItemByShare()
        {
            try
            {
                var name = GetParamNOUrlDecode("name");

                var serverid = GetParam("serverid");
                var time     = GetParam("time");
                var type     = GetParam("type");

                var sign = GetParam("sign");
                if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(serverid) ||
                    string.IsNullOrEmpty(time) || string.IsNullOrEmpty(type)
                    )
                {
                    return(UAErrorCode.ErrDataOP);
                }

                var key     = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.H5_A8DataKey);
                var appSign = CryptHelper.GetMD5(name + serverid + type + time + key).ToLower();
                if (sign != appSign)
                {
                    return(UAErrorCode.ErrCheckSign);
                }
                name = GetParam("name");
                var t    = ConvertHelper.ConvertToInt(type);
                var code = WebServerHandler.SendItemByShare(platFormKey, serverid, name, t);
                if (code == (int)MessageCode.NbParameterError)
                {
                    return(UAErrorCode.ErrDataOP);
                }
                if (code == (int)MessageCode.LoginNoUser)
                {
                    return(UAErrorCode.ErrNoManager);
                }
                if (code == (int)MessageCode.Exception)
                {
                    return(UAErrorCode.ErrException);
                }
                if (code == (int)MessageCode.TourPassPrizeHasReceive)
                {
                    return(UAErrorCode.ErrRepeatOrder);
                }

                return("" + code);
            }
            catch (Exception)
            {
                return(UAErrorCode.ErrException);
            }
        }
Exemplo n.º 10
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.º 11
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);
            }
        }
Exemplo n.º 12
0
 private MessageCode StartGameNew(string openid, string state, string serverId, string pf,
                                  string sessionId, string jsNeed, string nickName)
 {
     try
     {
         WebServerHandler.SetStartGameEntity(ShareUtil.PlatformCode, serverId, openid, state, serverId, pf, sessionId, jsNeed, nickName);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("a8 StartGameNew", ex);
         return(MessageCode.LoginError);
     }
     return(MessageCode.Success);
 }
Exemplo n.º 13
0
        public string IsRegistByNameList()
        {
            var    data     = GetParamNOUrlDecode("data");
            string serverid = GetParam("serverId");
            string time     = GetParam("time");
            string sign     = GetParam("sign");

            if (string.IsNullOrEmpty(data) ||
                string.IsNullOrEmpty(serverid) ||
                string.IsNullOrEmpty(time) ||
                string.IsNullOrEmpty(sign))
            {
                return(UAErrorCode.ErrDataOP);
            }
            var key     = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.H5_A8DataKey);
            var appSign = CryptHelper.GetMD5(data + serverid + time + key).ToLower();

            if (sign != appSign)
            {
                return(UAErrorCode.ErrCheckSign);
            }
            data = GetParam("data");
            //UAHelper.WriteLog("IsRegistByNameList", "|" + data + "|" + serverid + "|" + time + "|" + sign + "|");

            var managerList = WebServerHandler.IsRegistByNameList(platFormKey, serverid, data);

            if (managerList == null || managerList.Length <= 0 || string.IsNullOrEmpty(managerList[0].Name))
            {
                return(UAErrorCode.ErrNoUser);
            }
            string str = "";

            foreach (var manager in managerList)
            {
                var rowTime    = manager.RowTime;
                var registTime = ShareUtil.GetTimeTick(rowTime);
                str += "{\"name\":\"" + manager.Name + "\",\"serverId\":\"" + serverid + "\",\"gamelevel\":\"" + manager.Level +
                       "\",\"registtime\":\"" + registTime + "\"},";
            }
            string r = str.Substring(0, str.Length - 1);

            return("{\"code\":\"0\",\"data\":[" + r + "]}");
        }
Exemplo n.º 14
0
        /// <summary>
        /// a8进入游戏(3)
        /// </summary>
        /// <returns></returns>
        private string StartGame(string openid, string state, string serverId, string nowTimestamp, string pf,
                                 string sessionId, string sign, string jsNeed, string nickName)
        {
            try
            {
                /* download-wyfth5.3333.cn/wyft1758/index.html?openid=pf+gid&state=xxx&serverId=8001&nowTimestamp=46546461321&pf=1758&sessionId&sign=xxx&jsNeed=0&nickName=xxx*/
                bool b = false;
                try
                {
                    b = WebServerHandler.SetStartGameEntity(ShareUtil.PlatformCode, ShareUtil.PlatformZoneName, openid,
                                                            state, serverId, pf, sessionId, jsNeed, nickName);
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("A8 Login", ex);
                    b = false;
                }
                if (b)
                {
                    ;
                }
                {
                    //登录
                    var result = Login(openid, platFormKey);

                    if (result != UAErrorCode.ErrOK)
                    {
                        return(UAErrorCode.ErrOther);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("A8 Login", ex);
                Response.Write("{\"ret\":\"fail\",\"msg\":\"系统异常" + ex + "\"}");
                return(UAErrorCode.ErrException);
            }
            return(UAErrorCode.ErrOK);
        }
Exemplo n.º 15
0
 protected void btnUnlockUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckManager())
         {
             var code = WebServerHandler.BreakLock(_account.ZoneId, User.Identity.Name, _account.ManagerId, this.User.Identity.Name, txtLockMemo.Text, _account.ZoneId);
             if (code)
             {
                 SaveAdminLog(EnumAdminOperationType.BreakLock, string.Format("Managerid:{0},Name:{1}", _account.ManagerId, _account.Name));
                 ShowMessage("解封成功");
             }
             else
             {
                 ShowMessage("解封失败");
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         ShowMessage(ex.Message);
     }
 }
Exemplo n.º 16
0
 protected void btnKickSession_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckManager())
         {
             var code = WebServerHandler.KickSession(_account.ZoneId, _account.ManagerId);
             if (code)
             {
                 SaveAdminLog(EnumAdminOperationType.KickSession, string.Format("Managerid:{0},Name:{1}", _account.ManagerId, _account.Name));
                 ShowMessage("踢线成功");
             }
             else
             {
                 ShowMessage("踢线失败");
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Insert(ex);
         ShowMessage(ex.Message);
     }
 }
Exemplo n.º 17
0
        private MessageCode StartGameNew(string openid, string state, string serverId, string pf, string sessionId, string jsNeed, string nickName, string strCommon = "")
        {
            try
            {
                if (WebServerHandler.SetStartGameEntity(ShareUtil.PlatformCode, serverId, openid, state,
                                                        serverId, pf, sessionId, jsNeed, nickName, strCommon))
                {
                    ;
                }
                {
                    ////登录
                    //var result = Login(openid);

                    //if (result != UAErrorCode.ErrOK)
                    //    return MessageCode.LoginError;
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("txa8 StartGameNew", ex);
                return(MessageCode.LoginError);
            }
            return(MessageCode.Success);
        }
Exemplo n.º 18
0
        public static string CheckActive(string platformCode, string platformZoneCode, string account)
        {
            string returnCode = "";

            try
            {
                var returnVaule = WebServerHandler.CheckActive(platformCode, platformZoneCode, account);
                if (returnVaule != 0)
                {
                    WriteLog("UAHelper CheckActive", returnVaule.ToString());
                    return(UAErrorCode.ErrNoManager);
                }
                else
                {
                    return(UAErrorCode.ErrOK);
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("UAHelper CheckActive", ex);
                returnCode = UAErrorCode.ErrOther;
            }
            return(returnCode);
        }
Exemplo n.º 19
0
        private string Charge()
        {
            try
            {
                string serverid = GetParam("serverid");
                string orderno  = GetParam("orderno");
                string username = GetParam("username");
                string addgold  = GetParam("addgold");
                string rmb      = GetParam("rmb");
                string paytime  = GetParam("paytime");
                string ext      = GetParam("ext");
                string sign     = GetParam("sign");

                if (string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(serverid) ||
                    string.IsNullOrEmpty(orderno) ||
                    string.IsNullOrEmpty(username) ||
                    string.IsNullOrEmpty(addgold) ||
                    string.IsNullOrEmpty(rmb) ||
                    string.IsNullOrEmpty(paytime) ||
                    string.IsNullOrEmpty(ext) ||
                    string.IsNullOrEmpty(sign))
                {
                    return("-4");
                }

                //Sign = Md5(orderno+username + serverid+addgold + rmb+paytime+ext+key).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("-4");
                }

                string cryptKey  = channelAliasEntity.ChargeKey;
                string signParam =
                    CryptHelper.GetMD5(orderno + username + serverid + addgold + rmb + paytime + ext + cryptKey).ToLower();
                if (sign != signParam)
                {
                    return("-4");
                }

                decimal cash = ConvertHelper.ConvertToDecimal(rmb, 0);
                var     exts = ext.Split('_');
                if (exts.Length < 3)
                {
                    return("-4");
                }
                int    mallCode = ConvertHelper.ConvertToInt(exts[0]);
                string sId      = exts[1];
                string orderId  = exts[2];
                var    result   = WebServerHandler.BuyPointShipments(platFormKey, sId, username,
                                                                     orderId, orderno,
                                                                     cash, mallCode);
                if (result == 0)
                {
                    return("1");
                }
                SystemlogMgr.Error("充值", "code:" + result);
                switch (result)
                {
                case 2062:
                    return("-2");

                case 5211:
                    return("-1");

                case 151:
                    return("-1");

                default:
                    return("-7");
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("a8 dologinnew", ex);
                return("-7");
            }
        }
Exemplo n.º 20
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\"}");
            }
        }
Exemplo n.º 21
0
 public void SetHandler(WebServerHandler _handler)
 {
     handler = _handler;
 }
Exemplo n.º 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="matchData"></param>
        /// <param name="laddermatch"></param>
        void Fight(BaseMatchData matchData, CrossladderMatchEntity laddermatch)
        {
            if (laddermatch.HomeIsBot && laddermatch.AwayIsBot)
            {
                laddermatch.HomeScore = 0;
                laddermatch.AwayScore = 0;
                laddermatch.Status    = (int)EnumLadderStatus.End;

                //保存比赛
                CrossladderMatchMgr.Insert(laddermatch);
                return;
            }
            else
            {
                try
                {
                    MatchCore.CreateMatch(matchData);

                    if (matchData.ErrorCode == (int)MessageCode.Success)
                    {
                        laddermatch.HomeScore = matchData.Home.Score;
                        laddermatch.AwayScore = matchData.Away.Score;
                        laddermatch.Status    = (int)EnumLadderStatus.End;
                        CalPrizePoint(laddermatch);

                        int returnCode = -1;
                        //保存比赛
                        CrossladderMatchMgr.SaveMatch(laddermatch.DomainId, laddermatch.LadderId, laddermatch.HomeId, laddermatch.AwayId, laddermatch.HomeName, laddermatch.AwayName,
                                                      laddermatch.HomeLogo, laddermatch.AwayLogo,
                                                      laddermatch.HomeSiteId, laddermatch.AwaySiteId,
                                                      laddermatch.HomeLadderScore, laddermatch.AwayLadderScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeCoin, laddermatch.AwayCoin, laddermatch.HomeExp, laddermatch.AwayExp,
                                                      laddermatch.HomeIsBot, laddermatch.AwayIsBot, laddermatch.GroupIndex, laddermatch.PrizeHomeScore, laddermatch.PrizeAwayScore,
                                                      laddermatch.RowTime, laddermatch.Idx, ref returnCode);

                        if (!laddermatch.HomeIsBot)
                        {
                            WebServerHandler.AddManagerData(laddermatch.HomeId, laddermatch.HomeExp, laddermatch.HomeCoin, 0, laddermatch.HomeSiteId);
                            MatchCore.SaveMatchStat(laddermatch.HomeId, EnumMatchType.CrossLadder, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.HomeSiteId);
                            if (laddermatch.HomeIsHook)
                            {
                                CrossLadderManager.Instance.UpdateHookScore(laddermatch.HomeSiteId, laddermatch.HomeId, laddermatch.PrizeHomeScore,
                                                                            laddermatch.HomeScore > laddermatch.AwayScore, laddermatch.HomeScore,
                                                                            laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName,
                                                                            laddermatch.HomeCoin);
                            }
                        }
                        if (!laddermatch.AwayIsBot)
                        {
                            WebServerHandler.AddManagerData(laddermatch.AwayId, laddermatch.AwayExp, laddermatch.AwayCoin, 0, laddermatch.AwaySiteId);
                            MatchCore.SaveMatchStat(laddermatch.AwayId, EnumMatchType.CrossLadder, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.AwaySiteId);
                            if (laddermatch.AwayIsHook)
                            {
                                CrossLadderManager.Instance.UpdateHookScore(laddermatch.AwaySiteId, laddermatch.AwayId, laddermatch.PrizeAwayScore,
                                                                            laddermatch.AwayScore < laddermatch.HomeScore, laddermatch.HomeScore,
                                                                            laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName,
                                                                            laddermatch.AwayCoin);
                            }
                        }
                    }
                    MemcachedFactory.LadderMatchClient.Set(laddermatch.Idx, laddermatch);
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("CrossLadderProcess-Fight", ex);
                }
            }
            matchData   = null;
            laddermatch = null;
        }
Exemplo n.º 23
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\"}");
            }
        }
Exemplo n.º 24
0
        void SavePrizeAfter(CrosscrowdMatchEntity crowdMatch, CrosscrowdManagerEntity homeManager, CrosscrowdManagerEntity awayManager)
        {
            try
            {
                WebServerHandler.AddCoin2(crowdMatch.HomeSiteId, crowdMatch.HomeId, crowdMatch.HomePrizeCoin,
                                          _coinChargeSourceType);
                WebServerHandler.AddCoin2(crowdMatch.AwaySiteId, crowdMatch.AwayId, crowdMatch.AwayPrizeCoin,
                                          _coinChargeSourceType);

                string banner  = "";
                string homePop = "";
                string awayPop = "";

                if (crowdMatch.HomeScore > crowdMatch.AwayScore)
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Win, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Lose, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                    if (homeManager.WinningCount == 2)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd3Win(crowdMatch.HomeName);
                    }
                    else if (homeManager.WinningCount == 4)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd5Win(crowdMatch.HomeName);
                    }
                }
                else if (crowdMatch.AwayScore > crowdMatch.HomeScore)
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Lose, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Win, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                    if (awayManager.WinningCount == 2)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd3Win(crowdMatch.AwayName);
                    }
                    else if (awayManager.WinningCount == 4)
                    {
                        banner += "&" + CrossCrowdMessage.BuildBannerCrowd5Win(crowdMatch.AwayName);
                    }
                }
                else
                {
                    homePop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Draw, crowdMatch.AwayName, crowdMatch.HomeScore, crowdMatch.AwayScore);
                    awayPop += "&" + CrossCrowdMessage.BuildCrowdMatch(EnumWinType.Draw, crowdMatch.HomeName, crowdMatch.AwayScore, crowdMatch.HomeScore);
                }
                homePop += "&" + CrossCrowdMessage.BuildCrowdMatchPrize(crowdMatch.HomePrizeScore, crowdMatch.HomePrizeCoin, crowdMatch.HomePrizeHonor);
                awayPop += "&" + CrossCrowdMessage.BuildCrowdMatchPrize(crowdMatch.AwayPrizeScore, crowdMatch.AwayPrizeCoin, crowdMatch.AwayPrizeHonor);

                var scoreDiv = crowdMatch.HomeScore - crowdMatch.AwayScore;
                if (scoreDiv >= 3)
                {
                    banner += "&" + CrossCrowdMessage.BuildBannerCrowdWinOver(crowdMatch.HomeName, crowdMatch.HomeScore, crowdMatch.AwayScore, crowdMatch.AwayName);
                }
                else if (scoreDiv < -2)
                {
                    banner += "&" + CrossCrowdMessage.BuildBannerCrowdWinOver(crowdMatch.AwayName, crowdMatch.AwayScore, crowdMatch.HomeScore, crowdMatch.HomeName);
                }

                if (crowdMatch.HomeMorale <= 0 && crowdMatch.AwayMorale <= 0)
                {
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdKillTogether(crowdMatch.AwayName);
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdKillTogether(crowdMatch.HomeName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.HomeName, crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.AwayName, crowdMatch.HomeName);
                    crowdMatch.IsKill = true;
                }
                else if (crowdMatch.HomeMorale <= 0)
                {
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdKill(crowdMatch.HomeName);
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdByKill(crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.AwayName, crowdMatch.HomeName);
                    crowdMatch.IsKill = true;
                }
                else if (crowdMatch.AwayMorale <= 0)
                {
                    awayPop          += "&" + CrossCrowdMessage.BuildCrowdByKill(crowdMatch.HomeName);
                    homePop          += "&" + CrossCrowdMessage.BuildCrowdKill(crowdMatch.AwayName);
                    banner           += "&" + CrossCrowdMessage.BuildBannerCrowdKill(crowdMatch.HomeName, crowdMatch.AwayName);
                    crowdMatch.IsKill = true;
                }
                //LogHelper.Insert(string.Format("HomePop:{0},AwayPop:{1}",homePop,awayPop),LogType.Info);
                if (!string.IsNullOrEmpty(homePop))
                {
                    CrossCrowdMessage.SendCrowdPop(crowdMatch.HomeId, homePop.TrimStart('&'));
                }
                if (!string.IsNullOrEmpty(awayPop))
                {
                    CrossCrowdMessage.SendCrowdPop(crowdMatch.AwayId, awayPop.TrimStart('&'));
                }
                if (!string.IsNullOrEmpty(banner))
                {
                    CrossCrowdMessage.SendCrowdBanner(_domainId, banner.TrimStart('&'));
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("CrossCrowdProcess-SavePrizeAfter", ex);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// pay回调
        /// </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 nonce_str      = GetParam("nonce_str");
                string extra          = GetParam("extra");
                string isTest         = GetParam("isTest");
                string appId          = GetParam("appId");
                string product_id     = GetParam("product_id");
                string order_id       = GetParam("order_id");
                string transaction_id = GetParam("transaction_id");
                string price          = GetParam("cash");
                string uid            = GetParam("uid");
                string game_uid       = GetParam("game_uid");
                string payResult      = GetParam("result");
                //UAHelper.WriteLog("bear Charge",
                //   string.Format(
                //       @"appId={0}&cash={1}&extra={2}&game_uid={3}&isTest={4}&nonce_str={5}&order_id={6}&product_id={7}&result={8}&transaction_id={9}&uid={10}||{11}"
                //       , appId, price, extra, game_uid, isTest, nonce_str, order_id, product_id, payResult, transaction_id, uid,
                //        sign));
                if (string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(nonce_str) ||
                    string.IsNullOrEmpty(extra) ||
                    string.IsNullOrEmpty(payResult) ||
                    string.IsNullOrEmpty(game_uid) ||
                    string.IsNullOrEmpty(transaction_id) ||
                    string.IsNullOrEmpty(price) ||
                    string.IsNullOrEmpty(sign) ||
                    string.IsNullOrEmpty(uid)
                    )
                {
                    return("{\"ret\":\"fail\",\"msg\":\"参数为空\"}");
                }
                if (payResult.Trim().ToLower() != "success")
                {
                    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(string.Format(@"appId={0}&cash={1}&extra={2}&game_uid={3}&isTest={4}&nonce_str={5}&order_id={6}&product_id={7}&result={8}&transaction_id={9}&uid={10}{11}"
                                                     , appId, price, extra, game_uid, isTest, nonce_str, order_id, product_id, payResult, transaction_id, uid, cryptKey));
                if (sign != signParam)
                {
                    return("{\"ret\":\"fail\",\"msg\":\"sign错误\"}");
                }
                var ary     = extra.Split('|');
                var server  = "";
                var orderId = "";
                if (ary.Length > 1)
                {
                    orderId = ary[0];
                    server  = ary[1];
                }
                decimal cash = ConvertHelper.ConvertToDecimal(price, 0) / 100; //价格单位是  分

                var zoneName = ShareUtil.ZoneName;
                var list     = NbManagerMgr.GetByAccount(uid, zoneName);
                var manager  = new NbManagerEntity();
                if (list.Count > 0)
                {
                    manager = list[0];
                }
                var result = WebServerHandler.BuyPointShipments(platFormKey, server, "" + manager.Idx,
                                                                orderId, order_id, cash, ConvertHelper.ConvertToInt(product_id));
                if (result == 0)
                {
                    return("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("bear Charge", ex);
                return("{\"ret\":\"fail\",\"msg\":\"系统内部错误2\"}");
            }
        }