Initial commit

This commit is contained in:
2026-05-20 16:13:58 +08:00
commit ceffbe382e
500 changed files with 157469 additions and 0 deletions
+166
View File
@@ -0,0 +1,166 @@
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.ActivityListReq true "参数"
// @Success 200 {object} proto.ActivityListResp "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/list [GET]
func ActivityList(ctx *gin.Context) {
var param proto.ActivityListReq
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := activitySer.GetActivityList(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.AddActivityReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/add [POST]
func AddActivity(ctx *gin.Context) {
param := proto.AddActivityReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.AddOneAct(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.UpdateActivityReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/update [POST]
func ActUpdate(ctx *gin.Context) {
param := proto.UpdateActivityReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.UpdateOneAct(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.DelActivityReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/del [POST]
func DelOneAct(ctx *gin.Context) {
param := proto.DelActivityReq{}
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
return
}
code, err := activitySer.DeleteOneAct(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.ActivityVisitCountReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/visit [POST]
func ActivityVisitCount(ctx *gin.Context) {
var param proto.ActivityVisitCountReq
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.UpdateActivityVisitCount(ctx, ctx.ClientIP(), 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.ActivityVisitCountReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/visit/list [GET]
func ActivityVisitCountList(ctx *gin.Context) {
var param proto.ActivityVisitCountListReq
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, resp, err := activitySer.GetActivityVisitList(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
stdLog.ServerJSON(ctx, code, resp)
}
+110
View File
@@ -0,0 +1,110 @@
package activityApi
import (
"stat/api/proto"
"stat/common/stdLog"
"stat/service/activitySer"
"github.com/gin-gonic/gin"
)
// @Tags 活动管理
// @Summary h5页面活动信息
// @Description h5页面活动信息
// @Accept json
// @Produce json
// @Param param body proto.ActivityInfoReq true "参数"
// @Success 200 {object} proto.ActivityInfoResp "成功"
// @Success 400 {string} string "失败"
// @Router /api/stat/activity/h5/info [POST]
func ActivityInfo(ctx *gin.Context) {
var param proto.ActivityInfoReq
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := activitySer.GetActivityInfo(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
stdLog.ServerJSON(ctx, code, data)
}
// @Tags 活动管理
// @Summary h5页面活动奖品信息
// @Description h5页面活动奖品信息
// @Accept json
// @Produce json
// @Param param body proto.ActivityGiftInfoReq true "参数"
// @Success 200 {object} proto.ActivityGiftInfoResp "成功"
// @Success 400 {string} string "失败"
// @Router /api/stat/activity/h5/giftinfo [POST]
func ActivityGiftInfo(ctx *gin.Context) {
param := proto.ActivityGiftInfoReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := activitySer.GetActivityGiftInfo(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.DrawReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Router /api/stat/activity/h5/draw [POST]
func LuckyDraw(ctx *gin.Context) {
param := proto.DrawReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := activitySer.Draw(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.DelActivityReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/del [POST]
// func DelOneAct(ctx *gin.Context) {
// param := proto.DelActivityReq{}
// if err := ctx.ShouldBind(&param); err != nil {
// stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
// return
// }
// code, err := activitySer.DeleteOneAct(ctx, param)
// if err != nil {
// stdLog.ServerJSON(ctx, code, err)
// return
// }
// stdLog.ServerJSON(ctx, code, "")
// }
+138
View File
@@ -0,0 +1,138 @@
package activityApi
import (
"stat/api/proto"
"stat/common/stdLog"
"stat/common/utils"
"stat/service/activitySer"
"stat/service/opLogSer"
"github.com/gin-gonic/gin"
)
// @Tags 活动管理
// @Summary 生成活动抽奖码
// @Description 生成活动抽奖码
// @Accept json
// @Produce json
// @Param param body proto.GenLotteryCodeReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/lotterycode/gen [POST]
func GenLotCode(ctx *gin.Context) {
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
param := proto.GenLotteryCodeReq{}
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.GenLotteryCodes(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, "")
}
// @Tags 活动管理
// @Summary 修改活动抽奖码
// @Description 修改活动抽奖码
// @Accept json
// @Produce json
// @Param param body proto.UpdateLotteryCodeReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/lotterycode/update [POST]
func UpdateLotCode(ctx *gin.Context) {
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
param := proto.UpdateLotteryCodeReq{}
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
return
}
code, err := activitySer.UpdateLotteryCode(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, "")
}
// @Tags 活动管理
// @Summary 删除活动抽奖码
// @Description 删除活动抽奖码
// @Accept json
// @Produce json
// @Param param body proto.DelLotteryCodeReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/lotterycode/del [POST]
func DelLotCode(ctx *gin.Context) {
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
param := proto.DelLotteryCodeReq{}
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
return
}
code, err := activitySer.DeleteOneLotteryCode(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, "")
}
// @Tags 活动管理
// @Summary 活动抽奖码列表
// @Description 活动抽奖码列表
// @Accept json
// @Produce json
// @Param param body proto.LotteryCodeListReq true "参数列表"
// @Success 200 {object} proto.LotteryCodeListResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/activity/lotterycode/list [POST]
func LotteryCodeList(ctx *gin.Context) {
param := proto.LotteryCodeListReq{}
if err := ctx.ShouldBind(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
return
}
code, data, err := activitySer.GetLotteryCodeList(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
stdLog.ServerJSON(ctx, code, data)
}
+113
View File
@@ -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.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(&param); 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(&param); 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(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.UpdateOneRecvGiftInfo(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.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(&param); 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, "")
}
+113
View File
@@ -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(&param); 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(&param); 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(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, err := activitySer.UpdateOneGift(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.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(&param); 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, "")
}