mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-10 19:23:44 +08:00
发布v2.13.1版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md
This commit is contained in:
@@ -11,7 +11,10 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/library/hgorm"
|
||||
"hotgo/internal/model"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
@@ -25,6 +28,7 @@ func NewAdminPost() *sAdminPost {
|
||||
|
||||
func init() {
|
||||
service.RegisterAdminPost(NewAdminPost())
|
||||
dict.RegisterFunc("adminPostOption", "岗位选项", service.AdminPost().Option)
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
@@ -156,6 +160,24 @@ func (s *sAdminPost) List(ctx context.Context, in *adminin.PostListInp) (list []
|
||||
return
|
||||
}
|
||||
|
||||
// Option 岗位选项
|
||||
func (s *sAdminPost) Option(ctx context.Context) (opts []*model.Option, err error) {
|
||||
var list []*entity.AdminPost
|
||||
if err = dao.AdminPost.Ctx(ctx).OrderAsc(dao.AdminPost.Columns().Sort).Scan(&list); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(list) == 0 {
|
||||
opts = make([]*model.Option, 0)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range list {
|
||||
opts = append(opts, dict.GenHashOption(v.Id, v.Name))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetMemberByStartName 获取指定用户的第一岗位
|
||||
func (s *sAdminPost) GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error) {
|
||||
// 默认取第一岗位
|
||||
|
||||
Reference in New Issue
Block a user