e8e3a3a72b
- 分页列出 lottery_draw,join 奖品快照 + 用户邮箱 + 发放账本(grant_ledger) - 支持 activity/user/win/dispatch_state/prize_type/时间窗过滤 - 展示中奖人/奖品/发放状态/发放结果(如"已新建订阅并加 30 天") Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86 lines
3.0 KiB
Go
86 lines
3.0 KiB
Go
// admin_claims_handler.go 提供 Stage 2 后台工单接口的 gin handler 层。
|
|
// 路径注册在 internal/handler/lottery_routes.go 里;handler 只负责参数绑定 +
|
|
// 委派到 internal/logic/admin/lottery/admin_claims.go。
|
|
package lottery
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
adminlottery "github.com/perfect-panel/server/internal/logic/admin/lottery"
|
|
"github.com/perfect-panel/server/internal/svc"
|
|
"github.com/perfect-panel/server/internal/types"
|
|
"github.com/perfect-panel/server/pkg/result"
|
|
)
|
|
|
|
// ListLotteryClaimsHandler GET /v1/admin/lottery/claims
|
|
func ListLotteryClaimsHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.ListAdminLotteryClaimsRequest
|
|
_ = c.ShouldBind(&req)
|
|
l := adminlottery.NewListLotteryClaimsLogic(c.Request.Context(), svcCtx)
|
|
resp, err := l.ListLotteryClaims(&req)
|
|
result.HttpResult(c, resp, err)
|
|
}
|
|
}
|
|
|
|
// ApproveLotteryClaimHandler POST /v1/admin/lottery/claims/approve
|
|
func ApproveLotteryClaimHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.AdminApproveClaimRequest
|
|
_ = c.ShouldBind(&req)
|
|
if err := svcCtx.Validate(&req); err != nil {
|
|
result.ParamErrorResult(c, err)
|
|
return
|
|
}
|
|
l := adminlottery.NewApproveLotteryClaimLogic(c.Request.Context(), svcCtx)
|
|
result.HttpResult(c, nil, l.ApproveLotteryClaim(&req))
|
|
}
|
|
}
|
|
|
|
// RejectLotteryClaimHandler POST /v1/admin/lottery/claims/reject
|
|
func RejectLotteryClaimHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.AdminRejectClaimRequest
|
|
_ = c.ShouldBind(&req)
|
|
if err := svcCtx.Validate(&req); err != nil {
|
|
result.ParamErrorResult(c, err)
|
|
return
|
|
}
|
|
l := adminlottery.NewRejectLotteryClaimLogic(c.Request.Context(), svcCtx)
|
|
result.HttpResult(c, nil, l.RejectLotteryClaim(&req))
|
|
}
|
|
}
|
|
|
|
// MarkPaidLotteryClaimHandler POST /v1/admin/lottery/claims/mark-paid
|
|
func MarkPaidLotteryClaimHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.AdminMarkPaidClaimRequest
|
|
_ = c.ShouldBind(&req)
|
|
if err := svcCtx.Validate(&req); err != nil {
|
|
result.ParamErrorResult(c, err)
|
|
return
|
|
}
|
|
l := adminlottery.NewMarkPaidLotteryClaimLogic(c.Request.Context(), svcCtx)
|
|
result.HttpResult(c, nil, l.MarkPaidLotteryClaim(&req))
|
|
}
|
|
}
|
|
|
|
// LotteryClaimsSummaryHandler GET /v1/admin/lottery/claims/summary
|
|
func LotteryClaimsSummaryHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
l := adminlottery.NewLotteryClaimsSummaryLogic(c.Request.Context(), svcCtx)
|
|
resp, err := l.LotteryClaimsSummary()
|
|
result.HttpResult(c, resp, err)
|
|
}
|
|
}
|
|
|
|
// ListLotteryDrawsHandler GET /v1/admin/lottery/draws
|
|
func ListLotteryDrawsHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.ListAdminLotteryDrawsRequest
|
|
_ = c.ShouldBind(&req)
|
|
l := adminlottery.NewListLotteryDrawsLogic(c.Request.Context(), svcCtx)
|
|
resp, err := l.ListLotteryDraws(&req)
|
|
result.HttpResult(c, resp, err)
|
|
}
|
|
}
|