Compare commits

...

3 Commits

  1. 11
      call/mail.go
  2. 1
      call/redpoint.go
  3. 6
      call/share.go
  4. 8
      modules/backend/models/db.go
  5. 2
      modules/web/handler/game.go
  6. 10
      modules/web/handler/user.go
  7. 38
      modules/web/providers/sn/api.go
  8. 3
      modules/web/providers/sn/base.go
  9. 45
      modules/web/providers/sn/handler.go
  10. 5
      modules/web/providers/sn/values.go
  11. 10
      modules/web/values/protocol.go

@ -2,6 +2,7 @@ package call
import ( import (
"fmt" "fmt"
"github.com/liangdas/mqant/log"
"server/common" "server/common"
"server/db" "server/db"
"server/util" "server/util"
@ -51,11 +52,11 @@ func checkMail(uid int, red *common.PlayerRed) (unReadCount int) {
db.Mysql().QueryAll(sql, "", &common.Mail{}, &all) db.Mysql().QueryAll(sql, "", &common.Mail{}, &all)
if len(all) > 0 { if len(all) > 0 {
now := time.Now().Unix() now := time.Now().Unix()
//u, err := db.Mysql().UpdateRes(&common.PlayerData{UID: uid, LastSysEmailDraw: data.LastSysEmailDraw}, &common.PlayerData{LastSysEmailDraw: now}) u, err := db.Mysql().UpdateRes(&common.PlayerData{UID: uid, LastSysEmailDraw: data.LastSysEmailDraw}, &common.PlayerData{LastSysEmailDraw: now})
//if err != nil || u == 0 { if err != nil || u == 0 {
// log.Error("err:%v", err) log.Error("err:%v", err)
// return return
//} }
for _, v := range all { for _, v := range all {
one := v one := v
one.ID = 0 one.ID = 0

@ -159,4 +159,5 @@ func PushRed(uid int, module pb.RedPointModule, num uint32) {
one.List = append(one.List, &pb.RedInfo{ModuleName: module, Num: num}) one.List = append(one.List, &pb.RedInfo{ModuleName: module, Num: num})
log.Debug("redpoint,uid:%v,module:%v,info:%v", uid, module, one) log.Debug("redpoint,uid:%v,module:%v,info:%v", uid, module, one)
SendNR(uid, int(pb.ServerCommonResp_CommonRedPointResp), one, "common") SendNR(uid, int(pb.ServerCommonResp_CommonRedPointResp), one, "common")
checkMail(uid, nil)
} }

@ -853,15 +853,15 @@ func updateShareByUp(uid, upUid, uplevel, updateType int, updateValue int64, exp
// UpdateShare updateType(1:下注,2:充值,3:任务,4:邀请人,5:提现, 6:回滚) // UpdateShare updateType(1:下注,2:充值,3:任务,4:邀请人,5:提现, 6:回滚)
func UpdateShare(uid, updateType int, updateValue int64, expand ...string) (err error) { func UpdateShare(uid, updateType int, updateValue int64, expand ...string) (err error) {
if updateType == 1 { // 直接更新下注奖池 if updateType == 1 { // 直接更新下注奖池
if len(expand) > 0 && expand[0] == "isRobot" {
return
}
_, _, expired, rankKey := getShareRankJackpotKey() _, _, expired, rankKey := getShareRankJackpotKey()
_, err = db.Redis().Incr(rankKey, updateValue/100) _, err = db.Redis().Incr(rankKey, updateValue/100)
if err != nil { if err != nil {
log.Error("update rank jackpot err, %s:%s", rankKey, err.Error()) log.Error("update rank jackpot err, %s:%s", rankKey, err.Error())
} }
db.Redis().Expire(rankKey, time.Duration(expired)*time.Second) db.Redis().Expire(rankKey, time.Duration(expired)*time.Second)
if len(expand) > 0 && expand[0] == "isRobot" {
return
}
} }
now := time.Now() now := time.Now()
shareInfo := GetShareInfo(uid) shareInfo := GetShareInfo(uid)

@ -1200,8 +1200,8 @@ func GetNewPayAmountBySqls(s, e int64, t common.CurrencyType, channel ...*int) i
INNER JOIN INNER JOIN
(SELECT id from users where birth >= %d AND birth < %d) as u (SELECT id from users where birth >= %d AND birth < %d) as u
ON re.uid = u.id ON re.uid = u.id
WHERE event = %d AND status = %d and callback_time >= %d AND callback_time < %d and currency_type = %d`, WHERE event in (%d,%d) AND status = %d and callback_time >= %d AND callback_time < %d and currency_type = %d`,
i, i+oneDay, common.CurrencyEventReCharge, common.StatusROrderPay, i, i+oneDay, t) i, i+oneDay, common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard, common.StatusROrderPay, i, i+oneDay, t)
if len(channel) > 0 { if len(channel) > 0 {
sql += PackChannels(channel...) sql += PackChannels(channel...)
} }
@ -1257,8 +1257,8 @@ func GetOldPayCountBySqls(s, e int64, channel ...*int) int64 {
INNER JOIN INNER JOIN
(SELECT id from users WHERE birth < %d)AS u (SELECT id from users WHERE birth < %d)AS u
ON re.uid = u.id ON re.uid = u.id
WHERE event = %d AND status = %d AND re.callback_time >= %d AND re.callback_time < %d AND event = %d`, WHERE event in (%d,%d) AND status = %d AND re.callback_time >= %d AND re.callback_time < %d AND event = %d`,
i, common.CurrencyEventReCharge, common.StatusROrderPay, i, i+oneDay, common.CurrencyEventReCharge) i, common.CurrencyEventReCharge, common.CurrencyEventActivityWeekCard, common.StatusROrderPay, i, i+oneDay, common.CurrencyEventReCharge)
if len(channel) > 0 { if len(channel) > 0 {
sql += PackChannels(channel...) sql += PackChannels(channel...)
} }

@ -365,7 +365,7 @@ func EnterGameNew(c *gin.Context) {
resp.URL = all.EnterGame(enter) resp.URL = all.EnterGame(enter)
if resp.URL == "" { if resp.URL == "" {
a.Code = values.CodeParam a.Code = values.CodeParam
a.Msg = "Under Maintenance,please try later." a.Msg = "The game is under maintenance and is expected to be available at 12:00."
return return
} }
util.Go(func() { util.Go(func() {

@ -44,10 +44,7 @@ func getUserInfo(uid int, isNew bool) (resp values.UserInfoResp, err error) {
resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid) resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid)
resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid) resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 { if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct { resp.Activitys.DiscountTicket = &values.DiscountTicketV{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
} }
vip := call.GetVipCon(uid) vip := call.GetVipCon(uid)
var nextVip *common.ConfigVIP var nextVip *common.ConfigVIP
@ -140,10 +137,7 @@ func GetUserInfo(c *gin.Context) {
resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid) resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid)
resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid) resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 { if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct { resp.Activitys.DiscountTicket = &values.DiscountTicketV{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
} }
vip := call.GetVipCon(a.UID) vip := call.GetVipCon(a.UID)
nextVip := call.GetConfigVIPByLevel(vip.Level + 1) nextVip := call.GetConfigVIPByLevel(vip.Level + 1)

@ -185,9 +185,10 @@ type GameControlCallbackResp struct {
type ControlReq struct { type ControlReq struct {
BaseReq BaseReq
ThirdName string `json:"third_name"` ThirdName string `json:"third_name"`
ControlId int `json:"control_id"` ControlId int `json:"control_id"`
Data []struct { TemplateId string `json:"template_id"`
Data []struct {
TargetRtp int `json:"target_rtp"` TargetRtp int `json:"target_rtp"`
} `json:"data"` } `json:"data"`
Sn int `json:"sn"` Sn int `json:"sn"`
@ -210,3 +211,34 @@ type ControlResp struct {
Data struct { Data struct {
} `json:"data"` } `json:"data"`
} }
type ControlTemplateReq struct {
BaseReq
PageSize int `json:"page_size"`
PageIndex int `json:"page_index"`
}
type ControlTemplateResp struct {
Code int `json:"code"`
Success bool `json:"success"`
StatusCode int `json:"status_code"`
System int `json:"system"`
Msg string `json:"msg"`
Prompt string `json:"prompt"`
RequestId string `json:"request_id"`
RequestMethod string `json:"request_method"`
Provider string `json:"provider"`
Doc string `json:"doc"`
Data struct {
List []struct {
TemplateId string `json:"template_id"`
DealerList interface{} `json:"dealer_list"`
Desc string `json:"desc"`
Operator string `json:"operator"`
Time int `json:"time"`
CoinType int `json:"coin_type"`
List interface{} `json:"list"`
} `json:"list"`
TotalCount int `json:"total_count"`
} `json:"data"`
}

@ -25,6 +25,7 @@ func (s *Sub) Init() {
API = APITest API = APITest
APICreate = APICreateUserTest APICreate = APICreateUserTest
APIControl = APIControlTest APIControl = APIControlTest
APIGameControlTemplate = APIGameControlTemplateTest
SnAccount = TestSnAccount SnAccount = TestSnAccount
DefaultLanguage = TestDefaultLanguage DefaultLanguage = TestDefaultLanguage
ApiKey = TestApiKey ApiKey = TestApiKey
@ -36,6 +37,7 @@ func (s *Sub) Init() {
API = APIRlease API = APIRlease
APICreate = APICreateUserRlease APICreate = APICreateUserRlease
APIControl = APIControlRlease APIControl = APIControlRlease
APIGameControlTemplate = APIGameControlTemplateRelease
SnAccount = ReleaseSnAccount SnAccount = ReleaseSnAccount
DefaultLanguage = ReleaseDefaultLanguage DefaultLanguage = ReleaseDefaultLanguage
ApiKey = ReleaseApiKey ApiKey = ReleaseApiKey
@ -44,6 +46,7 @@ func (s *Sub) Init() {
AgentId = ReleaseAgentId AgentId = ReleaseAgentId
SnId = ReleaseSnId SnId = ReleaseSnId
} }
InitGameControlTemplate()
} }
type EnterReq struct { type EnterReq struct {

@ -12,6 +12,7 @@ import (
"server/modules/web/providers/base" "server/modules/web/providers/base"
"server/util" "server/util"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -641,10 +642,11 @@ func Control(uid int, controlId int) error {
SnAccount: SnAccount, SnAccount: SnAccount,
Time: time.Now().Unix(), Time: time.Now().Unix(),
}, },
ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)), ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)),
ControlId: controlId, ControlId: controlId,
Sn: SnId, Sn: SnId,
AgentId: AgentId, AgentId: AgentId,
TemplateId: DefaultTemplateId,
Data: []struct { Data: []struct {
TargetRtp int `json:"target_rtp"` TargetRtp int `json:"target_rtp"`
}{ }{
@ -673,3 +675,38 @@ func Control(uid int, controlId int) error {
return nil return nil
} }
func InitGameControlTemplate() error {
req := &ControlTemplateReq{
BaseReq: BaseReq{
SnAccount: SnAccount,
Time: time.Now().Unix(),
},
}
log.Debug("sn get control template req, %+v", *req)
reqBody, _ := json.Marshal(req)
var tmpValue map[string]interface{}
json.Unmarshal(reqBody, &tmpValue)
req.Sign = GeneratedSign(tmpValue, ApiKey)
var resp ControlTemplateResp
err := util.HttpPost(APIGameControlTemplate, req, &resp, nil)
if err != nil {
log.Error("err:%v", err)
return err
}
if resp.Code != CodeRequestSuccess && resp.Code != CodeRequestExist {
log.Error("sn get control template err, %+v", resp)
return fmt.Errorf("sn get control template err, %+v ", resp)
}
for _, v := range resp.Data.List {
if strings.Contains(v.Desc, "90%50") {
DefaultTemplateId = v.TemplateId
break
}
}
return nil
}

@ -20,6 +20,9 @@ const (
APIControlRlease = "https://ve-api.1betnbet.com/v1/control" APIControlRlease = "https://ve-api.1betnbet.com/v1/control"
APIControlTest = "https://api.nbetps.com/v1/control" APIControlTest = "https://api.nbetps.com/v1/control"
APIGameControlTemplateRelease = "https://ve-api.1betnbet.com/v1/game_control/search_control_template"
APIGameControlTemplateTest = "https://api.nbetps.com/v1/game_control/search_control_template"
TestSnAccount = "wjA77Game_N601" TestSnAccount = "wjA77Game_N601"
TestDefaultLanguage = "en" TestDefaultLanguage = "en"
TestAgentId = 320 TestAgentId = 320
@ -46,6 +49,8 @@ var (
API = "" API = ""
APICreate = "" APICreate = ""
APIControl = "" APIControl = ""
APIGameControlTemplate = ""
DefaultTemplateId = ""
SnAccount, DefaultLanguage, ApiKey, WalletKey, ControlKey string SnAccount, DefaultLanguage, ApiKey, WalletKey, ControlKey string
AgentId, SnId int AgentId, SnId int
) )

@ -68,13 +68,15 @@ type UserInfoResp struct {
DaySign bool DaySign bool
WeekCard bool // 是否弹出周卡 WeekCard bool // 是否弹出周卡
LuckyShop bool // 是否弹出幸运商店 LuckyShop bool // 是否弹出幸运商店
DiscountTicket struct { DiscountTicket *DiscountTicketV
Amount int64 // 优惠券额度
DiscountAmount int64 // 优惠金额
} // 优惠金额最大优惠券
} }
} }
type DiscountTicketV struct {
Amount int64 // 优惠券额度
DiscountAmount int64 // 优惠金额
}
// BalanceHisReq 请求金币流水记录 // BalanceHisReq 请求金币流水记录
type BalanceHisReq struct { type BalanceHisReq struct {
Page int `json:"page"` // 页码 Page int `json:"page"` // 页码

Loading…
Cancel
Save