1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-14 03:05:51 +08:00
parent 7cdf7a0890
commit 06b77d598e
15 changed files with 102 additions and 59 deletions

View File

@@ -58,6 +58,7 @@ func NewItemService() *ItemService {
Model: model.NewItemGift(),
PageQueryOp: &cool.QueryOp{
KeyWordField: []string{"remark"},
FieldEQ: []string{"is_egg"},
},
},
}

View File

@@ -13,6 +13,11 @@ func NewPetRewardService() *PetRewardService {
return &PetRewardService{
&cool.Service{
Model: model.NewPetReward(),
PageQueryOp: &cool.QueryOp{
FieldEQ: []string{"is_egg", "is_light"},
},
},
}
}

View File

@@ -40,12 +40,15 @@ func (c *TitleController) Get(ctx context.Context, req *GetReq) (res *cool.BaseR
alltitile := service.NewUserService(uint32(admin.UserId)).Title.Get()
titles := dict.NewDictInfoService().GetData("achieve")
for _, v := range alltitile {
ret = append(ret, TitleRes{
tt := TitleRes{
ID: v,
Name: titles[v].Name,
Desc: *titles[v].Remark,
})
}
if titles[v].Remark != nil {
tt.Desc = *titles[v].Remark
}
ret = append(ret, tt)
}
res.Data = ret

View File

@@ -10,20 +10,12 @@ const TableNameTask = "player_task"
// Task mapped from table <task>
type Task struct {
Base
PlayerID uint64 `gorm:"not null;index:idx_task_by_player_id;comment:'所属玩家ID'" json:"player_id"`
TaskID uint32 `gorm:"not null;comment:'任务ID'" json:"task_id"`
Data string `gorm:"type:jsonb;not null;comment:'全部数据'" json:"data"`
PlayerID uint64 `gorm:"not null;index:idx_task_by_player_id;comment:'所属玩家ID'" json:"player_id"`
TaskID uint32 `gorm:"not null;comment:'任务ID'" json:"task_id"`
Data []uint32 `struc:"[20]byte" gorm:"type:jsonb;not null;default:'[]';comment:'全部数据'" json:"data"`
}
// TaskEX 单个任务的详细信息,包含任务步骤状态和整体状态
type TaskEX struct {
Task
Data []uint32 `struc:"[20]byte" orm:"data" json:"data"`
//LastResetTime time.Time `gorm:"not null;comment:'上次重置时间UTC'" json:"last_reset_time"` //这里是每天重置
// Status 任务整体状态0-未接受1-已接受2-已完成未领取3-已完成已领取
// json标签指定JSON字段名与业务状态说明保持一致
//Status byte `json:"status"`
}
// TableName PlayerInfo's table name
func (*Task) TableName() string {
@@ -35,13 +27,6 @@ func (*Task) GroupName() string {
return "default"
}
func (t *Task) GetData() string {
return t.Data
}
func (t *Task) SetData(t1 string) {
t.Data = t1
}
// NewPlayerInfo create a new PlayerInfo
func NewTask() *Task {
return &Task{

View File

@@ -9,11 +9,15 @@ import (
)
// 获取任务信息
func (s *TaskService) Exec(id uint32, t func(*model.TaskEX) bool) {
var gg model.TaskEX
func (s *TaskService) Exec(id uint32, t func(*model.Task) bool) {
var gg model.Task
m1 := s.dbm(s.Model).Where("task_id", id)
m1.Scan(&gg)
if gg.Data == nil {
gg.Data = make([]uint32, 0)
}
tre := t(&gg)
if !tre { //不需要更新