CreateLotteryDraw 创建新的抽奖活动
(ctx *gin.Context, req req.CreateLotteryDrawReq)
| 68 | |
| 69 | // CreateLotteryDraw 创建新的抽奖活动 |
| 70 | func (lh *LotteryDrawHandler) CreateLotteryDraw(ctx *gin.Context, req req.CreateLotteryDrawReq) (Result, error) { |
| 71 | input := domain.LotteryDraw{ |
| 72 | Name: req.Name, |
| 73 | Description: req.Description, |
| 74 | StartTime: req.StartTime, |
| 75 | EndTime: req.EndTime, |
| 76 | } |
| 77 | |
| 78 | err := lh.svc.CreateLotteryDraw(ctx, domain.LotteryDraw{ |
| 79 | Name: input.Name, |
| 80 | Description: input.Description, |
| 81 | StartTime: input.StartTime, |
| 82 | EndTime: input.EndTime, |
| 83 | Status: domain.LotteryStatusPending, |
| 84 | }) |
| 85 | if err != nil { |
| 86 | return Result{ |
| 87 | Code: ServerRequestError, |
| 88 | Msg: CreateLotteryDrawError, |
| 89 | }, err |
| 90 | } |
| 91 | |
| 92 | return Result{ |
| 93 | Code: RequestsOK, |
| 94 | Msg: CreateLotteryDrawSuccess, |
| 95 | }, nil |
| 96 | } |
| 97 | |
| 98 | // GetLotteryDraw 获取指定ID的抽奖活动 |
| 99 | func (lh *LotteryDrawHandler) GetLotteryDraw(ctx *gin.Context, req req.GetLotteryDrawReq) (Result, error) { |
nothing calls this directly
no test coverage detected