public string FirstGift(string sGameName, string sAccount, string sMultiPP, string sHost) { if (sMultiPP.Length < 10) { return("pplengthissmall"); } string sBeginTime = ServerBLL.ServerTimeSel(sGameName); if (!FirstGiftBLL.valTime(sBeginTime)) { return("timeerr"); } if (sHost.Length < 4) { return("hostlenerr"); } int iUserID = UserBll.UserIDSel(sAccount); if (!ProvideCommon.valMultiPP(iUserID, sMultiPP)) { return("pperr"); } string sGiftState = FirstGiftBLL.GiftStateSel(iUserID, sGameName); int iPoint = 10; string sTranIP = ProvideCommon.GetRealIP(); string sGiftRes = string.Empty; string sRes = string.Empty; switch (sGiftState) { case "0": sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sHost); if (sGiftRes == "0") { sRes = "0"; FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1); } else { sRes = sGiftRes; } break; case "1": sRes = "1"; break; case "2": sRes = "7"; break; default: string sLevel = FirstGiftBLL.ULevelSel(iUserID, sGameName); int iLevel = 0; int.TryParse(sLevel, out iLevel); int iTrueLevel = GameLevelSel(sGameName); if (iLevel > iTrueLevel) { FirstGiftBLL.GiftAdd(iUserID, iLevel, sGameName); sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sHost); if (sGiftRes == "0") { FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1); sRes = "0"; } else { FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 0); sRes = sGiftRes; } } else { sRes = "2"; //sRes = string.Format("2|{0}",iTrueLevel.ToString()); } break; } return(sRes); }
public string FirstGift(string sGameName, int iUserID) { if (iUserID < 1000000) { return("useriderr!"); } string sBeginTime = ServerBLL.ServerTimeSel(sGameName); if (!FirstGiftBLL.valTime(sBeginTime)) { return("timeerr"); } if (Request.UrlReferrer.Host.Length < 6) { return("hostlenerr"); } if (Request.UrlReferrer.Host.Split('.').Length < 2) { return("hosterr"); } string sFromHost = Request.UrlReferrer.Host.Split('.')[1]; string sAccount = UserBll.AccountSel(iUserID).Trim(); string sGiftState = FirstGiftBLL.GiftStateSel(iUserID, sGameName); string sRes = string.Empty; int iPoint = 10; string sTranIP = ProvideCommon.GetRealIP(); string sGiftRes = string.Empty; switch (sGiftState) { case "0": sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sFromHost); if (sGiftRes == "0") { sRes = "0"; FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1); } else { sRes = sGiftRes; } break; case "1": sRes = "1"; break; case "2": sRes = "7"; break; default: string sLevel = FirstGiftBLL.ULevelSel(iUserID, sGameName); int iLevel = 0; int.TryParse(sLevel, out iLevel); if (iLevel > 29) { FirstGiftBLL.GiftAdd(iUserID, iLevel, sGameName); sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sFromHost); if (sGiftRes == "0") { FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1); sRes = "0"; } else { FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 0); sRes = sGiftRes; } } else { sRes = "2"; } break; } return(sRes); }