private void ManagerInfo() { if (UserAccount.ManagerId == Guid.Empty) //登录 { var info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx); var sessionId = ShareUtil.GenerateComb().ToString(); if (info.Code == (int)MessageCode.Success) { if (info.Data.NeedSelect == false) { if (info.Data.ManagerInfo == null) { string playerName = ""; string logo = "1"; int templateId = 1; var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code != (int)MessageCode.Success) { info.Code = createData.Code; OutputHelper.Output(info); return; } info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx); } if (CheckLockState(info.Data.ManagerInfo.Manager.Idx)) { OutputHelper.Output(MessageCode.LoginOnlineLock); return; } //写入登录信息 string cookie = UAHelper.SetFormsAuthentication(UserAccount.Account, info.Data.ManagerInfo.Manager.Idx, info.Data.ManagerInfo.Manager.Name, 1, sessionId); OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); onlineClient.RiseOnlineTime(info.Data.ManagerInfo.Manager.Idx); info.Data.Cookie = cookie; } } OutputHelper.Output(info); } else { if (CheckLockState(UserAccount.ManagerId)) { OutputHelper.Output(MessageCode.LoginOnlineLock); return; } var info = reader.GetManagerInfo(UserAccount.ManagerId, UAFactory.Instance.IsTx); info.Data.Cookie = ""; OutputHelper.Output(info); } }
public int BuyPlayzoneItem(string openId, string openKey, string pf, int appId, string appKey, string itemId, string zoneType, ref string orderId, ref int cost) { try { OpenApiV3 sdk = new OpenApiV3(openId, openKey, appId, pf, appKey, UAFactory.Instance.OpenUALog); sdk.SetUserIp(UAHelper.GetRealIP()); RstArray result = buyPlayzoneItem(sdk, itemId, zoneType); if (result.Ret == 0) { var json = JsonConvert.DeserializeObject(result.Msg) as JObject; if (json == null) { return(1); } var code = ConvertHelper.ConvertToInt(JsonUtil.GetJsonValue(json, "code")); //订单号 if (code != 0) { switch (code) { case 1002: //用户没有登录态 return((int)MessageCode.UserNotLogin); break; case 1003: //账户被冻结 return((int)MessageCode.UserFreeze); break; case 1004: //账户余额不足 return((int)MessageCode.TxNotSufficientFunds); break; default: return((int)MessageCode.TxBuyPointFail); break; } } var data = json["data"]; if (data == null) { return(1); } orderId = JsonUtil.GetJsonValue(data[0], "billno").ToLower(); //订单号 cost = ConvertHelper.ConvertToInt(JsonUtil.GetJsonValue(data[0], "cost")); //消耗积分 } } catch (Exception ex) { SystemlogMgr.Error("腾讯充", ex); return(-1); } return(0); }
public int WbUserInfo(string openId, string openKey, string pf, string platform, int appId, string appKey) { try { OpenApiV3 sdk = new OpenApiV3(openId, openKey, appId, pf, appKey, UAFactory.Instance.OpenUALog); sdk.SetUserIp(UAHelper.GetRealIP()); RstArray result = GetUserInfo(sdk); if (result.Ret != 0) { return(result.Ret); } var json = JsonConvert.DeserializeObject(result.Msg) as JObject; if (json == null) { return(1); } //var nickName = JsonUtil.GetJsonValue(json, "nickname"); //var logo = JsonUtil.GetJsonValue(json, "figureurl"); //var extraData = BuildExtraData(openkey, pf, pfkey); if (pf == "wanba_ts") { var result1 = GetWanBaUserInfo(sdk, "1"); if (result1.Ret != 0) { return(result1.Ret); } var json1 = JsonConvert.DeserializeObject(result1.Msg) as JObject; if (json1 == null) { return(1); } var data = json1["data"]; if (data == null) { return(1); } var is_vip = JsonUtil.GetJsonValue(data[0], "is_vip").ToLower(); //是否开通游戏达人 var vip_level = JsonUtil.GetJsonValue(data[0], "vip_level"); //达人等级 //var score = JsonUtil.GetJsonValue(data[0], "score"); //用户积分 //var expiredtime = JsonUtil.GetJsonValue(data[0], "vip_level"); // 达人过期时间 TxYellowvipMgr.Add(ShareUtil.GetWanBaVipAccount(openId), is_vip == "true", false, false, ConvertHelper.ConvertToInt(vip_level), ""); } return(0); } catch (Exception ex) { SystemlogMgr.Error("腾讯获取用户", ex); return(-1); } }
private void Register() { string playerName = GetParam("name"); string logo = GetParam("logo"); int templateId = 1; // GetParamInt("ti"); if (string.IsNullOrEmpty(playerName)) { OutputHelper.Output(MessageCode.RegisterNameIsEmpty); return; } var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code == (int)MessageCode.Success) { var sessionId = ShareUtil.GenerateComb().ToString(); var cookie = UAHelper.SetFormsAuthentication(UserAccount.Account, createData.Data, playerName, 1, sessionId); OnlineMgr.LoginSession(createData.Data, sessionId); onlineClient.RiseOnlineTime(createData.Data); } OutputHelper.Output(createData); }
public int WbUserInfo() { try { string openId = "3C12344A556DADF34634CEFB80B05D7D"; string openKey = "2DC6A89C97E6AAFA9F74C03E15D0CEFA"; string pf = "qzone"; //format //userip //sig //UAFactory int appId = 1105806369; string appKey = "uOFRHYPj69tRtk3i"; string serverName = "v3/user/buy_playzone_item"; OpenApiV3 sdk = new OpenApiV3(openId, openKey, appId, pf, appKey, UAFactory.Instance.OpenUALog); sdk.SetUserIp(UAHelper.GetRealIP()); RstArray result = buyPlayzoneItem(sdk); if (result.Ret != 0) { return(result.Ret); } var json = JsonConvert.DeserializeObject(result.Msg) as JObject; if (json == null) { return(1); } var nickName = JsonUtil.GetJsonValue(json, "nickname"); var logo = JsonUtil.GetJsonValue(json, "figureurl"); //var extraData = BuildExtraData(openkey, pf, pfkey); if (pf == "wanba") { var result1 = GetWanBaUserInfo(sdk, "1"); if (result1.Ret != 0) { return(result1.Ret); } var json1 = JsonConvert.DeserializeObject(result1.Msg) as JObject; if (json1 == null) { return(1); } var data = json1["data"]; if (data == null) { return(1); } var is_vip = JsonUtil.GetJsonValue(data[0], "is_vip"); //是否开通游戏达人 var vip_level = JsonUtil.GetJsonValue(data[0], "vip_level"); //达人等级 var score = JsonUtil.GetJsonValue(data[0], "score"); //用户积分 var expiredtime = JsonUtil.GetJsonValue(data[0], "vip_level"); // 达人过期时间 TxYellowvipMgr.Add(ShareUtil.GetWanBaVipAccount(openId), is_vip == "true", false, false, ConvertHelper.ConvertToInt(vip_level), ""); } return(0); } catch (Exception ex) { SystemlogMgr.Error("腾讯获取用户", ex); return(-1); } }
private bool doLoginNew(ref string cookie) { try { TxLogininfoEntity tLoginInfo = null; var platformId = GetParam("platform"); var userName = GetParam("openid"); if (ShareUtil.IsQunHei) { userName = GetParam("username"); } //if (userName.Length>0 && userName.Contains("h5_zhiqu")) // return false; var user = NbUserMgr.GetByAccount(userName, GetIp(), DateTime.Today.AddDays(-1), DateTime.Today, 0); var sessionId = ShareUtil.GenerateComb().ToString(); if (user != null) { UserAccountEntity userAccountEntity = new UserAccountEntity(user.Account, Guid.Empty, "", 1, platformId, sessionId); userAccountEntity.ExtraData = "d|pengyou|f"; var info = reader.GetManagerInfoByAccount(userAccountEntity.Account, GetIp(), UAFactory.Instance.IsTx); if (info.Code == (int)MessageCode.Success) { if (info.Data.NeedSelect == false) { if (ShareUtil.IsTx) { string openKey = GetParam("openkey"); string pf = GetParam("pf"); if (string.IsNullOrEmpty(pf)) { pf = "wanba_ts"; } string platform = GetParam("platform"); //userip //sig int appId = UAFactory.Instance.TxAppId; string appKey = UAFactory.Instance.TxAppKey; var result = WbUserInfo(userName, openKey, pf, platform, appId, appKey); if (result != 0) { OutputHelper.Output(result); } tLoginInfo = new TxLogininfoEntity(userName, openKey, pf, platform, "", "", DateTime.Now, DateTime.Now); } if (info.Data.ManagerInfo == null) { string playerName = ""; string logo = "1"; int templateId = 1; var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code != (int)MessageCode.Success) { info.Code = createData.Code; OutputHelper.Output(info); } info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx);; } try { if (ShareUtil.IsH5A8) { UA_A8.UserAction("entergame", info.Data.ManagerInfo.Manager.Account, "", "", info.Data.ManagerInfo.Manager); } } catch (Exception) { } if (CheckLockState(info.Data.ManagerInfo.Manager.Idx)) { OutputHelper.Output(MessageCode.LoginOnlineLock); } //写入登录信息 cookie = UAHelper.SetFormsAuthentication(userAccountEntity.Account, info.Data.ManagerInfo.Manager.Idx, info.Data.ManagerInfo.Manager.Name, 1, sessionId); OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); onlineClient.RiseOnlineTime(info.Data.ManagerInfo.Manager.Idx); info.Data.Cookie = cookie; Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); var isSubscribe = GetParamBool("isSubscribe"); if (isSubscribe)//关注 { activityClient.DoShare(info.Data.ManagerInfo.Manager.Idx, 4); } if (ShareUtil.IsTx) { TxLogininfoMgr.InsertUpdate(tLoginInfo); } return(true); } return(true); } else { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Account, DateTime.Now, DateTime.Now.AddDays(10), false, userAccountEntity.ToString(), FormsAuthentication .FormsCookiePath); cookie = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(false); } } return(false); } catch (Exception ex) { cookie = ex.ToString(); return(true); } }
private bool doLogin(ref string cookie) { try { var platformId = GetParam("platform"); var userName = GetParamNOUrlDecode("username"); //if (userName.Length > 0 && userName.Contains("h5_zhiqu")) // return false; var user = NbUserMgr.GetByAccount(userName, GetIp(), DateTime.Today.AddDays(-1), DateTime.Today, 0); var sessionId = ShareUtil.GenerateComb().ToString(); if (user != null) { UserAccountEntity userAccountEntity = new UserAccountEntity(user.Account, Guid.Empty, "", 1, platformId, sessionId); userAccountEntity.ExtraData = "d|pengyou|f"; var info = reader.GetManagerInfoByAccount(userAccountEntity.Account, GetIp(), UAFactory.Instance.IsTx); if (info.Code == (int)MessageCode.Success) { if (info.Data.NeedSelect == false) { if (info.Data.ManagerInfo == null) { string playerName = ""; string logo = "1"; int templateId = 1; var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code != (int)MessageCode.Success) { info.Code = createData.Code; OutputHelper.Output(info); } info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx);; } if (CheckLockState(info.Data.ManagerInfo.Manager.Idx)) { OutputHelper.Output(MessageCode.LoginOnlineLock); } //写入登录信息 cookie = UAHelper.SetFormsAuthentication(userAccountEntity.Account, info.Data.ManagerInfo.Manager.Idx, info.Data.ManagerInfo.Manager.Name, 1, sessionId); OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); onlineClient.RiseOnlineTime(info.Data.ManagerInfo.Manager.Idx); info.Data.Cookie = cookie; Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(true); } return(true); } else { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Account, DateTime.Now, DateTime.Now.AddDays(10), false, userAccountEntity.ToString(), FormsAuthentication .FormsCookiePath); cookie = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(false); } } return(false); } catch (Exception ex) { cookie = ex.ToString(); return(true); } }