Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
- Variables
- func CreateAdmin(input CreateAdminParams, isSuper bool) (res schema.Response)
- func DeleteAdminByAccount(account string)
- func DeleteAdminById(c helper.Context, adminId string) (res schema.Response)
- func GetAccession() (res schema.Response)
- func GetAdminInfo(c helper.Context) (res schema.Response)
- func GetAdminInfoById(c helper.Context, adminId string) (res schema.Response)
- func GetList(c helper.Context, input Query) (res schema.Response)
- func Login(input SignInParams) (res schema.Response)
- func Update(c helper.Context, adminId string, input UpdateParams) (res schema.Response)
- func UpdatePassword(c helper.Context, input UpdatePasswordParams) (res schema.Response)
- type CreateAdminParams
- type Query
- type SignInParams
- type UpdateParams
- type UpdatePasswordParams
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateAdminRouter = router.Handler(func(c router.Context) { var ( input CreateAdminParams err error ) defer func() { c.ResponseFunc(err, func() schema.Response { return CreateAdmin(input, false) }) }() if err = c.ShouldBindJSON(&input); err != nil { return } adminInfo := model.Admin{ Id: c.Uid(), } if err = database.Db.Where(&adminInfo).First(&adminInfo).Error; err != nil { if err == gorm.ErrRecordNotFound { err = exception.AdminNotExist return } return } if adminInfo.IsSuper == false { err = exception.AdminNotSuper return } })
View Source
var DeleteAdminByIdRouter = router.Handler(func(c router.Context) { id := c.Param("admin_id") c.ResponseFunc(nil, func() schema.Response { return DeleteAdminById(helper.NewContext(&c), id) }) })
View Source
var GetAccessionRouter = router.Handler(func(c router.Context) { c.ResponseFunc(nil, func() schema.Response { return GetAccession() }) })
View Source
var GetAdminInfoByIdRouter = router.Handler(func(c router.Context) { adminId := c.Param("admin_id") c.ResponseFunc(nil, func() schema.Response { return GetAdminInfoById(helper.NewContext(&c), adminId) }) })
View Source
var GetAdminInfoRouter = router.Handler(func(c router.Context) { c.ResponseFunc(nil, func() schema.Response { return GetAdminInfo(helper.NewContext(&c)) }) })
View Source
var GetListRouter = router.Handler(func(c router.Context) { var ( input Query ) c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response { return GetList(helper.NewContext(&c), input) }) })
View Source
var LoginRouter = router.Handler(func(c router.Context) { var ( input SignInParams ) c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Login(input) }) })
View Source
var UpdatePasswordRouter = router.Handler(func(c router.Context) { var ( input UpdatePasswordParams ) c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return UpdatePassword(helper.NewContext(&c), input) }) })
View Source
var UpdateRouter = router.Handler(func(c router.Context) { var ( input UpdateParams ) id := c.Param("admin_id") c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Update(helper.NewContext(&c), id, input) }) })
Functions ¶
func CreateAdmin ¶
func CreateAdmin(input CreateAdminParams, isSuper bool) (res schema.Response)
创建管理员
func DeleteAdminByAccount ¶
func DeleteAdminByAccount(account string)
func GetAccession ¶
func GetAdminInfoById ¶
func Login ¶
func Login(input SignInParams) (res schema.Response)
func UpdatePassword ¶
func UpdatePassword(c helper.Context, input UpdatePasswordParams) (res schema.Response)
Types ¶
type CreateAdminParams ¶
type SignInParams ¶
type UpdateParams ¶
type UpdateParams struct { Status *model.AdminStatus `json:"status"` // 管理员状态 Name *string `json:"name"` // 管理员名字 Accession *[]string `json:"accession"` // 管理员的权限 }
type UpdatePasswordParams ¶
Click to show internal directories.
Click to hide internal directories.