forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
package activityApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/activitySer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 活动管理
|
||||
// @Summary 活动奖励列表
|
||||
// @Description 活动奖励列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.GiftListReq true "参数"
|
||||
// @Success 200 {object} proto.GiftListResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/activity/gift/list [GET]
|
||||
func LotteryGiftList(ctx *gin.Context) {
|
||||
|
||||
var param proto.GiftListReq
|
||||
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
code, data, err := activitySer.GetLotteryGiftList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 活动管理
|
||||
// @Summary 添加活动奖励
|
||||
// @Description 添加活动奖励
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AddGiftReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/activity/gift/add [POST]
|
||||
func AddLotGift(ctx *gin.Context) {
|
||||
param := proto.AddGiftReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, err := activitySer.AddOneGift(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, "")
|
||||
}
|
||||
|
||||
// @Tags 活动管理
|
||||
// @Summary 更新一个活动奖励
|
||||
// @Description 更新一个活动奖励
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.UpdateGiftReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/activity/gift/update [POST]
|
||||
func UpdateLotGift(ctx *gin.Context) {
|
||||
param := proto.UpdateGiftReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, err := activitySer.UpdateOneGift(ctx, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, "")
|
||||
}
|
||||
|
||||
// @Tags 活动管理
|
||||
// @Summary 删除一个活动奖励
|
||||
// @Description 删除一个活动奖励
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.DelGiftReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/activity/gift/del [POST]
|
||||
func DelLotGift(ctx *gin.Context) {
|
||||
param := proto.DelGiftReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, err := activitySer.DeleteOneGift(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, "")
|
||||
}
|
||||
Reference in New Issue
Block a user