|
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 分享配置
|
|
|
|
|
type ConfigShareSys struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
WithdrawLimit int64 `gorm:"column:withdraw_limit;type:bigint(20);default:100;comment:最低领取数额" web:"withdraw_limit"`
|
|
|
|
|
ShareRecharge int64 `gorm:"column:share_recharge;type:bigint(20);default:2000;comment:有效玩家充值需求" web:"share_recharge"`
|
|
|
|
|
ShareReward int64 `gorm:"column:share_reward;type:bigint(20);default:1000;comment:分享有效玩家奖励" web:"share_reward"`
|
|
|
|
|
FakeInviteReward int64 `gorm:"column:fake_invite_reward;type:bigint(20);default:1250000000;comment:虚拟邀请奖励" web:"fake_invite_reward"`
|
|
|
|
|
FakeBetReward int64 `gorm:"column:fake_bet_reward;type:bigint(20);default:980000000;comment:虚拟投注奖励" web:"fake_bet_reward"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareSys) TableName() string {
|
|
|
|
|
return "config_share_sys"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 绑定关系
|
|
|
|
|
type ShareInfo struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"`
|
|
|
|
|
CreateTime int64 `gorm:"column:create_time;type:bigint(20);index:ct;default:0;comment:创建时间"`
|
|
|
|
|
Exp int64 `gorm:"column:exp;default:0;type:int(11);comment:当前经验值"`
|
|
|
|
|
Level int `gorm:"column:level;default:0;type:int(11);comment:等级"`
|
|
|
|
|
LastLevel int `gorm:"column:last_level;default:1;type:int(11);comment:上次查看时的等级"`
|
|
|
|
|
Share string `gorm:"column:share;not null;type:varchar(64);uniqueIndex:share;comment:分享码"`
|
|
|
|
|
UP1 int `gorm:"column:up1;type:int(11);default:0;comment:上1级"`
|
|
|
|
|
UP2 int `gorm:"column:up2;type:int(11);default:0;comment:上2级"`
|
|
|
|
|
UP3 int `gorm:"column:up3;type:int(11);default:0;comment:上3级"`
|
|
|
|
|
UP4 int `gorm:"column:up4;default:0;type:int(11);comment:上4级"`
|
|
|
|
|
UP5 int `gorm:"column:up5;default:0;type:int(11);comment:上5级"`
|
|
|
|
|
UpInviteReward int64 `gorm:"column:up_invite_reward;default:0;type:int(11);comment:为上级创造的邀请奖励"`
|
|
|
|
|
UpInviteUnlock int64 `gorm:"column:up_invite_Unlock;default:0;type:int(11);comment:为上级已解锁的邀请奖励"`
|
|
|
|
|
Down1 int64 `gorm:"column:down1;default:0;type:int(11);comment:下1级数量"`
|
|
|
|
|
Down2 int64 `gorm:"column:down2;default:0;type:int(11);comment:下2级数量"`
|
|
|
|
|
Down3 int64 `gorm:"column:down3;default:0;type:int(11);comment:下3级数量"`
|
|
|
|
|
Down4 int64 `gorm:"column:down4;default:0;type:int(11);comment:下4级数量"`
|
|
|
|
|
Down5 int64 `gorm:"column:down5;default:0;type:int(11);comment:下5级数量"`
|
|
|
|
|
CalLoseValue int64 `gorm:"column:cal_lose_value;default:0;type:bigint(20);comment:用于计算客损的额度"`
|
|
|
|
|
PopWithdraw int `gorm:"pop_withdraw;default:0;type:tinyint(4);comment:是否弹出过退出"`
|
|
|
|
|
|
|
|
|
|
ChannelID int `gorm:"column:channel_id;type:int(11);default:0;comment:渠道id"`
|
|
|
|
|
RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20);default:0;comment:充值金额"`
|
|
|
|
|
|
|
|
|
|
UpList []int `gorm:"-"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;default:0;type:bigint(20);comment:总奖励"`
|
|
|
|
|
Withdrawable int64 `gorm:"column:withdrawable;default:0;type:bigint(20);comment:可退出奖励"`
|
|
|
|
|
BetAmount int64 `gorm:"column:bet_amount;type:bigint(20);default:0;comment:下注金额"`
|
|
|
|
|
BetAmountTeam int64 `gorm:"column:bet_amount_team;type:bigint(20);default:0;comment:团队下注金额"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *ShareInfo) TableName() string {
|
|
|
|
|
return "share_info"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareDetail struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
Type int `gorm:"column:type;not null;default:0;type:int(11);"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);"`
|
|
|
|
|
Up int `gorm:"column:up;type:int(11);default:0;comment:上级"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:获取奖励"`
|
|
|
|
|
RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20);default:0;comment:充值金额"`
|
|
|
|
|
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:时间"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *ShareDetail) TableName() string {
|
|
|
|
|
return "share_detail"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 绑定关系
|
|
|
|
|
// type ShareInfo struct {
|
|
|
|
|
// ID int `gorm:"primarykey"`
|
|
|
|
|
// UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"`
|
|
|
|
|
// Share string `gorm:"column:share;not null;type:varchar(64);uniqueIndex:share;comment:分享码"`
|
|
|
|
|
// UP int `gorm:"column:up;not null;type:int(11);comment:上级"`
|
|
|
|
|
// Level int `gorm:"column:level;default:1;type:int(11);comment:等级"`
|
|
|
|
|
// ChannelID int `gorm:"column:channel_id;type:bigint(20);comment:渠道id"`
|
|
|
|
|
|
|
|
|
|
// Bet int64 `gorm:"column:bet;type:bigint(20);default:0;comment:待结算下注额,结算后会清零"`
|
|
|
|
|
// TodayBet int64 `gorm:"column:today_bet;type:bigint(20);default:0;comment:今日总下注"`
|
|
|
|
|
// TotalBet int64 `gorm:"column:total_bet;type:bigint(20);default:0;comment:总下注"`
|
|
|
|
|
|
|
|
|
|
// TodayAgentsBet int64 `gorm:"column:today_agents_bet;type:decimal(38);default:0;comment:团队今日下注"`
|
|
|
|
|
// TotalAgentsBet int64 `gorm:"column:total_agents_bet;type:decimal(38);default:0;comment:团队总下注"`
|
|
|
|
|
|
|
|
|
|
// TodayAgents int64 `gorm:"column:today_agents;type:bigint(20);default:0;comment:今日下级数量"`
|
|
|
|
|
// TotalAgents int64 `gorm:"column:total_agents;type:bigint(20);default:0;comment:总下级数量"`
|
|
|
|
|
|
|
|
|
|
// TodayRealAgents int64 `gorm:"column:today_real_agents;type:bigint(20);default:0;comment:今日有效下级数量"`
|
|
|
|
|
// TotalRealAgents int64 `gorm:"column:total_real_agents;type:bigint(20);default:0;comment:总有效下级数量"`
|
|
|
|
|
|
|
|
|
|
// TodayReward int64 `gorm:"column:today_reward;type:bigint(20);default:0;comment:今日佣金"`
|
|
|
|
|
// TotalReward int64 `gorm:"column:total_reward;type:bigint(20);default:0;comment:总佣金"`
|
|
|
|
|
|
|
|
|
|
// TodayUpReward int64 `gorm:"column:today_up_reward;type:bigint(20);default:0;comment:今日给上级创造的佣金"`
|
|
|
|
|
// AvailableReward int64 `gorm:"column:available_reward;type:bigint(20);default:0;comment:可支配佣金"`
|
|
|
|
|
// Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:加入的时间"`
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
type ShareActivityCode struct {
|
|
|
|
|
Id int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key;" json:"id"`
|
|
|
|
|
UID int `gorm:"column:uid;type:int(11);index:idx_share;comment:玩家ID" json:"uid"`
|
|
|
|
|
ShareCode string `gorm:"column:share_code;type:varchar(255);index:idx_share;comment:分享码" json:"share_code"`
|
|
|
|
|
ActivityId int `gorm:"column:activity_id;type:int(11);index:idx_share;comment:关联活动ID" json:"activity_id"`
|
|
|
|
|
Reward string `gorm:"column:reward;type:varchar(255);index:idx_share;comment:分享码" json:"reward"`
|
|
|
|
|
ValidNum int `gorm:"column:valid_num;type:int(11);index:idx_share;comment:有效次数" json:"valid_num"`
|
|
|
|
|
CreateAt int64 `gorm:"column:create_at;type:bigint(20);comment:创建时间" json:"create_at"`
|
|
|
|
|
ExpireAt int64 `gorm:"column:expire_at;type:bigint(20);comment:过期时间" json:"expire_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *ShareActivityCode) TableName() string {
|
|
|
|
|
return "share_act_code"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareOrder struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11)"`
|
|
|
|
|
CreateTime int64 `gorm:"column:create_time;type:bigint(20);comment:创建时间"`
|
|
|
|
|
ExamineTime int64 `gorm:"column:examine_time;type:bigint(20);default:0;comment:审核时间"`
|
|
|
|
|
OrderID string `gorm:"column:orderid;not null;type:varchar(255);uniqueIndex:orderid;comment:本地ID"`
|
|
|
|
|
Amount int64 `gorm:"column:amount;not null;type:bigint(20);comment:单位8位小数"`
|
|
|
|
|
ChannelID int `gorm:"column:channel_id;type:bigint(20);comment:渠道id"`
|
|
|
|
|
Status int `gorm:"column:status;not null;type:tinyint(4);comment:1新建,2支付完成,3发货完成,4支付失败,5取消"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *ShareOrder) TableName() string {
|
|
|
|
|
return "share_order"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 机器人
|
|
|
|
|
type ConfigShareRobot struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
RobotID int `gorm:"column:robot_id;type:int(11);default:0" web:"robot_id"`
|
|
|
|
|
Avatar string `gorm:"column:avatar;type:varchar(255);default:''" web:"avatar"`
|
|
|
|
|
Nick string `gorm:"column:nick;type:varchar(255);default:''" web:"nick"`
|
|
|
|
|
InitCash int64 `gorm:"column:init_cash;type:bigint(20);default:0;comment:初始金币" web:"init_cash"`
|
|
|
|
|
DayCashDown int64 `gorm:"column:day_cash_down;type:bigint(20);default:0;comment:每日增加金币数下限" web:"day_cash_down"`
|
|
|
|
|
DayCashUp int64 `gorm:"column:day_cash_up;type:bigint(20);default:0;comment:每日增加金币数上限" web:"day_cash_up"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareRobot) TableName() string {
|
|
|
|
|
return "config_share_robot"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareRankReward struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
StartLevel int `gorm:"column:start_level;type:int(11);default:0;comment:开始等级" web:"start_level"`
|
|
|
|
|
EndLevel int `gorm:"column:end_level;type:int(11);default:0;comment:结束等级" web:"end_level"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:奖励金额" web:"reward"`
|
|
|
|
|
isOpen int `gorm:"column:is_open;type:int(11);default:0;comment:是否外放" web:"is_open"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareRankReward) TableName() string {
|
|
|
|
|
return "config_share_rank_reward"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareRankRule struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
Day int `gorm:"column:day;type:int(11);default:0;comment:天数" web:"day"`
|
|
|
|
|
StartInterval int64 `gorm:"column:start_interval;type:bigint(20);default:0;comment:开始间隔" web:"start_interval"`
|
|
|
|
|
EndInterval int64 `gorm:"column:end_interval;type:bigint(20);default:0;comment:结束间隔" web:"end_interval"`
|
|
|
|
|
IncrNum int64 `gorm:"column:incr_num;type:bigint(20);default:0;comment:增长人数" web:"incr_num"`
|
|
|
|
|
StartIncrTimes int64 `gorm:"column:start_incr_times;type:bigint(20);default:0;comment:增长次数" web:"start_incr_times"`
|
|
|
|
|
EndIncrTimes int64 `gorm:"column:end_incr_times;type:bigint(20);default:0;comment:增长次数" web:"end_incr_times"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareRankRule) TableName() string {
|
|
|
|
|
return "config_share_rank_rule"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ShareEvent = iota
|
|
|
|
|
// ShareEventDaily // 每日活动
|
|
|
|
|
ShareEventInvitation // 邀请奖励
|
|
|
|
|
ShareEventRecharge // 充值返利
|
|
|
|
|
ShareEventAffiliate // 客损返利
|
|
|
|
|
ShareEventOther // 活动、签到等归此类
|
|
|
|
|
// ShareEventBet // 下注返回
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ConfigShareTaskNew 分享新手任务
|
|
|
|
|
type ConfigShareTaskNew struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
TaskID int `gorm:"column:task_id;type:int(11);default:1;uniqueIndex:task_id;comment:任务编号" web:"task_id"`
|
|
|
|
|
Type int `gorm:"column:type;type:int(11);default:2;comment:任务类型" web:"type"`
|
|
|
|
|
Condition int `gorm:"column:condition;type:int(11);default:0;comment:任务条件,玩牌对应游戏id" web:"condition"`
|
|
|
|
|
Target int64 `gorm:"column:target;type:int(11);default:1;comment:任务目标" web:"target"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:int(11);default:0;comment:任务奖励" web:"reward"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareTaskNew) TableName() string {
|
|
|
|
|
return "config_share_task_new"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ShareTaskNewTypeZero = iota
|
|
|
|
|
ShareTaskNewTypeFirst // 首次任务
|
|
|
|
|
ShareTaskNewTypeInvite // 邀请注册任务
|
|
|
|
|
ShareTaskNewTypeRecharge // 邀请下级用户充值任务
|
|
|
|
|
ShareTaskNewTypeAll
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ShareTaskNewData struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:ut"`
|
|
|
|
|
TaskID int `gorm:"column:task_id;type:int(11);default:1;uniqueIndex:ut;comment:当前任务id"`
|
|
|
|
|
Type int `gorm:"column:type;type:int(11);default:1;comment:任务类型"`
|
|
|
|
|
Condition int `gorm:"column:condition;type:int(11);default:0;comment:任务条件,玩牌对应游戏id"`
|
|
|
|
|
Progress int64 `gorm:"column:progress;type:int(11);default:0;comment:任务进度"`
|
|
|
|
|
Target int64 `gorm:"column:target;type:int(11);default:1;comment:任务目标"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:int(11);default:0;comment:任务奖励"`
|
|
|
|
|
Status int `gorm:"column:status;type:int(11);default:0;comment:状态 0未领取 1已领取"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareTaskNewData) TableName() string {
|
|
|
|
|
return "share_task_new_data"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareTaskNewData) GetDesc() string {
|
|
|
|
|
switch c.Type {
|
|
|
|
|
case ShareTaskNewTypeFirst:
|
|
|
|
|
return "First Check in"
|
|
|
|
|
case ShareTaskNewTypeInvite:
|
|
|
|
|
str := fmt.Sprintf("Successfully invited %d player", c.Target)
|
|
|
|
|
if c.Target > 1 {
|
|
|
|
|
str += "s"
|
|
|
|
|
}
|
|
|
|
|
return str
|
|
|
|
|
case ShareTaskNewTypeRecharge:
|
|
|
|
|
str := fmt.Sprintf("Recharge for %d invited player", c.Target)
|
|
|
|
|
if c.Target > 1 {
|
|
|
|
|
str += "s"
|
|
|
|
|
}
|
|
|
|
|
return str
|
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareTiers struct {
|
|
|
|
|
Tier int // 层级
|
|
|
|
|
Per int64 // 分成比例
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分享配置
|
|
|
|
|
type ConfigShare struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
Level int `gorm:"column:level;type:int(11);default:0;comment:代理等级" web:"level"`
|
|
|
|
|
InviteExp int `gorm:"column:invite_exp;type:int(11);default:0;comment:邀请人数" web:"invite_exp"`
|
|
|
|
|
BetExp int `gorm:"column:bet_exp;type:int(11);default:0;comment:下注数" web:"bet_exp"`
|
|
|
|
|
BetRebate int64 `gorm:"column:bet_rebate;type:int(11);default:0;comment:客损返利(*1万)" web:"bet_rebate"`
|
|
|
|
|
RechargeRebate int64 `gorm:"column:recharge_rebate;type:int(11);default:0;comment:充值返利(*1万)" web:"recharge_rebate"`
|
|
|
|
|
InviteRebate int64 `gorm:"column:invite_rebate;type:int(11);default:0;comment:拉人奖励" web:"invite_rebate"`
|
|
|
|
|
BeInviteRebate int64 `gorm:"column:be_invite_rebate;type:int(11);default:10;comment:被拉人奖励" web:"be_invite_rebate"`
|
|
|
|
|
RewardTiers string `gorm:"column:reward_tiers;type:varchar(256);default:'[]';comment:返利层级配置" web:"reward_tiers"`
|
|
|
|
|
SubRewardTiers []ConfigShareTiers `gorm:"-"`
|
|
|
|
|
SubRewardTiersMap map[int]ConfigShareTiers `gorm:"-" json:"-"`
|
|
|
|
|
DayWithdrawCount int `gorm:"column:day_withdraw_count;type:int(11);default:3;comment:日退出次数" web:"day_withdraw_count"`
|
|
|
|
|
WithdrawAudit int64 `gorm:"column:withdraw_audit;type:int(11);default:50000;comment:退出审核金额" web:"withdraw_audit"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShare) TableName() string {
|
|
|
|
|
return "config_share"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShare) CalReward(event int, amount int64) int64 {
|
|
|
|
|
switch event {
|
|
|
|
|
case ShareEventInvitation:
|
|
|
|
|
return c.InviteRebate
|
|
|
|
|
case ShareEventRecharge:
|
|
|
|
|
return amount * c.RechargeRebate / 10000
|
|
|
|
|
case ShareEventAffiliate:
|
|
|
|
|
return amount * c.BetRebate / 10000
|
|
|
|
|
default:
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShare) GetLevelUpInfo() LevelUpInfo {
|
|
|
|
|
info := LevelUpInfo{}
|
|
|
|
|
info.Level = c.Level
|
|
|
|
|
info.Invitation = fmt.Sprintf("%drs/person", c.InviteRebate)
|
|
|
|
|
// todo
|
|
|
|
|
//info.RechargeCommission = fmt.Sprintf("%d", c.RechargeReward+c.AffiliateReward) + "%"
|
|
|
|
|
tmp := ""
|
|
|
|
|
for i, v := range c.SubRewardTiers {
|
|
|
|
|
this := ""
|
|
|
|
|
switch v.Tier {
|
|
|
|
|
case 1:
|
|
|
|
|
this = "A"
|
|
|
|
|
case 2:
|
|
|
|
|
this = "B"
|
|
|
|
|
case 3:
|
|
|
|
|
this = "C"
|
|
|
|
|
case 4:
|
|
|
|
|
this = "D"
|
|
|
|
|
case 5:
|
|
|
|
|
this = "E"
|
|
|
|
|
}
|
|
|
|
|
tmp += this
|
|
|
|
|
if i != len(c.SubRewardTiers)-1 {
|
|
|
|
|
tmp += "+"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
info.CommissionFromAffiliate = fmt.Sprintf("Lv%d(%s)", info.Level, tmp)
|
|
|
|
|
return info
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LevelUpInfo struct {
|
|
|
|
|
Level int
|
|
|
|
|
Invitation string
|
|
|
|
|
RechargeCommission string
|
|
|
|
|
CommissionFromAffiliate string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ShareAffiliatePer = 80 // 客损计算比例
|
|
|
|
|
ShareRankMaxNum = 100 // 排行榜最大个数
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ShareRankTypeDaily = iota
|
|
|
|
|
ShareRankTypeWeekly
|
|
|
|
|
ShareRankTypeMonthly
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 分享排行榜
|
|
|
|
|
type ShareRank struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:ut"`
|
|
|
|
|
Type int `gorm:"column:type;type:int(11);default:0;uniqueIndex:ut;comment:类型 0日榜 1周榜 2月榜"`
|
|
|
|
|
Time int64 `gorm:"column:time;type:bigint(20);default:0;uniqueIndex:ut;comment:创建时间"`
|
|
|
|
|
Avatar string `gorm:"column:avatar;type:varchar(256);default:''"`
|
|
|
|
|
Nick string `gorm:"column:nick;type:varchar(256);default:''"`
|
|
|
|
|
Level int `gorm:"column:level;type:int(11);default:0;comment:等级"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:奖励"`
|
|
|
|
|
Rank int `gorm:"-"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareRank) TableName() string {
|
|
|
|
|
return "share_rank"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareLimitTask struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
PN int `gorm:"column:pn;type:int(11);default:0;comment:包类别" web:"pn"`
|
|
|
|
|
Channel int `gorm:"column:channel;type:int(11);default:0;comment:渠道" web:"channel"`
|
|
|
|
|
Level int `gorm:"column:level;type:int(11);default:0;comment:等级" web:"level"`
|
|
|
|
|
Time int64 `gorm:"column:time;type:int(11);default:4320;comment:完成时限,单位分钟" web:"time"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:int(11);default:0;comment:任务奖励" web:"reward"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareLimitTask) TableName() string {
|
|
|
|
|
return "config_share_limit_task"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareLimitTaskData struct {
|
|
|
|
|
ID int `gorm:"primarykey"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:ul"`
|
|
|
|
|
Level int `gorm:"column:level;type:int(11);default:1;uniqueIndex:ul;comment:当前任务等级"`
|
|
|
|
|
CreateTime int64 `gorm:"column:create_time;type:bigint(20);default:0;comment:创建时间"`
|
|
|
|
|
Time int64 `gorm:"column:time;type:int(11);default:4320;comment:完成时限,单位分钟"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:int(11);default:0;comment:任务奖励"`
|
|
|
|
|
Status int `gorm:"column:status;type:int(11);default:0;comment:状态 0未领取 1已领取"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareLimitTaskData) TableName() string {
|
|
|
|
|
return "share_limit_task_data"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareLimitTaskData) IsValid() bool {
|
|
|
|
|
if c.ID == 0 {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return c.Status == 0 && c.CreateTime+c.Time*60-time.Now().Unix() > 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareWithdrawInfo struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"`
|
|
|
|
|
DayCount int `gorm:"column:day_count;type:int(11);default:0;comment:日退出次数"`
|
|
|
|
|
DayTime int64 `gorm:"column:day_time;type:bigint(20);default:0;comment:日退出时间标记"`
|
|
|
|
|
Record string `gorm:"column:record;type:varchar(256);default:'';comment:已退出金额标记"`
|
|
|
|
|
TotalWithdraw int64 `gorm:"column:total_withdraw;type:int(11);default:0;comment:已退出总数"`
|
|
|
|
|
SubRecord map[int64]int `gorm:"-"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareWithdrawInfo) TableName() string {
|
|
|
|
|
return "share_withdraw_info"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 退出商品配置
|
|
|
|
|
type ConfigShareWithdrawProducts struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
PN int `gorm:"column:pn;type:int(11);default:0;comment:包类别" web:"pn"`
|
|
|
|
|
Channel int `gorm:"column:channel;type:int(11);default:0;comment:渠道" web:"channel"`
|
|
|
|
|
ProductID int `gorm:"column:product_id;type:int(11);default:0;comment:商品id" web:"product_id"`
|
|
|
|
|
Amount int64 `gorm:"column:amount;type:int(11);default:0;comment:金额" web:"amount"`
|
|
|
|
|
Count int `gorm:"column:count;type:int(11);default:0;comment:可使用次数,-1为不限制" web:"count"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareWithdrawProducts) TableName() string {
|
|
|
|
|
return "config_share_withdraw_products"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareBanner struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
Sort int `gorm:"column:sort;type:int(11);default:1;comment:排序" web:"sort"`
|
|
|
|
|
URL string `gorm:"column:url;type:varchar(256);default:'';comment:图片地址" web:"url"`
|
|
|
|
|
Desc string `gorm:"column:desc;type:varchar(256);default:'';comment:分享文案" web:"desc"`
|
|
|
|
|
SearchWord string `gorm:"column:search_word;type:varchar(512);default:'';comment:google search word" web:"search_word"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareBanner) TableName() string {
|
|
|
|
|
return "config_share_banner"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareRewardData struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:ut"`
|
|
|
|
|
Time int64 `gorm:"column:time;type:bigint(20);default:0;uniqueIndex:ut;comment:创建时间"`
|
|
|
|
|
Date string `gorm:"column:date;type:varchar(256);default:''"`
|
|
|
|
|
PopTime int64 `gorm:"column:pop_time;type:bigint(20);default:0;comment:弹出时间"`
|
|
|
|
|
TotalReward int64 `gorm:"column:total_reward;type:int(11);default:0;comment:总奖励"`
|
|
|
|
|
InviteReward int64 `gorm:"column:invite_reward;type:int(11);default:0;comment:邀请奖励"`
|
|
|
|
|
RechargeReward int64 `gorm:"column:recharge_reward;type:int(11);default:0;comment:充值返利"`
|
|
|
|
|
AffiliateReward int64 `gorm:"column:affiliate_reward;type:int(11);default:0;comment:下级返利"`
|
|
|
|
|
OtherReward int64 `gorm:"column:other_reward;type:int(11);default:0;comment:活动、签到等"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareRewardData) TableName() string {
|
|
|
|
|
return "share_reward_data"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareRewardData) SetReward(shareEvent int, reward int64) {
|
|
|
|
|
switch shareEvent {
|
|
|
|
|
case ShareEventInvitation:
|
|
|
|
|
c.InviteReward += reward
|
|
|
|
|
case ShareEventRecharge:
|
|
|
|
|
c.RechargeReward += reward
|
|
|
|
|
case ShareEventAffiliate:
|
|
|
|
|
c.AffiliateReward += reward
|
|
|
|
|
case ShareEventOther:
|
|
|
|
|
c.OtherReward += reward
|
|
|
|
|
}
|
|
|
|
|
c.TotalReward += reward
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareRewardData) GetRewardName(shareEvent int) string {
|
|
|
|
|
switch shareEvent {
|
|
|
|
|
case ShareEventInvitation:
|
|
|
|
|
return "invite_reward"
|
|
|
|
|
case ShareEventRecharge:
|
|
|
|
|
return "recharge_reward"
|
|
|
|
|
case ShareEventAffiliate:
|
|
|
|
|
return "affiliate_reward"
|
|
|
|
|
case ShareEventOther:
|
|
|
|
|
return "other_reward"
|
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ESShareBalance 分享流水
|
|
|
|
|
// Time 时间戳
|
|
|
|
|
// Event 事件
|
|
|
|
|
// FriendUID 奖励来源玩家uid
|
|
|
|
|
// FriendNick 奖励来源玩家nick
|
|
|
|
|
// Phone 奖励来源玩家手机号
|
|
|
|
|
// AmountType 奖励类型
|
|
|
|
|
// Amount 数量
|
|
|
|
|
// RefererUID 分享者UID
|
|
|
|
|
// RefererNick 分享者昵称
|
|
|
|
|
// Level 分享等级
|
|
|
|
|
type ESShareBalance struct {
|
|
|
|
|
Date string
|
|
|
|
|
Time int64
|
|
|
|
|
Event int
|
|
|
|
|
FriendUID int
|
|
|
|
|
FriendNick string
|
|
|
|
|
Phone string
|
|
|
|
|
AmountType int
|
|
|
|
|
Amount int64
|
|
|
|
|
RefererUID int
|
|
|
|
|
RefererNick string
|
|
|
|
|
Level int
|
|
|
|
|
Balance int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareReward struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11)"`
|
|
|
|
|
UpLevel int `gorm:"column:up_level;type:int(11);default:0"`
|
|
|
|
|
RewardType int `gorm:"column:reward_type;type:int(11);default:0;comment:奖励类型(1:下注,2:充值,3:任务,4:邀请人,5:提现)"`
|
|
|
|
|
RewardCount int64 `gorm:"column:reward_count;type:int(11);default:0;comment:奖励数量"`
|
|
|
|
|
RewardDesc string `gorm:"column:reward_desc;type:varchar(256);default:'奖励描述'"`
|
|
|
|
|
RewardAt int64 `gorm:"column:reward_at;type:int(11);default:0;comment:奖励时间"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareReward) TableName() string {
|
|
|
|
|
return "share_reward"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ConfigShareRankAward struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
ShareRankType int `gorm:"column:share_rank_type;type:int(11);default:2;comment:分享排行榜类型(1:日,2:周,3:月)" web:"share_rank_type"`
|
|
|
|
|
RankAwards string `gorm:"column:rank_awards;type:text;comment:排行榜奖励信息(复用打码排行榜奖励格式)" web:"rank_awards"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigShareRankAward) TableName() string {
|
|
|
|
|
return "config_share_rank_award"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareRankData struct {
|
|
|
|
|
ID int64 `gorm:"column:id;type:bigint(20);primaryKey;autoIncrement:true" json:"id"`
|
|
|
|
|
UID int `gorm:"column:uid;type:bigint(11);not null;uniqueIndex:rank_idx,priority:3;comment:玩家id" json:"uid"` // 玩家id
|
|
|
|
|
RankCycle int `gorm:"column:rank_cycle;type:int(11);default:0;uniqueIndex:rank_idx,priority:1;comment:排行榜周期(1:日,2:周,3:月)" json:"rank_cycle"` // 排行榜周期(1:日,2:周,3:月)
|
|
|
|
|
RankAt int64 `gorm:"column:rank_at;type:bigint(20);not null;uniqueIndex:rank_idx,priority:2;comment:排行榜开始日期" json:"rank_at"` // 排行榜开始日期
|
|
|
|
|
RankValue int64 `gorm:"column:rank_value;type:bigint(20);not null;comment:玩家数值" json:"rank_value"` // 玩家数值
|
|
|
|
|
IsRobot int `gorm:"column:is_robot;type:int(11);not null;comment:是不是机器人(0:不是,1:是)" json:"is_robot"` // 是不是机器人(0:不是,1:是)
|
|
|
|
|
UserAward int `gorm:"column:user_award;type:int(11);not null;comment:玩家奖励比例(*10000)" json:"user_award"` // 玩家奖励比例(*10000)
|
|
|
|
|
UserAwardCount int64 `gorm:"column:user_award_count;type:bigint(20);not null;comment:玩家奖励数量" json:"user_award_count"` // 玩家奖励数量
|
|
|
|
|
Rank int `gorm:"column:rank;type:int(11);default:0;comment:排名" json:"rank"` // 玩家奖励比例(*10000)
|
|
|
|
|
UpdatedAt int64 `gorm:"column:updated_at;type:bigint(20);not null;comment:更新时间" json:"updated_at"` // 更新时间
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ShareRankDataWithUser struct {
|
|
|
|
|
ShareRankData `gorm:"embedded"` // RankData的所有字段会展开到表中
|
|
|
|
|
UserInfo PlayerDBInfo `gorm:"embedded"` // UserInfo的所有字段也会展开到同一张表中
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ShareRankData) TableName() string {
|
|
|
|
|
return "share_rank_data"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LuckyWheelReward struct {
|
|
|
|
|
ID int `gorm:"primarykey;autoIncrement:true"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11)"`
|
|
|
|
|
Nick string `gorm:"column:nick;type:varchar(256);default:''"`
|
|
|
|
|
LuckyType int `gorm:"column:lucky_type;type:int(11);default:0"`
|
|
|
|
|
AwardType int `gorm:"column:award_type;type:int(11);default:1"`
|
|
|
|
|
AwardCount int `gorm:"column:award_count;type:int(11);default:0"`
|
|
|
|
|
SpeAwardType int `gorm:"column:spe_award_type;type:int(11);default:0"`
|
|
|
|
|
SpeAwardCount int `gorm:"column:spe_award_count;type:int(11);default:0"`
|
|
|
|
|
UpdatedAt int64 `gorm:"column:updated_at;type:int(11);default:0;comment:奖励时间"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *LuckyWheelReward) TableName() string {
|
|
|
|
|
return "lucky_wheel_reward"
|
|
|
|
|
}
|