42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"admin/apps/game/model/dto"
|
|
"admin/internal/context"
|
|
)
|
|
|
|
func (ctl *controller) CommonList(ctx *context.WebContext, restfulResourceName string, params *dto.CommonListReq, rsp *dto.CommonListRsp) error {
|
|
list, err := ctl.svc.CommonList(ctx, restfulResourceName, params)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*rsp = *list
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonPost(ctx *context.WebContext, restfulResourceName string, params *dto.CommonPostReq, rsp *dto.CommonPostRsp) error {
|
|
newObj, err := ctl.svc.CommonPost(ctx, restfulResourceName, *params.Dto)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rsp.Dto = &newObj
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonPut(ctx *context.WebContext, restfulResourceName string, params *dto.CommonPutReq, rsp *dto.CommonPutRsp) error {
|
|
newObj, err := ctl.svc.CommonPut(ctx, restfulResourceName, *params.Dto)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rsp.Dto = &newObj
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonDelete(ctx *context.WebContext, restfulResourceName string, params *dto.CommonDeleteReq, rsp *dto.CommonDeleteRsp) error {
|
|
err := ctl.svc.CommonDelete(ctx, restfulResourceName, params.Id)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|