You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
package main
|
|
|
|
|
|
|
|
func InitializationHttpCrudAdminMyTestr(router *hskgin.GinHelper) {
|
|
var authority = func(ctx *hskgin.GinContextHelper) {
|
|
//todo 权限控制
|
|
}
|
|
|
|
router.Any("/admin/myTestr/get", func(ctx *hskgin.GinContextHelper) {
|
|
authority(ctx)
|
|
req := MyTestr{}
|
|
ctx.Bind(&req)
|
|
err := req.Load()
|
|
ctx.CheckErrDisplayByError(err)
|
|
ctx.DisplayByData(req)
|
|
})
|
|
|
|
router.Any("/admin/myTestr/save", func(ctx *hskgin.GinContextHelper) {
|
|
authority(ctx)
|
|
req := MyTestr{}
|
|
ctx.Bind(&req)
|
|
err := req.Save()
|
|
ctx.CheckErrDisplayByError(err)
|
|
err = req.Load()
|
|
ctx.CheckErrDisplayByError(err)
|
|
ctx.DisplayByData(req)
|
|
})
|
|
|
|
router.Any("/admin/myTestr/data", func(ctx *hskgin.GinContextHelper) {
|
|
authority(ctx)
|
|
req := MyTestr{}
|
|
ctx.Bind(&req)
|
|
data := req.Data()
|
|
ctx.DisplayByData(data)
|
|
})
|
|
|
|
router.Any("/admin/myTestr/list", func(ctx *hskgin.GinContextHelper) {
|
|
authority(ctx)
|
|
req := MyTestr{}
|
|
ctx.Bind(&req)
|
|
page := ctx.ParamRequired2Page(true)
|
|
data, count := req.PageData(page, 10)
|
|
ctx.DisplayByPage(data, count)
|
|
})
|
|
}
|
|
|