private void EgretInfo() { var token = GetParam("token"); var time = ShareUtil.GetTimeTick(DateTime.Now); var appId = (int)UAEnum.EgretAppId; var appkey = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.EgretAppKey); var sign = CryptHelper.GetMD5("token=" + token + "time=" + time + "appId=" + appId + appkey); var str = "token=" + token + "&time=" + time + "&appId=" + appId + "&sign=" + sign; var url = UAFactory.Instance.GetRedirectURL(UAFactory.Instance.FactoryName, "useraction"); var result = UAHelper.HttpPost(url, str); JavaScriptSerializer serializer = new JavaScriptSerializer(); var r1 = serializer.Deserialize <PostResult>(result); if (r1.Code == 0) { try { var r2 = serializer.Deserialize <EgretInfo>(result); var response = new EgretInfoResponse(); response.Code = 0; response.Data = r2; OutputHelper.Output(response); } catch (Exception ex) { } } else { OutputHelper.OutputParameterError(); } }
private string TxBuyItem(MallBuyPoint entity, string qqOpenid, string qqOpenkey, string qqPf, string platform, string itemId) { var url = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.TxWb_ChargeUrl);//txh5_a8购买url //用 | 连接qqOpenid, qqOpenkey, qqPf, platform,nickName5个参数放在公共参数Common里 var str = ""; double cash = (double)entity.Cash; //金额单位转为 分 str = "qqopenid=" + qqOpenid + "&qqopenkey=" + qqOpenkey + "&qqpf=" + qqPf + "&platform=" + platform + "&itemid=" + itemId + "&count=" + entity.itemCount + "&gameOrderId=" + entity.OrderId + "&price=" + cash; return(UAHelper.HttpPost(url, str)); }
private string TxBuyItem(MallBuyPoint entity) { var url = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.TxWb_ChargeUrl);//txh5_a8购买url //用 | 连接qqOpenid, qqOpenkey, qqPf, platform,nickName5个参数放在公共参数Common里 var strCommon = entity.StrCommon; var qqOpenid = ""; var qqOpenkey = ""; var qqPf = ""; var platform = ""; if (strCommon != null) { var strlist = strCommon.Split('|'); if (strlist.Length != 4) { return("-1"); } qqOpenid = strlist[0]; qqOpenkey = strlist[1]; qqPf = strlist[2]; platform = strlist[3]; } //拿配置的腾讯itemId var itemstr = AppsettingCache.Instance.GetAppSetting((EnumAppsetting)entity.ItemCode); var itemId = ""; var i = itemstr.Split('|'); try { if (platform.IndexOf("and") == -1) { itemId = i[1]; } else { itemId = i[0]; } } catch (Exception ex) { } var str = ""; double cash = (double)entity.Cash;//金额单位转为 分 str = "qqopenid=" + qqOpenid + "&qqopenkey=" + qqOpenkey + "&qqpf=" + qqPf + "&platform=" + platform + "&itemid=" + itemId + "&count=" + entity.itemCount + "&gameOrderId=" + entity.OrderId + "&price=" + cash; return(UAHelper.HttpPost(url, str)); }
private void Testt2() { var qqOpenid = "B04DBBF689C75926C62D687B27C61F98"; var qqOpenkey = "C985F772E2B10317DADCE0E83A8EED89"; var qqPf = "wanba_ts"; var platform = "ios"; 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; } 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; var f = flag; } } } catch (Exception ex) { Response.Write("{\"ret\":\"fail\",\"msg\":\"" + ex.Message + "}"); } } }
private void SetVipInfo(string openid, string qqOpenid, string qqOpenkey, string qqPf, string platform, ref int score, ref bool flag) { 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; } else if (ret == "success") { var json2 = serializer.Deserialize <InnerData>(json.data); flag = json2.is_vip.ToLower() == "true"; int vipLevel = (int)ConvertHelper.ConvertToDouble(json2.vip_level); score = ConvertHelper.ConvertToInt(json2.score); var str1 = json2.score + "|" + json2.expiredtime; TxYellowvipMgr.Add(openid, flag, false, false, vipLevel, str1, null, "" + ShareUtil.ZoneName); } } } catch (Exception ex) { Response.Write("{\"ret\":\"fail\",\"msg\":\"" + ex.Message + "}"); } } }
private bool SetVipInfo(string openid, string qqOpenid, string qqOpenkey, string qqPf, string platform) { var url = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.TxWb_ChargeUrl);//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(); var json = serializer.Deserialize <TxVipJsonResult2>(result); if (json != null) { try { var ret = json.ret; if (string.IsNullOrEmpty(ret) || ret == "fail") { return(false); } else if (ret == "success") { bool flag = json.is_vip == "1"; int vipLevel = Convert.ToInt32(json.vip_level); var str1 = json.score + "|" + json.expiredtime; return(TxYellowvipMgr.Add(openid, flag, false, false, vipLevel, str1, null, "" + ShareUtil.ZoneId)); } } catch (Exception ex) { return(true); } } } return(false); }
private void TestMall() { int mallcode = 70108; var reader = new MallClient(); var resp = reader.BuyPoint(new Guid("418A8F6F-7868-4A8D-A008-A62600E5BF1E"), mallcode); if (resp.Code == (int)MessageCode.Success) { try { var pf = UAFactory.Instance.GetPlatform("txh5_a8"); bool flag = false; if (pf.Idx == 1005) { flag = true; } //以下a8传参 var url = UAFactory.Instance.GetRedirectURL(UAFactory.Instance.FactoryName, "charge"); var chargeKey = pf.ChargeKey; var channelAlias = resp.Data.ChannelAlias; var zone = UAFactory.Instance.GetZoneByZoneName("a8s3"); string serverId = ""; string serverName = ""; if (zone != null) { serverId = zone.PlatformZoneName; serverName = zone.Name; } var ext = resp.Data.Ext; resp.Data.AccountId = resp.Data.DateEntity.Account; resp.Data.ServerId = serverId; resp.Data.ServerName = serverName; var str = "appKey=" + chargeKey + "&gameOrderId=" + resp.Data.OrderId + "&price=" + resp.Data.Cash + "&" + "goodsName=" + resp.Data.ItemName + "&" + "goodsId=" + resp.Data.ItemCode + "&title=" + resp.Data.ItemName + "&csdkId=" + (int)A8csdkEnum.csdkId + "&" + "channelAlias=" + channelAlias + "&subChannel=&serverId=" + serverId + "&" + "serverName=" + serverName + "&roleId=" + resp.Data.DateEntity.Account + "&roleName=" + resp.Data.DateEntity.Name + "&" + "roleLevel=" + resp.Data.DateEntity.Level + "&sessionId=" + resp.Data.SessionId + "&model=&release=&deviceId=" + resp.Data.IP + "&ext=" + ext + "&uid=" + resp.Data.DateEntity.Account; if (string.IsNullOrEmpty(str)) { resp.Code = (int)MessageCode.BuyPointFail; } else { var result = UAHelper.HttpPost(url, str); if (result.Length > 0) { JavaScriptSerializer serializer = new JavaScriptSerializer(); var json = serializer.Deserialize <JsonResult>(result); if (json != null) { var ret = json.ret; if (string.IsNullOrEmpty(ret)) { resp.Code = (int)MessageCode.BuyPointFail; } else if (ret == "fail") { resp.Code = (int)MessageCode.BuyPointFail; } else if (ret == "success") { resp.PR = json.payURL; resp.Code = (int)MessageCode.Success; var resultTx = ""; if (flag) //是否腾讯玩吧接口 { resultTx = TxBuyItem(resp.Data); resp.Code = IsSuccess(resultTx); } } } else { resp.Code = (int)MessageCode.BuyPointFail; } } else { resp.Code = (int)MessageCode.BuyPointFail; } } } catch (Exception ex) { SystemlogMgr.Error("下单", ex); resp.Code = (int)MessageCode.BuyPointFail; } } OutputHelper.Output(resp); }
private void BuyPoint() { var teststr = "11111"; int mallcode = GetParamInt("mallcode"); var resp = reader.BuyPoint(UserAccount.ManagerId, mallcode); if (resp.Code == (int)MessageCode.Success && (ShareUtil.IsH5A8 || ShareUtil.IsTx)) { try { var pf = UAFactory.Instance.GetPlatform(UAFactory.Instance.FactoryName); var zone = UAFactory.Instance.GetZoneByZoneName(UAFactory.Instance.ZoneName); //以下a8传参 var itemId = ""; var url = UAFactory.Instance.GetRedirectURL(UAFactory.Instance.FactoryName, "charge"); var chargeKey = pf.ChargeKey; var channelAlias = resp.Data.ChannelAlias; string serverId = ""; string serverName = ""; var qqOpenid = ""; var qqOpenkey = ""; var qqPf = ""; var platform = ""; bool isvip = false; if (zone != null) { serverId = zone.PlatformZoneName; serverName = zone.Name; } var ext = resp.Data.Ext; var openId3 = UserAccount.Account; var oId = UAHelper.StrToUtf8(openId3); resp.Data.AccountId = oId; resp.Data.ServerId = serverId; resp.Data.ServerName = serverName; resp.Data.IsJump = false; var score = 0; var zoneidd = ""; var appId = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.TxWb_AppId); if (ShareUtil.IsTx) { var strCommon = resp.Data.StrCommon; if (strCommon != null) { var strlist = strCommon.Split('|'); qqOpenid = strlist[0]; qqOpenkey = strlist[1]; qqPf = strlist[2]; platform = strlist[3]; } itemId = GetTxItemId(resp.Data.ItemCode, platform, ref zoneidd); } else { itemId = "" + resp.Data.ItemCode; } var str = "appKey=" + chargeKey + "&gameOrderId=" + resp.Data.OrderId + "&price=" + resp.Data.Cash + "&" + "goodsName=" + resp.Data.ItemName + "&" + "goodsId=" + itemId + "&title=" + resp.Data.ItemName + "&csdkId=" + (int)A8csdkEnum.csdkId + "&" + "channelAlias=" + channelAlias + "&subChannel=&serverId=" + serverId + "&" + "serverName=" + serverName + "&roleId=" + UserAccount.ManagerId + "&roleName=" + resp.Data.DateEntity.Name + "&" + "roleLevel=" + resp.Data.DateEntity.Level + "&sessionId=" + resp.Data.SessionId + "&model=&release=&deviceId=" + resp.Data.IP + "&ext=" + ext + "&uid=" + oId; var result = UAHelper.HttpPost(url, str); if (result.Length > 0) { JavaScriptSerializer serializer = new JavaScriptSerializer(); var json = serializer.Deserialize <JsonResult>(result); if (json != null) { var ret = json.ret; if (string.IsNullOrEmpty(ret)) { resp.Code = (int)MessageCode.BuyPointFail; } else if (ret == "fail") { resp.Code = (int)MessageCode.BuyPointFail; } else if (ret == "success") { resp.PR = json.payURL; resp.Code = (int)MessageCode.Success; var resultTx = ""; if (ShareUtil.IsTx) //是否腾讯玩吧接口 { resultTx = TxBuyItem(resp.Data, qqOpenid, qqOpenkey, qqPf, platform, itemId); resp.Code = IsSuccess(resultTx); SetVipInfo(UserAccount.Account, qqOpenid, qqOpenkey, qqPf, platform, ref score, ref isvip); } if (resp.Code == (int)MessageCode.NotSufficientFunds) { var cash = resp.Data.Cash; resp.Data.IsJump = true; resp.Data.Is_vip = isvip; resp.Data.OpenId = qqOpenid; resp.Data.OpenKey = qqOpenkey; resp.Data.Score = score; if (isvip) { resp.Data.DefaultScore = "" + (double)cash * 0.8 / 10; //价格单位 由分 改成1:10的 星星(达人传8折) } else { resp.Data.DefaultScore = "" + (double)cash / 10; //价格单位 由分 改成1:10的 星星 } resp.Data.AppId = appId; resp.Data.ZoneId = zoneidd; resp.Code = (int)MessageCode.Success; } } } else { resp.Code = (int)MessageCode.BuyPointFail; } } else { resp.Code = (int)MessageCode.BuyPointFail; } } catch (Exception ex) { SystemlogMgr.Error("下单", ex); resp.Code = (int)MessageCode.BuyPointFail; } } //小熊接口没有serverId字段 if (ShareUtil.IsBear) { var s = resp.Data.ServerId; var o = resp.Data.OrderId; resp.Data.Ext = o + "|" + s; } if (ShareUtil.IsQunHei) { var pf = UAFactory.Instance.GetPlatform(UAFactory.Instance.FactoryName); resp.PR = pf.ChargeUrl; } OutputHelper.Output(resp); }