周卡活动

dev
mofangmin 1 year ago
parent 8ab04ca908
commit 967cc8bbfa
  1. 16
      call/activity.go
  2. 4
      call/item.go
  3. 6
      call/pay.go
  4. 19
      common/activity.go
  5. 4
      common/config.go
  6. 900
      common/excel.go
  7. 3
      common/player.go
  8. 127
      modules/backend/handler/notice/broadcast.go
  9. 121
      modules/backend/handler/notice/notice.go
  10. 2
      modules/backend/migrate.go
  11. 1
      modules/backend/routers/routers.go
  12. 21
      modules/backend/routers/routiers_notice.go
  13. 48
      modules/backend/values/notice.go
  14. 88
      modules/web/handler/activity.go
  15. 69
      modules/web/handler/recharge.go
  16. 1
      modules/web/handler/withdraw.go
  17. 1
      modules/web/middleware/token.go
  18. 16
      modules/web/values/activity.go
  19. 5
      modules/web/values/pay.go
  20. 51
      util/util.go

@ -100,8 +100,22 @@ func ShouldShowActivityFirstRechargeBack(uid int) bool {
if uid == 0 {
return true
}
now := time.Now().Unix()
conf := GetConfigActivityFirstRechargeBack()
p, _ := GetUserXInfo(uid, "birth")
data := GetUserFirstRechargeBackData(uid)
return data.RewardTime == 0
val := int64(0)
if data.RechargeTime > 0 {
rechargeInfo := GetRechargeInfo(uid)
val = data.Amount - GetUserCurrencyTotal(uid, common.CurrencyINR) + rechargeInfo.TotalWithdrawing
if val < 0 {
val = 0
}
}
if now >= p.Birth+conf.CD && val == 0 || data.RewardTime > 0 {
return false
}
return true
}
func UploadActivityData(uid, activityID, t int, amount int64) {

@ -35,6 +35,6 @@ func GetUserBestDiscountTicket(uid int) *common.PlayerItems {
return nil
}
func AddUserDiscountTicket(uid, exi1 int) {
db.Mysql().Create(&common.PlayerItems{UID: uid, ItemID: common.ItemDiscountTicket, Time: time.Now().Unix(), Status: common.ItemStatusNormal, Exi1: exi1})
func AddUserDiscountTicket(uid int, exi1, exi2 int64) {
db.Mysql().Create(&common.PlayerItems{UID: uid, ItemID: common.ItemDiscountTicket, Time: time.Now().Unix(), Status: common.ItemStatusNormal, Exi1: exi1, Exi2: exi2})
}

@ -540,7 +540,7 @@ func ActivityFirstRechargeBack(r *common.RechargeOrder) {
rechargeBackData := GetUserFirstRechargeBackData(r.UID)
now := time.Now().Unix()
// 注册多少时间内
if p.Birth+conf.CD <= now {
if now <= p.Birth+conf.CD {
if rechargeBackData.Amount == 0 {
data := &common.ActivityFirstRechargeBackData{UID: r.UID, Amount: r.Amount}
if r.Amount >= conf.MinRecharge {
@ -549,7 +549,7 @@ func ActivityFirstRechargeBack(r *common.RechargeOrder) {
db.Mysql().Create(data)
} else {
update := map[string]interface{}{
"amount": gorm.Expr("amount + ?"),
"amount": gorm.Expr("amount + ?", r.Amount),
}
if rechargeBackData.Amount+r.Amount >= conf.MinRecharge {
update["recharge_time"] = time.Now().Unix()
@ -627,7 +627,7 @@ func ActivityWeekCard(r *common.RechargeOrder, product *common.ConfigPayProduct)
return
}
rows, err := db.Mysql().UpdateRes(&common.ActivityWeekCardData{UID: r.UID}, map[string]interface{}{
"recharge_time": time.Now().Unix()})
"recharge_time": time.Now().Unix(), "day": 0, "recharge_amount": r.Amount})
if err != nil || rows == 0 {
log.Error("err:%v", err)
return

@ -307,8 +307,10 @@ func (c *ConfigActivityBreakGift) TableName() string {
type ConfigActivityWeekCard struct {
ID int `gorm:"primarykey"`
MiniLimit int64 `gorm:"column:mini_limit;type:bigint(20);default:0;comment:下限" web:"mini_limit"` // 下限
RewardAmount int64 `gorm:"column:reward_amount;type:bigint(20);default:0;comment:前六天奖励金额" web:"reward_amount"` // 前六天奖励金额
DayOneReward int64 `gorm:"column:day_one_reward;type:bigint(20);default:0;comment:第一天奖励" web:"day_one_reward"` // 下限
MiniLimit int64 `gorm:"column:mini_limit;type:bigint(20);default:0;comment:下限" web:"mini_limit"` // 下限
RewardAmount int64 `gorm:"column:reward_amount;type:bigint(20);default:0;comment:第二到第6天奖励金额" web:"reward_amount"` // 第二到第6天奖励金额
Discount int64 `gorm:"column:discount;type:bigint(20);default:0;comment:第二到第6天奖励金额" web:"discount"` // 满减券折扣
}
func (c *ConfigActivityWeekCard) TableName() string {
@ -320,12 +322,13 @@ const (
)
type ActivityWeekCardData struct {
ID int `gorm:"primarykey"`
UID int `gorm:"column:uid;type:int(11);uniqueIndex:ul"`
Rewards string `gorm:"column:rewards;type:varchar(256);comment:前六天领取奖励"`
Day int `gorm:"column:day;type:int(11);default:0;comment:已经领取天数"`
LastDraw int64 `gorm:"column:last_draw;type:bigint(20);default:0;comment:上次领取时间"`
RechargeTime int64 `gorm:"column:recharge_time;type:bigint(20);default:0;comment:充值时间"`
ID int `gorm:"primarykey"`
UID int `gorm:"column:uid;type:int(11);uniqueIndex:ul"`
Rewards string `gorm:"column:rewards;type:varchar(256);comment:前5天领取奖励"`
Day int `gorm:"column:day;type:int(11);default:0;comment:已经领取天数"`
LastDraw int64 `gorm:"column:last_draw;type:bigint(20);default:0;comment:上次领取时间"`
RechargeTime int64 `gorm:"column:recharge_time;type:bigint(20);default:0;comment:充值时间"`
RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20);default:0;comment:充值金额"`
}
func (c *ActivityWeekCardData) TableName() string {

@ -584,9 +584,9 @@ type ConfigActivityBetDraw struct {
Cost int64 `gorm:"column:cost;type:int(11);default:0;comment:消耗幸运值" web:"cost"`
Reward int64 `gorm:"column:reward;type:bigint(20);comment:奖励" web:"reward"`
Weight int64 `gorm:"column:weight;type:bigint(20);comment:权重" web:"weight"`
VipUnlock int `gorm:"column:vip_unlock;type:int(11);comment:vip解锁等级" web:"vipUnlock"`
VipUnlock int `gorm:"column:vip_unlock;type:int(11);comment:vip解锁等级" web:"vip_unlock"`
Cd int64 `gorm:"column:cd;type:bigint(20);comment:冷却时间" web:"cd"`
LimitNum int `gorm:"column:limit_num;type:int(11);comment:每日领取次数" web:"limitNum"`
LimitNum int `gorm:"column:limit_num;type:int(11);comment:每日领取次数" web:"limit_num"`
}
func (c *ConfigActivityBetDraw) TableName() string {

@ -0,0 +1,900 @@
package common
import (
"encoding/json"
"fmt"
)
// SheetRoomConfig 房间通用结构
type SheetRoomConfig struct {
GameID int `json:"GameID" redis:"GameID" table:"game_id"`
RoomID int `json:"RoomID" redis:"RoomID" table:"room_id"`
RoomName string `json:"RoomName" redis:"RoomName" table:"room_name"`
RoomType int `json:"RoomType" redis:"RoomType" table:"room_type"`
MinPlayer int `json:"MinPlayer" redis:"MinPlayer" table:"min_players"`
MaxPlayer int `json:"MaxPlayer" redis:"MaxPlayer" table:"max_players"`
StartTime int `json:"StartTime" redis:"StartTime" table:"start_time"`
IsOpen bool `json:"IsOpen" redis:"IsOpen" table:"is_open"`
BootRecharge int `json:"BootRecharge" redis:"BootRecharge" table:"boot_recharge"`
CurrenyType CurrencyType `json:"CurrenyType" redis:"CurrenyType" table:"currency_type"`
CarryInitialValue int64 `json:"CarryInitial" redis:"CarryInitial" table:"carry_initial_value"`
Boot int `json:"Boot" redis:"Boot" table:"boot"`
TurnTime int `json:"TurnTime" redis:"TurnTime" table:"turn_time"`
MinTakeIn int64 `json:"MinTakeIn" redis:"MinTakeIn" table:"min_buyin"`
MaxTakeIn int64 `json:"MaxTakeIn" redis:"MaxTakeIn" table:"max_buyin"`
MaxBlinds int `json:"MaxBlinds" redis:"MaxBlinds" table:"max_blinds"`
TurnLimit int `json:"TurnLimit" redis:"TurnLimit" table:"turn_limit"`
ChaalLimit int `json:"ChaalLimit" redis:"ChaalLimit" table:"chaal_limit"`
PotLimit int64 `json:"PotLimit" redis:"PotLimit" table:"pot_limit"`
IsCharge bool `json:"IsCharge" redis:"IsCharge" table:"is_charge"`
ChargeType int `json:"ChargeType" redis:"ChargeType" table:"charge_type"`
ChargeMode int `json:"ChargeMode" redis:"ChargeMode" table:"charge_mode"`
Charge int64 `json:"Charge" redis:"Charge" table:"charge"`
PlayTime int `json:"PlayTime" redis:"PlayTime" table:"playing_time"`
BetTime int `json:"BetTime" redis:"BetTime" table:"bet_time"`
LotteryTime int `json:"LotteryTime" redis:"LotteryTime" table:"lottery_time"`
BetNumAmount []int `json:"BetNumAmount" redis:"BetNumAmount" table:"betnum_amount"`
BetAmount [][]int `json:"BetAmount" redis:"BetAmount" table:"bet_amount"`
BetLimit []int64 `json:"BetLimit" redis:"BetLimit" table:"bet_limit"`
BetOdds []int `json:"BetOdds" redis:"BetOdds" table:"bet_odds"`
BetMin int64 `json:"BetMin" redis:"BetMin" table:"bet_min"` // 最低下注限制
ChangePer []int `json:"ChangePer" redis:"ChangePer" table:"change_pr"`
}
func (s *SheetRoomConfig) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetRoomConfig) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
type GameRoomConfig interface {
MinTake() int
MaxTake() int
Open() bool
}
type SheetTP_Config struct {
RoomName string `gorm:"column:room_name;type:varchar(32);comment:房间名称" json:"RoomName" redis:"room_name" table:"room_name"`
RoomID int `gorm:"column:room_id;type:int(11);comment:房间id" json:"RoomID" redis:"room_id" table:"room_id"`
RoomType int `gorm:"column:room_type;type:int(11);comment:房间类型 1现金场 2练习场" json:"RoomType" redis:"room_type" table:"room_type"`
MinPlayerCount int `gorm:"column:min_players;type:int(11);comment:玩牌人数下限" json:"MinPlayerCount" redis:"min_players" table:"min_players"`
MaxPlayerCount int `gorm:"column:max_players;type:int(11);comment:玩牌人数上限" json:"MaxPlayerCount" redis:"max_players" table:"max_players"`
StartTime int `gorm:"column:start_time;type:int(11);comment:开局时长" json:"StartTime" redis:"start_time" table:"start_time"`
IsOpen bool `gorm:"column:is_open;type:int(11);comment:是否开启 0关闭 1开启" json:"IsOpen" redis:"is_open" table:"is_open"`
BootRecharge int `gorm:"column:boot_recharge;type:int(11);comment:推荐充值" json:"BootRecharge" redis:"boot_recharge" table:"boot_recharge"`
CurrenyType CurrencyType `gorm:"column:currency_type;type:int(11);comment:货币类型 1金币 2筹码" json:"CurrenyType" json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `gorm:"column:carry_initial_value;type:int(11);comment:初始携带货币" json:"CarryInitialValue" redis:"carry_initial_value" table:"carry_initial_value"`
Boot int `gorm:"column:boot;type:int(11);comment:底注" json:"Boot" redis:"boot" table:"boot"`
TurnTime int `gorm:"column:turn_time;type:int(11);comment:操作时长" json:"TurnTime" redis:"turn_time" table:"turn_time"`
MinTakeIn int `gorm:"column:min_buyin;type:int(11);comment:入场下限" json:"MinTakeIn" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `gorm:"column:max_buyin;type:int(11);comment:入场上限" json:"MaxTakeIn" redis:"max_buyin" table:"max_buyin"`
MaxBlinds int `gorm:"column:max_blinds;type:int(11);comment:盲注轮数" json:"MaxBlinds" redis:"max_blinds" table:"max_blinds"`
TurnLimit int `gorm:"column:turn_limit;type:int(11);comment:轮数上限" json:"TurnLimit" redis:"turn_limit" table:"turn_limit"`
ChaalLimit int `gorm:"column:chaal_limit;type:int(11);comment:加注上限" json:"ChaalLimit" redis:"chaal_limit" table:"chaal_limit"`
PotLimit int `gorm:"column:pot_limit;type:int(11);comment:奖池上限" json:"PotLimit" redis:"pot_limit" table:"pot_limit"`
IsCharge int `gorm:"column:is_charge;type:int(11);comment:是否抽水 0不抽 1抽" json:"IsCharge" redis:"is_charge" table:"is_charge"`
ChargeType int `gorm:"column:charge_type;type:int(11);comment:抽水类型 1赢家 2全体" json:"ChargeType" redis:"charge_type" table:"charge_type"`
ChargeMode int `gorm:"column:charge_mode;type:int(11);comment:抽水方式 1百分比 2固定" json:"ChargeMode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `gorm:"column:charge;type:int(11);comment:抽水金额" json:"ChargeAmount" redis:"charge" table:"charge"`
}
func (s *SheetTP_Config) TableName() string {
return "game_teenpatti_config"
}
func (s *SheetTP_Config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetTP_Config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetTP_Config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetTP_Config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetTP_Config) Open() bool {
return s.IsOpen
}
type SheetRummy_config struct {
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
StartTime int `json:"start_time" redis:"start_time" table:"start_time"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
Boot int `json:"boot" redis:"boot" table:"boot"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxBlinds int `json:"max_blinds" redis:"max_blinds" table:"max_blinds"`
TurnLimit int `json:"turn_limit" redis:"turn_limit" table:"turn_limit"`
ChaalLimit int `json:"chaal_limit" redis:"chaal_limit" table:"chaal_limit"`
PotLimit int `json:"pot_limit" redis:"pot_limit" table:"pot_limit"`
// TurnTime int `json:"turn_time" redis:"turn_time" table:"turn_time"`
TouchTime int `json:"touch_time" redis:"touch_time" table:"touch_time"`
PlayTime int `json:"playing_time" redis:"playing_time" table:"playing_time"`
CarryAmount int `json:"carry_amount" redis:"carry_amount" table:"carry_amount"`
IsCharge int `json:"is_charge" redis:"is_charge" table:"is_charge"`
ChargeType int `json:"charge_type" redis:"charge_type" table:"charge_type"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
}
func (s *SheetRummy_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetRummy_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetRummy_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetRummy_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetRummy_config) Open() bool {
return s.IsOpen
}
type SheetDvt_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"`
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
PKTime int `json:"pk_time" redis:"pk_time" table:"pk_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *SheetDvt_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetDvt_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetDvt_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetDvt_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetDvt_config) Open() bool {
return s.IsOpen
}
type Sheet7up7down_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"`
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
LotteryTime int `json:"lottery_time" redis:"lottery_time" table:"lottery_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *Sheet7up7down_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *Sheet7up7down_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *Sheet7up7down_config) MinTake() int {
return s.MinTakeIn
}
func (s *Sheet7up7down_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *Sheet7up7down_config) Open() bool {
return s.IsOpen
}
type SheetAndar_bahar_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"` // 扩大100倍运算
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
LotteryTime int `json:"lottery_time" redis:"lottery_time" table:"lottery_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *SheetAndar_bahar_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetAndar_bahar_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetAndar_bahar_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetAndar_bahar_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetAndar_bahar_config) Open() bool {
return s.IsOpen
}
type SheetJhandi_Munda_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"` // 房间名称
BetOdds [][]int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"` // 投注赔率
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"` // 投注上限
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"` // 投注金额
GameID int `json:"game_id" redis:"game_id" table:"game_id"` // 游戏id
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"` // 计量方式
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"` // 货币类型
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"` // 初始携带货币
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"` // 入场下限货币
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"` // 入场上限货币
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"` // 玩牌人数上限
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"` // 推荐充值
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"` // 投注时长
LotteryTime int `json:"lottery_time" redis:"lottery_time" table:"lottery_time"` // 开奖时长
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"` // 玩牌人数下限
RoomType int `json:"room_type" redis:"room_type" table:"room_type"` // 房间类型
RoomID int `json:"room_id" redis:"room_id" table:"room_id"` // 房间id
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"` // 抽水方式
ChargeAmount int `json:"charge" redis:"charge" table:"charge"` // 抽水金额
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"` // 是否开启
Dice1 int `json:"dice1" redis:"dice1" table:"dice1"` // 骰子1 概率
Dice2 int `json:"dice2" redis:"dice2" table:"dice2"` // 骰子2 概率
}
func (s *SheetJhandi_Munda_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetJhandi_Munda_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetJhandi_Munda_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetJhandi_Munda_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetJhandi_Munda_config) Open() bool {
return s.IsOpen
}
type SheetHorse_Racing_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
// BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"` // 扩大100倍运算
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
RacingTime int `json:"racing_time" redis:"racing_time" table:"racing_time"`
SettlementTime int `json:"settlement_time" redis:"settlement_time" table:"settlement_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *SheetHorse_Racing_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetHorse_Racing_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetHorse_Racing_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetHorse_Racing_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetHorse_Racing_config) Open() bool {
return s.IsOpen
}
type SheetFruit_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"` // 扩大100倍运算
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
ChangePer []int `json:"change_pr" redis:"change_pr" table:"change_pr"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
LotteryTime int `json:"lottery_time" redis:"lottery_time" table:"lottery_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *SheetFruit_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetFruit_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetFruit_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetFruit_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetFruit_config) Open() bool {
return s.IsOpen
}
type SheetCar_config struct {
BetMin int64 `json:"bet_min" redis:"bet_min" table:"bet_min"` // 最低下注限制
RoomName string `json:"room_name" redis:"room_name" table:"room_name"`
Poker []int `json:"poker" redis:"poker" table:"poker"`
BetOdds []int `json:"bet_odds" redis:"bet_odds" table:"bet_odds"` // 扩大100倍运算
BetLimit []int64 `json:"bet_limit" redis:"bet_limit" table:"bet_limit"`
ChangePer []int `json:"change_pr" redis:"change_pr" table:"change_pr"`
BetAmount []int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
MeterageMode int `json:"meterage_mode" redis:"meterage_mode" table:"meterage_mode"`
CurrenyType CurrencyType `json:"currency_type" redis:"currency_type" table:"currency_type"`
CarryInitialValue int64 `json:"carry_initial_value" redis:"carry_initial_value" table:"carry_initial_value"`
MinTakeIn int `json:"min_buyin" redis:"min_buyin" table:"min_buyin"`
MaxTakeIn int `json:"max_buyin" redis:"max_buyin" table:"max_buyin"`
MaxPlayerCount int `json:"max_players" redis:"max_players" table:"max_players"`
PokerNumber int `json:"poker_number" redis:"poker_number" table:"poker_number"`
BootRecharge int `json:"boot_recharge" redis:"boot_recharge" table:"boot_recharge"`
BetTime int `json:"bet_time" redis:"bet_time" table:"bet_time"`
LotteryTime int `json:"lottery_time" redis:"lottery_time" table:"lottery_time"`
MinPlayerCount int `json:"min_players" redis:"min_players" table:"min_players"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"`
ChargeAmount int `json:"charge" redis:"charge" table:"charge"`
IsOpen bool `json:"is_open" redis:"is_open" table:"is_open"`
}
func (s *SheetCar_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetCar_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
func (s *SheetCar_config) MinTake() int {
return s.MinTakeIn
}
func (s *SheetCar_config) MaxTake() int {
return s.MaxTakeIn
}
func (s *SheetCar_config) Open() bool {
return s.IsOpen
}
// SheetTp_robot_ai_config
type SheetTp_robot_ai_config struct {
RandomTime []int `json:"random_time" redis:"random_time" table:"random_time"`
ID int `json:"serial" redis:"serial" table:"serial"`
GameResult bool `json:"game_result" redis:"game_result" table:"game_result"` // 输赢
TypeID int `json:"type_id" redis:"type_id" table:"type_id"` // 方案id
PlayerLower int `json:"player_lower" redis:"player_lower" table:"player_lower"`
PlayerUpper int `json:"player_upper" redis:"player_upper" table:"player_upper"`
PokerType int `json:"poker_type" redis:"poker_type" table:"poker_type"`
PokerColor int `json:"poker_color" redis:"poker_color" table:"poker_color"`
Poker1Lower int `json:"poker1_lower" redis:"poker1_lower" table:"poker1_lower"`
Poker1Upper int `json:"poker1_upper" redis:"poker1_upper" table:"poker1_upper"`
Poker2Lower int `json:"poker2_lower" redis:"poker2_lower" table:"poker2_lower"`
Poker2Upper int `json:"poker2_upper" redis:"poker2_upper" table:"poker2_upper"`
Poker3Lower int `json:"poker3_lower" redis:"poker3_lower" table:"poker3_lower"`
Poker3Upper int `json:"poker3_upper" redis:"poker3_upper" table:"poker3_upper"`
JackpotLower float64 `json:"jackpot_lower" redis:"jackpot_lower" table:"jackpot_lower"`
JackpotUpper float64 `json:"jackpot_upper" redis:"jackpot_upper" table:"jackpot_upper"`
RoundLower int `json:"round_lower" redis:"round_lower" table:"round_lower"`
RoundUpper int `json:"round_upper" redis:"round_upper" table:"round_upper"`
MultiplesLower int `json:"multiples_lower" redis:"multiples_lower" table:"multiples_lower"`
MultiplesUpper int `json:"multiples_upper" redis:"multiples_upper" table:"multiples_upper"`
IfSideShow int `json:"if_side_show" redis:"if_side_show" table:"if_side_show"`
IfShow int `json:"if_show" redis:"if_show" table:"if_show"`
ActionType int `json:"action_type" redis:"action_type" table:"action_type"`
SeeStatus int `json:"see_status" redis:"see_status" table:"see_status"`
PackPr float64 `json:"pack_pr" redis:"pack_pr" table:"pack_pr"`
SeePr float64 `json:"see_pr" redis:"see_pr" table:"see_pr"`
BlindPr float64 `json:"blind_pr" redis:"blind_pr" table:"blind_pr"`
DoubleBlindPr float64 `json:"double_blind_pr" redis:"double_blind_pr" table:"double_blind_pr"`
ChaalPr float64 `json:"chaal_pr" redis:"chaal_pr" table:"chaal_pr"`
DoubleChaalPr float64 `json:"double_chaal_pr" redis:"double_chaal_pr" table:"double_chaal_pr"`
SideShowPr float64 `json:"side_show_pr" redis:"side_show_pr" table:"side_show_pr"`
BeSideShowPr float64 `json:"beside_show_pr" redis:"beside_show_pr" table:"beside_show_pr"` // 接受比牌概率
ShowPr float64 `json:"show_pr" redis:"show_pr" table:"show_pr"`
}
func (s *SheetTp_robot_ai_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetTp_robot_ai_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetMillionRobotConfig 百人场机器人通用结构
type SheetMillionRobotConfig struct {
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
Group int `json:"group_number" redis:"group_number" table:"group_number"` // 分组号
Period [][]int `json:"incoming_period" redis:"incoming_period" table:"incoming_period"` // 入局时段
Serial int `json:"serial" redis:"serial" table:"sserial"`
LastResult int `json:"last_result" redis:"last_result" table:"last_result"` // 上局结果
ContinuityResult []int `json:"continuity_result" redis:"continuity_result" table:"continuity_result"` // 连开局数
// PlayerBet [][]int `json:"player_bet" redis:"player_bet" table:"player_bet"` // 玩家投注
BetArea []int `json:"bet_region" redis:"bet_region" table:"bet_region"` // 投注区域
BetAmount int `json:"bet_amount" redis:"bet_amount" table:"bet_amount"` // 投注额度
BetNumber int `json:"bet_number" redis:"bet_number" table:"bet_number"` // 投注次数
Interval int `json:"interval_duration" redis:"interval_duration" table:"interval_duration"` // 间隔时长(s)
}
func (s *SheetMillionRobotConfig) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetMillionRobotConfig) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetRobot_config
type SheetRobot_config struct {
Name string `json:"name" redis:"name" table:"name"`
UID int `json:"uid" redis:"uid"`
ID int `json:"robot_uid" redis:"robot_uid" table:"robot_uid"`
Gold int64 `json:"gold" redis:"gold" table:"gold"`
Avatar int `json:"head" redis:"head" table:"head"`
Group int `json:"group_number" redis:"group_number"`
}
func (s *SheetRobot_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetRobot_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetRobot_play_config
type SheetRobot_play_config struct {
GameID int `json:"game_id" redis:"game_id" table:"game_id"` // gameID
Group int `json:"group_number" redis:"group_number" table:"group_number"` // 分组号
RoomID int `json:"room_id" redis:"room_id" table:"room_id"` // room_id
RoomType int `json:"room_type" redis:"room_type" table:"room_type"` // room_type
ID int `json:"robot_uid" redis:"robot_uid" table:"robot_uid"` // id
IfCharge int `json:"if_charge" redis:"if_charge" table:"if_charge"` // 是否抽水
ChargeType int `json:"charge_type" redis:"charge_type" table:"charge_type"` // 昵称
ChargeMode int `json:"charge_mode" redis:"charge_mode" table:"charge_mode"` // 抽水方式,1百分比2固定值,0无
ChargeAmount int `json:"charge" redis:"charge" table:"charge"` // 抽水金额
}
func (s *SheetRobot_play_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetRobot_play_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetWithdraw_amount_config
type SheetWithdraw_amount_config struct {
ID int `json:"amount_id" redis:"amount_id" table:"amount_id"` // id
Method int `json:"withdrawal_method" redis:"withdrawal_method" table:"withdrawal_method"` // 提现方式 1UPI 2Bank 3UPI+Bank
Amount int `json:"withdrawal_amount" redis:"withdrawal_amount" table:"withdrawal_amount"`
ServiceCharge int `json:"service_charge" redis:"service_charge" table:"service_charge"`
PayGold int64 `json:"pay_gold" redis:"pay_gold" table:"pay_gold"`
ReceiptType int `json:"receipt_type" redis:"receipt_type" table:"receipt_type"` // 到账类型 1实时 2延时
}
func (s *SheetWithdraw_amount_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetWithdraw_amount_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetWithdraw_condition_config
type SheetWithdraw_condition_config struct {
ID int `json:"serial" redis:"serial" table:"serial"` // id
Type int `json:"type" redis:"type" table:"type"` // 提现类型 1免费 2额外
WithdrawTimes int `json:"withdrawal_times" redis:"withdrawal_times" table:"withdrawal_times"` // 提现次数(天)
Combination int `json:"combination" redis:"combination" table:"combination"` // 条件组合 1同时 2任一
Event1 int `json:"event_1" redis:"event_1" table:"event_1"` // 1玩牌 2充值 3登录
LiftingTimes1 int `json:"lifting_times_1" redis:"lifting_times_1" table:"lifting_times_1"` // 满足条件可提现次数
SubClassEvent1 int `json:"subclass_event_1" redis:"subclass_event_1" table:"subclass_event_1"` // 达成事件 1金额 2次数 3局数
Cycle1 int `json:"cycle_1" redis:"cycle_1" table:"cycle_1"` // 1天数 —1无限制 0无
EventTarget1 int `json:"event_target_1" redis:"event_target_1" table:"event_target_1"` // 达成事件数量 -1任意 0无
Event2 int `json:"event_2" redis:"event_2" table:"event_2"` // 1玩牌 2充值 3登录
LiftingTimes2 int `json:"lifting_times_2" redis:"lifting_times_2" table:"lifting_times_2"` // 满足条件可提现次数
SubClassEvent2 int `json:"subclass_event_2" redis:"subclass_event_2" table:"subclass_event_2"` // 达成事件 1金额 2次数 3局数
Cycle2 int `json:"cycle_2" redis:"cycle_2" table:"cycle_2"` // 1天数 —1无限制 0无
EventTarget2 int `json:"event_target_2" redis:"event_target_2" table:"event_target_2"` // 达成事件数量 -1任意 0无
}
func (s *SheetWithdraw_condition_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetWithdraw_condition_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetGoods_config
type SheetGoods_config struct {
Describe string `json:"describe" redis:"describe" table:"describe"`
Name1 string `json:"goods_name_1" redis:"goods_name_1" table:"goods_name_1"`
Name2 string `json:"goods_name_2" redis:"goods_name_2" table:"goods_name_2"`
ResourcePicture string `json:"resource_picture" redis:"resource_picture" table:"resource_picture"`
ID int `json:"goods_id" redis:"goods_id" table:"goods_id"`
EffectiveTime int `json:"effective_time" redis:"effective_time" table:"effective_time"`
Type int `json:"type" redis:"type" table:"type"`
EffectiveDays int `json:"effective_days" redis:"effective_days" table:"effective_days"`
StackLimit int `json:"stack_limit" redis:"stack_limit" table:"stack_limit"`
IfStack bool `json:"if_stack" redis:"if_stack" table:"if_stack"`
IfWithdrawal bool `json:"if_withdrawal" redis:"if_withdrawal" table:"if_withdrawal"`
IfTrade bool `json:"if_trade" redis:"if_trade" table:"if_trade"`
IfDiscard bool `json:"if_discard" redis:"if_discard" table:"if_discard"`
}
func (s *SheetGoods_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetGoods_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetReport_activity_config
type SheetReport_activity_config struct {
Name1 string `json:"activity_name_1" redis:"activity_name_1" table:"activity_name_1"`
Name2 string `json:"activity_name_2" redis:"activity_name_2" table:"activity_name_2"`
CumulativeDay []int `json:"cumulative_day" redis:"cumulative_day" table:"cumulative_day"`
CumulativeReward [][]GoodsPair `json:"cumulative_reward" redis:"cumulative_reward" table:"cumulative_reward"`
Reward []GoodsPair `json:"reward_check" redis:"reward_check" table:"reward_check"`
Sort int `json:"sort" redis:"sort" table:"sort"`
ID int `json:"activity_id" redis:"activity_id" table:"activity_id"`
LoopNumber int `json:"loop_number" redis:"loop_number" table:"loop_number"`
SignCycle int `json:"sign_cycle" redis:"sign_cycle" table:"sign_cycle"`
CumulativeCycle int `json:"cumulative_cycle" redis:"cumulative_cycle" table:"cumulative_cycle"`
RewardNumber int `json:"reward_number" redis:"reward_number" table:"reward_number"`
IfLoop bool `json:"if_loop" redis:"if_loop" table:"if_loop"`
}
func (s *SheetReport_activity_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetReport_activity_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetMatching_table_config
// match_pr 匹配出现概率
type SheetMatching_table_config struct {
WaittimeRange []int `json:"waittime_range" redis:"waittime_range" table:"waittime_range"`
PlayGold []int `json:"player_gold" redis:"player_gold" table:"player_gold"`
Quantity2 []int `json:"quantity_2" redis:"quantity_2" table:"quantity_2"`
Quantity1 []int `json:"quantity_1" redis:"quantity_1" table:"quantity_1"`
RobotRange []int `json:"robot_range" redis:"robot_range" table:"robot_range"`
EmptyPositionNumber []int `json:"empty_position_number" redis:"empty_position_number" table:"empty_position_number"`
GameID int `json:"game_id" redis:"game_id" table:"game_id"`
Order int `json:"match_table_order" redis:"match_table_order" table:"match_table_order"`
TableState int `json:"table_state" redis:"table_state" table:"table_state"`
ExitCondition1 int `json:"exit_condition_1" redis:"exit_condition_1" table:"exit_condition_1"`
RoomID int `json:"room_id" redis:"room_id" table:"room_id"`
ExitCondition2 int `json:"exit_condition_2" redis:"exit_condition_2" table:"exit_condition_2"`
RoomType int `json:"room_type" redis:"room_type" table:"room_type"`
ExitCondition3 int `json:"exit_condition_3" redis:"exit_condition_3" table:"exit_condition_3"`
Quantity3 []int `json:"quantity_3" redis:"quantity_3" table:"quantity_3"`
MatchType int `json:"type_match" redis:"type_match" table:"type_match"`
MatchPer int `json:"match_pr" redis:"match_pr" table:"match_pr"`
}
func (s *SheetMatching_table_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetMatching_table_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetNoticeConfig mysql表结构
type SheetNoticeConfig struct {
Id int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" redis:"id"`
SheetNotice_config
}
func (s *SheetNoticeConfig) TableName() string {
return fmt.Sprintf("config_sheet_notice")
}
// SheetNotice_config
type SheetNotice_config struct {
Content2 string `json:"notice_content2" redis:"notice_content2" table:"notice_content2"` // 公告内容_2(印地语)
Title1 string `json:"notice_title1" redis:"notice_title1" table:"notice_title1"` // 公告标题_1(英语)
Content1 string `json:"notice_content1" redis:"notice_content1" table:"notice_content1"` // 公告内容_1(英语)
Title2 string `json:"notice_title2" redis:"notice_title2" table:"notice_title2"` // 公告标题_2(印地语)
Type int `json:"notice_type" redis:"notice_type" table:"notice_type"` // 公告类型 (1.紧急 2.常规)
IsRelease int `json:"is_release" redis:"is_release" table:"is_release"` // 是否发布
ReleaseMethod int `json:"release_method" redis:"release_method" table:"release_method"` // 发布方式
ReleaseTime int64 `json:"release_time" redis:"release_time" table:"release_time"` // 发布时间
IsTips int `json:"is_tips" redis:"is_tips" table:"is_tips"` // 是否提示
Interval int `json:"interval_duration" redis:"interval_duration" table:"interval_duration"` // 间隔时常
PushTimes int `json:"push_times" redis:"push_times" table:"push_times"` // 推送次数
}
func (s *SheetNotice_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetNotice_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetBroadcastConfig mysql表结构
type SheetBroadcastConfig struct {
Id int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" redis:"id"`
Content string `json:"radio_news" redis:"radio_news" table:"radio_news"` // 广播消息
Amount string `json:"amount" redis:"amount" table:"amount"` // 数量 eg: 111,222,333 []int 存db时需要字符串,取出来时需要转[]int
DisplayLocation string `json:"display_location" redis:"display_location" table:"display_location"` // 展示位置 eg: 111,222,333 []int 存db时需要字符串,取出来时需要转[]int
RadioId int `json:"radio_id" redis:"radio_id" table:"radio_id"` // 广播ID
Event int `json:"event" redis:"event" table:"event"` // 事件
TargetID int `json:"target_id" redis:"target_id" table:"target_id"` // 目标Id
Type int `json:"type" redis:"type" table:"type"` // 类型
Priority int `json:"priority" redis:"priority" table:"priority"` // 优先级
LoopFrequency int `json:"loop_frequency" redis:"loop_frequency" table:"loop_frequency"` // 循环次数
Interval int `json:"interval_duration" redis:"interval_duration" table:"interval_duration"` // 间隔时常
GenerationType int `json:"generation_type" redis:"generation_type" table:"generation_type"` // 生成类型
IsRelease int `json:"is_release" redis:"is_release" table:"is_release"` // 是否发布
}
func (s *SheetBroadcastConfig) TableName() string {
return fmt.Sprintf("config_sheet_broadcast")
}
// SheetBroadcast_config
type SheetBroadcast_config struct {
Content string `json:"radio_news" redis:"radio_news" table:"radio_news"`
Amount []int `json:"amount" redis:"amount" table:"amount"`
DisplayLocation []int `json:"display_location" redis:"display_location" table:"display_location"`
ID int `json:"radio_id" redis:"radio_id" table:"radio_id"`
Event int `json:"event" redis:"event" table:"event"` // 2登录 3连赢 4赢钱 5活动奖励
TargetID int `json:"target_id" redis:"target_id" table:"target_id"`
Type int `json:"type" redis:"type" table:"type"` // 1玩家局数 2游戏金币 3提现金币
Priority int `json:"priority" redis:"priority" table:"priority"`
LoopFrequency int `json:"loop_frequency" redis:"loop_frequency" table:"loop_frequency"`
Interval int `json:"interval_duration" redis:"interval_duration" table:"interval_duration"`
GenerationType int `json:"generation_type" redis:"generation_type" table:"generation_type"`
IsRelease int `json:"is_release" redis:"is_release" table:"is_release"`
}
func (s *SheetBroadcast_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetBroadcast_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetActivity_config
// type SheetActivity_config struct {
// ResourcePath string `json:"resource_path" redis:"resource_path" table:"resource_path"`
// JumpPosition string `json:"jump_position" redis:"jump_position" table:"jump_position"`
// ID int `json:"activity_id" redis:"activity_id" table:"activity_id"`
// Sort int `json:"sort" redis:"sort" table:"sort"`
// Start int64 `json:"start_date" redis:"start_date" table:"start_date"`
// End int64 `json:"end_date" redis:"end_date" table:"end_date"`
// IsRelease int `json:"is_release" redis:"is_release" table:"is_release"`
// ReleaseMethod int `json:"release_method" redis:"release_method" table:"release_method"`
// ReleaseTime int64 `json:"release_time" redis:"release_time" table:"release_time"`
// ReleasePosition int64 `json:"release_position" redis:"release_position" table:"release_position"`
// PushFrequency int `json:"push_frequency" redis:"push_frequency" table:"push_frequency"`
// Push bool `json:"if_push" redis:"if_push" table:"if_push"`
// }
// func (s *SheetActivity_config) MarshalBinary() ([]byte, error) {
// return json.Marshal(s)
// }
// func (s *SheetActivity_config) UnmarshalBinary(data []byte) error {
// return json.Unmarshal(data, s)
// }
// Expire 判断活动是否可用
// func (s *SheetActivity_config) IsValid() bool {
// now := time.Now().Unix()
// if s.IsRelease == 0 || s.Start > now || (s.End < now && s.End > 0) {
// return false
// }
// return true
// }
// SheetRecharge1_config
type SheetRecharge1_config struct {
ActivityName1 string `json:"activity_name_1" redis:"activity_name_1" table:"activity_name_1"`
ActivityName2 string `json:"activity_name_2" redis:"activity_name_2" table:"activity_name_2"`
CashbackRate string `json:"cashback_rate" redis:"cashback_rate" table:"cashback_rate"`
ID int `json:"activity_id" redis:"activity_id" table:"activity_id"`
FirstRecharge int `json:"first_recharge" redis:"first_recharge" table:"first_recharge"`
GoodsID int `json:"goods_id" redis:"goods_id" table:"goods_id"`
RechargeAmount int `json:"recharge_amount" redis:"recharge_amount" table:"recharge_amount"`
Getcoins1 int `json:"getcoins_1" redis:"getcoins_1" table:"getcoins_1"`
Amount1 int `json:"amount_1" redis:"amount_1" table:"amount_1"`
Getcoins2 int `json:"getcoins_2" redis:"getcoins_2" table:"getcoins_2"`
Amount2 int `json:"amount_2" redis:"amount_2" table:"amount_2"`
CurrencyType int `json:"currency_type" redis:"currency_type" table:"currency_type"`
}
func (s *SheetRecharge1_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetRecharge1_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetChat_config
type SheetChat_config struct {
Type int `json:"chat_type" redis:"chat_type" table:"chat_type"` // 聊天类型
Msg string `json:"chat_message" redis:"chat_message" table:"chat_message"` // 聊天消息
Rate int `json:"probability" redis:"probability" table:"probability"` // 概率
Resource string `json:"resource_path" redis:"resource_path" table:"resource_path"` // 表情资源路径
}
func (s *SheetChat_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetChat_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetHelp_config
type SheetHelp_config struct {
GameID int `json:"game_id" redis:"game_id" table:"game_id"` // 游戏ID
Languages int `json:"languages" redis:"languages" table:"languages"` // 聊天消息
ContentEG string `json:"play_help_eg" redis:"play_help_eg" table:"play_help_eg"` // 玩法帮助英语
ContentHI string `json:"play_help_hi" redis:"play_help_hi" table:"play_help_hi"` // 玩法帮助印地语
IfDisplay bool `json:"if_display" redis:"if_display" table:"if_display"` // 是否显示
}
func (s *SheetHelp_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetHelp_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// SheetChange_config 百人场机器人投注逻辑
type SheetChange_config struct {
GameID int `json:"game_id" redis:"game_id" table:"game_id"` // 游戏ID
RoomID int `json:"room_id" redis:"room_id" table:"room_id"` // 房间ID
ChangePer []int `json:"change_pr" redis:"change_pr" table:"change_pr"` // 下注区域数量权重
PlacePer []int `json:"place_pr" redis:"place_pr" table:"place_pr"` // 下注区域权重
TimePer []int `json:"time_pr" redis:"time_pr" table:"time_pr"` // 下注时间分配
}
func (s *SheetChange_config) MarshalBinary() ([]byte, error) {
return json.Marshal(s)
}
func (s *SheetChange_config) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, s)
}
// GoodsPair 物品id,数量对
type GoodsPair struct {
ID int // 物品id
Value int64 // 数量
Rate int // 获得概率
}

@ -174,7 +174,8 @@ type PlayerItems struct {
ItemID int `gorm:"column:item_id;default:0;comment:物品id"`
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:获得的时间"`
Status int `gorm:"column:status;type:int(11);default:0;comment:物品状态"`
Exi1 int `gorm:"column:exi1;type:int(11);default:0;comment:物品标识字段1"`
Exi1 int64 `gorm:"column:exi1;type:bigint(20);default:0;comment:物品标识字段1"`
Exi2 int64 `gorm:"column:exi2;type:bigint(20);default:0;comment:物品标识字段2"`
}
func (p *PlayerItems) TableName() string {

@ -0,0 +1,127 @@
package notice
import (
"server/call"
"server/common"
"server/db"
"server/modules/backend/app"
"server/modules/backend/values"
"server/natsClient"
"server/pb"
"github.com/gin-gonic/gin"
"github.com/liangdas/mqant/log"
)
// 添加广播
func AddBroadcast(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.AddAddBroadcastReq)
if !a.S(req) {
return
}
if len(req.List) <= 0 {
a.Code = values.CodeParam
return
}
err := db.Mysql().C().Model(&common.SheetBroadcastConfig{}).CreateInBatches(&req.List, len(req.List)).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeRetry
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadBroadcast})
if err != nil {
log.Error(err.Error())
}
}
// 获取广播
func GetBroadcast(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.GetBroadcastReq)
if !a.S(req) {
return
}
var SheetBroadcastConfig []common.SheetBroadcastConfig
_, err := db.Mysql().QueryAll("", "", &common.SheetBroadcastConfig{}, &SheetBroadcastConfig)
if err != nil {
log.Error(err.Error())
a.Code = values.CodeRetry
return
}
a.Data = SheetBroadcastConfig
}
// 编辑广播
func EditBroadcast(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.EditBroadcastReq)
if !a.S(req) {
a.Code = values.CodeParam
return
}
err := db.Mysql().C().Model(&common.SheetBroadcastConfig{}).Where("id = ?", req.Id).Updates(map[string]interface{}{
"content": req.Broadcast.Content,
"amount": req.Broadcast.Amount,
"display_location": req.Broadcast.DisplayLocation,
"event": req.Broadcast.Event,
"radio_id": req.Broadcast.RadioId,
"target_id": req.Broadcast.TargetID,
"type": req.Broadcast.Type,
"priority": req.Broadcast.Priority,
"loop_frequency": req.Broadcast.LoopFrequency,
"interval": req.Broadcast.Interval,
"generation_type": req.Broadcast.GenerationType,
"is_release": req.Broadcast.IsRelease,
}).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeParam
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadBroadcast})
if err != nil {
log.Error(err.Error())
}
}
// 删除广播
func DeleteBroadcast(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.DeleteBroadcastReq)
if !a.S(req) {
return
}
err := db.Mysql().C().Where("id = ?", req.Id).Unscoped().Delete(&common.SheetBroadcastConfig{}).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeParam
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadBroadcast})
if err != nil {
log.Error(err.Error())
}
}

@ -0,0 +1,121 @@
package notice
import (
"server/call"
"server/common"
"server/db"
"server/modules/backend/app"
"server/modules/backend/values"
"server/natsClient"
"server/pb"
"time"
"github.com/gin-gonic/gin"
"github.com/liangdas/mqant/log"
)
// 系统公告配置
func AddSystemNotice(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.AddSystemNoticeReq)
if !a.S(req) {
return
}
if len(req.List) <= 0 {
a.Code = values.CodeParam
return
}
for i := 0; i < len(req.List); i++ {
if req.List[i].ReleaseTime == 0 {
req.List[i].ReleaseTime = time.Now().Unix()
}
}
err := db.Mysql().C().Model(&common.SheetNoticeConfig{}).CreateInBatches(&req.List, len(req.List)).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeRetry
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadNotice})
if err != nil {
log.Error(err.Error())
}
}
// 系统公告配置
func GetSystemNotice(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.GetSystemNoticeReq)
if !a.S(req) {
return
}
var SheetNoticeConfig []common.SheetNoticeConfig
_, err := db.Mysql().QueryAll("", "", &common.SheetNoticeConfig{}, &SheetNoticeConfig)
if err != nil {
log.Error(err.Error())
a.Code = values.CodeRetry
return
}
a.Data = SheetNoticeConfig
}
// 编辑系统公告
func EditSystemNotice(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.EditSystemNoticeReq)
if !a.S(req) {
a.Code = values.CodeParam
return
}
err := db.Mysql().C().Where("id = ?", req.Id).Save(req.Notice).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeParam
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadNotice})
if err != nil {
log.Error(err.Error())
}
}
// 删除系统公告
func DeleteSystemNotice(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.DeleteSystemNoticeReq)
if !a.S(req) {
return
}
err := db.Mysql().C().Where("id = ?", req.Id).Unscoped().Delete(&common.SheetNoticeConfig{}).Error
if err != nil {
log.Error(err.Error())
a.Code = values.CodeParam
return
}
err = call.Publish(natsClient.TopicReloadConfig, &pb.ReloadGameConfig{Type: common.ReloadNotice})
if err != nil {
log.Error(err.Error())
}
}

@ -114,6 +114,8 @@ func MigrateDB() {
new(common.ConfigActivityBetDraw),
new(common.ActivityBetDrawData),
new(common.ConfigActivityPopup),
new(common.SheetBroadcastConfig),
new(common.SheetNoticeConfig),
)
if err != nil {
panic("Migrate db fail")

@ -45,5 +45,6 @@ func SetUpRouter() *gin.Engine {
blockpay(r)
output(r)
firstPage(r)
notice(r)
return r
}

@ -0,0 +1,21 @@
package routers
import (
handler "server/modules/backend/handler/notice"
"github.com/gin-gonic/gin"
)
func notice(e *gin.Engine) {
// 公告请求
e.POST("/sys/notice/add", handler.AddSystemNotice)
e.POST("/sys/notice/get", handler.GetSystemNotice)
e.POST("/sys/notice/edit", handler.EditSystemNotice)
e.POST("/sys/notice/delete", handler.DeleteSystemNotice)
// 广播请求
e.POST("/sys/broadcast/add", handler.AddBroadcast)
e.POST("/sys/broadcast/get", handler.GetBroadcast)
e.POST("/sys/broadcast/edit", handler.EditBroadcast)
e.POST("/sys/broadcast/delete", handler.DeleteBroadcast)
}

@ -0,0 +1,48 @@
package values
import "server/common"
// AddSystemNoticeReq 添加系统公告
type AddSystemNoticeReq struct {
List []common.SheetNoticeConfig
}
// GetSystemNoticeReq 获取系统公告
type GetSystemNoticeReq struct {
}
// GetSystemNoticeResp 获取系统公告
type GetSystemNoticeResp struct {
List []common.SheetNoticeConfig
}
// EditSystemNoticeReq 编辑公告
type EditSystemNoticeReq struct {
Id int64 `json:"Id" binding:"required"`
Notice common.SheetNoticeConfig
}
// DeleteSystemNoticeReq 删除公告
type DeleteSystemNoticeReq struct {
Id int64 `json:"Id" binding:"required"` // 公告id
}
// AddAddBroadcastReq 添加广播
type AddAddBroadcastReq struct {
List []common.SheetBroadcastConfig
}
// GetBroadcastReq 获取广播
type GetBroadcastReq struct {
}
// EditBroadcastReq 编辑广播
type EditBroadcastReq struct {
Id int64 `json:"Id" binding:"required"`
Broadcast common.SheetBroadcastConfig
}
// DeleteBroadcastReq 删除广播
type DeleteBroadcastReq struct {
Id int64 `json:"Id" binding:"required"` // id
}

@ -639,29 +639,31 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) {
resp.NeedRechargeAmount = conf.MinRecharge
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDFirstRechargeBack)
resp.Recharge = data.Amount
resp.PayAmount = data.Amount
resp.BackPer = conf.MaxBack
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR)
p, _ := call.GetUserXInfo(a.UID, "birth")
resp.DrawTime = p.Birth + conf.CD
rechargeInfo := call.GetRechargeInfo(a.UID)
if data.RechargeTime == 0 {
resp.CanRecharge = true
return
}
if data.RewardTime > 0 {
resp.Draw = true
}
val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR)
val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR) - rechargeInfo.WithdrawingCash
if val < 0 {
val = 0
}
val = val * conf.MaxBack / 100
now := time.Now().Unix()
p, _ := call.GetUserXInfo(a.UID, "birth")
if p.Birth+conf.CD >= now {
db.Mysql().Update(&common.ActivityFirstRechargeBackData{UID: a.UID}, map[string]interface{}{
"reward": val,
})
}
if data.RewardTime > 0 && val > 0 {
resp.Draw = true
}
resp.Back = val
resp.DrawTime = p.Birth + conf.CD
}
func ActivityFirstRechargeBackDraw(c *gin.Context) {
@ -674,17 +676,22 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) {
}
conf := call.GetConfigActivityFirstRechargeBack()
data := call.GetUserFirstRechargeBackData(a.UID)
if time.Now().Unix()-data.RechargeTime < common.ActivityFirstRechargeBackTime {
if time.Now().Unix()-data.RechargeTime < conf.CD {
log.Error("not ActivityFirstRechargeBackDraw time:%+v", data)
a.Code = values.CodeRetry
return
}
if data.RewardTime > 0 {
a.Code = values.CodeRetry
a.Msg = "Award claimed"
return
}
rows, err := db.Mysql().UpdateRes(&common.ActivityFirstRechargeBackData{UID: a.UID}, map[string]interface{}{"reward_time": time.Now().Unix()})
if err != nil || rows == 0 {
a.Code = values.CodeRetry
return
}
val := data.Reward * conf.MaxBack / 100
val := data.Reward
_, err = call.UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: a.UID,
@ -1263,31 +1270,48 @@ func ActivityWeekCardInfo(c *gin.Context) {
defer func() {
a.Response()
}()
a.GetUID()
if !a.CheckActivityExpire(common.ActivityIDWeekCard) {
return
}
resp := &values.ActivityWeekCardInfoResp{}
a.Data = resp
cons := call.GetConfigActivityWeekCard()
cardInfo := call.GetUserWeekCard(a.UID)
cardInfo := new(common.ActivityWeekCardData)
if a.UID > 0 {
cardInfo = call.GetUserWeekCard(a.UID)
}
var rewardList []int64
var err error
if cardInfo.ID <= 0 {
rewardList, err := util.GenerateSequence(cons.RewardAmount, cons.MiniLimit)
cardInfo.Day = 0
rewardList, err = util.GenerateSequence(cons.RewardAmount, cons.MiniLimit)
if err != nil {
log.Error("err:%v", err)
}
if len(rewardList) == 6 {
rewardList = append(rewardList, 0)
}
resp.RewardList = rewardList
rewardList = append([]int64{cons.DayOneReward}, rewardList...)
rewardList = append(rewardList, 0)
cardInfo.Rewards = strings.Join(util.Int64SliceToStringSlice(rewardList), ",")
db.Mysql().Create(cardInfo)
if a.UID > 0 {
db.Mysql().Create(cardInfo)
}
}
if resp.RewardList == nil {
resp.RewardList, _ = util.StringToInt64Slice(cardInfo.Rewards, ",")
if rewardList == nil {
rewardList, _ = util.StringToInt64Slice(cardInfo.Rewards, ",")
}
for _, item := range rewardList {
resp.RewardList = append(resp.RewardList, values.WeekCardInfo{
Min: cons.MiniLimit,
Max: cons.RewardAmount,
Val: item,
})
}
if !util.IsSameDayTimeStamp(time.Now().Unix(), cardInfo.LastDraw) {
resp.Status = true
}
if cardInfo.RechargeTime != 0 {
resp.RechargeStatus = true
}
resp.RewardDay = cardInfo.Day
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR)
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDWeekCard)
@ -1305,6 +1329,7 @@ func ActivityWeekCardDraw(c *gin.Context) {
if !a.S(req) {
return
}
conf := call.GetConfigActivityWeekCard()
card := call.GetUserWeekCard(a.UID)
if card.ID == 0 {
a.Code = values.CodeRetry
@ -1329,6 +1354,31 @@ func ActivityWeekCardDraw(c *gin.Context) {
reward = rewards[card.Day] * common.DecimalDigits
} else {
// 第几天折扣券
// 用户画像一:6天内充值3笔及以上用户
// 推送当前最高额度向上一档充值满减卷
// 用户画像二:只解锁周卡,未充值的玩家
// 推送当前额度向下一档充值满减卷,最低300
q := elastic.NewBoolQuery()
q.Filter(elastic.NewRangeQuery("time").Gte(card.RechargeTime))
q.Filter(elastic.NewRangeQuery("time").Lte(now))
q.Filter(elastic.NewRangeQuery("event").Gte(common.CurrencyEventReCharge))
q.Must(elastic.NewTermsQuery("uid", a.UID))
count := db.ES().Count(common.ESIndexBalance, q)
up := false
if count >= 3 {
up = true
}
exi2 := int64(300) * common.DecimalDigits
// 判断充值的金额
productList := call.GetConfigPayProduct()
for _, product := range productList {
if product.Amount > card.RechargeAmount && up && exi2 < product.Amount {
exi2 = product.Amount
} else if product.Amount < card.RechargeAmount && up && exi2 > product.Amount {
exi2 = product.Amount
}
}
call.AddUserDiscountTicket(a.UID, conf.Discount, exi2)
}
resp := &values.ActivityWeekCardDrawResp{
@ -1673,7 +1723,7 @@ func ActivitySevenDayBoxDraw(c *gin.Context) {
call.UploadActivityData(a.UID, common.ActivityIDSevenDayBox, common.ActivityDataJoin, reward)
}
if oneDiscount.Discount > 0 {
call.AddUserDiscountTicket(a.UID, oneDiscount.Discount)
// call.AddUserDiscountTicket(a.UID, oneDiscount.Discount)
resp.Discount = oneDiscount.Discount
}
}
@ -1777,7 +1827,7 @@ func ActivitySuperDraw(c *gin.Context) {
})
call.UploadActivityData(a.UID, common.ActivityIDSuper, 2, reward.Reward)
} else {
call.AddUserDiscountTicket(a.UID, int(reward.Reward))
// call.AddUserDiscountTicket(a.UID, int(reward.Reward))
}
a.Data = &values.ActivitySuperDrawResp{
Reward: values.ActivitySuperOneReward{

@ -1,6 +1,7 @@
package handler
import (
"encoding/json"
"fmt"
"server/call"
"server/config"
@ -90,7 +91,7 @@ func RechargeInfo(c *gin.Context) {
if a.UID > 0 {
// 判断是否有折扣券
tickets := call.GetUserValidItems(a.UID, common.ItemDiscountTicket)
discount := 0
discount := int64(0)
for _, v := range tickets {
thisDiscount := v.Exi1
diff := v.Time + common.ActivityWeekCardTicketExpireTime - time.Now().Unix()
@ -103,12 +104,12 @@ func RechargeInfo(c *gin.Context) {
}
if discount < thisDiscount {
discount = thisDiscount
resp.DiscountTicket = &values.DiscountTicket{
resp.DiscountTicket = append(resp.DiscountTicket, &values.DiscountTicket{
// Level: con.Level,
Discount: fmt.Sprintf("%d", 100-discount),
TimeLeft: diff,
// Range: ,
}
Amount: v.Exi2,
})
// 折扣券
// con := call.GetConfigActivityWeekCardByLevel(1)
// if con != nil {
@ -253,39 +254,37 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
ProductID: req.ProductID,
}
// 只有商城购买才能使用优惠券
// ticketCon := call.GetConfigActivityWeekCardByLevel(1)
if req.ProductID == 0 {
// 首先判断折扣券
// if ticketCon != nil && len(ticketCon.SubRange) == 2 {
// if req.Amount >= ticketCon.SubRange[0] && req.Amount <= ticketCon.SubRange[1] {
// discount := -1
// var ticket *common.PlayerItems
// // 判断是否有折扣券
// tickets := call.GetUserValidItems(uid, common.ItemDiscountTicket)
// for i, v := range tickets {
// thisDiscount := v.Exi1
// diff := v.Time + common.ActivityWeekCardTicketExpireTime - time.Now().Unix()
// if diff <= 0 {
// id := v.ID
// util.Go(func() {
// db.Mysql().Update(&common.PlayerItems{ID: id}, map[string]interface{}{"status": common.ItemStatusInvalid})
// })
// continue
// }
// if discount < 0 || thisDiscount < discount {
// discount = thisDiscount
// ticket = tickets[i]
// }
// }
// if discount > 0 {
// ticketData := common.ActivityRechargeData{ID: common.ItemDiscountTicket, I1: ticket.Exi1, I2: req.Amount}
// ticketByte, _ := json.Marshal(ticketData)
// order.Extra = string(ticketByte)
// req.Amount = common.RoundCurrency(common.CurrencyINR, req.Amount*int64(discount)/100)
// order.Amount = req.Amount
// }
// }
// }
var ticket *common.PlayerItems
discount := int64(-1)
exi2 := int64(0)
// 判断是否有折扣券
tickets := call.GetUserValidItems(uid, common.ItemDiscountTicket)
for i, v := range tickets {
thisDiscount := v.Exi1
diff := v.Time + common.ActivityWeekCardTicketExpireTime - time.Now().Unix()
if diff <= 0 {
id := v.ID
util.Go(func() {
db.Mysql().Update(&common.PlayerItems{ID: id}, map[string]interface{}{"status": common.ItemStatusInvalid})
})
continue
}
if discount < 0 || thisDiscount < discount {
discount = thisDiscount
ticket = tickets[i]
exi2 = v.Exi2
}
}
if discount > 0 && order.Amount == exi2 && ticket != nil {
ticketData := common.ActivityRechargeData{ID: common.ItemDiscountTicket, I1: int(ticket.Exi1), I2: req.Amount}
ticketByte, _ := json.Marshal(ticketData)
order.Extra = string(ticketByte)
req.Amount = common.RoundCurrency(common.CurrencyINR, req.Amount*discount/common.DecimalDigits)
order.Amount = req.Amount
}
}
re := call.GetRechargeInfo(uid)
notCharge := re.TotalRecharge == 0

@ -305,6 +305,7 @@ func PlayerWithdraw(c *gin.Context) {
if need > has {
log.Error("err not enough cash:%v,%v", has, need)
a.Code = values.CodeWithdrawNotEnough
a.Msg = "not enough cash"
return
}

@ -57,6 +57,7 @@ var (
"/activity/activityPopup/info": {},
"/customer/image/download": {},
"/activity/firstRechargeBack/info": {},
"/activity/weekCard/info": {},
}
)

@ -137,12 +137,18 @@ type OneWeekCard struct {
TotalReward int64
}
type WeekCardInfo struct {
Min int64
Val int64
Max int64
}
type ActivityWeekCardInfoResp struct {
RewardList []int64 // 奖励列表
RewardDay int // 领取天数
Status bool // 是否可领取
ChannelList []*common.ConfigPayChannels
ProductList []*common.ConfigPayProduct
RewardList []WeekCardInfo // 奖励列表
RewardDay int // 领取天数
Status bool // 是否可领取
RechargeStatus bool // 是否充值
ChannelList []*common.ConfigPayChannels
ProductList []*common.ConfigPayProduct
}
// Level 领取的周卡的等级

@ -25,14 +25,13 @@ type RechargeInfoResp struct {
ConfigPayBonus []OneConfigPayBonus
Tips string
SelectID int
DiscountTicket *DiscountTicket
DiscountTicket []*DiscountTicket
}
type DiscountTicket struct {
Level int
Discount string
TimeLeft int64
Range []int64
Amount int64
}
// RechargeReq 充值请求 地址格式为:{"city":"Mumbai","street":"sarang street","houseNumber":"-54/a"}

@ -11,7 +11,6 @@ import (
"os"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"
@ -995,49 +994,31 @@ func StringToInt64Slice(s, sep string) ([]int64, error) {
}
// 通过总数Count分成一个递增数列
func GenerateSequence(totalSum, minValue int64) ([]int64, error) {
length := 6
func GenerateSequence(N, M int64) ([]int64, error) {
length := int64(5)
// 初步生成递增数列 [minValue, minValue+1, ..., minValue+5]
// 初步生成一个递增数列 [M, M+1, ..., M+5]
sequence := make([]int64, length)
for i := 0; i < length; i++ {
sequence[i] = minValue + int64(i)
for i := int64(0); i < length; i++ {
sequence[i] = M + i
}
// 计算初步数列的总和
sumInitial := (2*minValue + int64(length-1)) * int64(length) / 2
// 计算初步生成数列的总和
sumInitial := (2*M + length - 1) * length / 2
// 如果初步数列的总和已经大于 totalSum,则无法生成
if sumInitial > totalSum {
return nil, fmt.Errorf("cannot generate a sequence with the given totalSum and minValue")
// 如果初步生成数列的总和已经大于 N,则无法生成
if sumInitial > N {
return nil, fmt.Errorf("无法生成满足条件的数列")
}
// 计算剩余需要分配的值
remaining := totalSum - sumInitial
// 设置随机种子
rand.Seed(time.Now().UnixNano())
// 平均分配剩余的值,同时减少极端情况的出现
for remaining > 0 {
// 每次迭代从头到尾随机增量分配,减少单个元素过度增长
for i := 0; i < length && remaining > 0; i++ {
// 确保递增,计算可能的最大增量
maxIncrement := remaining / int64(length-i)
if i > 0 && sequence[i] <= sequence[i-1] {
maxIncrement = sequence[i-1] - sequence[i] + 1
}
remaining := N - sumInitial
// 随机选择增量
if maxIncrement > 0 {
randIncrement := rand.Int63n(maxIncrement + 1)
sequence[i] += randIncrement
remaining -= randIncrement
}
}
// 将剩余的值均匀分配到数列中,从后往前加值,保持递增
for i := length - 1; i >= 0 && remaining > 0; i-- {
sequence[i] += remaining
remaining = 0
}
sort.Slice(sequence, func(i, j int) bool {
return sequence[i] < sequence[j]
})
return sequence, nil
}

Loading…
Cancel
Save