forked from all_user/stat_center
109 lines
3.4 KiB
Go
109 lines
3.4 KiB
Go
package dailystatadvertise
|
|
|
|
import (
|
|
"stat/common/stdLog"
|
|
"stat/models/dailystatadvertise"
|
|
"stat/service/dailystatadvertiseser"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Tags 统计数据(广告)
|
|
// @Summary 分组分页获取统计数据(广告)
|
|
// @Description 分组分页获取统计数据(广告)
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body dailystatadvertiseser.DailyStatAdvertiseSearch true "参数列表"
|
|
// @Success 200 {object} dailystatadvertiseser.DailyStatAdvertiseSearchResp "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/statadvertise/list [POST]
|
|
func GetDailyStatAdvertise(ctx *gin.Context) {
|
|
var req = &dailystatadvertiseser.DailyStatAdvertiseSearch{}
|
|
if err := ctx.ShouldBind(req); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
resp, serr := dailystatadvertiseser.GetDailyStatAdvertise(ctx, req)
|
|
if serr != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
|
}
|
|
|
|
// @Tags 统计数据(广告)
|
|
// @Summary 添加一个统计数据(广告)
|
|
// @Description 添加一个统计数据(广告)
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body dailystatadvertise.DailyStatAdvertise true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/statadvertise/add [POST]
|
|
func AddOneDailyStatAdvertise(ctx *gin.Context) {
|
|
var req = &dailystatadvertise.DailyStatAdvertise{}
|
|
if err := ctx.ShouldBind(req); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
//fmt.Println("err", err)
|
|
return
|
|
}
|
|
serr := dailystatadvertiseser.AddDailyStatAdvertise(ctx, req)
|
|
if serr != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
|
}
|
|
|
|
// @Tags 统计数据(广告)
|
|
// @Summary 删除一个统计数据(广告)
|
|
// @Description 删除一个统计数据(广告)
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body dailystatadvertiseser.DailyStatAdvertiseDelReq true "参数列表"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/statadvertise/del [POST]
|
|
func DelOneDailyStatAdvertise(ctx *gin.Context) {
|
|
var req = &dailystatadvertiseser.DailyStatAdvertiseDelReq{}
|
|
if err := ctx.ShouldBind(req); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
return
|
|
}
|
|
serr := dailystatadvertiseser.DelDailyStatAdvertise(ctx, req.Id)
|
|
if serr != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
|
}
|
|
|
|
// @Tags 统计数据(广告)
|
|
// @Summary 更新一个统计数据(广告)
|
|
// @Description 更新一个统计数据(广告)
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body dailystatadvertiseser.DailyStatAdvertiseUpdateReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/statadvertise/update [POST]
|
|
func UpdateOneDailyStatAdvertise(ctx *gin.Context) {
|
|
var req = &dailystatadvertiseser.DailyStatAdvertiseUpdateReq{}
|
|
if err := ctx.ShouldBind(req); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
|
return
|
|
}
|
|
serr := dailystatadvertiseser.UpdateDailyStatAdvertise(ctx, req.Id, &req.Param)
|
|
if serr != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
|
}
|