|
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
type TaskType int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
TaskTypeZero TaskType = iota
|
|
|
|
|
TaskTypeOnceRecharge // 单次充值任务
|
|
|
|
|
TaskTypeInvite // 邀请好友
|
|
|
|
|
TaskTypePlayGame // 参与一次牌局
|
|
|
|
|
TaskTypeBet1000 // 累计下注1000
|
|
|
|
|
TaskTypeBet10000 // 累计下注10000
|
|
|
|
|
TaskTypeAll
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// TaskTypeFirstRecharge // 首次充值任务
|
|
|
|
|
// TaskTypeRegist // 注册任务
|
|
|
|
|
// TaskTypeDownload // 下载app任务
|
|
|
|
|
// TaskTypeTotalRecharge // 累充任务
|
|
|
|
|
// 完成任意一次充值
|
|
|
|
|
// (每日重置一次)
|
|
|
|
|
// 完成一次好友邀请
|
|
|
|
|
// (每日重置一次,这里要有效好友才可完成,有效好友意思是只邀请的玩家充值了200卢比)
|
|
|
|
|
// 参与一次牌局
|
|
|
|
|
// (任务每日重置一次)
|
|
|
|
|
// 累记下注到1000
|
|
|
|
|
// (每日任务重置一次)
|
|
|
|
|
// 累记下注到10000
|
|
|
|
|
// (每日任务重置一次)
|
|
|
|
|
|
|
|
|
|
// 判读任务的目标是否是次数
|
|
|
|
|
func IsNumTaskType(t int) bool {
|
|
|
|
|
// return t == TaskTypeOnceRecharge || t == TaskTypeInvite || t == TaskTypePlayGame
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetTaskTitle(task *ConfigTask) string {
|
|
|
|
|
// switch task.Type {
|
|
|
|
|
// case TaskTypeTotalRecharge:
|
|
|
|
|
// return fmt.Sprintf(task.Title, task.Target/DecimalDigits)
|
|
|
|
|
// case TaskTypeOnceRecharge:
|
|
|
|
|
// return fmt.Sprintf(task.Title, task.Target/DecimalDigits)
|
|
|
|
|
// }
|
|
|
|
|
return task.Title
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
TaskKindZero = iota
|
|
|
|
|
TaskKindOnce
|
|
|
|
|
TaskKindCycle
|
|
|
|
|
TaskKindAll
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ConfigTask 任务配置
|
|
|
|
|
// Kind 1单次 2循环
|
|
|
|
|
// Type 1注册 2下载 3累充 4单次充
|
|
|
|
|
type ConfigTask struct {
|
|
|
|
|
ID int `gorm:"primary_key;AUTO_INCREMENT;column:id"`
|
|
|
|
|
TaskID int `gorm:"column:task_id;type:int(11);default:0;uniqueIndex:task_id;comment:任务id" web:"task_id"`
|
|
|
|
|
Target int64 `gorm:"column:target;type:bigint(20);default:0;comment:任务目标" web:"target"`
|
|
|
|
|
Reward int64 `gorm:"column:reward;type:bigint(20);default:0;comment:奖励" web:"reward"`
|
|
|
|
|
Open int `gorm:"column:open;type:int(11);default:1;comment:开关 1打开" web:"open"`
|
|
|
|
|
Kind int `gorm:"column:kind;type:int(11);default:1;comment:1单次 2循环" web:"kind"`
|
|
|
|
|
Type TaskType `gorm:"column:type;type:int(11);default:1;comment:1注册 2下载" web:"type"`
|
|
|
|
|
Title string `gorm:"column:title;type:varchar(256);default:'';comment:标题" web:"title"`
|
|
|
|
|
Icon string `gorm:"column:icon;type:varchar(256);default:'';comment:图标" web:"icon"`
|
|
|
|
|
Sort int `gorm:"column:sort;type:int(11);default:0;comment:排序" web:"sort"`
|
|
|
|
|
Action int `gorm:"column:action;type:int(11);default:1;comment:跳转类型" web:"action"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *ConfigTask) TableName() string {
|
|
|
|
|
return "config_task"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type TaskData struct {
|
|
|
|
|
ID int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"ID"`
|
|
|
|
|
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid" json:"UID"`
|
|
|
|
|
Time int64 `gorm:"column:time;not null;type:bigint(20);default:0;comment:任务生成时间" json:"Time"`
|
|
|
|
|
TaskID int `gorm:"column:task_id;type:int(11);default:0;uniqueIndex:uid;comment:任务id" web:"task_id"`
|
|
|
|
|
Progress int64 `gorm:"column:progress;type:bigint(20);default:0;comment:进度" web:"progress"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *TaskData) TableName() string {
|
|
|
|
|
return "task_data"
|
|
|
|
|
}
|