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 (
"fmt"
"github.com/liangdas/mqant/log"
"server/common"
"server/db"
"server/util"
@ -51,11 +52,11 @@ func checkMail(uid int, red *common.PlayerRed) (unReadCount int) {
db.Mysql().QueryAll(sql, "", &common.Mail{}, &all)
if len(all) > 0 {
now := time.Now().Unix()
//u, err := db.Mysql().UpdateRes(&common.PlayerData{UID: uid, LastSysEmailDraw: data.LastSysEmailDraw}, &common.PlayerData{LastSysEmailDraw: now})
//if err != nil || u == 0 {
// log.Error("err:%v", err)
// return
//}
u, err := db.Mysql().UpdateRes(&common.PlayerData{UID: uid, LastSysEmailDraw: data.LastSysEmailDraw}, &common.PlayerData{LastSysEmailDraw: now})
if err != nil || u == 0 {
log.Error("err:%v", err)
return
}
for _, v := range all {
one := v
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})
log.Debug("redpoint,uid:%v,module:%v,info:%v", uid, module, one)
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:回滚)
func UpdateShare(uid, updateType int, updateValue int64, expand ...string) (err error) {
if updateType == 1 { // 直接更新下注奖池
if len(expand) > 0 && expand[0] == "isRobot" {
return
}
_, _, expired, rankKey := getShareRankJackpotKey()
_, err = db.Redis().Incr(rankKey, updateValue/100)
if err != nil {
log.Error("update rank jackpot err, %s:%s", rankKey, err.Error())
}
db.Redis().Expire(rankKey, time.Duration(expired)*time.Second)
if len(expand) > 0 && expand[0] == "isRobot" {
return
}
}
now := time.Now()
shareInfo := GetShareInfo(uid)

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

@ -365,7 +365,7 @@ func EnterGameNew(c *gin.Context) {
resp.URL = all.EnterGame(enter)
if resp.URL == "" {
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
}
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.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct {
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
resp.Activitys.DiscountTicket = &values.DiscountTicketV{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
}
vip := call.GetVipCon(uid)
var nextVip *common.ConfigVIP
@ -140,10 +137,7 @@ func GetUserInfo(c *gin.Context) {
resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid)
resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct {
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
resp.Activitys.DiscountTicket = &values.DiscountTicketV{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
}
vip := call.GetVipCon(a.UID)
nextVip := call.GetConfigVIPByLevel(vip.Level + 1)

@ -185,9 +185,10 @@ type GameControlCallbackResp struct {
type ControlReq struct {
BaseReq
ThirdName string `json:"third_name"`
ControlId int `json:"control_id"`
Data []struct {
ThirdName string `json:"third_name"`
ControlId int `json:"control_id"`
TemplateId string `json:"template_id"`
Data []struct {
TargetRtp int `json:"target_rtp"`
} `json:"data"`
Sn int `json:"sn"`
@ -210,3 +211,34 @@ type ControlResp struct {
Data struct {
} `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
APICreate = APICreateUserTest
APIControl = APIControlTest
APIGameControlTemplate = APIGameControlTemplateTest
SnAccount = TestSnAccount
DefaultLanguage = TestDefaultLanguage
ApiKey = TestApiKey
@ -36,6 +37,7 @@ func (s *Sub) Init() {
API = APIRlease
APICreate = APICreateUserRlease
APIControl = APIControlRlease
APIGameControlTemplate = APIGameControlTemplateRelease
SnAccount = ReleaseSnAccount
DefaultLanguage = ReleaseDefaultLanguage
ApiKey = ReleaseApiKey
@ -44,6 +46,7 @@ func (s *Sub) Init() {
AgentId = ReleaseAgentId
SnId = ReleaseSnId
}
InitGameControlTemplate()
}
type EnterReq struct {

@ -12,6 +12,7 @@ import (
"server/modules/web/providers/base"
"server/util"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
@ -641,10 +642,11 @@ func Control(uid int, controlId int) error {
SnAccount: SnAccount,
Time: time.Now().Unix(),
},
ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)),
ControlId: controlId,
Sn: SnId,
AgentId: AgentId,
ThirdName: call.GetProviderUserName(fmt.Sprintf("%d", uid)),
ControlId: controlId,
Sn: SnId,
AgentId: AgentId,
TemplateId: DefaultTemplateId,
Data: []struct {
TargetRtp int `json:"target_rtp"`
}{
@ -673,3 +675,38 @@ func Control(uid int, controlId int) error {
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"
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"
TestDefaultLanguage = "en"
TestAgentId = 320
@ -46,6 +49,8 @@ var (
API = ""
APICreate = ""
APIControl = ""
APIGameControlTemplate = ""
DefaultTemplateId = ""
SnAccount, DefaultLanguage, ApiKey, WalletKey, ControlKey string
AgentId, SnId int
)

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

Loading…
Cancel
Save