forked from all_user/stat_center
114 lines
2.9 KiB
Go
114 lines
2.9 KiB
Go
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.GetGiftInfoReq true "参数"
|
|
// @Success 200 {object} proto.GetGiftInfoResp "成功"
|
|
// @Success 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/activity/getgift/list [GET]
|
|
func ReceiveGiftInfoList(ctx *gin.Context) {
|
|
|
|
var param proto.GetGiftInfoReq
|
|
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
return
|
|
}
|
|
code, data, err := activitySer.GetReceiveGiftInfoList(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.GenGiftCodeRes true "参数"
|
|
// @Success 200 {string} string "成功"
|
|
// @Success 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/activity/getgift/gen [POST]
|
|
func GenGiftCode(ctx *gin.Context) {
|
|
param := proto.GenGiftCodeRes{}
|
|
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
return
|
|
}
|
|
|
|
code, err := activitySer.GenManyGiftCode(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/getgift/update [POST]
|
|
func UpdateRecvGiftInfo(ctx *gin.Context) {
|
|
param := proto.UpdateGetGiftReq{}
|
|
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
return
|
|
}
|
|
|
|
code, err := activitySer.UpdateOneRecvGiftInfo(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/getgift/del [POST]
|
|
func DelReceiveGiftInfo(ctx *gin.Context) {
|
|
param := proto.DelGetGiftReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, err := activitySer.DelOneRecvGiftInfo(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, code, "")
|
|
}
|