From 81ab289ef47bbb7281dec712f73fb91f9727f9a5 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Wed, 25 Sep 2024 12:07:08 +0800 Subject: [PATCH] =?UTF-8?q?1.100=E6=A1=A3=E7=B2=92=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E5=85=85=E5=80=BC=E4=B8=80=E6=AC=A1=202.=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=8A=A0=E4=B8=8A=E7=94=A8=E6=88=B7=E7=9A=84?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E7=A0=81=203.=E4=B8=AA=E6=8E=A7=E6=8F=90?= =?UTF-8?q?=E5=AD=98=E6=AF=94=E6=94=B9=E6=88=90=EF=BC=88=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=89=8B=E4=B8=8A=E4=BD=99=E9=A2=9D+=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E3=80=8B/=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/config.go | 2 +- call/pay.go | 56 +++++++++++++++++++++++++++++++++ call/robot.go | 8 ++--- call/user.go | 10 ++++-- modules/web/handler/activity.go | 6 ++-- modules/web/handler/recharge.go | 12 +++++++ modules/web/handler/share.go | 4 ++- 7 files changed, 87 insertions(+), 11 deletions(-) diff --git a/call/config.go b/call/config.go index aa88194..42ebad4 100644 --- a/call/config.go +++ b/call/config.go @@ -1622,7 +1622,7 @@ func GetConfigRTP() []common.ConfigRtp { // GetConfigRTPByAmount func GetConfigRTPByAmount(amount int64) (ret common.ConfigRtp) { for _, item := range configRtp { - if amount >= item.MinRecharge && amount <= item.MinRecharge { + if amount >= item.MinRecharge && amount <= item.MaxRecharge { return item } } diff --git a/call/pay.go b/call/pay.go index 1ba61ec..812f489 100644 --- a/call/pay.go +++ b/call/pay.go @@ -15,6 +15,7 @@ import ( "server/pb" "server/util" "sort" + "strings" "time" "github.com/gogo/protobuf/proto" @@ -628,6 +629,61 @@ func ActivityWeekCard(r *common.RechargeOrder, product *common.ConfigPayProduct) }, }) UploadActivityData(r.UID, common.ActivityIDWeekCard, common.ActivityDataJoin, product.Value) + // 自动领第一天的 + cons := GetConfigActivityWeekCard() + cardInfo := GetUserWeekCard(r.UID) + var rewardList []int64 + rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5) + if err != nil { + log.Error("err:%v", err) + } + rewardList = append([]int64{cons.DayOneReward}, rewardList...) + rewardList = append(rewardList, 0) + if cardInfo.ID <= 0 || len(cardInfo.Rewards) == 0 { + cardInfo.Day = 0 + rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5) + if err != nil { + log.Error("err:%v", err) + } + rewardList = append([]int64{cons.DayOneReward}, rewardList...) + rewardList = append(rewardList, 0) + cardInfo.Rewards = strings.Join(util.Int64SliceToStringSlice(rewardList), ",") + db.Mysql().Update(&common.ActivityWeekCardData{UID: r.UID}, map[string]interface{}{ + "rewards": cardInfo.Rewards, + }) + } + rewards, _ := util.StringToInt64Slice(cardInfo.Rewards, ",") + if cardInfo.Day >= len(rewards) { + log.Error("The weekly card has been collected") + return + } + now := time.Now() + rows, err = db.Mysql().UpdateRes(&common.ActivityWeekCardData{UID: r.UID}, + map[string]interface{}{"day": gorm.Expr("day + 1"), "last_draw": now.Unix()}) + if rows == 0 || err != nil { + log.Error("err:%v", err) + return + } + var reward int64 + if cardInfo.Day < 6 { + reward = rewards[cardInfo.Day] * common.DecimalDigits + } + resource := common.CurrencyResourceWeekCard + if cardInfo.Day > 0 { + resource = common.CurrencyResourceBonus + } + if reward > 0 { + UpdateCurrencyPro(&common.UpdateCurrency{ + CurrencyBalance: &common.CurrencyBalance{ + UID: r.UID, + Type: common.CurrencyINR, + Value: reward, + Event: common.CurrencyEventActivityWeekCard, + ChannelID: r.ChannelID, + NeedBet: GetConfigCurrencyResourceNeedBet(resource, reward), + }, + }) + } } func ActivityLuckyShop(r *common.RechargeOrder, product *common.ConfigPayProduct) { diff --git a/call/robot.go b/call/robot.go index 1f0a043..de877f9 100644 --- a/call/robot.go +++ b/call/robot.go @@ -78,7 +78,7 @@ func GetRedisRankRewardKey() string { func TodayLogic(key string, uid int, num, times int64) { robotKey := GetRedisRankRobotKey(uid) timesCount := db.Redis().HGetInt(robotKey, "times_count") - // timesUse := db.Redis().HGetInt(robotKey, "times_use") + timesUse := db.Redis().HGetInt(robotKey, "times_use") if timesCount == 0 { err := db.Redis().HSet(robotKey, map[string]interface{}{ "times_count": times, @@ -101,9 +101,9 @@ func TodayLogic(key string, uid int, num, times int64) { return } } - // if timesUse < timesCount { - IncreaseInviteCount(fmt.Sprintf("%v", uid), num, true) - // } + if timesUse < timesCount { + IncreaseInviteCount(fmt.Sprintf("%v", uid), num, true) + } } // IncreaseInviteCount 增长机器人邀请人数 diff --git a/call/user.go b/call/user.go index e109caf..977fbaa 100644 --- a/call/user.go +++ b/call/user.go @@ -793,7 +793,8 @@ func GetUserRtp(uid int) *common.PlayerRtpData { func GetRtpControl(uid int) int { rechargeInfo := GetRechargeInfo(uid) - withdrawRechargePer := (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash) / rechargeInfo.TotalRecharge * 100 + cash := GetUserCurrency(uid, common.CurrencyINR) + withdrawRechargePer := (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash + cash) * 100 / rechargeInfo.TotalRecharge rtpConf := GetConfigRTPByAmount(rechargeInfo.TotalRecharge) rtpData := GetUserRtp(uid) // 1.优先玩家配置 @@ -804,8 +805,11 @@ func GetRtpControl(uid int) int { rtp = rtpData.Rtp } else { if rtpConf.ID > 0 { - if withdrawRechargePer >= int64(rtpConf.EnterPer) && withdrawRechargePer <= int64(rtpConf.ExitPer) { - rtp = rtpConf.Rtp + if withdrawRechargePer >= int64(rtpConf.EnterPer) { + if withdrawRechargePer > int64(rtpConf.ExitPer) { + rtp = rtpConf.Rtp + } + } } } diff --git a/modules/web/handler/activity.go b/modules/web/handler/activity.go index 580af37..9b065da 100644 --- a/modules/web/handler/activity.go +++ b/modules/web/handler/activity.go @@ -2214,8 +2214,10 @@ func InviteRankInfo(c *gin.Context) { resp.ActivityConf = call.GetConfigActivityByID(common.ActivityIDInviteRank) resp.RankInfoList = call.GetTopShareRank(call.RankNum) for idx, rankInfo := range resp.RankInfoList { - rankInfo.UserName = rankInfo.UserName[:6] - rankInfo.UserName = rankInfo.UserName[:3] + "***" + if len(rankInfo.UserName) > 6 { + rankInfo.UserName = rankInfo.UserName[:6] + rankInfo.UserName = rankInfo.UserName[:3] + "***" + } resp.RankInfoList[idx].UserName = "User" + rankInfo.UserName } resp.RewardRankConfig = call.GetConfigRobotRankReward() diff --git a/modules/web/handler/recharge.go b/modules/web/handler/recharge.go index 0a8b5d6..f87280f 100644 --- a/modules/web/handler/recharge.go +++ b/modules/web/handler/recharge.go @@ -15,6 +15,7 @@ import ( "github.com/gin-gonic/gin" "github.com/liangdas/mqant/log" + "github.com/olivere/elastic/v7" ) func CheckRechargeOrder(c *gin.Context) { @@ -61,6 +62,13 @@ func RechargeInfo(c *gin.Context) { } resp.ConfigPayBonus = append(resp.ConfigPayBonus, one) } + data := common.CurrencyBalance{} + q := elastic.NewBoolQuery() + q.Filter(elastic.NewMatchQuery("uid", a.UID)) + q.Filter(elastic.NewMatchQuery("value", 100*common.DecimalDigits)) + q.Filter(elastic.NewMatchQuery("event", common.CurrencyEventReCharge)) + db.ES().QueryOne(common.ESIndexBalance, q, &data, "id", false) + log.Info("data:%+v", data) for _, v := range list { one := *v if v.IfSell == 2 { @@ -83,6 +91,10 @@ func RechargeInfo(c *gin.Context) { } } } + // 放开100档,用户生涯只能使用一次 + if one.Amount == 100*common.DecimalDigits && data.Id > 0 { + continue + } resp.List = append(resp.List, one) } } diff --git a/modules/web/handler/share.go b/modules/web/handler/share.go index 01ba45f..fc1ab96 100644 --- a/modules/web/handler/share.go +++ b/modules/web/handler/share.go @@ -100,7 +100,9 @@ func ShareInfo(c *gin.Context) { resp.RechargeCount = call.GetUserShareRecharges(a.UID, 1) resp.TotalRecharge = call.GetUserShareRechargeAmount(a.UID, 1) resp.ShareCode = shareInfo.Share - + if len(resp.ShareLink) > 0 { + resp.ShareLink += fmt.Sprintf("&code=%v", shareInfo.Share) + } num := 0 if resp.AvailableReward > 0 { num = 1