MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / CreateLotteryDraw

Method CreateLotteryDraw

internal/api/lotteryDraw.go:70–96  ·  view source on GitHub ↗

CreateLotteryDraw 创建新的抽奖活动

(ctx *gin.Context, req req.CreateLotteryDrawReq)

Source from the content-addressed store, hash-verified

68
69// CreateLotteryDraw 创建新的抽奖活动
70func (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的抽奖活动
99func (lh *LotteryDrawHandler) GetLotteryDraw(ctx *gin.Context, req req.GetLotteryDrawReq) (Result, error) {

Callers

nothing calls this directly

Calls 1

CreateLotteryDrawMethod · 0.65

Tested by

no test coverage detected