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, query 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 CreateAdminParams struct { Account string `json:"account" validate:"required,min=1,max=36" comment:"帐号"` // 管理员账号,登陆凭证 Password string `json:"password" validate:"required,min=6,max=36" comment:"密码"` // 管理员密码 Name string `json:"name" validate:"required,min=2,max=36" comment:"名称"` // 管理员名称,注册后不可修改 }
type Query ¶
type Query struct { schema.Query Status *model.AdminStatus `json:"status" url:"status" validate:"omitempty,number" comment:"管理员状态"` // 管理员状态 }
type SignInParams ¶
type UpdateParams ¶
type UpdateParams struct { Status *model.AdminStatus `json:"status" validate:"omitempty" comment:"管理员状态"` // 管理员状态 Name *string `json:"name" validate:"omitempty,min=2,max=36" comment:"名称"` // 管理员名字 Accession *[]string `json:"accession" validate:"omitempty" comment:"管理员的权限"` // 管理员的权限 }
type UpdatePasswordParams ¶
type UpdatePasswordParams struct { OldPassword string `json:"old_password" validate:"required,max=36" comment:"旧密码"` // 旧密码 NewPassword string `json:"new_password" validate:"required,max=36" comment:"新密码"` // 新密码 ConfirmPassword string `json:"confirm_password" validate:"required,max=36,eqfield=NewPassword" comment:"确认密码"` // 确认密码 }
Click to show internal directories.
Click to hide internal directories.