Files
bl/modules/player/controller/admin/title.go
xinian f8b948721f
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 简化玩家称号获取逻辑,直接返回ID列表
2026-02-27 10:21:49 +08:00

62 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package admin
import (
"blazing/cool"
"blazing/modules/player/service"
"context"
"github.com/gogf/gf/v2/frame/g"
)
type TitleController struct {
*cool.Controller
}
func init() {
var task_info_controller = &TitleController{
&cool.Controller{
Prefix: "/admin/game/title",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(0), //因为page已经过滤所以这里需要改成0
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}
type GetReq struct {
g.Meta `path:"/get" method:"POST"`
ID uint32 `json:"id"`
}
func (c *TitleController) Get(ctx context.Context, req *GetReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
//var ret []TitleRes
var (
admin = cool.GetAdmin(ctx)
//r = g.RequestFromCtx(ctx)
)
alltitile := service.NewUserService(uint32(admin.UserId)).Title.Get()
//titles := dict.NewDictInfoService().GetData("achieve")
// tt := []uint32{}
// for _, v := range alltitile {
// //info := titles[v]
// // if info.Remark != nil {
// // tt.Desc = *info.Remark
// // }
// // tt.Name = info.Name
// tt = append(tt, v.)
// }
res.Data = alltitile
return
}
// type TitleRes struct {
// ID uint32 `json:"id"`
// Name string `json:"name"`
// Desc string `json:"desc"`
// }