feat:完善项目
This commit is contained in:
@ -9,12 +9,18 @@ import (
|
||||
type Role struct{}
|
||||
|
||||
type roleForm struct {
|
||||
ParentID uint64 `json:"parent_id" form:"parent_id"`
|
||||
ParentID string `json:"parent_id" form:"parent_id"`
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Remark string `json:"remark" form:"remark" binding:"required"`
|
||||
Sort int `json:"sort" form:"sort"`
|
||||
}
|
||||
|
||||
func (this *roleForm) parentInfo() uint64 {
|
||||
obj := new(IDStringForm)
|
||||
obj.ID = this.ParentID
|
||||
return obj.Convert()
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiDefine Role 角色管理
|
||||
*/
|
||||
@ -66,7 +72,7 @@ func (a *Role) Add(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Form(&role.InstanceParams{
|
||||
ParentID: form.ParentID, Name: form.Name, Remark: form.Remark, Sort: form.Sort,
|
||||
ParentID: form.parentInfo(), Name: form.Name, Remark: form.Remark, Sort: form.Sort,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
@ -81,7 +87,7 @@ func (a *Role) Edit(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Form(&role.InstanceParams{
|
||||
ID: form.Convert(), ParentID: form.ParentID, Name: form.Name, Remark: form.Remark, Sort: form.Sort,
|
||||
ID: form.Convert(), ParentID: form.parentInfo(), Name: form.Name, Remark: form.Remark, Sort: form.Sort,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
@ -165,6 +165,7 @@ func (*User) List(c *gin.Context) {
|
||||
|
||||
func (*User) Detail(c *gin.Context) {
|
||||
form := new(IDStringForm)
|
||||
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
|
Reference in New Issue
Block a user