feat:完善项目
This commit is contained in:
@ -68,6 +68,14 @@ func (c *Instance) Login(account, password, captchaKey, captchaValue, ip string)
|
||||
return &InstanceLoginResponse{Token: session.Token, EffectTime: config.SettingInfo.TokenEffectTime}, nil
|
||||
}
|
||||
|
||||
// Logout 退出请求
|
||||
func (c *Instance) Logout() error {
|
||||
if c.UID > 0 {
|
||||
service.Publish(config.EventForRedisHashDestroy, config.RedisKeyForAccount, utils.UintToString(c.UID))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *service.Session) *Instance {
|
||||
return &Instance{session}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package basic
|
||||
|
||||
// ReturnPages 分页数据
|
||||
type ReturnPages struct {
|
||||
// PageDataResponse 分页数据
|
||||
type PageDataResponse struct {
|
||||
Data interface{} `json:"data"`
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ type (
|
||||
)
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.ReturnPages, error) {
|
||||
func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mManageSupplier := model.NewManageSupplier()
|
||||
|
||||
out := make([]*model2.ManageSupplier, 0)
|
||||
@ -69,7 +69,7 @@ func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, pag
|
||||
ID: v.GetEncodeID(), ManageSupplier: v,
|
||||
})
|
||||
}
|
||||
return &basic.ReturnPages{Data: list, Count: count}, nil
|
||||
return &basic.PageDataResponse{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// Form 数据处理
|
||||
|
@ -2,6 +2,7 @@ package user
|
||||
|
||||
import (
|
||||
"ArmedPolice/app/controller/basic"
|
||||
"ArmedPolice/app/model"
|
||||
"ArmedPolice/app/service"
|
||||
)
|
||||
|
||||
@ -9,8 +10,41 @@ type Instance struct{ *service.Session }
|
||||
|
||||
type InstanceHandle func(session *service.Session) *Instance
|
||||
|
||||
func (c *Instance) List() (*basic.ReturnPages, error) {
|
||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
||||
type (
|
||||
// InstanceBasic 基本信息
|
||||
InstanceBasic struct {
|
||||
Name string `json:"name"`
|
||||
Avatar string `json:"avatar"`
|
||||
}
|
||||
// InstanceInfo 用户信息
|
||||
InstanceInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.SysUserInfo
|
||||
}
|
||||
)
|
||||
|
||||
// Info 基本信息
|
||||
func (c *Instance) Info() *InstanceBasic {
|
||||
return &InstanceBasic{Name: c.Name, Avatar: c.Avatar}
|
||||
}
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(name string, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mSysUser := model.NewSysUser()
|
||||
var count int64
|
||||
|
||||
out, err := mSysUser.Users(page, pageSize, &count)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*InstanceInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &InstanceInfo{ID: v.GetEncodeID(), SysUserInfo: v})
|
||||
}
|
||||
return &basic.PageDataResponse{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func (c *Instance) Form() error {
|
||||
|
Reference in New Issue
Block a user