2025-04-18 17:17:23 +08:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"admin/apps/game/model/dto"
|
|
|
|
"admin/internal/context"
|
|
|
|
)
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
func (ctl *controller) CommonList(ctx *context.WebContext, params *dto.CommonListReq, rsp *dto.CommonListRsp) error {
|
|
|
|
projectId, resource := getCtxURIProjectIdAndResource(ctx)
|
|
|
|
list, err := ctl.svc.CommonList(ctx, projectId, resource, params)
|
2025-04-18 17:17:23 +08:00
|
|
|
if err != nil {
|
2025-04-22 15:46:48 +08:00
|
|
|
return err
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
2025-04-22 15:46:48 +08:00
|
|
|
*rsp = *list
|
|
|
|
return nil
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
func (ctl *controller) CommonPost(ctx *context.WebContext, params *dto.CommonPostReq, rsp *dto.CommonPostRsp) error {
|
|
|
|
projectId, resource := getCtxURIProjectIdAndResource(ctx)
|
|
|
|
newObj, err := ctl.svc.CommonPost(ctx, projectId, resource, *params.Dto)
|
2025-04-18 17:17:23 +08:00
|
|
|
if err != nil {
|
2025-04-22 15:46:48 +08:00
|
|
|
return err
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
2025-04-22 15:46:48 +08:00
|
|
|
rsp.Dto = &newObj
|
|
|
|
return nil
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
func (ctl *controller) CommonPut(ctx *context.WebContext, params *dto.CommonPutReq, rsp *dto.CommonPutRsp) error {
|
|
|
|
projectId, resource := getCtxURIProjectIdAndResource(ctx)
|
|
|
|
err := ctl.svc.CommonPut(ctx, projectId, resource, *params.Dto)
|
2025-04-18 17:17:23 +08:00
|
|
|
if err != nil {
|
2025-04-22 15:46:48 +08:00
|
|
|
return err
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
2025-04-24 20:39:31 +08:00
|
|
|
rsp.Dto = params.Dto
|
2025-04-22 15:46:48 +08:00
|
|
|
return nil
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
func (ctl *controller) CommonDelete(ctx *context.WebContext, params *dto.CommonDeleteReq, rsp *dto.CommonDeleteRsp) error {
|
|
|
|
projectId, resource := getCtxURIProjectIdAndResource(ctx)
|
|
|
|
err := ctl.svc.CommonDelete(ctx, projectId, resource, params.Id)
|
2025-04-18 17:17:23 +08:00
|
|
|
if err != nil {
|
2025-04-22 15:46:48 +08:00
|
|
|
return err
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|
2025-04-22 15:46:48 +08:00
|
|
|
return nil
|
2025-04-18 17:17:23 +08:00
|
|
|
}
|