2023-12-29 21:28:16 +08:00
|
|
|
package sponsor
|
|
|
|
|
|
|
|
import (
|
|
|
|
"PersonalMain/api"
|
|
|
|
"PersonalMain/api/request"
|
2024-01-02 00:28:12 +08:00
|
|
|
"PersonalMain/internal/model/entity"
|
2023-12-29 21:28:16 +08:00
|
|
|
"PersonalMain/internal/service/SponsorService"
|
|
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ControllerV1 struct{}
|
|
|
|
|
|
|
|
func NewSponsorV1() api.ISponsorV1 {
|
|
|
|
return &ControllerV1{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func sponorService() SponsorService.SponsorService {
|
|
|
|
return SponsorService.NewSponsorService()
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetSponsor
|
|
|
|
//
|
|
|
|
// 获取赞助
|
|
|
|
func (*ControllerV1) GetSponsor(ctx context.Context, _ *request.GetSponsorReq) (res *request.GetSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
sponorService().GetSponsor(req)
|
|
|
|
return res, err
|
|
|
|
}
|
2024-01-02 00:28:12 +08:00
|
|
|
|
|
|
|
// AddSponsor
|
|
|
|
//
|
|
|
|
// 添加赞助
|
|
|
|
func (*ControllerV1) AddSponsor(ctx context.Context, _ *request.AddSponsorReq) (res *request.AddSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
sponsorAddVO := entity.SponsorAddVO{}
|
|
|
|
err = req.GetRequestStruct(&sponsorAddVO)
|
|
|
|
if err == nil {
|
|
|
|
sponorService().AddSponsor(req, sponsorAddVO)
|
|
|
|
}
|
|
|
|
return res, err
|
|
|
|
}
|
2024-01-06 22:41:38 +08:00
|
|
|
|
|
|
|
// GetCheckSponsor
|
|
|
|
//
|
|
|
|
// 获取检查赞助
|
|
|
|
func (*ControllerV1) GetCheckSponsor(ctx context.Context, _ *request.GetCheckSponsorReq) (res *request.GetCheckSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
sponorService().GetCheckSponsor(req)
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// CheckSponsor
|
|
|
|
//
|
|
|
|
// 检查赞助
|
|
|
|
func (*ControllerV1) CheckSponsor(ctx context.Context, _ *request.CheckSponsorReq) (res *request.CheckSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
checkSponsorVO := entity.CheckSponsorVO{}
|
|
|
|
err = req.GetRequestStruct(&checkSponsorVO)
|
|
|
|
if err == nil {
|
|
|
|
sponorService().CheckSponsor(req, checkSponsorVO)
|
|
|
|
}
|
|
|
|
return res, err
|
|
|
|
}
|
2024-01-09 21:06:03 +08:00
|
|
|
|
|
|
|
// EditSponsor
|
|
|
|
//
|
|
|
|
// 编辑赞助
|
|
|
|
func (*ControllerV1) EditSponsor(ctx context.Context, _ *request.EditSponsorReq) (res *request.EditSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
editSponsorVO := entity.SponsorEditVO{}
|
|
|
|
err = req.GetRequestStruct(&editSponsorVO)
|
|
|
|
if err == nil {
|
|
|
|
sponorService().EditSponsor(req, editSponsorVO)
|
|
|
|
}
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteSponsor
|
|
|
|
//
|
|
|
|
// 删除赞助
|
|
|
|
func (*ControllerV1) DeleteSponsor(ctx context.Context, _ *request.DeleteSponsorReq) (res *request.DeleteSponsorRes, err error) {
|
|
|
|
req := ghttp.RequestFromCtx(ctx)
|
|
|
|
// 获取业务
|
|
|
|
deleteSponsorVO := entity.SponsorDelVO{}
|
|
|
|
err = req.GetRequestStruct(&deleteSponsorVO)
|
|
|
|
if err == nil {
|
|
|
|
sponorService().DeleteSponsor(req, deleteSponsorVO)
|
|
|
|
}
|
|
|
|
return res, err
|
|
|
|
}
|