fix/release
mofangmin 1 year ago
parent 6b02bd2ded
commit 8179cbcdd6
  1. 6
      modules/web/handler/account.go
  2. 2
      modules/web/handler/task.go
  3. 3
      modules/web/handler/user.go
  4. 29
      modules/web/handler/vip.go

@ -1,14 +1,12 @@
package handler
import (
"fmt"
"server/call"
"server/common"
"server/config"
"server/db"
"server/modules/web/app"
"server/modules/web/values"
"server/pb"
"server/util"
"time"
@ -103,10 +101,6 @@ func onLogin(user *common.PlayerDBInfo, a *app.Gin, isNew bool) {
}
call.InsertLoginRecord(uid, cid, ip, birth, deviceType)
// 第二次登录
if db.Mysql().Count(&common.LoginRecord{}, fmt.Sprintf(" uid = %d", uid)) == 1 {
call.PushRed(uid, pb.RedPointModule_RedPointLoginAgain, 1)
}
// if db.Mysql().CountTable(common.PlayerRechargeTableName, fmt.Sprintf("uid = %d", uid)) == 0 {
// db.Mysql().C().Table(common.PlayerRechargeTableName).Create(&common.PlayerCurrency{UID: uid, ChannelID: cid})
// }

@ -98,7 +98,6 @@ func DrawTask(c *gin.Context) {
}
TaskComplete(a, req)
a.Data = req
num := 0
for _, task := range GetUserTaskStatus(a) {
if task.Status == 1 {
@ -106,5 +105,4 @@ func DrawTask(c *gin.Context) {
}
}
call.PushRed(a.UID, pb.RedPointModule_RedPointTask, uint32(num))
}

@ -9,6 +9,7 @@ import (
"server/db"
"server/modules/web/app"
"server/modules/web/values"
"server/pb"
"server/util"
"time"
@ -279,6 +280,7 @@ func CheckRedPoint(uid int, c *gin.Context) {
// 防止玩家未连接网关,所以延迟3秒
time.AfterFunc(time.Second*3, func() {
nc := newContext(c)
call.PushRed(uid, pb.RedPointModule_RedPointLoginAgain, 1)
// 是否可以转动转盘
ActivityBetDrawInfo(nc)
// 是否可以签到
@ -289,5 +291,6 @@ func CheckRedPoint(uid int, c *gin.Context) {
ShareInfo(nc)
// vip奖励
GetVipInfo(nc)
})
}

@ -103,14 +103,27 @@ func GetVipInfo(c *gin.Context) {
q.Filter(elastic.NewTermQuery("uid", a.UID))
q.Filter(elastic.NewTermQuery("event", common.CurrencyEventVIPCashback))
resp.TotalCashback = db.ES().SumByInt64(common.ESIndexBalance, "value", q)
// db.ES().QueryList(common.ESIndexBalance, req.Page, req.Num, q, &resp.CashbackList, "time", false)
num := 0
if resp.Info.Cashback > 0 {
num = 1
db.ES().QueryList(common.ESIndexBalance, req.Page, req.Num, q, &resp.CashbackList, "time", false)
reset = !util.IsSameDayTimeStamp(now.Unix(), resp.Info.ProfitTime)
if reset && resp.Info.Cashback > 0 {
call.PushRed(a.UID, pb.RedPointModule_RedPointVipCashback, uint32(1))
}
if hasVipBonus(resp.Info) {
call.PushRed(a.UID, pb.RedPointModule_RedPointVipReward, uint32(1))
}
}
func hasVipBonus(vip *common.VipData) bool {
// 遍历所有VIP级别
for level := 1; level <= vip.Level; level++ {
// 计算标志位
flag := int64(1 << level)
// 检查该级别的奖励是否已经领取
if vip.Draws&flag == 0 {
return true
}
if num > 0 {
call.PushRed(a.UID, pb.RedPointModule_RedPointVipCashback, uint32(num))
}
return false
}
func DrawVipBonus(c *gin.Context) {
@ -139,7 +152,7 @@ func DrawVipBonus(c *gin.Context) {
return
}
flag := int64(1 << req.Level)
if vip.Draws&int64(flag) > 0 {
if vip.Draws&flag > 0 {
a.Code = values.CodeParam
a.Msg = "reward has been claimed"
return
@ -183,7 +196,7 @@ func DrawVipBonus(c *gin.Context) {
return
}
vip = call.GetVIP(a.UID)
if vip.Draws == 0 {
if !hasVipBonus(vip) {
call.PushRed(a.UID, pb.RedPointModule_RedPointVipReward, uint32(0))
}
}

Loading…
Cancel
Save