diff --git a/call/activity.go b/call/activity.go index 7aa6441..9459728 100644 --- a/call/activity.go +++ b/call/activity.go @@ -101,14 +101,18 @@ func ShouldShowActivityFirstRechargeBack(uid int) bool { return true } now := time.Now().Unix() + conf := GetConfigActivityFirstRechargeBack() + p, _ := GetUserXInfo(uid, "birth") data := GetUserFirstRechargeBackData(uid) - if data.RechargeTime == 0 { - return true - } - if now-data.RechargeTime > 2*common.ActivityFirstRechargeBackTime { - return false + 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-data.RechargeTime > common.ActivityFirstRechargeBackTime && data.Lost == 0 { + if now >= p.Birth+conf.CD && val == 0 || data.RewardTime > 0 { return false } return true @@ -137,18 +141,12 @@ func ShouldShowActivitySign(uid int) bool { return now-birth <= 6*common.OneDay } -func GetUserWeekCard(uid, level int) *common.ActivityWeekCardData { - data := &common.ActivityWeekCardData{UID: uid, Level: level} +func GetUserWeekCard(uid int) *common.ActivityWeekCardData { + data := &common.ActivityWeekCardData{UID: uid} db.Mysql().Get(data) return data } -func GetUserWeekCards(uid int) []*common.ActivityWeekCardData { - list := []*common.ActivityWeekCardData{} - db.Mysql().QueryAll(fmt.Sprintf("uid = %d", uid), "", &common.ActivityWeekCardData{}, &list) - return list -} - func ShouldShowActivityWeekCard(uid int) bool { if !IsActivityValid(common.ActivityIDWeekCard) { return false @@ -156,12 +154,6 @@ func ShouldShowActivityWeekCard(uid int) bool { if uid == 0 { return true } - cards := GetUserWeekCards(uid) - for _, v := range cards { - if v.Day > 0 { - return false - } - } return true } diff --git a/call/config.go b/call/config.go index 6948aea..d9556bb 100644 --- a/call/config.go +++ b/call/config.go @@ -55,7 +55,7 @@ var ( configActivitySign []*common.ConfigActivitySign configActivityBreakGift []*common.ConfigActivityBreakGift configShareRobot []*common.ConfigShareRobot - configActivityWeekCard []*common.ConfigActivityWeekCard + configActivityWeekCard *common.ConfigActivityWeekCard configActivitySlots []*common.ConfigActivitySlots configActivityLuckyShop []*common.ConfigActivityLuckyShop configServerFlag []*common.ConfigServerFlag @@ -358,6 +358,18 @@ func LoadConfigPayChannels() (err error) { return nil } +// GetConfigPayChannelsByID 获取支付渠道配置 +func GetConfigPayChannelsByID(currencyType common.CurrencyType) []*common.ConfigPayChannels { + ret := []*common.ConfigPayChannels{} + for i, v := range ConfigPayChannels { + if v.PayPer <= 0 || v.CurrencyType != currencyType { + continue + } + ret = append(ret, ConfigPayChannels[i]) + } + return ret +} + // GetConfigPayChannels 获取代收渠道配置 func GetConfigPayChannels() []*common.ConfigPayChannels { ret := []*common.ConfigPayChannels{} @@ -1341,36 +1353,18 @@ func GetConfigShareRobotByID(robotID int) *common.ConfigShareRobot { } func LoadConfigActivityWeekCard() (err error) { - list := []*common.ConfigActivityWeekCard{} - if _, err = db.Mysql().QueryAll("", "level", &common.ConfigActivityWeekCard{}, &list); err != nil { - log.Error("err:%v", err) + one := new(common.ConfigActivityWeekCard) + if err := db.Mysql().Get(one); err != nil { return err } - for _, v := range list { - if len(v.Range) > 0 { - err := json.Unmarshal([]byte(v.Range), &v.SubRange) - if err != nil { - log.Error("err:%v", err) - } - } - } - configActivityWeekCard = list + configActivityWeekCard = one return nil } -func GetConfigActivityWeekCard() []*common.ConfigActivityWeekCard { +func GetConfigActivityWeekCard() *common.ConfigActivityWeekCard { return configActivityWeekCard } -func GetConfigActivityWeekCardByLevel(level int) *common.ConfigActivityWeekCard { - for _, v := range configActivityWeekCard { - if v.Level == level { - return v - } - } - return nil -} - func LoadConfigActivitySlots() (err error) { list := []*common.ConfigActivitySlots{} if _, err = db.Mysql().QueryAll("", "rank_down", &common.ConfigActivitySlots{}, &list); err != nil { diff --git a/call/item.go b/call/item.go index e16a2f1..5e2dd57 100644 --- a/call/item.go +++ b/call/item.go @@ -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}) } diff --git a/call/pay.go b/call/pay.go index 2067b0d..0eb59e4 100644 --- a/call/pay.go +++ b/call/pay.go @@ -534,14 +534,33 @@ func PayActivity(r *common.RechargeOrder, notCharge bool, user *common.PlayerDBI } func ActivityFirstRechargeBack(r *common.RechargeOrder) { - now := time.Now().Unix() if IsActivityValid(common.ActivityIDFirstRechargeBack) { + conf := GetConfigActivityFirstRechargeBack() + p, _ := GetUserXInfo(r.UID, "birth") rechargeBackData := GetUserFirstRechargeBackData(r.UID) - if rechargeBackData.RechargeTime == 0 { - db.Mysql().Create(&common.ActivityFirstRechargeBackData{UID: r.UID, RechargeTime: time.Now().Unix(), Amount: r.Amount}) - } else if now-rechargeBackData.RechargeTime < common.ActivityFirstRechargeBackTime { - db.Mysql().Update(&common.ActivityFirstRechargeBackData{UID: r.UID}, map[string]interface{}{"amount": gorm.Expr("amount + ?", r.Amount)}) + now := time.Now().Unix() + // 注册多少时间内 + if now <= p.Birth+conf.CD { + if rechargeBackData.Amount == 0 { + data := &common.ActivityFirstRechargeBackData{UID: r.UID, Amount: r.Amount} + if r.Amount >= conf.MinRecharge { + data.RechargeTime = now + } + db.Mysql().Create(data) + } else { + update := map[string]interface{}{ + "amount": gorm.Expr("amount + ?", r.Amount), + } + if rechargeBackData.Amount+r.Amount >= conf.MinRecharge { + update["recharge_time"] = time.Now().Unix() + } + err := db.Mysql().Update(&common.ActivityFirstRechargeBackData{UID: r.UID}, update) + if err != nil { + log.Error("err:%v", err) + } + } } + } } @@ -603,34 +622,15 @@ func ActivityBreakGift(r *common.RechargeOrder, product *common.ConfigPayProduct } func ActivityWeekCard(r *common.RechargeOrder, product *common.ConfigPayProduct) { - level := product.Exi - card := GetUserWeekCard(r.UID, level) - con := GetConfigActivityWeekCardByLevel(level) + con := GetConfigActivityWeekCard() if con == nil { return } - if card.ID == 0 { - err := db.Mysql().Create(&common.ActivityWeekCardData{ - UID: r.UID, - Level: level, - DayReward: con.DayReward, - Day: con.Day, - // LastDraw: time.Now().Unix(), - }) - if err != nil { - return - } - } else { - if card.Day > 0 { - return - } - rows, err := db.Mysql().UpdateResW(&common.ActivityWeekCardData{}, map[string]interface{}{ - "day": con.Day, "day_reward": con.DayReward, "get_discount": 0, "last_draw": 0}, - fmt.Sprintf("uid = %d and level = %d and day = 0", r.UID, level)) - if err != nil || rows == 0 { - log.Error("err:%v", err) - return - } + rows, err := db.Mysql().UpdateRes(&common.ActivityWeekCardData{UID: r.UID}, map[string]interface{}{ + "recharge_time": time.Now().Unix(), "day": 0, "recharge_amount": r.Amount, "rewards": ""}) + if err != nil || rows == 0 { + log.Error("err:%v", err) + return } // ok UpdateCurrencyPro(&common.UpdateCurrency{ diff --git a/cmd/build.sh b/cmd/build.sh index 61a7d07..4b29610 100644 --- a/cmd/build.sh +++ b/cmd/build.sh @@ -8,4 +8,4 @@ cd pb/proto # go generate cd ../.. #go build main.go -CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gameserver main.go \ No newline at end of file +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o indiaprovider main.go \ No newline at end of file diff --git a/common/activity.go b/common/activity.go index 9c6ee7e..450787a 100644 --- a/common/activity.go +++ b/common/activity.go @@ -1,6 +1,9 @@ package common import ( + "database/sql/driver" + "encoding/json" + "errors" "time" ) @@ -198,7 +201,8 @@ const ( type ConfigActivityFirstRechargeBack struct { ID int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"ID"` MinRecharge int64 `gorm:"column:min_recharge;type:bigint(20);default:10000000000;comment:最低充值额度" web:"min_recharge"` - MaxBack int64 `gorm:"column:max_back;type:bigint(20);default:-1;comment:最大返还额度" web:"max_back"` + MaxBack int64 `gorm:"column:max_back;type:bigint(20);default:0;comment:最大返还额度比例" web:"max_back"` + CD int64 `gorm:"column:cd;type:bigint(20);default:0;comment:持续时间" web:"cd"` } func (c *ConfigActivityFirstRechargeBack) TableName() string { @@ -209,7 +213,8 @@ type ActivityFirstRechargeBackData struct { UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"` RechargeTime int64 `gorm:"column:recharge_time;type:bigint(20);default:0;comment:首次充值时间"` Amount int64 `gorm:"column:amount;type:bigint(20);default:0;comment:总充值金额"` - Lost int64 `gorm:"column:lost;type:bigint(20);default:0;comment:活动时间内总损失"` + Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:给定金额"` + RewardTime int64 `gorm:"column:reward_time;type:bigint(20);default:0;comment:领取时间"` } func (c *ActivityFirstRechargeBackData) TableName() string { @@ -301,16 +306,11 @@ func (c *ConfigActivityBreakGift) TableName() string { } type ConfigActivityWeekCard struct { - ID int `gorm:"primarykey"` - Level int `gorm:"column:level;type:int(11);default:1;comment:等级" web:"level"` - ProductID int `gorm:"column:product_id;type:int(11);default:0;comment:商品id" web:"product_id"` - DayReward int64 `gorm:"column:day_reward;type:bigint(11);default:700000000;comment:每日可领取奖励" web:"day_reward"` - OriginPrice int64 `gorm:"column:origin_price;type:bigint(11);default:5000000000;comment:显示的原价" web:"origin_price"` - Day int `gorm:"column:day;type:int(11);default:6;comment:可领取天数" web:"day"` - Discount int `gorm:"column:discount;type:int(11);default:70;comment:折扣率,百分位" web:"discount"` - Rebate int `gorm:"column:rebate;type:int(11);default:240;comment:返利率,百分位" web:"rebate"` - Range string `gorm:"column:range;default:'[2000000000,100000000000]';type:varchar(255);comment:充值可用范围"` - SubRange []int64 `gorm:"-" json:"-"` + ID int `gorm:"primarykey"` + 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 { @@ -322,13 +322,13 @@ const ( ) type ActivityWeekCardData struct { - ID int `gorm:"primarykey"` - UID int `gorm:"column:uid;type:int(11);uniqueIndex:ul"` - Level int `gorm:"column:level;type:int(11);default:0;uniqueIndex:ul;comment:周卡等级"` - DayReward int64 `gorm:"column:day_reward;type:bigint(11);default:700000000;comment:每日可领取奖励"` - Day int `gorm:"column:day;type:int(11);default:6;comment:可领取天数"` - LastDraw int64 `gorm:"column:last_draw;type:bigint(20);default:0;comment:上次领取时间"` - GetDiscount int `gorm:"column:get_discount;type:tinyint(4);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 { @@ -492,10 +492,39 @@ func (c *ActivitySuperData) TableName() string { return "activity_super_data" } +type LuckyData struct { + LastSpinTime int64 + SpinNum int + NextSpinTIme int64 + SpinCount int // 总次数 +} + +func (m LuckyData) Value() (driver.Value, error) { + return json.Marshal(m) +} + +func (m *LuckyData) Scan(value interface{}) error { + if value == nil { + *m = LuckyData{} + return nil + } + // 将数据库中的 JSON 字符串解析为 map + bytes, ok := value.([]byte) + if !ok { + return errors.New("type assertion to []byte failed") + } + if len(bytes) == 0 { + *m = LuckyData{} + return nil + } + return json.Unmarshal(bytes, &m) +} + type ActivityBetDrawData struct { - ID int `gorm:"primarykey"` - UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"` - Lucky int64 `gorm:"column:lucky;;not null;type:bigint(20);comment:幸运值" web:"lucky"` + ID int `gorm:"primarykey"` + UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"` + Lucky int64 `gorm:"column:lucky;;not null;type:bigint(20);comment:幸运值" web:"lucky"` + SpinInfo LuckyData `gorm:"column:spin_info;;not null;type:varchar(256);comment:转盘信息" web:"spinInfo"` } func (c *ActivityBetDrawData) TableName() string { diff --git a/common/config.go b/common/config.go index dde4b84..151a115 100644 --- a/common/config.go +++ b/common/config.go @@ -579,11 +579,14 @@ func (c *ConfigTgRobot) TableName() string { } type ConfigActivityBetDraw struct { - ID int `gorm:"primarykey"` - Type int `gorm:"column:type;type:int(11);default:0;comment:转盘类型" web:"type"` - 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"` + ID int `gorm:"primarykey"` + Type int `gorm:"column:type;type:int(11);default:0;comment:转盘类型" web:"type"` + 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:"vip_unlock"` + Cd int64 `gorm:"column:cd;type:bigint(20);comment:冷却时间" web:"cd"` + LimitNum int `gorm:"column:limit_num;type:int(11);comment:每日领取次数" web:"limit_num"` } func (c *ConfigActivityBetDraw) TableName() string { diff --git a/common/currency.go b/common/currency.go index c99d194..43e1498 100644 --- a/common/currency.go +++ b/common/currency.go @@ -28,6 +28,7 @@ const ( CurrencyResourceBonus // 额外赠送 CurrencyResourceRechargeBonus // bonus充值 CurrencyResourceFirstRecharge // 首充 + CurrencyResourceWeekCard // 周卡 CurrencyResourceAll ) diff --git a/common/excel.go b/common/excel.go new file mode 100644 index 0000000..20cb5be --- /dev/null +++ b/common/excel.go @@ -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 // 获得概率 +} diff --git a/common/player.go b/common/player.go index fba1ea9..a648ef2 100644 --- a/common/player.go +++ b/common/player.go @@ -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 { diff --git a/modules/backend/handler/common/common.go b/modules/backend/handler/common/common.go index ac0d402..a0851ed 100644 --- a/modules/backend/handler/common/common.go +++ b/modules/backend/handler/common/common.go @@ -133,5 +133,5 @@ func UploadOSS(c *gin.Context) { log.Error("UploadOSS PutObject err:%v", err) return } - rsp.Url = fmt.Sprintf("https://%s/%s%s%d_%s", ossConf.Domain, ossConf.ObjectName, req.Folder, time.Now().Unix(), file.Filename) + rsp.Url = fmt.Sprintf("https://%s/%s%s%d_%s", ossConf.Domain, ossConf.ObjectName, req.Folder, now, file.Filename) } diff --git a/modules/backend/handler/notice/broadcast.go b/modules/backend/handler/notice/broadcast.go new file mode 100644 index 0000000..e605c08 --- /dev/null +++ b/modules/backend/handler/notice/broadcast.go @@ -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()) + } +} diff --git a/modules/backend/handler/notice/notice.go b/modules/backend/handler/notice/notice.go new file mode 100644 index 0000000..e04f685 --- /dev/null +++ b/modules/backend/handler/notice/notice.go @@ -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()) + } +} diff --git a/modules/backend/migrate.go b/modules/backend/migrate.go index b8c8c8a..d0f1e57 100644 --- a/modules/backend/migrate.go +++ b/modules/backend/migrate.go @@ -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") diff --git a/modules/backend/routers/routers.go b/modules/backend/routers/routers.go index 41ae446..5a96736 100644 --- a/modules/backend/routers/routers.go +++ b/modules/backend/routers/routers.go @@ -45,5 +45,6 @@ func SetUpRouter() *gin.Engine { blockpay(r) output(r) firstPage(r) + notice(r) return r } diff --git a/modules/backend/routers/routiers_notice.go b/modules/backend/routers/routiers_notice.go new file mode 100644 index 0000000..a4b4e5b --- /dev/null +++ b/modules/backend/routers/routiers_notice.go @@ -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) +} diff --git a/modules/backend/values/notice.go b/modules/backend/values/notice.go new file mode 100644 index 0000000..1fe46fd --- /dev/null +++ b/modules/backend/values/notice.go @@ -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 +} diff --git a/modules/common/nats.go b/modules/common/nats.go index c7c03a9..85387e3 100644 --- a/modules/common/nats.go +++ b/modules/common/nats.go @@ -34,8 +34,8 @@ func afterSettle(d *pb.InnerAfterSettle) { log.Debug("afterSettle:%+v", *d) UpdateGameData(d) call.ShareSettle(d) - p := &Player{uid: int(d.UID), gid: int(d.GameID), settleData: d} - p.ActivityFirstRechargeBack() + // p := &Player{uid: int(d.UID), gid: int(d.GameID), settleData: d} + // p.ActivityFirstRechargeBack() } func UpdateGameData(d *pb.InnerAfterSettle) { diff --git a/modules/web/app/response.go b/modules/web/app/response.go index 2a3aa3a..778de1b 100644 --- a/modules/web/app/response.go +++ b/modules/web/app/response.go @@ -88,7 +88,6 @@ func (g *Gin) ResponseB() { // Response setting gin.JSON func (g *Gin) Response() { if g.R.Code == values.CodeRetry { - g.R.Msg = "inner error" } else if g.R.Code == values.CodeToken { g.R.Msg = "login expired" } diff --git a/modules/web/handler/activity.go b/modules/web/handler/activity.go index 0200d77..aaa61fd 100644 --- a/modules/web/handler/activity.go +++ b/modules/web/handler/activity.go @@ -12,6 +12,7 @@ import ( "server/pb" "server/util" "sort" + "strings" "time" "github.com/gin-gonic/gin" @@ -574,42 +575,6 @@ func ActivityFreeSpinDraw(c *gin.Context) { resp := &values.ActivityFreeSpinDrawResp{} a.Data = resp - // 首次旋转,给予固定奖励 - // if freeSpin.LastSpin == 0 { - // items := call.GetConfigActivityFreeSpinByType(common.ActivityFreeSpinItemRandomCash) - // if len(items) == 0 { - // a.Code = values.CodeRetry - // return - // } - // err := db.Mysql().Create(&common.ActivityFreeSpinData{UID: a.UID, LastSpin: time.Now().Unix()}) - // if err != nil { - // a.Code = values.CodeRetry - // return - // } - // resp.Reward = config.GetConfig().Web.FreeSpinFirst - // if resp.Reward == 0 { - // resp.Reward = 5 * common.DecimalDigits - // } - // _, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ - // CurrencyBalance: &common.CurrencyBalance{ - // Type: common.CurrencyINR, - // UID: a.UID, - // Event: common.CurrencyEventActivityFreeSpin, - // Value: resp.Reward, - // ChannelID: a.Channel, - // NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, resp.Reward), - // }, - // }) - // if err != nil { - // a.Code = values.CodeRetry - // return - // } - // ran := rand.Intn(len(items)) - // resp.ID = items[ran].ID - // call.UploadActivityData(a.UID, common.ActivityIDFreeSpin, common.ActivityDataJoin, resp.Reward) - // return - // } - con := call.GetConfigActivityFreeSpin() if con == nil { a.Code = values.CodeRetry @@ -663,39 +628,53 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) { defer func() { a.Response() }() + a.GetUID() if !a.CheckActivityExpire(common.ActivityIDFirstRechargeBack) { return } resp := &values.ActivityFirstRechargeBackInfoResp{} + conf := call.GetConfigActivityFirstRechargeBack() a.Data = resp data := call.GetUserFirstRechargeBackData(a.UID) - diff := time.Now().Unix() - data.RechargeTime - log.Debug("ActivityFirstRechargeBackInfo:%+v", data) + resp.NeedRechargeAmount = conf.MinRecharge / common.DecimalDigits + 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 - } else { - if diff > common.ActivityFirstRechargeBackTime*2 { - a.Code = values.CodeActivityExpire - return - } - resp.CanRecharge = diff < common.ActivityFirstRechargeBackTime - } - resp.Recharge = data.Amount - if data.Amount < call.GetConfigActivityFirstRechargeBack().MinRecharge { return } - val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR) - if val < 0 { - val = 0 + if data.Reward == 0 { + 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() + if now >= p.Birth+conf.CD && data.Reward == 0 && data.RechargeTime == 0 { + update := map[string]interface{}{ + "reward": val, + } + if val == 0 { + data.RechargeTime = now + update["reward_time"] = now + } + db.Mysql().Update(&common.ActivityFirstRechargeBackData{UID: a.UID}, update) + } + data.Reward = val } - max := call.GetConfigActivityFirstRechargeBack().MaxBack - if max > 0 && val > max { - val = max + if data.RewardTime > 0 { + resp.Draw = true } - if val > data.Amount { - val = data.Amount + resp.Back = data.Reward + if !resp.Draw { + call.PushRed(a.UID, pb.RedPointModule_RedPointFirstRecharge, 1) } - resp.Back = val } func ActivityFirstRechargeBackDraw(c *gin.Context) { @@ -706,32 +685,28 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) { if !a.CheckActivityExpire(common.ActivityIDFirstRechargeBack) { return } + resp := new(values.ActivityFirstRechargeBackDrawResp) + a.Data = resp + conf := call.GetConfigActivityFirstRechargeBack() data := call.GetUserFirstRechargeBackData(a.UID) - val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR) - if val <= 0 { - return - } - if time.Now().Unix()-data.RechargeTime < common.ActivityFirstRechargeBackTime { + p, _ := call.GetUserXInfo(a.UID, "birth") + if time.Now().Unix()-p.Birth < conf.CD { log.Error("not ActivityFirstRechargeBackDraw time:%+v", data) a.Code = values.CodeRetry + a.Msg = "Unarrived time" return } - if time.Now().Unix()-data.RechargeTime > common.ActivityFirstRechargeBackTime*2 { - a.Code = values.CodeActivityExpire + 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{}{"lost": 0}) + 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 } - max := call.GetConfigActivityFirstRechargeBack().MaxBack - if max > 0 || val > max { - val = max - } - if val > data.Amount { - val = data.Amount - } + val := data.Reward _, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ CurrencyBalance: &common.CurrencyBalance{ UID: a.UID, @@ -745,7 +720,9 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) { a.Code = values.CodeRetry return } + resp.Reward = val call.UploadActivityData(a.UID, common.ActivityIDFirstRechargeBack, common.ActivityDataJoin, val) + call.PushRed(a.UID, pb.RedPointModule_RedPointFirstRecharge, 0) } // 幸运码活动 @@ -1310,44 +1287,75 @@ func ActivityWeekCardInfo(c *gin.Context) { defer func() { a.Response() }() + a.GetUID() if !a.CheckActivityExpire(common.ActivityIDWeekCard) { return } - cons := call.GetConfigActivityWeekCard() - list := call.GetUserWeekCards(a.UID) resp := &values.ActivityWeekCardInfoResp{} a.Data = resp - for _, v := range cons { - product := call.GetConfigPayProductByID(v.ProductID) - if product == nil { - continue - } - one := values.OneWeekCard{ - Level: v.Level, - Rebate: fmt.Sprintf("%d", v.Rebate) + "%", - OriginPrice: v.OriginPrice, - Price: product.Amount, - Reward: product.Value, - DayReward: v.DayReward, - DayCount: v.Day, - Discount: fmt.Sprintf("%d", 100-v.Discount), - Next: -1, - ProductID: v.ProductID, - TotalReward: v.DayReward*int64(v.Day) + product.Value, + cons := call.GetConfigActivityWeekCard() + cardInfo := new(common.ActivityWeekCardData) + if a.UID > 0 { + cardInfo = call.GetUserWeekCard(a.UID) + } + var rewardList []int64 + var err error + rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5) + if err != nil { + log.Error("err:%v", err) + } + rewardList = append([]int64{cons.DayOneReward}, rewardList...) + rewardList = append(rewardList, 0) + + if cardInfo.ID <= 0 || len(cardInfo.Rewards) == 0 { + cardInfo.Day = 0 + rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5) + if err != nil { + log.Error("err:%v", err) } - for _, k := range list { - if k.Level == v.Level && k.Day > 0 { - one.DayReward = k.DayReward - one.Day = k.Day - if !util.IsSameDayTimeStamp(k.LastDraw, time.Now().Unix()) { - one.Next = 0 - } else { - one.Next = util.GetZeroTime(time.Now().AddDate(0, 0, 1)).Unix() - k.LastDraw - } - break + rewardList = append([]int64{cons.DayOneReward}, rewardList...) + rewardList = append(rewardList, 0) + if cardInfo.ID <= 0 { + cardInfo.Rewards = strings.Join(util.Int64SliceToStringSlice(rewardList), ",") + if a.UID > 0 { + db.Mysql().Create(cardInfo) } + } else { + cardInfo.Rewards = strings.Join(util.Int64SliceToStringSlice(rewardList), ",") + db.Mysql().Update(&common.ActivityWeekCardData{UID: a.UID}, map[string]interface{}{ + "rewards": cardInfo.Rewards, + }) + } + } + + if rewardList == nil { + rewardList, _ = util.StringToInt64Slice(cardInfo.Rewards, ",") + } + if cardInfo.RechargeTime != 0 { + resp.RechargeStatus = true + } + // step:签完7天就重置 + if cardInfo.Day >= len(rewardList) { + resp.RechargeStatus = false + } + for _, item := range rewardList { + resp.RewardList = append(resp.RewardList, values.WeekCardInfo{ + Min: cons.MiniLimit, + Max: cons.RewardAmount - cons.MiniLimit*4, + Val: item, + }) + } + resp.Status = true + if config.GetBase().Release { + if util.IsSameDayTimeStamp(time.Now().Unix(), cardInfo.LastDraw) { + resp.Status = false } - resp.List = append(resp.List, one) + } + resp.RewardDay = cardInfo.Day + resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR) + resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDWeekCard) + if resp.Status { + call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1) } } @@ -1363,56 +1371,86 @@ func ActivityWeekCardDraw(c *gin.Context) { if !a.S(req) { return } - card := call.GetUserWeekCard(a.UID, req.Level) + resp := &values.ActivityWeekCardDrawResp{} + a.Data = resp + conf := call.GetConfigActivityWeekCard() + card := call.GetUserWeekCard(a.UID) if card.ID == 0 { a.Code = values.CodeRetry return } - if card.Day <= 0 { - a.Code = values.CodeRetry - return - } now := time.Now().Unix() - if util.IsSameDayTimeStamp(now, card.LastDraw) { + if config.GetBase().Release { + if util.IsSameDayTimeStamp(now, card.LastDraw) { + a.Code = values.CodeRetry + a.Msg = "today has reward" + return + } + } + rewards, _ := util.StringToInt64Slice(card.Rewards, ",") + if card.Day >= len(rewards) { a.Code = values.CodeRetry + a.Msg = "The weekly card has been collected" return } - rows, err := db.Mysql().UpdateRes(&common.ActivityWeekCardData{UID: a.UID, Level: req.Level, Day: card.Day}, - map[string]interface{}{"day": gorm.Expr("day - 1"), "last_draw": now}) + rows, err := db.Mysql().UpdateRes(&common.ActivityWeekCardData{UID: a.UID}, + map[string]interface{}{"day": gorm.Expr("day + 1"), "last_draw": now}) if rows == 0 || err != nil { log.Error("err:%v", err) a.Code = values.CodeRetry return } - resp := &values.ActivityWeekCardDrawResp{ - Reward: card.DayReward, - } - a.Data = resp - call.UpdateCurrencyPro(&common.UpdateCurrency{ - CurrencyBalance: &common.CurrencyBalance{ - UID: a.UID, - Type: common.CurrencyINR, - Value: card.DayReward, - Event: common.CurrencyEventActivityWeekCard, - ChannelID: a.Channel, - NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, card.DayReward), - }, - }) - con := call.GetConfigActivityWeekCardByLevel(card.Level) - if con != nil { - // 最后一天必得一次 - if card.Day == 1 { - call.AddUserDiscountTicket(a.UID, con.Discount) - resp.DiscountTicket = fmt.Sprintf("%d", 100-con.Discount) - } else if card.GetDiscount == 0 { // 未领取过则随机一次 - ran := rand.Intn(card.Day) - if ran == 0 { - db.Mysql().Update(&common.ActivityWeekCardData{UID: a.UID, Level: req.Level}, map[string]interface{}{"get_discount": 1}) - call.AddUserDiscountTicket(a.UID, con.Discount) - resp.DiscountTicket = fmt.Sprintf("%d", 100-con.Discount) + var reward int64 + if card.Day < 6 { + 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.DiscountTicket = conf.Discount + } + resource := common.CurrencyResourceWeekCard + if card.Day > 0 { + resource = common.CurrencyResourceBonus + } + resp.Reward = reward + if reward > 0 { + call.UpdateCurrencyPro(&common.UpdateCurrency{ + CurrencyBalance: &common.CurrencyBalance{ + UID: a.UID, + Type: common.CurrencyINR, + Value: reward, + Event: common.CurrencyEventActivityWeekCard, + ChannelID: a.Channel, + NeedBet: call.GetConfigCurrencyResourceNeedBet(resource, reward), + }, + }) } + call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 0) + } func ActivitySlotsInfo(c *gin.Context) { @@ -1740,7 +1778,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 } } @@ -1844,7 +1882,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{ @@ -1870,18 +1908,34 @@ func ActivityBetDrawInfo(c *gin.Context) { db.Mysql().Create(drawInfo) } } + vipInfo := call.GetVIP(a.UID) + confList := call.GetConfigBetDraw() resp := &values.ActivityBetDrawInfoResp{ - List: call.GetConfigBetDraw(), + List: confList, Lucky: drawInfo.Lucky, } a.Data = resp + now := time.Now() + update := false + if !util.IsSameDayTimeStamp(drawInfo.SpinInfo.LastSpinTime, now.Unix()) { + drawInfo.SpinInfo.SpinNum = 0 + update = true + } + if update && a.UID > 0 { + db.Mysql().Update(&common.ActivityBetDrawData{UID: a.UID}, map[string]interface{}{ + "spin_info": drawInfo.SpinInfo, + }) + } + drawInfo.SpinInfo.SpinCount = confList[0].LimitNum + resp.SpinInfo = append(resp.SpinInfo, drawInfo.SpinInfo) + call.UploadActivityData(a.UID, common.ActivityIDBetDraw, common.ActivityDataClick, 0) for _, item := range resp.List { - if resp.Lucky >= item.Cost { + if resp.Lucky >= item.Cost && vipInfo.Level >= item.VipUnlock && + drawInfo.SpinInfo.SpinNum < drawInfo.SpinInfo.SpinCount && + now.Unix() >= drawInfo.SpinInfo.NextSpinTIme { call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(1)) - break } } - call.UploadActivityData(a.UID, common.ActivityIDBetDraw, common.ActivityDataClick, 0) } func ActivityBetDrawDraw(c *gin.Context) { @@ -1904,6 +1958,19 @@ func ActivityBetDrawDraw(c *gin.Context) { conf := configList[0] drawInfo := common.ActivityBetDrawData{UID: a.UID} db.Mysql().Get(&drawInfo) + now := time.Now() + spinInfo := drawInfo.SpinInfo + // step:判断cd + if spinInfo.LastSpinTime != 0 && spinInfo.NextSpinTIme > now.Unix() { + a.Code = values.CodeRetry + a.Msg = "Unarrived spin time" + return + } + if spinInfo.SpinNum >= conf.LimitNum { + a.Code = values.CodeRetry + a.Msg = "No spin times" + return + } if drawInfo.Lucky < conf.Cost { a.Code = values.CodeRetry a.Msg = "lucky not enough" @@ -1917,8 +1984,14 @@ func ActivityBetDrawDraw(c *gin.Context) { } rewardConf := configList[idx] reward := rewardConf.Reward - err := db.Mysql().Update(&drawInfo, map[string]interface{}{ - "lucky": gorm.Expr("lucky - ?", conf.Cost), + spinInfo.LastSpinTime = time.Now().Unix() + spinInfo.SpinNum += 1 + spinInfo.NextSpinTIme = spinInfo.LastSpinTime + conf.Cd + err := db.Mysql().Update(&common.ActivityBetDrawData{ + UID: a.UID, + }, map[string]interface{}{ + "lucky": gorm.Expr("lucky - ?", conf.Cost), + "spin_info": spinInfo, }) if err != nil { a.Code = values.CodeRetry @@ -1950,14 +2023,8 @@ func ActivityBetDrawDraw(c *gin.Context) { drawInfo = common.ActivityBetDrawData{UID: a.UID} db.Mysql().Get(&drawInfo) - list := call.GetConfigBetDraw() - num := 0 - for _, item := range list { - if drawInfo.Lucky >= item.Cost { - num++ - } - } - call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(num)) + + call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(0)) } func ActivityBetDrawHistory(c *gin.Context) { @@ -1999,3 +2066,39 @@ func ActivityPopup(c *gin.Context) { resp.List = call.GetConfigActivityPopupByType(req.JumpType) } } + +func WeekCardInfo(c *gin.Context) { + a := app.NewApp(c) + defer func() { + a.Response() + }() + req := values.ActivityPopupReq{} + if !a.S(&req) { + return + } + resp := new(values.ActivityPopupResp) + a.Data = resp + if req.JumpType == 0 { + resp.List = call.GetConfigActivityPopup() + } else { + resp.List = call.GetConfigActivityPopupByType(req.JumpType) + } +} + +func WeekCardDraw(c *gin.Context) { + a := app.NewApp(c) + defer func() { + a.Response() + }() + req := values.ActivityPopupReq{} + if !a.S(&req) { + return + } + resp := new(values.ActivityPopupResp) + a.Data = resp + if req.JumpType == 0 { + resp.List = call.GetConfigActivityPopup() + } else { + resp.List = call.GetConfigActivityPopupByType(req.JumpType) + } +} diff --git a/modules/web/handler/recharge.go b/modules/web/handler/recharge.go index 9236950..274b4eb 100644 --- a/modules/web/handler/recharge.go +++ b/modules/web/handler/recharge.go @@ -91,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() @@ -104,21 +104,22 @@ 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: , - } - con := call.GetConfigActivityWeekCardByLevel(1) - if con != nil { - resp.DiscountTicket.Range = con.SubRange - } - if discount > 50 { - resp.DiscountTicket.Level = 1 - } else { - resp.DiscountTicket.Level = 2 - } + Amount: v.Exi2, + }) + // 折扣券 + // con := call.GetConfigActivityWeekCardByLevel(1) + // if con != nil { + // resp.DiscountTicket.Range = con.SubRange + // } + // if discount > 50 { + // resp.DiscountTicket.Level = 1 + // } else { + // resp.DiscountTicket.Level = 2 + // } } } } @@ -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 diff --git a/modules/web/handler/withdraw.go b/modules/web/handler/withdraw.go index 5161605..db21388 100644 --- a/modules/web/handler/withdraw.go +++ b/modules/web/handler/withdraw.go @@ -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 } diff --git a/modules/web/middleware/token.go b/modules/web/middleware/token.go index 120f9c1..68fe599 100644 --- a/modules/web/middleware/token.go +++ b/modules/web/middleware/token.go @@ -15,47 +15,49 @@ import ( var ( passURLs = map[string]struct{}{ - "/firstpage": {}, - "/game/list": {}, - "/sys/config": {}, - "/account/email/code": {}, - "/account/email/regist": {}, - "/account/email/login": {}, - "/account/email/resetPass": {}, - "/account/guestLogin": {}, - "/account/gpLogin": {}, - "/account/fbLogin": {}, - "/account/tokenLogin": {}, - "/account/phoneCode/get": {}, - "/account/phoneCode/verify": {}, - "/account/phoneCode/regist": {}, - "/account/phoneCode/login": {}, - "/share/upload": {}, - "/share/config": {}, - "/game/enter": {}, - "/activity/appSpin/info": {}, - "/activity/pdd/info": {}, - "/account/phone/regist": {}, - "/account/phone/login": {}, - "/account/phone/resetPass": {}, - "/balance/recharge/info": {}, - "/share/info": {}, - "/vip/info": {}, - "/share/reference": {}, - "/share/report": {}, - "/share/transfer": {}, - "/task/info": {}, - "/activity/freeSpin/info": {}, - "/promotions": {}, - "/tg/luckyCode": {}, - "/activity/sign/info": {}, - "/ad/uploadFB": {}, - "/activity/slots/info": {}, - "/activity/sign/new/info": {}, - "/activity/betDraw/info": {}, - "/activity/betDraw/record": {}, - "/activity/activityPopup/info": {}, - "/customer/image/download": {}, + "/firstpage": {}, + "/game/list": {}, + "/sys/config": {}, + "/account/email/code": {}, + "/account/email/regist": {}, + "/account/email/login": {}, + "/account/email/resetPass": {}, + "/account/guestLogin": {}, + "/account/gpLogin": {}, + "/account/fbLogin": {}, + "/account/tokenLogin": {}, + "/account/phoneCode/get": {}, + "/account/phoneCode/verify": {}, + "/account/phoneCode/regist": {}, + "/account/phoneCode/login": {}, + "/share/upload": {}, + "/share/config": {}, + "/game/enter": {}, + "/activity/appSpin/info": {}, + "/activity/pdd/info": {}, + "/account/phone/regist": {}, + "/account/phone/login": {}, + "/account/phone/resetPass": {}, + "/balance/recharge/info": {}, + "/share/info": {}, + "/vip/info": {}, + "/share/reference": {}, + "/share/report": {}, + "/share/transfer": {}, + "/task/info": {}, + "/activity/freeSpin/info": {}, + "/promotions": {}, + "/tg/luckyCode": {}, + "/activity/sign/info": {}, + "/ad/uploadFB": {}, + "/activity/slots/info": {}, + "/activity/sign/new/info": {}, + "/activity/betDraw/info": {}, + "/activity/betDraw/record": {}, + "/activity/activityPopup/info": {}, + "/customer/image/download": {}, + "/activity/firstRechargeBack/info": {}, + "/activity/weekCard/info": {}, } ) diff --git a/modules/web/routers/routers_activity.go b/modules/web/routers/routers_activity.go index 2157cba..9b48aab 100644 --- a/modules/web/routers/routers_activity.go +++ b/modules/web/routers/routers_activity.go @@ -19,8 +19,6 @@ func activity(e *gin.RouterGroup) { e.POST("/activity/pdd/reference", handler.ActivityPddReference) e.POST("/activity/freeSpin/info", handler.ActivityFreeSpinInfo) e.POST("/activity/freeSpin/draw", handler.ActivityFreeSpinDraw) - e.POST("/activity/firstRechargeBack/info", handler.ActivityFirstRechargeBackInfo) - e.POST("/activity/firstRechargeBack/draw", handler.ActivityFirstRechargeBackDraw) e.POST("/activity/luckyCode/info", handler.ActivityLuckyCodeInfo) e.POST("/activity/luckyCode/draw", handler.ActivityLuckyCodeDraw) // e.POST("/activity/sign/info", handler.ActivitySignInfo) @@ -29,8 +27,6 @@ func activity(e *gin.RouterGroup) { e.POST("/activity/sign/new/info", handler.ActivitySignNewInfo) e.POST("/activity/sign/new/draw", handler.ActivitySignNewDraw) e.POST("/activity/breakGift/info", handler.ActivityBreakGiftInfo) - e.POST("/activity/weekCard/info", handler.ActivityWeekCardInfo) - e.POST("/activity/weekCard/draw", handler.ActivityWeekCardDraw) e.POST("/activity/slots/info", handler.ActivitySlotsInfo) e.POST("/activity/slots/draw", handler.ActivitySlotsDraw) e.POST("/activity/slots/drawLast", handler.ActivitySlotsDrawLast) @@ -45,4 +41,9 @@ func activity(e *gin.RouterGroup) { e.POST("/activity/betDraw/record", handler.ActivityBetDrawHistory) // 活动弹窗 e.POST("/activity/activityPopup/info", handler.ActivityPopup) + // 首充返还 + e.POST("/activity/firstRechargeBack/info", handler.ActivityFirstRechargeBackInfo) + e.POST("/activity/firstRechargeBack/draw", handler.ActivityFirstRechargeBackDraw) + e.POST("/activity/weekCard/info", handler.ActivityWeekCardInfo) + e.POST("/activity/weekCard/draw", handler.ActivityWeekCardDraw) } diff --git a/modules/web/values/activity.go b/modules/web/values/activity.go index cd446d8..de5c948 100644 --- a/modules/web/values/activity.go +++ b/modules/web/values/activity.go @@ -44,9 +44,20 @@ type ActivityFreeSpinDrawResp struct { // Recharge 充值总额 // Back 可领取的总额 type ActivityFirstRechargeBackInfoResp struct { - Recharge int64 - Back int64 - CanRecharge bool + Recharge int64 + Back int64 + BackPer int64 + CanRecharge bool + PayAmount int64 // 支付金额 + DrawTime int64 // 领取时间 + Draw bool // 是否领取 + NeedRechargeAmount int64 // + ChannelList []*common.ConfigPayChannels + ProductList []*common.ConfigPayProduct +} + +type ActivityFirstRechargeBackDrawResp struct { + Reward int64 } // ID 物品id @@ -130,8 +141,18 @@ type OneWeekCard struct { TotalReward int64 } +type WeekCardInfo struct { + Min int64 + Val int64 + Max int64 +} type ActivityWeekCardInfoResp struct { - List []OneWeekCard + RewardList []WeekCardInfo // 奖励列表 + RewardDay int // 领取天数 + Status bool // 是否可领取 + RechargeStatus bool // 是否充值 + ChannelList []*common.ConfigPayChannels + ProductList []*common.ConfigPayProduct } // Level 领取的周卡的等级 @@ -143,7 +164,7 @@ type ActivityWeekCardDrawReq struct { // DiscountTicket 获得的折扣券折扣 type ActivityWeekCardDrawResp struct { Reward int64 - DiscountTicket string + DiscountTicket int64 } // Spin 可转次数 @@ -257,8 +278,9 @@ type ActivitySuperDrawResp struct { } type ActivityBetDrawInfoResp struct { - List []*common.ConfigActivityBetDraw // 配置 - Lucky int64 // 幸运值 + List []*common.ConfigActivityBetDraw // 配置 + Lucky int64 // 幸运值 + SpinInfo []common.LuckyData } type ActivityBetDrawDrawReq struct { @@ -287,3 +309,7 @@ type ActivityPopupReq struct { type ActivityPopupResp struct { List []*common.ConfigActivityPopup } + +type ActivityFirstRechargeInfoResp struct { + List []*common.ConfigActivityPopup +} diff --git a/modules/web/values/pay.go b/modules/web/values/pay.go index cd16a76..573e502 100644 --- a/modules/web/values/pay.go +++ b/modules/web/values/pay.go @@ -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"} diff --git a/pb/proto/platform.proto b/pb/proto/platform.proto index 11f7346..bbc2173 100644 --- a/pb/proto/platform.proto +++ b/pb/proto/platform.proto @@ -56,6 +56,8 @@ enum RedPointModule{ RedPointFreeSpin = 6; // 免费转盘 RedPointVipReward = 7; // vip升级奖励 RedPointLoginAgain = 8; // 第二次登录游戏 + RedPointWeekCard = 9; // 周卡 + RedPointFirstRecharge = 10 ; // 首充 } message RedInfo { diff --git a/util/util.go b/util/util.go index 4d0a5d8..009ea4b 100644 --- a/util/util.go +++ b/util/util.go @@ -965,3 +965,58 @@ func HashUnmarshal(data map[string]string, v interface{}) error { return nil } + +func Int64SliceToStringSlice(int64Slice []int64) []string { + stringSlice := make([]string, len(int64Slice)) + for i, num := range int64Slice { + stringSlice[i] = strconv.FormatInt(num, 10) + } + return stringSlice +} + +func StringToInt64Slice(s, sep string) ([]int64, error) { + // 使用分隔符拆分字符串 + parts := strings.Split(s, sep) + + // 创建一个空的 []int64 切片用于存储转换后的数字 + int64Slice := make([]int64, len(parts)) + + // 遍历拆分后的字符串部分并转换为 int64 + for i, part := range parts { + num, err := strconv.ParseInt(part, 10, 64) + if err != nil { + return nil, err // 如果转换失败,返回错误 + } + int64Slice[i] = num + } + + return int64Slice, nil +} + +func GenerateRandomSequence(totalSum, minValue, length int64) ([]int64, error) { + + sequence := make([]int64, length) + for i := int64(0); i < length; i++ { + sequence[i] = minValue + } + + initialSum := minValue * length + if initialSum > totalSum { + return nil, fmt.Errorf("无法生成满足条件的序列") + } + + remaining := totalSum - initialSum + + rand.Seed(time.Now().UnixNano()) + for remaining > 0 { + batchSize := remaining / length // 计算一次性分配的批量大小 + if batchSize == 0 { + batchSize = 1 + } + index := rand.Int63n(length) + sequence[index] += batchSize + remaining -= batchSize + } + + return sequence, nil +}