feat:完善项目
This commit is contained in:
@ -26,6 +26,28 @@ type userForm struct {
|
||||
RoleIDs []string `json:"role_ids" form:"role_ids"`
|
||||
}
|
||||
|
||||
func (this *userForm) avatarInfo() string {
|
||||
obj := &ImageForm{Image: this.Avatar}
|
||||
return obj.FilterImageURL()
|
||||
}
|
||||
|
||||
func (this *userForm) tenantInfo() uint64 {
|
||||
obj := &IDStringForm{ID: this.TenantID}
|
||||
return obj.Convert()
|
||||
}
|
||||
|
||||
// roleInfo 角色信息
|
||||
func (this *userForm) roleInfo() []uint64 {
|
||||
obj := new(IDStringForm)
|
||||
roleIDs := make([]uint64, 0)
|
||||
|
||||
for _, v := range this.RoleIDs {
|
||||
obj.ID = v
|
||||
roleIDs = append(roleIDs, obj.Convert())
|
||||
}
|
||||
return roleIDs
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/info 用户信息
|
||||
* @apiVersion 1.0.0
|
||||
@ -152,7 +174,7 @@ func (*User) Detail(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/add 用户信息添加
|
||||
* @api {post} /api/v1/user/add 用户信息添加
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserAdd
|
||||
* @apiGroup User
|
||||
@ -191,18 +213,16 @@ func (*User) Add(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
obj := &ImageForm{Image: form.Avatar}
|
||||
IDObj := &IDStringForm{ID: form.TenantID}
|
||||
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Form(&user.InstanceParams{
|
||||
TenantID: IDObj.Convert(), Account: form.Account, Name: form.Name, Avatar: obj.FilterImageURL(),
|
||||
TenantID: form.tenantInfo(), Account: form.Account, Name: form.Name, Avatar: form.avatarInfo(),
|
||||
Mobile: form.Mobile, Password: form.Password, Remark: form.Remark, Gender: form.Gender, Status: form.Status,
|
||||
RoleIDs: form.roleInfo(),
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/edit 用户信息修改
|
||||
* @api {post} /api/v1/user/edit 用户信息修改
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserEdit
|
||||
* @apiGroup User
|
||||
@ -244,18 +264,16 @@ func (*User) Edit(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
obj := &ImageForm{Image: form.Avatar}
|
||||
IDObj := &IDStringForm{ID: form.TenantID}
|
||||
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Form(&user.InstanceParams{
|
||||
ID: form.Convert(), TenantID: IDObj.Convert(), Account: form.Account, Name: form.Name, Avatar: obj.FilterImageURL(),
|
||||
ID: form.Convert(), TenantID: form.tenantInfo(), Account: form.Account, Name: form.Name, Avatar: form.avatarInfo(),
|
||||
Mobile: form.Mobile, Password: form.Password, Remark: form.Remark, Gender: form.Gender, Status: form.Status,
|
||||
RoleIDs: form.roleInfo(),
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/delete 用户信息删除
|
||||
* @api {post} /api/v1/user/delete 用户信息删除
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserDelete
|
||||
* @apiGroup User
|
||||
@ -288,7 +306,7 @@ func (*User) Delete(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/password/quick 用户密码快速设置
|
||||
* @api {post} /api/v1/user/password/quick 用户密码快速设置
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserPasswordQuick
|
||||
* @apiGroup User
|
||||
@ -324,7 +342,7 @@ func (*User) PasswordQuick(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/password/tradition 用户密码传统设置
|
||||
* @api {post} /api/v1/user/password/tradition 用户密码传统设置
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserPasswordTradition
|
||||
* @apiGroup User
|
||||
@ -365,7 +383,7 @@ func (*User) PasswordTradition(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/password/activate 用户账号激活
|
||||
* @api {post} /api/v1/user/activate 用户账号激活
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserPasswordActivate
|
||||
* @apiGroup User
|
||||
@ -398,7 +416,7 @@ func (*User) Activate(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/password/frozen 用户账号冻结
|
||||
* @api {post} /api/v1/user/frozen 用户账号冻结
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserPasswordFrozen
|
||||
* @apiGroup User
|
||||
@ -481,7 +499,7 @@ func (a *User) Role(c *gin.Context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/user/role/bind 用户角色绑定
|
||||
* @api {post} /api/v1/user/role/bind 用户角色绑定
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName UserRoleBind
|
||||
* @apiGroup User
|
||||
|
Reference in New Issue
Block a user