1
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
|
||||
"36wisdom/biz/model/dto"
|
||||
"36wisdom/biz/service"
|
||||
)
|
||||
|
||||
type adminUser struct{}
|
||||
|
||||
var AdminUser = &adminUser{}
|
||||
|
||||
func (c *adminUser) Get(ctx context.Context, req *dto.AdminUserGetReq) (*dto.AdminUserGetRes, error) {
|
||||
rec, err := service.AdminUser.GetByUsername(ctx, req.Username)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res := &dto.AdminUserGetRes{}
|
||||
if !rec.IsEmpty() {
|
||||
res.AdminUser = adminUserItem(rec)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func adminUserItem(r gdb.Record) dto.AdminUserItem {
|
||||
return dto.AdminUserItem{
|
||||
Id: r["id"].Int64(),
|
||||
Username: r["username"].String(),
|
||||
Status: r["status"].Int(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user