forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -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(¶m); 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(¶m); 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(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, err := activitySer.UpdateOneAct(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.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(¶m); 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(¶m); 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(¶m); 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)
|
||||
}
|
||||
@@ -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(¶m); 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(¶m); 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(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := activitySer.Draw(ctx, ¶m)
|
||||
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(¶m); 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, "")
|
||||
// }
|
||||
@@ -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(¶m); 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(¶m); 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(¶m); 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(¶m); 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)
|
||||
}
|
||||
@@ -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(¶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, "")
|
||||
}
|
||||
@@ -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, "")
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
package adminApi
|
||||
|
||||
import (
|
||||
"encoding/base32"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/skip2/go-qrcode"
|
||||
"stat/api/proto"
|
||||
"stat/common"
|
||||
"stat/common/googauth"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/models/adminMod"
|
||||
"stat/models/authorityMod"
|
||||
"stat/service/adminSer"
|
||||
"stat/service/opLogSer"
|
||||
)
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 管理员登录
|
||||
// @Description 传入用户信息登录
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdminLoginReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/admin/login [POST]
|
||||
func AdminLogin(ctx *gin.Context) {
|
||||
var param struct {
|
||||
proto.AdminLoginReq
|
||||
}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
adminInfo, err := adminMod.FindOneByAccount(ctx, *param.Account)
|
||||
if err != nil || adminInfo.Account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, err)
|
||||
return
|
||||
}
|
||||
if adminInfo.Secret == "" {
|
||||
secret := base32.StdEncoding.EncodeToString([]byte(fmt.Sprintf("admin%s", common.RandStr(10))))
|
||||
_ = adminMod.TwoStepSecretSet(ctx, adminInfo.Account, secret)
|
||||
}
|
||||
|
||||
// 通过验证,再次验证密码是否正确
|
||||
if adminInfo.Password != *param.Password || adminInfo.BlocRole == 1 {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminPasswordError, err)
|
||||
return
|
||||
}
|
||||
|
||||
qrCodePNG := make([]byte, 0)
|
||||
if !adminInfo.HasBind {
|
||||
url := googauth.New(adminInfo.Secret, adminInfo.Account+"@sc")
|
||||
qrCodePNG, err = qrcode.Encode(url, qrcode.Medium, 256)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, "Admin login get QRCodePNG error: "+err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, gin.H{
|
||||
"qrCodePNG": qrCodePNG,
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 管理员登录
|
||||
// @Description 传入用户信息登录
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdminLoginReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/adminbloc/login [POST]
|
||||
func AdminLoginBloc(ctx *gin.Context) {
|
||||
param := proto.AdminLoginReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
adminInfo, err := adminMod.FindOneByAccount(ctx, *param.Account)
|
||||
if err != nil || adminInfo.Account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, err)
|
||||
return
|
||||
}
|
||||
|
||||
if adminInfo.Secret == "" {
|
||||
secret := base32.StdEncoding.EncodeToString([]byte(fmt.Sprintf("admin%s", common.RandStr(10))))
|
||||
_ = adminMod.TwoStepSecretSet(ctx, adminInfo.Account, secret)
|
||||
}
|
||||
|
||||
// 通过验证,再次验证密码是否正确
|
||||
if adminInfo.Password != *param.Password {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminPasswordError, err)
|
||||
return
|
||||
}
|
||||
|
||||
qrCodePNG := make([]byte, 0)
|
||||
if !adminInfo.HasBind {
|
||||
url := googauth.New(adminInfo.Secret, adminInfo.Account+"@sc")
|
||||
qrCodePNG, err = qrcode.Encode(url, qrcode.Medium, 256)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, "Admin login get QRCodePNG error: "+err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, gin.H{
|
||||
"qrCodePNG": qrCodePNG,
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 管理员登录验证
|
||||
// @Description 谷歌验证
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdminVerifyReq true "参数"
|
||||
// @Success 200 {object} proto.AdminLoginRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/admin/verify [POST]
|
||||
func AdminVerify(ctx *gin.Context) {
|
||||
param := proto.AdminVerifyReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
adminInfo, err := adminMod.FindOneByAccount(ctx, *param.Account)
|
||||
if err != nil || adminInfo.Account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, err)
|
||||
return
|
||||
}
|
||||
|
||||
//测试模式不使用两步验证
|
||||
if gin.Mode() == gin.ReleaseMode {
|
||||
ok, err := googauth.Verify(adminInfo.Secret, *param.VerifyCode)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.GoogleAuthFailed, "admin Verification 2-step error: "+err.Error())
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
stdLog.ServerJSON(ctx, stdLog.GoogleAuthFailed, "admin Verification 2-step verification failed")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
code, adminInfo, err := adminSer.AdminLogin(ctx, param)
|
||||
if err != nil || code != stdLog.Success {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
roleInfo, err := authorityMod.GetAuthorityById(ctx, adminInfo.RoleId)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminGetAuthorityFailed, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp := proto.AdminLoginRes{
|
||||
Account: adminInfo.Account,
|
||||
Token: adminInfo.Token,
|
||||
Name: adminInfo.Name,
|
||||
RoleInfo: proto.RoleInfo{
|
||||
RoleId: roleInfo.Id,
|
||||
Role: roleInfo.Role,
|
||||
AuthJson: roleInfo.AuthJson,
|
||||
},
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, resp)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 管理员列表
|
||||
// @Description 管理员列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AdminListReq true "参数列表"
|
||||
// @Success 200 {object} proto.AdminListRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/admin/list [POST]
|
||||
func AdminList(ctx *gin.Context) {
|
||||
param := proto.AdminListReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := adminSer.AdminList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 增加管理员
|
||||
// @Description 增加管理员
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAdminReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/admin/add [POST]
|
||||
func AddAdmin(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AddAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := adminSer.AddAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 修改管理员
|
||||
// @Description 修改管理员
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAdminReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/admin/update [POST]
|
||||
func UpdateAdmin(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := adminSer.UpdateAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 删除管理员
|
||||
// @Description 删除管理员
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAdminReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/admin/del [DELETE]
|
||||
func DelAdmin(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.DelAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := adminSer.DelAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 管理员列表
|
||||
// @Description 管理员列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AdminListReq true "参数列表"
|
||||
// @Success 200 {object} proto.AdminListRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adminbloc/list [POST]
|
||||
func AdminListBloc(ctx *gin.Context) {
|
||||
param := proto.AdminListReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
blocRole := 1
|
||||
param.BlocRole = &blocRole
|
||||
code, data, err := adminSer.AdminList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAdminReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adminbloc/add [POST]
|
||||
func AddAdminBloc(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AddAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
blocRole := 1
|
||||
param.BlocRole = &blocRole
|
||||
|
||||
code, data, err := adminSer.AddAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 修改管理员
|
||||
// @Description 修改管理员
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAdminReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adminbloc/update [POST]
|
||||
func UpdateAdminBloc(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
blocRole := 1
|
||||
param.BlocRole = &blocRole
|
||||
|
||||
code, data, err := adminSer.UpdateAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 系统管理
|
||||
// @Summary 删除管理员
|
||||
// @Description 删除管理员
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAdminReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adminbloc/del [DELETE]
|
||||
func DelAdminBloc(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.DelAdminReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := adminSer.DelAdmin(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package advertiseApi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advertiseSer"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告列表
|
||||
// @Description 广告列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAdsReq true "参数"
|
||||
// @Success 200 {object} proto.ListAdsRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/ads/list [POST]
|
||||
func ListAds(ctx *gin.Context) {
|
||||
param := proto.ListAdsReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.ListAds(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 新增广告信息
|
||||
// @Description 新增广告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAdsReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/ads/add [POST]
|
||||
func AddAds(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
param := proto.AddAdsReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.AddAds(ctx, param, account)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 修改广告信息
|
||||
// @Description 修改广告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAdsReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/ads/update [POST]
|
||||
func UpdateAds(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateAdsReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.UpdateAds(ctx, param, account)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 删除广告信息
|
||||
// @Description 删除广告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAdsReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/ads/del [POST]
|
||||
func DelAds(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
param := proto.DelAdsReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.DelAds(ctx, param, account)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 外部获取广告信息
|
||||
// @Description 外部获取广告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdvertiseReq true "参数"
|
||||
// @Success 200 {object} proto.AdvertiseRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/ads/get [POST]
|
||||
func GetAds(ctx *gin.Context) {
|
||||
param := proto.AdvertiseReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.GetAdvertise(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告点击
|
||||
// @Description 广告点击
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdsClickReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/ads/click [POST]
|
||||
func ClickAds(ctx *gin.Context) {
|
||||
param := proto.AdsClickReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.IncAdsClickCount(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package advertiseApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advertiseSer"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告位置列表
|
||||
// @Description 广告位置列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAdsLocReq true "参数"
|
||||
// @Success 200 {object} proto.ListAdsLocRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/list [POST]
|
||||
func ListAdsLoc(ctx *gin.Context) {
|
||||
param := proto.ListAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.ListAdsLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 新增广告位置信息
|
||||
// @Description 谷歌验证
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAdsLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/add [POST]
|
||||
func AddAdsLoc(ctx *gin.Context) {
|
||||
param := proto.AddAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.AddAdsLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 修改广告位置信息
|
||||
// @Description 修改广告位置信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAdsLocReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/update [POST]
|
||||
func UpdateAdsLoc(ctx *gin.Context) {
|
||||
param := proto.UpdateAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
code, data, err := advertiseSer.UpdateAdsLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 删除广告位置信息
|
||||
// @Description 删除广告位置信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAdsLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/del [POST]
|
||||
func DelAdsLoc(ctx *gin.Context) {
|
||||
param := proto.DelAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.DelAdsLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package advertiseApi
|
||||
|
||||
import (
|
||||
"stat/common/stdLog"
|
||||
"stat/service/advertiseSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告统计
|
||||
// @Description 广告统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body advertiseSer.GetAdvertiseStatReq true "参数列表"
|
||||
// @Success 200 {object} advertiseSer.GetAdvertiseStatResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/ads/stat [POST]
|
||||
func GetAdvertiseStat(ctx *gin.Context) {
|
||||
param := &advertiseSer.GetAdvertiseStatReq{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
result, err := advertiseSer.GetAdvertiseStatList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.QueryError, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告统计不分时统计
|
||||
// @Description 广告统计不分时统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body advertiseSer.GetAdvertiseTotalStatReq true "参数列表"
|
||||
// @Success 200 {object} advertiseSer.GetAdvertiseTotalStatResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/ads/stattotal [POST]
|
||||
func GetAdvertiseTotalStat(ctx *gin.Context) {
|
||||
param := &advertiseSer.GetAdvertiseTotalStatReq{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
result, err := advertiseSer.GetAdvertiseTotalStatList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.QueryError, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
package agentApi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"image/jpeg"
|
||||
"stat/api/proto"
|
||||
"stat/common"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/models/channelmod"
|
||||
"stat/service/agentSer"
|
||||
"stat/statg"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取图片验证码
|
||||
// @Description 获取图片验证码
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} proto.AgentImgVerifyCode "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/agent/imgVerify [POST]
|
||||
func AgentImgVerifyCode(ctx *gin.Context) {
|
||||
codeB := captcha.RandomDigits(4)
|
||||
id := common.RandStr(8)
|
||||
|
||||
statg.VerifyIMGStore.Set(id, codeB)
|
||||
img := captcha.NewImage(id, codeB, 180, 65)
|
||||
var buf bytes.Buffer
|
||||
_ = jpeg.Encode(&buf, img, nil)
|
||||
|
||||
resp := proto.AgentImgVerifyCode{
|
||||
VerifyImg: buf.Bytes(),
|
||||
ImgId: id,
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 代理商登陆
|
||||
// @Description 代理商登陆
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentLoginReq true "参数"
|
||||
// @Success 200 {object} proto.AgentLoginRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/agent/login [POST]
|
||||
func AgentLogin(ctx *gin.Context) {
|
||||
param := proto.AgentLoginReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
ip := ctx.ClientIP()
|
||||
code, agentInfo := agentSer.AgentLogin(ctx, ip, param)
|
||||
if code != stdLog.Success {
|
||||
stdLog.ServerJSON(ctx, code, "")
|
||||
return
|
||||
}
|
||||
|
||||
detail := &proto.ChannelAgentInfo{
|
||||
Channel: agentInfo.Channel,
|
||||
AppIds: agentInfo.AppIds,
|
||||
UserName: agentInfo.UserName,
|
||||
ParentAgent: agentInfo.ParentAgent,
|
||||
ChildCount: agentInfo.ChildCount,
|
||||
Status: agentInfo.Status,
|
||||
Mobile: agentInfo.Mobile,
|
||||
Type: agentInfo.Type,
|
||||
Remark: agentInfo.Remark,
|
||||
Lock: agentInfo.Lock,
|
||||
Wallet: agentInfo.Wallet,
|
||||
CreatedAt: agentInfo.CreatedAt,
|
||||
UpdatedAt: agentInfo.UpdatedAt,
|
||||
ChildShowDivideRate: agentInfo.ChildShowDivideRate,
|
||||
}
|
||||
|
||||
ruleFilter := bson.M{
|
||||
channelmod.FN.ChannelDeductionRule.Channel: agentInfo.Channel,
|
||||
}
|
||||
ruleInfoList, _ := channelmod.FindManyChannelDeductionRule(ctx, ruleFilter)
|
||||
for _, ruleinfo := range ruleInfoList {
|
||||
detail.Settlement = ruleinfo.Settlement
|
||||
detail.CPAPrice = ruleinfo.CPAPrice
|
||||
detail.CPSRate = ruleinfo.CPSRate
|
||||
detail.DivideRate = 100 //
|
||||
}
|
||||
|
||||
resp := proto.AgentLoginRes{
|
||||
Token: agentInfo.Token,
|
||||
Channel: agentInfo.Channel,
|
||||
Detail: detail,
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取渠道列表
|
||||
// @Description 获取渠道列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelInfoSearch true "参数"
|
||||
// @Success 200 {object} proto.AgentChannelInfoSearchResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/list [POST]
|
||||
func AgentChannelList(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
//fmt.Println("channel")
|
||||
|
||||
param := proto.AgentChannelInfoSearch{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := agentSer.AgentChannelListInfo(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 更新渠道规则
|
||||
// @Description 更新渠道规则
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelRuleUpdate true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/rule/update [POST]
|
||||
func AgentChannelRuleUpdate(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AgentChannelRuleUpdate{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = agentSer.AgentChannelRuleUpdate(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 更新渠道信息
|
||||
// @Description 更新渠道信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelInfoUpdate true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/info/update [POST]
|
||||
func AgentChannelInfoUpdate(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
param := proto.AgentChannelInfoUpdate{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
err = agentSer.AgentChannelInfoUpdate(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 修改渠道密码
|
||||
// @Description 修改渠道密码
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelPasswordUpdate true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/password/update [POST]
|
||||
func AgentChannelPasswordUpdate(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
fmt.Println("channel")
|
||||
|
||||
param := proto.AgentChannelPasswordUpdate{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = agentSer.AgentChannelPasswordUpdate(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 重置子渠道密码
|
||||
// @Description 重置子渠道密码
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelPasswordReset true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/password/reset [POST]
|
||||
func AgentChannelPasswordReset(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
fmt.Println("channel")
|
||||
|
||||
param := proto.AgentChannelPasswordReset{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = agentSer.AgentChannelPasswordReset(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 添加一个子渠道
|
||||
// @Description 添加一个子渠道
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelInfoAdd true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/add [POST]
|
||||
func AddAgentChannel(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AgentChannelInfoAdd{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = agentSer.AddAgentChannelInfo(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取渠道统计Ex
|
||||
// @Description 获取渠道日常统计Ex
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentChannelStatSearch true "参数"
|
||||
// @Success 200 {object} proto.AgentChannelStatResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/stat [POST]
|
||||
func GetAgentChannelStat(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AgentChannelStatSearch{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := agentSer.GetAgentChannelStat(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取首页渠道数据汇总
|
||||
// @Description 获取首页渠道数据汇总
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentSummaryStatHomeSearch true "参数"
|
||||
// @Success 200 {object} proto.AgentSummaryStatHomeResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/summary/home [POST]
|
||||
func GetAgentSummaryStatHome(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AgentSummaryStatHomeSearch{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := agentSer.GetAgentSummaryStatHome(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取子渠道数据汇总
|
||||
// @Description 获取子渠道数据汇总
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AgentSummaryStatChildSearch true "参数"
|
||||
// @Success 200 {object} proto.AgentSummaryStatChildResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/summary/child [POST]
|
||||
func GetAgentSummaryStatChild(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AgentSummaryStatChildSearch{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := agentSer.GetAgentSummaryStatChild(ctx, channel, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道后台
|
||||
// @Summary 获取落地页列表
|
||||
// @Description 获取落地页列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelAppInfoReq true "参数"
|
||||
// @Success 200 {object} proto.ChannelAppInfoResp "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/landpage [POST]
|
||||
func ChannelAppInfo(ctx *gin.Context) {
|
||||
channel, err := utils.GetAdmin(ctx)
|
||||
if err != nil || channel == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.ChannelAppInfoReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := agentSer.AgentChannelAppInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package announApi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/announInfoSer"
|
||||
)
|
||||
|
||||
// @Tags 公告管理
|
||||
// @Summary 公告列表
|
||||
// @Description 公告列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAnnounReq true "参数"
|
||||
// @Success 200 {object} proto.ListAnnounRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/announce/list [POST]
|
||||
func ListAnnounce(ctx *gin.Context) {
|
||||
param := proto.ListAnnounReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := announInfoSer.ListAnnoun(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 公告管理
|
||||
// @Summary 新增公告信息
|
||||
// @Description 新增公告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAnnounReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/announce/add [POST]
|
||||
func AddAnnounce(ctx *gin.Context) {
|
||||
param := proto.AddAnnounReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := announInfoSer.AddAnnounce(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 公告管理
|
||||
// @Summary 修改公告信息
|
||||
// @Description 修改公告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAnnounReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/announce/update [POST]
|
||||
func UpdateAnnounce(ctx *gin.Context) {
|
||||
param := proto.UpdateAnnounReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := announInfoSer.UpdateAnnounce(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 公告管理
|
||||
// @Summary 删除公告信息
|
||||
// @Description 删除公告信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAnnounReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/announce/del [POST]
|
||||
func DelAnnounce(ctx *gin.Context) {
|
||||
param := proto.DelAnnounReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := announInfoSer.DelAnnounce(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.AnnouncementReq true "参数"
|
||||
// @Success 200 {object} proto.AnnouncementRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/announce/get [POST]
|
||||
func GetAnnounce(ctx *gin.Context) {
|
||||
param := proto.AnnouncementReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := announInfoSer.GetAnnounce(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package appInfoApi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/appInfoSer"
|
||||
"stat/service/opLogSer"
|
||||
)
|
||||
|
||||
// @Tags 应用管理
|
||||
// @Summary app列表
|
||||
// @Description app列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAppInfoReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListAppInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appInfo/list [POST]
|
||||
func ListAppInfo(ctx *gin.Context) {
|
||||
param := proto.ListAppInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := appInfoSer.GetAppInfoList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 应用管理
|
||||
// @Summary 添加app
|
||||
// @Description 添加app
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAppInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appInfo/add [POST]
|
||||
func AddAppInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AddAppInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.AddAppInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 应用管理
|
||||
// @Summary 修改app
|
||||
// @Description 修改app
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAppInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appInfo/update [POST]
|
||||
func UpdateAppInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateAppInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.UpdateAppInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 应用管理
|
||||
// @Summary 删除app
|
||||
// @Description 删除app
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAppInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appInfo/del [DELETE]
|
||||
func DelAppInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.DelAppInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.DelAppInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package appInfoApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/appInfoSer"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 落地页列表
|
||||
// @Description 落地页列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.FindLandingPageReq true "参数列表"
|
||||
// @Success 200 {object} proto.LandingPageListRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landingPage/list [POST]
|
||||
func ListLandingPageInfo(ctx *gin.Context) {
|
||||
param := proto.FindLandingPageReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := appInfoSer.GetLandingPageList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 添加落地页
|
||||
// @Description 添加落地页
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddLandingPageReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landingPage/add [POST]
|
||||
func AddLandingPageInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AddLandingPageReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.AddLandingPage(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 修改落地页
|
||||
// @Description 修改落地页
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateLandingPageReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landingPage/update [POST]
|
||||
func UpdateLandingPageInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateLandingPageReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.UpdateLandingPage(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 删除落地页
|
||||
// @Description 删除落地页
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelLandingPageReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landingPage/del [DELETE]
|
||||
func DelLandingPageInfo(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.DelLandingPageReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.DelLandingPage(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package appInfoApi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/models/landPageConfig"
|
||||
"stat/service/appInfoSer"
|
||||
"stat/service/opLogSer"
|
||||
)
|
||||
|
||||
// @Tags 落地页配置
|
||||
// @Summary 落地页配置列表
|
||||
// @Description 落地页配置列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.FindLandPageConfigReq true "参数列表"
|
||||
// @Success 200 {object} proto.LandPageConfigListResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPageConfig/list [POST]
|
||||
func ListLandPageConfig(ctx *gin.Context) {
|
||||
param := &proto.FindLandPageConfigReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.GetLandPageConfigList(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.AddLandPageConfigReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPageConfig/add [POST]
|
||||
func AddLandPageConfig(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := &proto.AddLandPageConfigReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.AddLandPageConfig(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页配置
|
||||
// @Summary 修改落地页配置
|
||||
// @Description 修改落地页配置
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body landPageConfig.LandPageConfig true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPageConfig/update [POST]
|
||||
func UpdateLandPageConfig(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := &landPageConfig.LandPageConfig{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.UpdateLandPageConfig(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页配置
|
||||
// @Summary 删除落地页配置
|
||||
// @Description 删除落地页配置
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.DelLandPageConfigReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPageConfig/del [POST]
|
||||
func DelLandPageConfig(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
param := &proto.DelLandPageConfigReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.DelLandPageConfig(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页配置
|
||||
// @Summary 根据类型获取落地页配置
|
||||
// @Description 根据类型获取落地页配置
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.GetLandPageConfigByTypeReq true "参数列表"
|
||||
// @Success 200 {object} proto.LandingPageConfigList "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/landPageConfig/getByType [POST]
|
||||
func GetLandPageConfigByType(ctx *gin.Context) {
|
||||
param := &proto.GetLandPageConfigByTypeReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := appInfoSer.GetLandPageConfigByType(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package applicationapi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"stat/api/proto"
|
||||
"stat/common/log"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/applicationser"
|
||||
)
|
||||
|
||||
// @Tags 配置应用app管理
|
||||
// @Summary 外部app获取统计中心配置应用app信息
|
||||
// @Description 外部app获取配置应用app信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.CenterApplicationReq true "参数"
|
||||
// @Success 200 {object} proto.CenterApplicationRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/web/apps/get [POST]
|
||||
func GetApplication(ctx *gin.Context) {
|
||||
req := proto.CenterApplicationReq{}
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := applicationser.GetApplication(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
// @Tags 配置应用app管理
|
||||
// @Summary app点击申请到统计中心redis
|
||||
// @Description app点击
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ApplicationClickReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /api/stat/web/apps/click [POST]
|
||||
func ApplicationClick(ctx *gin.Context) {
|
||||
param := &proto.ApplicationClickReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
log.Error("ApplicationClick ShouldBindJSON", log.Any("err ", err))
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := applicationser.IncApplicationClickCount(ctx, param)
|
||||
if serr != nil {
|
||||
log.Error("ApplicationClick", log.Any("serr", serr), log.Any("param", param))
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package applicationapi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/applicationser"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告位置列表
|
||||
// @Description 广告位置列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAppLocReq true "参数"
|
||||
// @Success 200 {object} proto.ListAppLocRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appLoc/list [POST]
|
||||
func ListAppLoc(ctx *gin.Context) {
|
||||
param := proto.ListAppLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := applicationser.ListAppLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 新增广告位置信息
|
||||
// @Description 谷歌验证
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddAppLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appLoc/add [POST]
|
||||
func AddAppLoc(ctx *gin.Context) {
|
||||
param := proto.AddAppLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := applicationser.AddAppLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 修改广告位置信息
|
||||
// @Description 修改广告位置信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateAppLocReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appLoc/update [POST]
|
||||
func UpdateAppLoc(ctx *gin.Context) {
|
||||
param := proto.UpdateAppLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
code, data, err := applicationser.UpdateAppLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 删除广告位置信息
|
||||
// @Description 删除广告位置信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelAppLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/appLoc/del [POST]
|
||||
func DelAppLoc(ctx *gin.Context) {
|
||||
param := proto.DelAppLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := applicationser.DelAppLoc(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package authorityApi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/authoritySer"
|
||||
"stat/service/opLogSer"
|
||||
)
|
||||
|
||||
// @Tags 权限管理
|
||||
// @Summary 权限角色列表
|
||||
// @Description 权限角色列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.RoleListReq true "参数列表"
|
||||
// @Success 200 {object} proto.RoleListRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/authority/list [POST]
|
||||
func RoleList(ctx *gin.Context) {
|
||||
param := proto.RoleListReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := authoritySer.RoleList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 权限管理
|
||||
// @Summary 添加角色
|
||||
// @Description 添加角色
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddRoleReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/authority/add [POST]
|
||||
func AddRole(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.AddRoleReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := authoritySer.AddRole(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 权限管理
|
||||
// @Summary 修改角色
|
||||
// @Description 修改角色
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateRoleReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/authority/update [POST]
|
||||
func UpdateRole(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.UpdateRoleReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := authoritySer.UpdateRole(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 权限管理
|
||||
// @Summary 删除角色
|
||||
// @Description 删除角色
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelRoleReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/authority/del [DELETE]
|
||||
func DelRole(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
param := proto.DelRoleReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := authoritySer.DelRole(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package channelApi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/models/adminMod"
|
||||
"stat/service/channelSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 分组分页获取渠道管理
|
||||
// @Description 分组分页获取渠道管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/list [POST]
|
||||
func GetChannelInfo(ctx *gin.Context) {
|
||||
var req = &proto.ChannelInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 分组分页获取渠道列表导出
|
||||
// @Description 分组分页获取渠道列表导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/export [POST]
|
||||
func GetChannelInfoExport(ctx *gin.Context) {
|
||||
var req = &proto.ChannelInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
fPath, serr := channelSer.SearchChannelInfoExport(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 添加一个渠道管理
|
||||
// @Description 添加一个渠道管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelInfoAdd true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/add [POST]
|
||||
func AddOneChannelInfo(ctx *gin.Context) {
|
||||
var req = &proto.ChannelInfoAdd{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil || account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
adminInfo, err := adminMod.FindOneByAccount(ctx, account)
|
||||
if err != nil || adminInfo.Account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, serr := channelSer.AddChannelInfo(ctx, adminInfo.Name, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 删除一个渠道管理
|
||||
// @Description 删除一个渠道管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelInfoDelete true "参数列表"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/del [POST]
|
||||
func DelOneChannelInfo(ctx *gin.Context) {
|
||||
var req = &proto.ChannelInfoDelete{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
serr := channelSer.DelChannelInfo(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 proto.ChannelInfoUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/update [POST]
|
||||
func UpdateOneChannelInfo(ctx *gin.Context) {
|
||||
var req = &proto.ChannelInfoUpdate{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := channelSer.UpdateChannelInfo(ctx, req.ID, *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 proto.UserInfoSearch true "参数列表"
|
||||
// @Success 200 {object} registermod.RegisterMod "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/user/info [POST]
|
||||
func SearchUserInfo(ctx *gin.Context) {
|
||||
var req = &proto.UserInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchUserInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 更新一个渠道管理的所有者
|
||||
// @Description 更新一个渠道管理的所有者
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelOwnerUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/owner/update [POST]
|
||||
func UpdateOneChannelOwner(ctx *gin.Context) {
|
||||
var req = &proto.ChannelOwnerUpdate{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil || account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
adminInfo, err := adminMod.FindOneByAccount(ctx, account)
|
||||
if err != nil || adminInfo.Account == "" {
|
||||
stdLog.ServerJSON(ctx, stdLog.AdminAccountNotExists, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := channelSer.UpdateOneChannelOwner(ctx, adminInfo.Name, adminInfo.Account, *req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 渠道所有者变更信息
|
||||
// @Description 渠道所有者变更信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelOwnerChangeInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelOwnerChangeInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelInfo/ownerchange/list [POST]
|
||||
func SearchChannelOwnerChange(ctx *gin.Context) {
|
||||
var req = &proto.ChannelOwnerChangeInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelOwnerChangeInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package channelApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/channelSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 获取渠道扣量规则列表
|
||||
// @Description 获取渠道扣量规则列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelDeductionRuleSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelDeductionRuleSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelRule/list [POST]
|
||||
func GetChannelDeductionRule(ctx *gin.Context) {
|
||||
var req = &proto.ChannelDeductionRuleSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelDeductionRule(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 添加一个渠道管理
|
||||
// @Description 添加一个渠道管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelDeductionRuleAdd true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelRule/add [POST]
|
||||
func AddOneChannelDeductionRule(ctx *gin.Context) {
|
||||
var req = &proto.ChannelDeductionRuleAdd{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, serr := channelSer.AddChannelDeductionRule(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 删除一个渠道管理
|
||||
// @Description 删除一个渠道管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelDeductionRuleDelete true "参数列表"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelRule/del [POST]
|
||||
func DelOneChannelDeductionRule(ctx *gin.Context) {
|
||||
var req = &proto.ChannelDeductionRuleDelete{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
serr := channelSer.DelChannelDeductionRule(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 proto.ChannelDeductionRuleUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelRule/update [POST]
|
||||
func UpdateOneChannelDeductionRule(ctx *gin.Context) {
|
||||
var req = &proto.ChannelDeductionRuleUpdate{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := channelSer.UpdateChannelDeductionRule(ctx, req.ID, *req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
package channelApi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/middleware/define"
|
||||
"stat/service/channelSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 分组分页获取渠道结算
|
||||
// @Description 分组分页获取渠道结算
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/list [POST]
|
||||
func GetSearchSettlementInfo(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchSettlementInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 分组分页获取渠道结算申请表(渠道账号看的)
|
||||
// @Description 分组分页获取渠道结算申请表(渠道账号看的)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.GetApplyFormReq true "参数列表"
|
||||
// @Success 200 {object} proto.GetApplyFormResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/agent/channel/applies [POST]
|
||||
func GetApplyForm(ctx *gin.Context) {
|
||||
var req = &proto.GetApplyFormReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
accType, err := utils.GetAccountType(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
if accType != define.Channel {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, fmt.Errorf("代理账号才可以查看"))
|
||||
}
|
||||
resp, serr := channelSer.SearchApplyForm(ctx, req, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 获取结算申请人名字列表
|
||||
// @Description 获取结算申请人名字列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.GetSettlementApplicantListReq true "参数列表"
|
||||
// @Success 200 {object} proto.GetSettlementApplicantListResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/applicant/list [POST]
|
||||
func GetSettlementApplicantList(ctx *gin.Context) {
|
||||
var req = &proto.GetSettlementApplicantListReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.GetSettlementApplicantList(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 分组分页获取渠道结算已删除列表
|
||||
// @Description 分组分页获取渠道结算已删除列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/deleted/list [POST]
|
||||
func GetSearchDeletedSettlementInfo(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchDeletedSettlementInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 分组分页获取渠道结算导出
|
||||
// @Description 分组分页获取渠道结算导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/export [POST]
|
||||
func GetSearchSettlementInfoExport(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
fPath, serr := channelSer.SearchSettlementInfoExport(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 分组分页获取渠道结算申请表导出
|
||||
// @Description 分组分页获取渠道结算申请表导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoSearch true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementInfoSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/v2/export [POST]
|
||||
func GetSearchSettlementInfoApplyExport(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
fPath, serr := channelSer.SearchSettlementInfoApplyExport(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 添加一个渠道结算
|
||||
// @Description 添加一个渠道结算
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoAdd true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/add [POST]
|
||||
func AddOneSettlementInfo(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoAdd{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := channelSer.AddSettlementInfo(ctx, req)
|
||||
if serr != nil {
|
||||
if serr.Error() == "重复结算" {
|
||||
stdLog.ServerJSON(ctx, stdLog.SettlementDouble, serr.Error())
|
||||
} else {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 添加一个渠道结算2
|
||||
// @Description 添加一个渠道结算2
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoAdd true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/v2/add [POST]
|
||||
func AddOneSettlementInfo2(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoAdd2{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
accType, err := utils.GetAccountType(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
|
||||
serr := channelSer.AddSettlementInfo2(ctx, req, accType, account)
|
||||
if serr != nil {
|
||||
if serr.Error() == "重复结算" {
|
||||
stdLog.ServerJSON(ctx, stdLog.SettlementDouble, serr.Error())
|
||||
} else {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 更新一个渠道结算
|
||||
// @Description 更新一个渠道结算
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/update [POST]
|
||||
func UpdateOneSettlementInfo(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoUpdate{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := channelSer.UpdateSettlementInfo(ctx, *req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 更新一个渠道结算2
|
||||
// @Description 更新一个渠道结算2
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/v2/update [POST]
|
||||
func UpdateOneSettlementInfo2(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoUpdate2{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
accType, err := utils.GetAccountType(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
serr := channelSer.UpdateSettlementInfo2(ctx, *req, accType, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 删除一个渠道结算项
|
||||
// @Description 删除一个渠道结算(只有特定状态的结算项可以删除)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoDelete true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/v2/del [POST]
|
||||
func DelOneSettlementInfo(ctx *gin.Context) {
|
||||
var req = &proto.SettlementInfoDelete{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
accType, err := utils.GetAccountType(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
serr := channelSer.DeleteSettlementInfo(ctx, *req, accType, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 查看渠道结算项的详情
|
||||
// @Description 查看渠道结算项的详情
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementInfoDetail true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementInfoDetailResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/settlementinfo/v2/detail [POST]
|
||||
func DetailOneSettlementInfo(ctx *gin.Context) {
|
||||
var req = proto.SettlementInfoDetail{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.DetailSettlementInfo(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package channelApi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/channelSer"
|
||||
"stat/service/statSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 获取渠道统计列表
|
||||
// @Description 获取渠道统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelStatSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelStatSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/list [POST]
|
||||
func GetChannelStat(ctx *gin.Context) {
|
||||
var req = &proto.ChannelStatSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelStat(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道同时段对比
|
||||
// @Summary 渠道同时段对比
|
||||
// @Description 渠道同时段对比
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SearchChannelStatComparedReq true "参数列表"
|
||||
// @Success 200 {object} proto.SearchChannelStatComparedResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/compare/list [POST]
|
||||
func SearchChannelStatCompared(ctx *gin.Context) {
|
||||
var req = &proto.SearchChannelStatComparedReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelStatCompared(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 获取渠道统计信息
|
||||
// @Description 获取渠道统计信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelStatSettlementSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelStatSettlementSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/settlement/list [POST]
|
||||
func GetChannelSettlementStat(ctx *gin.Context) {
|
||||
var req = &proto.ChannelStatSettlementSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelSettlementStat(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 获取渠道统计信息v2
|
||||
// @Description 获取渠道统计信息v2
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelStatSettlementSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelStatSettlementSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/settlement/v2/list [POST]
|
||||
func GetChannelSettlementStat2(ctx *gin.Context) {
|
||||
var req = &proto.ChannelStatSettlementSearch2{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelSettlementStat2(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道结算
|
||||
// @Summary 对结算页用户选择的结算项目进行计算
|
||||
// @Description 对结算页用户选择的结算项目进行计算
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.SettlementCalcReq true "参数列表"
|
||||
// @Success 200 {object} proto.SettlementCalcResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/settlement/v2/calc [POST]
|
||||
func GetChannelSettlementCalc(ctx *gin.Context) {
|
||||
var req = &proto.SettlementCalcReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.ChannelSettlementCalc(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 渠道管理
|
||||
// @Summary 分组分页获取渠道结算表
|
||||
// @Description 分组分页获取渠道结算表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelSettlementSearch true "参数列表"
|
||||
// @Success 200 {object} proto.ChannelSettlementSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelSettlement/list [POST]
|
||||
func GetChannelSettlement(ctx *gin.Context) {
|
||||
var req = &proto.ChannelSettlementSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := channelSer.SearchChannelSettlement(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 渠道统计导出
|
||||
// @Description 渠道统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ChannelStatExportReq true "参数列表"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/channelStat/export [POST]
|
||||
func ListChannelStatExport(ctx *gin.Context) {
|
||||
param := proto.ChannelStatExportReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
fPath, serr := statSer.ChannelStatExport(ctx, param)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
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, "")
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package domainapi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/domainser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 域名管理
|
||||
// @Summary 域名列表
|
||||
// @Description 域名列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDomainInfoReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDomainInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/domain/list [POST]
|
||||
func ListDomainInfo(ctx *gin.Context) {
|
||||
param := proto.ListDomainInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := domainser.GetDomainInfoList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 域名管理
|
||||
// @Summary 添加域名
|
||||
// @Description 添加域名
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.AddDomainInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/domain/add [POST]
|
||||
func AddDomainInfo(ctx *gin.Context) {
|
||||
param := proto.AddDomainInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := domainser.AddDomainInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 域名管理
|
||||
// @Summary 修改域名
|
||||
// @Description 修改域名
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.UpdateDomainInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/domain/update [POST]
|
||||
func UpdateDomainInfo(ctx *gin.Context) {
|
||||
param := proto.UpdateDomainInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := domainser.UpdateDomainInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 域名管理
|
||||
// @Summary 删除域名
|
||||
// @Description 删除域名
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.DelDomainInfoReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/domain/del [DELETE]
|
||||
func DelDomainInfo(ctx *gin.Context) {
|
||||
param := proto.DelDomainInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
code, data, err := domainser.DelDomainInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package fileApi
|
||||
|
||||
import (
|
||||
"stat/common/file"
|
||||
"stat/common/log"
|
||||
"stat/common/stdLog"
|
||||
"stat/statg"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 文件上传
|
||||
// @Summary 文件上传
|
||||
// @Description 文件上传
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param file formData file true "文件数据"
|
||||
// @Success 200 {string}} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/file/upload [POST]
|
||||
func FileUpload(ctx *gin.Context) {
|
||||
f, err := ctx.FormFile("file")
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
// 上传到桶2
|
||||
data, err := file.PutObject(ctx, statg.Conf.ProxyUrl.FileRes, &file.FileObject{
|
||||
File: f,
|
||||
})
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
} else {
|
||||
|
||||
if !strings.HasPrefix(data, "v2/") {
|
||||
data = "v2/" + data
|
||||
}
|
||||
log.Error("file upload", log.Any("url", statg.Conf.ProxyUrl.FileRes), log.Any("path", data))
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package innerapi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/appInfoSer"
|
||||
"stat/service/botser"
|
||||
"stat/service/innerserverser"
|
||||
"stat/service/versionSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 请求机器人日时数据列表
|
||||
// @Description 请求机器人日时数据列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.BotDailyHourListReq true "参数列表"
|
||||
// @Success 200 {object} proto.BotDailyHourListResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/botStatList [POST]
|
||||
func BotDailyHourList(ctx *gin.Context) {
|
||||
param := &proto.BotDailyHourListReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := botser.GetBotDailyHourList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.QueryError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 请求机器人日时数据列表
|
||||
// @Description 请求机器人日时数据列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.BotDailyHourOneReq true "参数列表"
|
||||
// @Success 200 {object} proto.BotDailyHourOneResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/botDailyHourOne [POST]
|
||||
func BotDailyHourOne(ctx *gin.Context) {
|
||||
param := &proto.BotDailyHourOneReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := botser.GetBotDailyHourOne(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.QueryError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 发送TG消息
|
||||
// @Description 发送TG消息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.SendTgMessageReq true "参数列表"
|
||||
// @Success 200 {object} proto.SendTgMessageRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/inner/sendTgMessage [POST]
|
||||
func SendTgMessage(ctx *gin.Context) {
|
||||
param := proto.SendTgMessageReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if res, err := botser.RecvTgMessage(ctx, ¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
} else {
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, res)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 获取服务器的app列表
|
||||
// @Description 获取服务器的app列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAppInfoReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListAppInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/inner/appList [POST]
|
||||
func ListAppInfo(ctx *gin.Context) {
|
||||
param := proto.ListAppInfoReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := appInfoSer.GetAppInfoList(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.BotMonthStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.BotMonthStatResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/botMonthStat [POST]
|
||||
func BotMonthStatList(ctx *gin.Context) {
|
||||
param := &proto.BotMonthStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := botser.GetBotMonthStatList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.QueryError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 请求APP下载链接
|
||||
// @Description 请求APP下载链接
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.PageButtonClickReq true "参数列表"
|
||||
// @Success 200 {object} proto.PageButtonClickResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/appDownload [POST]
|
||||
func AppDownload(ctx *gin.Context) {
|
||||
param := &proto.PageButtonClickReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
ip := ctx.ClientIP()
|
||||
userAgent := ctx.Request.Header.Get("User-Agent")
|
||||
data, err := versionSer.PageButtonClick(ctx, userAgent, ip, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 请求别的服务器充值数据
|
||||
// @Description 请求别的服务器充值数据
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.InnerRechargeReq true "参数列表"
|
||||
// @Success 200 {object} proto.PageButtonClickResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/recharge/list [POST]
|
||||
func InnerRechargeList(ctx *gin.Context) {
|
||||
param := &proto.InnerRechargeReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := innerserverser.InnerRecgaregeList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 服务器数据同步
|
||||
// @Summary 请求别的服务器充值数据
|
||||
// @Description 请求别的服务器充值数据
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.InnerRechargeReq true "参数列表"
|
||||
// @Success 200 {object} proto.PageButtonClickResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/inner/rechargebotcmd/list [POST]
|
||||
func InnerRechargeBotcmdList(ctx *gin.Context) {
|
||||
param := &proto.InnerRechargeBotcmdReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := innerserverser.InnerRecgaregeBotcmdList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package mediaapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"stat/common/m3u8"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/storage"
|
||||
"stat/service/storage/proxy"
|
||||
"stat/statg"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 视频列表
|
||||
// @Summary 视频body上传
|
||||
// @Description 视频body上传
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object}} proxy.UploadVideoBodyResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/media/videoBody [POST]
|
||||
func VideoBody(ctx *gin.Context) {
|
||||
form, err := ctx.MultipartForm()
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
videoUploadDomain := "http://118.107.15.137:18092"
|
||||
result, err := storage.UploadVideoBody(ctx, form, videoUploadDomain)
|
||||
if err != nil || result.Code != http.StatusOK {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
resp := &proxy.UploadVideoBodyResp{
|
||||
Id: result.Data.Id,
|
||||
VideoUri: result.Data.VideoUri,
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 视频列表
|
||||
// @Summary 视频body上传完成信息调用
|
||||
// @Description 视频body上传完成信息调用
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param req body proxy.BaseInfo true "参数列表"
|
||||
// @Success 200 {int} int "ok"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/media/videoOk [post]
|
||||
func VideoOK(ctx *gin.Context) {
|
||||
var req proxy.BaseInfo
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
videoUploadDomain := "http://118.107.15.137:18092"
|
||||
result, err := storage.UploadVideoOK(ctx, &req, videoUploadDomain)
|
||||
if err != nil || result.Code != http.StatusOK {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result.Data)
|
||||
}
|
||||
|
||||
// @Tags 视频列表
|
||||
// @Summary 根据参数获取视频列表
|
||||
// @Description 获取视频列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param req body proxy.MediaSearchReq true "参数列表"
|
||||
// @Success 200 {object} proxy.MediaSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/media/search [post]
|
||||
func VideoSearch(ctx *gin.Context) {
|
||||
var req proxy.MediaSearchReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
videoUploadDomain := "http://118.107.15.137:18092"
|
||||
result, err := proxy.PostSearch(&req, videoUploadDomain)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
|
||||
}
|
||||
|
||||
// @Tags 视频列表
|
||||
// @Summary 更新视频信息
|
||||
// @Description 更新视频信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param req body proxy.MediasUpdateReq true "参数列表"
|
||||
// @Success 200 {object} proxy.MediasUpdateResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/media/update [post]
|
||||
func VideoUpdate(ctx *gin.Context) {
|
||||
var req proxy.MediasUpdateReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
videoUploadDomain := "http://118.107.15.137:18092"
|
||||
result, err := proxy.PostUpdate(&req, videoUploadDomain)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
|
||||
// @Tags 视频列表
|
||||
// @Summary 删除视频列表
|
||||
// @Description 删除视频列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param req body proxy.MediasDelReq true "参数列表"
|
||||
// @Success 200 {object} proxy.MediasDelResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/media/delete [post]
|
||||
func VideoDelete(ctx *gin.Context) {
|
||||
var req proxy.MediasDelReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
videoUploadDomain := "http://118.107.15.137:18092"
|
||||
result, err := proxy.PostDelete(&req, videoUploadDomain)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err)
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
|
||||
type fileHandler func(ctx *gin.Context) (contentLength int64, contentType string, reader io.Reader, extraHeaders map[string]string, err error)
|
||||
|
||||
func Enkey(ctx *gin.Context) {
|
||||
fn := func(c *gin.Context) (contentLength int64, contentType string, reader io.Reader, extraHeaders map[string]string, err error) {
|
||||
buffer, err := m3u8.Enkey(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
contentLength = int64(buffer.Len())
|
||||
contentType = "application/octet-stream"
|
||||
reader = buffer
|
||||
extraHeaders = map[string]string{}
|
||||
return
|
||||
}
|
||||
handlerFile(ctx, fn)
|
||||
}
|
||||
|
||||
func handlerFile(ctx *gin.Context, h fileHandler) {
|
||||
contentLength, contentType, reader, extraHeaders, err := h(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.DownloadM3u8File, err)
|
||||
return
|
||||
}
|
||||
ctx.DataFromReader(http.StatusOK, contentLength, contentType, reader, extraHeaders)
|
||||
}
|
||||
|
||||
func GetM3U8(ctx *gin.Context) {
|
||||
fn := func(c *gin.Context) (contentLength int64, contentType string, reader io.Reader, extraHeaders map[string]string, err error) {
|
||||
m3u8Name := ctx.Param("key")
|
||||
var req m3u8.Req
|
||||
if err = ctx.BindQuery(&req); err != nil {
|
||||
return
|
||||
}
|
||||
req.Name = m3u8Name
|
||||
cdnDomain := statg.Conf.LandPageCDN
|
||||
originDomain := "https://resourceyuan.bbaazz.me"
|
||||
_, buff, err := m3u8.TransFormWithSafely(&req, cdnDomain, originDomain, req.NeedHeader, 1)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
contentType = "application/vnd.apple.mpegurl"
|
||||
reader = bytes.NewReader(buff.Bytes())
|
||||
contentLength = int64(buff.Len())
|
||||
extraHeaders = map[string]string{}
|
||||
return
|
||||
}
|
||||
|
||||
handlerFile(ctx, fn)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package mediaapi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/mediatagSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 视频标签
|
||||
// @Summary 分组分页获取视频标签
|
||||
// @Description 分组分页获取视频标签
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.MediaTagSearch true "参数列表"
|
||||
// @Success 200 {object} proto.MediaTagSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/mediatag/list [POST]
|
||||
func GetMediaTag(ctx *gin.Context) {
|
||||
var req = &proto.MediaTagSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := mediatagSer.MediaTag(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 视频标签
|
||||
// @Summary 添加一个视频标签
|
||||
// @Description 添加一个视频标签
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.MediaTagAddReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/mediatag/add [POST]
|
||||
func AddOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.MediaTagAddReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := mediatagSer.AddMediaTag(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 proto.MediaTagDelReq true "参数列表"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/mediatag/del [POST]
|
||||
func DelOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.MediaTagDelReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
serr := mediatagSer.DelMediaTag(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 proto.MediaTagUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/mediatag/update [POST]
|
||||
func UpdateOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.MediaTagUpdateReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := mediatagSer.UpdateMediaTag(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package monitorApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/monitorSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 应用监控
|
||||
// @Summary 分组分页获取应用监控
|
||||
// @Description 分组分页获取应用监控
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.MonitorSearch true "参数列表"
|
||||
// @Success 200 {object} proto.MonitorSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/monitor/list [POST]
|
||||
func SearchMonitor(ctx *gin.Context) {
|
||||
var req = &proto.MonitorSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := monitorSer.SearchMonitor(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 应用监控
|
||||
// @Summary 添加一个应用监控
|
||||
// @Description 添加一个应用监控
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.MonitorAddReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/monitor/add [POST]
|
||||
func AddMonitor(ctx *gin.Context) {
|
||||
var req = &proto.MonitorAddReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := monitorSer.AddMonitor(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 proto.MonitorDelReq true "参数列表"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/monitor/del [DELETE]
|
||||
func DelMonitor(ctx *gin.Context) {
|
||||
var req = &proto.MonitorDelReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
serr := monitorSer.DelMonitor(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 proto.MonitorUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/monitor/update [POST]
|
||||
func UpdateMonitor(ctx *gin.Context) {
|
||||
var req = &proto.MonitorUpdateReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := monitorSer.UpdateMonitor(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package opLogApi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/opLogSer"
|
||||
)
|
||||
|
||||
// @Tags 操作日志
|
||||
// @Summary 操作日志列表
|
||||
// @Description 操作日志列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListOpLogReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListOpLogRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/opLog/list [POST]
|
||||
func ListOpLog(ctx *gin.Context) {
|
||||
param := proto.ListOpLogReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := opLogSer.GetOpLogList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/activitymod"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// 活动列表 请求数据
|
||||
type ActivityListReq struct {
|
||||
common.Page
|
||||
Enable *bool `json:"enable" form:"enable"` // 开关
|
||||
Name *string `json:"name" form:"name"` // 活动名称
|
||||
}
|
||||
|
||||
// 活动列表 返回数据
|
||||
type ActivityListResp struct {
|
||||
Total int64 `json:"total" bson:"total"` // 数量
|
||||
List []*ActivityInfo `json:"list" bson:"list"` // 活动信息列表
|
||||
}
|
||||
|
||||
type ActivityInfo struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
|
||||
Name string `json:"name" bson:"name"` // 活动名称
|
||||
Desc string `json:"desc" bson:"desc"` // 活动说明
|
||||
SortCode int `json:"sortCode" bson:"sortCode"` // 排序号
|
||||
H5Domain string `json:"h5Domain" bson:"h5Domain"` // 活动H5地址
|
||||
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖励说明
|
||||
Enable bool `json:"enable" bson:"enable"` // 活动开关
|
||||
Background string `json:"background" bson:"background"` // 背景图
|
||||
StartTime time.Time `json:"startTime" bson:"startTime"` // 活动开始时间
|
||||
EndTime time.Time `json:"endTime" bson:"endTime"` // 活动结束时间
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
|
||||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
|
||||
Banner []activitymod.BannerInfo `json:"banner" bson:"banner"` // banner列表
|
||||
LotteryCodeNum int64 `json:"lotteryCodeNum" bson:"lotteryCodeNum"` // 抽奖码总数量
|
||||
UsedLotteryCodeNum int64 `json:"usedLotteryCodeNum" bson:"usedLotteryCodeNum"` // 抽奖码已使用数量
|
||||
GiftCodeNum int64 `json:"giftCodeNum" bson:"giftCodeNum"` // 奖品兑换码总数量
|
||||
GiftCodeGivedNum int64 `json:"giftCodeGivedNum" bson:"giftCodeGivedNum"` // 奖品兑换码已发放数量
|
||||
GiftCodeUsedNum int64 `json:"giftCodeUsedNum" bson:"giftCodeUsedNum"` // 奖品兑换码已使用数量
|
||||
}
|
||||
|
||||
// 新增活动 请求数据
|
||||
type AddActivityReq struct {
|
||||
Name string `json:"name" bson:"name"` // 活动名称
|
||||
Desc string `json:"desc" bson:"desc"` // 活动描述
|
||||
SortCode int32 `json:"sortCode" bson:"sortCode"` // 排序号
|
||||
H5Domain string `json:"h5Domain" bson:"h5Domain"` // 活动H5地址
|
||||
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖励说明
|
||||
Enable bool `json:"enable" bson:"enable"` // 活动开关
|
||||
Background string `json:"background" bson:"background"` // 背景图
|
||||
StartTime time.Time `json:"startTime" bson:"startTime"` // 活动开始时间
|
||||
EndTime time.Time `json:"endTime" bson:"endTime"` // 活动结束时间
|
||||
Banner []activitymod.BannerInfo `json:"banner" bson:"banner"` // banner列表
|
||||
}
|
||||
|
||||
// 修改活动 请求数据
|
||||
type UpdateActivityReq struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id,omitempty" binding:"required"` // 唯一ID
|
||||
Name *string `json:"name" bson:"name,omitempty"` // 活动名称
|
||||
Desc *string `json:"desc" bson:"desc,omitempty"` // 活动描述
|
||||
SortCode *int `json:"sortCode" bson:"sortCode,omitempty"` // 排序号
|
||||
H5Domain *string `json:"h5Domain" bson:"h5Domain,omitempty"` // 活动H5地址
|
||||
GiftDesc *string `json:"giftDesc" bson:"giftDesc,omitempty"` // 奖励说明
|
||||
Enable *bool `json:"enable" bson:"enable,omitempty"` // 活动开关
|
||||
Background *string `json:"background" bson:"background,omitempty"` // 背景图
|
||||
StartTime *time.Time `json:"startTime" bson:"startTime,omitempty"` // 活动开始时间
|
||||
EndTime *time.Time `json:"endTime" bson:"endTime,omitempty"` // 活动结束时间
|
||||
Banner *[]activitymod.BannerInfo `json:"banner" bson:"banner"` // banner列表
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
// 删除活动 请求数据
|
||||
type DelActivityReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"` // 唯一ID
|
||||
}
|
||||
|
||||
// 生成抽奖码 请求数据
|
||||
type GenLotteryCodeReq struct {
|
||||
CodeNum int32 `json:"codeNum" bson:"codeNum" binding:"required,gt=0"` // 生产的抽奖码个数
|
||||
ActId primitive.ObjectID `json:"actId" bson:"actId" binding:"required"` // 所属活动的ID
|
||||
CodeLen int32 `json:"codeLen" bson:"codeLen" binding:"required,gt=0"` // 抽奖码长度
|
||||
}
|
||||
|
||||
// 修改抽奖码 请求数据
|
||||
type UpdateLotteryCodeReq struct {
|
||||
LotteryCodeId primitive.ObjectID `json:"lotteryCodeId" bson:"lotteryCodeId" binding:"required"` // 抽奖码Id
|
||||
Mark string `json:"mark" bson:"mark"` // 备注
|
||||
}
|
||||
|
||||
// 删除活动抽奖码 请求数据
|
||||
type DelLotteryCodeReq struct {
|
||||
LotteryCodeId primitive.ObjectID `json:"lotteryCodeId" binding:"required"` // 唯一ID
|
||||
}
|
||||
|
||||
// 活动抽奖码列表 请求数据
|
||||
type LotteryCodeListReq struct {
|
||||
common.Page
|
||||
LotteryCode *string `json:"lotteryCode" form:"lotteryCode"` // 抽奖码
|
||||
ActId *string `json:"actId" form:"actId"` // 所属活动的ID
|
||||
ActName *string `json:"actName" form:"actName"` // 活动名称
|
||||
UserIp *string `json:"userIp" form:"userIp"` // 抽奖者IP
|
||||
IsUsed *bool `json:"isUsed" form:"isUsed"` // 抽奖码是否已使用
|
||||
GiftCode *string `json:"giftCode" form:"giftCode"` // 奖品兑换码
|
||||
}
|
||||
|
||||
// 活动抽奖码列表 返回数据
|
||||
type LotteryCodeListResp struct {
|
||||
Total int64 `json:"total" bson:"total"` // 数量
|
||||
List activitymod.LottertyCodeInfoList `json:"list" bson:"list"` // 活动抽奖码列表
|
||||
}
|
||||
|
||||
// 活动奖品列表 请求数据
|
||||
type GiftListReq struct {
|
||||
common.Page
|
||||
ActId *string `json:"actId" form:"actId"` // 所属活动的ID
|
||||
GiftName *string `json:"giftName" form:"giftName"` // 奖品名称
|
||||
GiftDesc *string `json:"giftDesc" form:"giftDesc"` // 奖品描述
|
||||
Rate *int32 `json:"rate" form:"rate"` // 备注
|
||||
}
|
||||
|
||||
// 活动奖品列表 返回数据
|
||||
type GiftListResp struct {
|
||||
Total int64 `json:"total" bson:"total"` // 数量
|
||||
List []*GiftInfo `json:"list" bson:"list"`
|
||||
}
|
||||
|
||||
type GiftInfo struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
|
||||
ActId string `json:"actId" bson:"actId"` // 所属活动的ID
|
||||
ActName string `json:"actName" bson:"actName"` // 所属活动的名称
|
||||
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
|
||||
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖品描述
|
||||
Rate int32 `json:"rate" bson:"rate"` // 备注
|
||||
Sort int32 `json:"sort" bson:"sort"` // 排序
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
|
||||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
|
||||
GiftNum int64 `json:"giftNum" bson:"giftNum"` // 抽奖码总数量
|
||||
ReceivedGiftNum int64 `json:"receivedGiftNum" bson:"receivedGiftNum"` // 抽奖码已使用数量
|
||||
}
|
||||
|
||||
// 添加活动奖品 请求数据
|
||||
type AddGiftReq struct {
|
||||
ActId primitive.ObjectID `json:"actId" bson:"actId" binding:"required"` // 所属活动的ID
|
||||
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
|
||||
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖品描述
|
||||
Sort int32 `json:"sort" bson:"sort"` // 排序
|
||||
Rate int32 `json:"rate" bson:"rate"` // 中奖率
|
||||
}
|
||||
|
||||
// 更新活动奖品 请求数据
|
||||
type UpdateGiftReq struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id" binding:"required"` // 奖品唯一ID
|
||||
ActId *string `json:"actId" bson:"actId,omitempty" binding:"required"` // 所属活动的ID
|
||||
ActName *string `json:"actName" bson:"actName,omitempty"` // 所属活动的名称
|
||||
GiftName *string `json:"giftName" bson:"giftName,omitempty"` // 奖品名称
|
||||
GiftDesc *string `json:"giftDesc" bson:"giftDesc,omitempty"` // 奖品描述
|
||||
Rate *int32 `json:"rate" bson:"rate,omitempty"` // 中奖率
|
||||
Sort *int32 `json:"sort" bson:"sort,omitempty"` // 排序
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
|
||||
}
|
||||
|
||||
// 删除活动奖品 请求数据
|
||||
type DelGiftReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"` // 奖品唯一ID
|
||||
}
|
||||
|
||||
// 生成奖品兑换码 请求数据
|
||||
type GenGiftCodeRes struct {
|
||||
GiftId primitive.ObjectID `json:"giftId" bson:"giftId"` // 奖品唯一ID
|
||||
CodeNum int32 `json:"codeNum" bson:"codeNum"` // 生成奖品兑换码的数量
|
||||
CodeLen int32 `json:"codeLen" bson:"codeLen"` // 生成奖品兑换码的长度
|
||||
}
|
||||
|
||||
// 奖品兑换详情列表 请求数据
|
||||
type GetGiftInfoReq struct {
|
||||
common.Page
|
||||
LotteryCode *string `json:"lotteryCode" form:"lotteryCode"` // 抽奖码
|
||||
ActId *string `json:"actId" form:"actId"` // 所属活动的ID
|
||||
ActName *string `json:"actName" form:"actName"` // 所属活动的名称
|
||||
GiftId *string `json:"giftId" form:"giftId"` // 所属活动奖品的ID
|
||||
GiftName *string `json:"giftName" form:"giftName"` // 奖品名称
|
||||
UserId *string `json:"userId" form:"userId"` // 兑换者Id
|
||||
AppName *string `json:"appName" form:"appName"` // 所属app的名字
|
||||
IsGaveOut *bool `json:"isGaveOut" form:"isGaveOut"` // 兑换码是否已发放
|
||||
IsUsed *bool `json:"isUsed" form:"isUsed"` // 奖品兑换码是否已使用
|
||||
GiftCode *string `json:"giftCode" form:"giftCode"` // 奖品兑换码
|
||||
}
|
||||
|
||||
// 奖品兑换详情列表 返回数据
|
||||
type GetGiftInfoResp struct {
|
||||
Total int64 `json:"total" bson:"total"` // 数量
|
||||
List activitymod.LotteryGetGiftList `json:"list" bson:"list"`
|
||||
}
|
||||
|
||||
// 删除兑换详情 请求数据
|
||||
type DelGetGiftReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"` // 兑换详情唯一ID
|
||||
}
|
||||
|
||||
// 更新活动奖品兑换详情 请求数据
|
||||
type UpdateGetGiftReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"` // 奖品唯一ID
|
||||
UserId *string `json:"userId"` // 兑换者Id
|
||||
AppName *string `json:"appName"` // 所属app的名字
|
||||
Remark *string `json:"remark"` // 备注
|
||||
GiftCode string `json:"giftCode" binding:"required"` // 奖品兑换码
|
||||
}
|
||||
|
||||
// h5活动信息 请求数据
|
||||
type ActivityInfoReq struct {
|
||||
ActId primitive.ObjectID `json:"actId" bson:"actId"` // 活动ID
|
||||
}
|
||||
|
||||
type ActivityInfoResp struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
|
||||
Name string `json:"name" bson:"name"` // 活动名称
|
||||
Desc string `json:"desc" bson:"desc"` // 活动说明
|
||||
H5Domain string `json:"h5Domain" bson:"h5Domain"` // 活动H5地址
|
||||
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖励说明
|
||||
Enable bool `json:"enable" bson:"enable"` // 活动开关
|
||||
StartTime time.Time `json:"startTime" bson:"startTime"` // 活动开始时间
|
||||
EndTime time.Time `json:"endTime" bson:"endTime"` // 活动结束时间
|
||||
Banner []activitymod.BannerInfo `json:"banner" bson:"banner"` // banner列表
|
||||
}
|
||||
|
||||
// h5活动奖品信息 请求数据
|
||||
type ActivityGiftInfoReq struct {
|
||||
ActId string `json:"actId" binding:"required"` // 活动ID
|
||||
}
|
||||
|
||||
// h5活动奖品信息 返回数据
|
||||
type ActivityGiftInfoResp struct {
|
||||
Count int64 `json:"count" bson:"count"` // 奖品总数
|
||||
List []*H5GiftInfo `json:"list" bson:"list"`
|
||||
}
|
||||
|
||||
type H5GiftInfo struct {
|
||||
Id string `json:"id" bson:"_id"` // 奖品ID
|
||||
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
|
||||
}
|
||||
|
||||
// h5抽奖 请求数据
|
||||
type DrawReq struct {
|
||||
Ip string `json:"ip" binding:"required"` // 用户IP
|
||||
ActId primitive.ObjectID `json:"actId" binding:"required"` // 活动ID
|
||||
LotteryCode string `json:"lotteryCode" binding:"required"` // 抽奖码
|
||||
}
|
||||
|
||||
// h5抽奖 返回数据
|
||||
type DrawResp struct {
|
||||
GiftCode string `json:"giftCode" bson:"giftCode"` // 奖品兑换码
|
||||
GiftId string `json:"giftId" bson:"giftId"` // 奖品ID
|
||||
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
|
||||
}
|
||||
|
||||
type ActivityVisitCountReq struct {
|
||||
AppId int32 `from:"appId" json:"appId"` //AppID
|
||||
Ip string `from:"ip" json:"ip"` //ip
|
||||
Domain string `from:"domain" json:"domain"` //落地页域名
|
||||
CH string `from:"ch" json:"ch"` //渠道号
|
||||
ActivityId primitive.ObjectID `json:"activityId"` //活动ID
|
||||
ActivityName string `json:"activityName"` //活动名字
|
||||
}
|
||||
|
||||
type ActivityVisitCountListReq struct {
|
||||
common.Page
|
||||
ActivityId *string `json:"activityId" form:"activityId"` // 活动ID
|
||||
AppId *int32 `json:"appId" form:"appId"` // AppID
|
||||
CH *string `json:"ch" form:"ch"` // 渠道名字
|
||||
}
|
||||
|
||||
type ActivityVisitListResp struct {
|
||||
Total int64 `json:"total" bson:"total"` // 数量
|
||||
List []*ActivityVisitInfo `json:"list" bson:"list"` // 活动信息列表
|
||||
}
|
||||
|
||||
type ActivityVisitInfo struct {
|
||||
AppId int32 `json:"appId"` // appId
|
||||
CH string `json:"ch"` // 商区序列
|
||||
IP string `json:"ip"` // 用户IP
|
||||
DevType string `json:"devType"` // 设备类型
|
||||
SysType string `json:"sysType"` // 系统类型
|
||||
PeerIP string `json:"peerIP"` // 网站IP
|
||||
ActivityId string `json:"activityId"` // 活动Id
|
||||
ActivityName string `json:"activityName"` // 活动名字
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 管理员登陆请求
|
||||
type AdminLoginReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 账号
|
||||
Password *string `form:"password" json:"password" binding:"required"` // 密码
|
||||
}
|
||||
|
||||
// 管理员验证请求
|
||||
type AdminVerifyReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 账号
|
||||
VerifyCode *string `form:"verifyCode" json:"verifyCode" binding:"required"` // 验证码
|
||||
}
|
||||
|
||||
// 管理员登陆响应
|
||||
type AdminLoginRes struct {
|
||||
Account string `json:"account"` // 用户名
|
||||
Token string `json:"token"` // token
|
||||
Name string `json:"name"` // 名称
|
||||
RoleInfo RoleInfo `json:"roleInfo"` // 角色信息
|
||||
}
|
||||
|
||||
// 请求管理员列表
|
||||
type AdminListReq struct {
|
||||
common.Page
|
||||
BlocRole *int `json:"blocRole"` // 角色
|
||||
}
|
||||
|
||||
type AdminInfo struct {
|
||||
Account string `json:"account"` // 账号
|
||||
Password string `json:"password"` // 密码
|
||||
Name string `json:"name"` // 名称
|
||||
RoleId int64 `json:"roleId"` // 角色
|
||||
Role string `json:"role"` // 角色
|
||||
MerchantId string `json:"merchantId"` // 商人id
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
LastTime time.Time `json:"lastTime"` // 登录时间
|
||||
}
|
||||
|
||||
// 响应管理员列表
|
||||
type AdminListRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AdminInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 新增管理员账号
|
||||
type AddAdminReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 账号(唯一)
|
||||
Password *string `form:"password" json:"password" binding:"required"` // 密码
|
||||
Name *string `form:"name" json:"name" binding:"required"` // 名称
|
||||
RoleId *int64 `form:"roleId" json:"roleId" binding:"required"` // 角色id
|
||||
MerchantId *string `form:"merchantId" json:"merchantId" binding:"omitempty"` // 商人id
|
||||
BlocRole *int `json:"blocRole"` // 角色
|
||||
}
|
||||
|
||||
// 更新管理员信息
|
||||
type UpdateAdminReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 用户名
|
||||
Password *string `form:"password" json:"password" binding:"omitempty"` // 密码
|
||||
Name *string `form:"name" json:"name" binding:"omitempty"` // 名称
|
||||
RoleId *int64 `form:"roleId" json:"roleId" binding:"omitempty"` // 角色id
|
||||
Status *int64 `form:"status" json:"status" binding:"omitempty"` // 状态
|
||||
MerchantId *string `form:"merchantId" json:"merchantId" binding:"omitempty"` // 商人id
|
||||
BlocRole *int `json:"blocRole"` // 角色
|
||||
}
|
||||
|
||||
type DelAdminReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 用户id
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/advertiseMod"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 广告位置列表请求
|
||||
type ListAdsReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId,过滤条件
|
||||
IsActive *bool `form:"isActive" json:"isActive" binding:"omitempty"` // appId,过滤条件
|
||||
LocId *int32 `json:"locId"` // 位置id
|
||||
common.Page
|
||||
Link *string `form:"link" json:"link"` // 链接地址
|
||||
Title *string `form:"title" json:"title"` // 广告标题
|
||||
DaoLiangTitle *string `json:"daoLiangTitle"` // 广告导量标题
|
||||
}
|
||||
|
||||
type ListAdsRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AdsInfo `json:"list"`
|
||||
}
|
||||
|
||||
type LinkInfo struct {
|
||||
Link string `json:"link"` // 链接地址
|
||||
Foreign bool `json:"foreign"` // true 国外用户
|
||||
Weight int `json:"weight"` // 权重
|
||||
}
|
||||
|
||||
type AdsInfo struct {
|
||||
Id int64 `json:"id"` // 广告id
|
||||
AppId int32 `json:"appId"` // 应用id
|
||||
AppName string `json:"appName"` // 应用名称
|
||||
Title string `json:"title"` // 广告标题
|
||||
DaoLiangTitle string `json:"daoLiangTitle"` // 广告导量标题
|
||||
Tags []string `json:"tags"` // 广告标签
|
||||
CoverImg string `json:"coverImg"` // 封面
|
||||
VisibleChannels []string `json:"visibleChannels"` // 可见的渠道
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
ImgSizeDesc string `json:"imgSizeDesc"` // 图片尺寸
|
||||
LocName string `json:"locName"` // 位置名称
|
||||
Links []LinkInfo `json:"links"` // 链接地址
|
||||
Sort int64 `json:"sort"` // 排序值--优先级
|
||||
IsActive bool `json:"isActive"` // 是否激活
|
||||
StartTime time.Time `json:"startTime"` // 开始时间
|
||||
EndTime time.Time `json:"endTime"` // 结束时间
|
||||
Remark string `json:"remark"` // 备注
|
||||
ClickCount int64 `json:"clickCount"` // 点击次数
|
||||
AmbientColor string `json:"ambientColor"` // 氛围色
|
||||
CreatedAt time.Time `json:"createAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 添加广告请求
|
||||
type AddAdsReq struct {
|
||||
AppId int32 `form:"appId" json:"appId"` // 应用id
|
||||
Title string `form:"title" json:"title" ` // 广告标题
|
||||
Tags string `form:"tags" json:"tags" ` // 广告标签
|
||||
CoverImg string `form:"coverImg" json:"coverImg"` // 封面
|
||||
LocId int32 `form:"locId" json:"locId"` // 位置id
|
||||
Sort int64 `form:"sort" json:"sort"` // 排序值--优先级
|
||||
IsActive bool `form:"isActive" json:"isActive"` // 是否激活
|
||||
Links []LinkInfo `form:"links" json:"links"` // 链接地址
|
||||
StartTime time.Time `form:"startTime" json:"startTime" ` // 开始时间
|
||||
EndTime time.Time `form:"endTime" json:"endTime"` // 结束时间
|
||||
Remark string `form:"remark" json:"remark"` // 备注
|
||||
AmbientColor string `form:"ambientColor" json:"ambientColor"` // 氛围色
|
||||
}
|
||||
|
||||
// 更新广告请求
|
||||
type UpdateAdsReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"omitempty"` // 广告id
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // 应用id
|
||||
Title *string `form:"title" json:"title" binding:"omitempty"` // 广告标题
|
||||
DaoLiangTitle *string `form:"daoLiangTitle" json:"daoLiangTitle" binding:"omitempty"` // 广告导量标题
|
||||
Tags *string `form:"tags" json:"tags" binding:"omitempty"` // 广告标签
|
||||
CoverImg *string `form:"coverImg" json:"coverImg" binding:"omitempty"` // 封面
|
||||
VisibleChannels *string `form:"visibleChannels" json:"visibleChannels" binding:"omitempty"` // 可见的渠道,可输入多个渠道,用英文逗号","分隔开
|
||||
Location *int64 `form:"locId" json:"locId" binding:"omitempty"` // 位置
|
||||
JumpType *advertiseMod.JumpType `form:"jumpType" json:"jumpType" binding:"omitempty"` // 跳转方式 0:外部浏览器跳转 1:内部浏览器跳转 2:app内部跳转
|
||||
Links *[]LinkInfo `form:"links" json:"links" binding:"omitempty"` // 链接地址
|
||||
Sort *int64 `form:"sort" json:"sort" binding:"omitempty"` // 排序值--优先级
|
||||
IsActive *bool `form:"isActive" json:"isActive" binding:"omitempty"` // 是否激活
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 开始时间s
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
Remark *string `form:"remark" json:"remark" binding:"omitempty"`
|
||||
AmbientColor *string `form:"ambientColor" json:"ambientColor" binding:"omitempty"` //氛围色
|
||||
}
|
||||
|
||||
// 删除广告请求
|
||||
type DelAdsReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"required"` // 应用id
|
||||
}
|
||||
|
||||
// 外部获取广告
|
||||
type AdvertiseReq struct {
|
||||
AppId int32 `form:"appId" json:"appId" binding:"required"` // 应用id
|
||||
LocId *int32 `form:"locId" json:"locId" binding:"omitempty"` // 位置id
|
||||
UserId *uint64 `form:"userId" json:"userId" binding:"omitempty"` // 用户ID
|
||||
IP *string `form:"ip" json:"ip" binding:"omitempty"` // 用户IP
|
||||
}
|
||||
|
||||
type AdvertiseRes struct {
|
||||
AdvertiseList []*AdvertiseInfo `json:"advertiseList"` // 广告列表
|
||||
}
|
||||
|
||||
// 外部广告信息
|
||||
type AdvertiseInfo struct {
|
||||
Id int64 `json:"id"` // 广告id
|
||||
Title string `json:"title"` // 广告标题
|
||||
CoverImg string `json:"coverImg"` // 封面
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
JumpType advertiseMod.JumpType `json:"jumpType"` // 跳转方式 0:外部浏览器跳转 1:内部浏览器跳转 2:app内部跳转
|
||||
Link string `json:"link"` // 链接地址
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
Tags string `json:"tags"` // 标签
|
||||
Remark string `json:"remark"` // 备注描述
|
||||
AmbientColor string `json:"ambientColor"` // 氛围色(逼哩漫画)
|
||||
Type int // 0:系统 1:渠道
|
||||
}
|
||||
|
||||
// 广告点击请求
|
||||
type AdsClickReq struct {
|
||||
Id *int64 `from:"id" json:"id" binding:"required"` // 广告id
|
||||
AppId *int32 `from:"appId" json:"appId" binding:"required"` // 应用id
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 广告位置列表请求
|
||||
type ListAdsLocReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId,过滤条件
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListAdsLocRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AdsLocInfo `json:"list"`
|
||||
}
|
||||
|
||||
type AdsLocInfo struct {
|
||||
Id int64 `json:"id"` // 唯一id
|
||||
AppId int32 `json:"appId"` // 应用id
|
||||
AppName string `json:"appName"` // 应用名称
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
Name string `json:"name"` // 位置名称
|
||||
ImgSizeDesc string `json:"imgSizeDesc"` // 图片尺寸描述
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreatedAt time.Time `json:"createAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 添加广告位置信息请求
|
||||
type AddAdsLocReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // 应用Id
|
||||
LocId *int32 `form:"locId" json:"locId" binding:"required"` // 位置id
|
||||
Name *string `form:"name" json:"name" binding:"required"` // 位置名称
|
||||
ImgSizeDesc string `form:"imgSizeDesc" json:"imgSizeDesc" binding:"omitempty"` // 图片尺寸描述
|
||||
Remark string `form:"remark" json:"remark" binding:"omitempty"` // 备注
|
||||
}
|
||||
|
||||
// 更新广告位置信息请求
|
||||
type UpdateAdsLocReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"required"` // id
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // 应用id
|
||||
LocId *int32 `form:"locId" json:"locId" binding:"omitempty"` // 位置id
|
||||
Name *string `form:"name" json:"name" binding:"omitempty"` // 位置名称
|
||||
ImgSizeDesc *string `form:"imgSizeDesc" json:"imgSizeDesc" binding:"omitempty"` // 图片尺寸描述
|
||||
Remark *string `form:"remark" json:"remark" binding:"omitempty"` // 备注
|
||||
}
|
||||
|
||||
// 删除广告位置信息请求
|
||||
type DelAdsLocReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"required"` // 应用id
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 公告列表请求
|
||||
type ListAnnounReq struct {
|
||||
AppId *int32 `json:"appId"` // 应用id 筛选条件
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 公告列表响应
|
||||
type ListAnnounRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AnnounInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 公告信息
|
||||
type AnnounInfo struct {
|
||||
ID string `json:"id"` // 公告id
|
||||
AppId int32 `json:"appId"` // 应用id
|
||||
AppName string `json:"appName"` // 应用名称
|
||||
Title string `json:"title"` // 公告标题
|
||||
Content string `json:"content"` // 公告内容
|
||||
Cover string `json:"cover"` // 公告封面图
|
||||
Href string `json:"href"` // 公告跳转地址
|
||||
Type int `json:"type"` // 公告类型 0,外部连接;1,直接安装app
|
||||
Active bool `json:"active"` // 是否激活
|
||||
StartTime time.Time `json:"startTime"` // 开始时间
|
||||
EndTime time.Time `json:"endTime"` // 结束时间
|
||||
}
|
||||
|
||||
// 添加公告
|
||||
type AddAnnounReq struct {
|
||||
AppId *int32 `from:"appId" json:"appId" binding:"required"` // 应用id
|
||||
Title *string `from:"title" json:"title" binding:"required"` // 公告标题
|
||||
Content *string `from:"content" json:"content" binding:"required"` // 公告内容
|
||||
Cover *string `from:"cover" json:"cover" binding:"omitempty"` // 公告封面图
|
||||
Href *string `from:"href" json:"href" binding:"omitempty"` // 公告跳转地址
|
||||
Type *int `from:"type" json:"type" binding:"required"` // 公告类型 0,外部连接;1,直接安装app
|
||||
Active *bool `from:"active" json:"active" binding:"required"` // 是否激活
|
||||
StartTime *time.Time `from:"startTime" json:"startTime" binding:"required"` // 公告开始时间
|
||||
EndTime *time.Time `from:"endTime" json:"endTime" binding:"required"` // 公告结束时间
|
||||
}
|
||||
|
||||
// 修改公告
|
||||
type UpdateAnnounReq struct {
|
||||
Id *string `form:"id" json:"id" binding:"required"` // 公告id
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // 应用id
|
||||
Title *string `form:"title" json:"title" binding:"omitempty"` // 公告标题
|
||||
Content *string `form:"content" json:"content" binding:"omitempty"` // 公告内容
|
||||
Cover *string `form:"cover" json:"cover" binding:"omitempty"` // 公告封面图
|
||||
Href *string `form:"href" json:"href" binding:"omitempty"` // 公告跳转地址
|
||||
Type *int `form:"type" json:"type" binding:"omitempty"` // 公告类型 0,外部连接;1,直接安装app
|
||||
Active *bool `from:"active" json:"active" binding:"omitempty"` // 是否激活
|
||||
StartTime *time.Time `from:"startTime" json:"startTime" binding:"omitempty"` // 公告开始时间
|
||||
EndTime *time.Time `from:"endTime" json:"endTime" binding:"omitempty"` // 公告结束时间
|
||||
}
|
||||
|
||||
// 删除公告
|
||||
type DelAnnounReq struct {
|
||||
Id *string `json:"id" binding:"required"` // 公告id
|
||||
}
|
||||
|
||||
// 外部获取公告请求
|
||||
type AnnouncementReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // 应用id
|
||||
}
|
||||
|
||||
// 外部获取公告响应
|
||||
type AnnouncementRes struct {
|
||||
AnnounceList []AnnouncementInfo `json:"announceList"` // 公告列表
|
||||
}
|
||||
|
||||
// 外部获取公告
|
||||
type AnnouncementInfo struct {
|
||||
ID string `json:"id"` // 公告id
|
||||
Title string `json:"title"` // 公告标题
|
||||
Content string `json:"content"` // 公告内容
|
||||
Cover string `json:"cover"` // 公告封面图
|
||||
Href string `json:"href"` // 公告跳转地址
|
||||
Type int `json:"type"` // 公告类型 0,外部连接;1,直接安装app
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 请求app列表
|
||||
type ListAppInfoReq struct {
|
||||
AppName *string `form:"appName" json:"appName" binding:"omitempty"` // appId
|
||||
Used *bool `form:"used" json:"used" binding:"omitempty"` // 渠道
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 响应app列表
|
||||
type ListAppInfoRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AppInfoRes `json:"list"`
|
||||
}
|
||||
|
||||
type AppInfoRes struct {
|
||||
AppId int32 `json:"appId"` // appId,唯一id
|
||||
Name string `json:"name"` // app名称
|
||||
LandPages []string `json:"landPages"` // 落地页列表
|
||||
IconImg string `json:"iconImg"` // 应用图标
|
||||
AdvertiseNum int64 `json:"advertiseNum"` // 广告系数
|
||||
AdvertiseNewNum int64 `json:"advertiseNewNum"` // 广告新增系数
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 添加app
|
||||
type AddAppInfoReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId,唯一id
|
||||
Name *string `form:"name" json:"name" binding:"required"` // app名称
|
||||
IconImg *string `form:"iconImg" json:"iconImg" binding:"required"` // 应用图标
|
||||
// LandPages *[]string `form:"landPages" json:"landPages" binding:"required"` // 落地页列表
|
||||
}
|
||||
|
||||
// 修改app
|
||||
type UpdateAppInfoReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId,唯一id
|
||||
Name *string `form:"name" json:"name" binding:"omitempty"` // app名称
|
||||
IconImg *string `form:"iconImg" json:"iconImg" binding:"omitempty"` // 应用图标
|
||||
AdvertiseNum *int64 `form:"advertiseNum" json:"advertiseNum" binding:"omitempty"` // 广告系数
|
||||
AdvertiseNewNum *int64 `form:"advertiseNewNum" json:"advertiseNewNum" binding:"omitempty"` // 广告新增系数
|
||||
LandPages *[]string `form:"landPages" json:"landPages" binding:"omitempty"` // 落地页列表
|
||||
}
|
||||
|
||||
// 删除app
|
||||
type DelAppInfoReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId,唯一id
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/applicationmod"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// DelAppReq
|
||||
type DelAppReq struct {
|
||||
Id primitive.ObjectID `json:"id"`
|
||||
}
|
||||
|
||||
type GetApplicationsReq struct {
|
||||
Id *string `json:"id" bson:"_id"`
|
||||
ParentAppId *int64 `json:"parentAppId" bson:"parentAppId"` //所属appId
|
||||
Name *string `json:"name" bson:"name"` //应用名
|
||||
DaoLiangTitle *string `bson:"daoLiangTitle"` // 广告导量标题
|
||||
//Tag *common.AppReqType `json:"tag" bson:"tag"` //标签
|
||||
Status *bool `json:"status" bson:"status"` //状态
|
||||
Category *int64 `json:"category" bson:"category"` //分类ID
|
||||
PageNum int64 `json:"pageNum"` // 分页参数
|
||||
PageSize int64 `json:"pageSize" binding:"required"` // 分页参数
|
||||
LocIds []int32 `json:"locIds"` // 位置id
|
||||
|
||||
DownloadUrl *string `json:"download_url"` //下载地址
|
||||
IosUrl *string `json:"iosUrl"` //ios链接
|
||||
AndroidUrl *string `json:"androidUrl"` //安卓链接
|
||||
IsHighQuality *bool `json:"isHighQuality"` // 是否是优质APP推荐
|
||||
}
|
||||
|
||||
type GetApplicationsResp struct {
|
||||
List applicationmod.ApplicationList `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type AppCategoryInfo struct {
|
||||
Id int64 `json:"id"` // 分类ID
|
||||
Name string `json:"name" bson:"name"` // 名称
|
||||
Applications CenterApplicationList `json:"applications" bson:"applications"` // 分类app列表
|
||||
}
|
||||
|
||||
type ApplicationClickReq struct {
|
||||
Id string `from:"id" json:"id" binding:"required"` // applicationid
|
||||
}
|
||||
|
||||
// 应用中心
|
||||
type CenterApplication struct {
|
||||
Id primitive.ObjectID `json:"id" bson:"_id"`
|
||||
AppId int64 `json:"appId" bson:"appId"` //appId
|
||||
ParentAppId int64 `json:"parentAppId" bson:"parentAppId"` //所属appId
|
||||
Name string `json:"name" bson:"name"` //应用名
|
||||
Tag int32 `json:"tag" bson:"tag"` //标签
|
||||
Internal bool `json:"internal" bson:"internal"` //是否内部应用
|
||||
Categories []*common.CategoryRank `json:"categories" bson:"categories"` //分类排序
|
||||
Desc string `json:"desc" bson:"desc"` //描述
|
||||
DownloadUrl string `json:"download_url" bson:"download_url"` //下载地址
|
||||
IosUrl string `json:"iosUrl" bson:"iosUrl"` //ios链接
|
||||
AndroidUrl string `json:"androidUrl" bson:"androidUrl"` //安卓链接
|
||||
Avatar string `json:"avatar" bson:"avatar"` //头像图片
|
||||
Status bool `json:"status" bson:"status"` //状态
|
||||
Rank int64 `json:"rank" bson:"rank"` //默认排序
|
||||
Total int64 `json:"total" bson:"total"` //总点击
|
||||
CreatedId int64 `json:"created_id" bson:"created_id"` //创建人
|
||||
UpdatedId int64 `json:"updated_id" bson:"updated_id"` //最后更新人
|
||||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"` //创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` //更新时间
|
||||
NineShow bool `json:"nineShow" bson:"nineShow"` //是否九宫格
|
||||
RecreationShow bool `json:"recreationShow" bson:"recreationShow"` //是否娱乐中心显示
|
||||
IsRecommend bool `json:"isRecommend" bson:"isRecommend"` //是否推荐
|
||||
IsGame bool `json:"isGame" bson:"isGame"` //是否游戏
|
||||
HomeShow bool `json:"homeShow" bson:"homeShow"` //是否首页展示
|
||||
LocIds []int64 `json:"locIds" bson:"locIds"` //位置id
|
||||
SmallImg string `json:"smallImg" bson:"smallImg"` // 小图标
|
||||
BigImg string `json:"bigImg" bson:"bigImg"` // 大图标
|
||||
IsHighQuality bool `json:"isHighQuality" bson:"isHighQuality"` // 是否是优质APP推荐
|
||||
HighQualityType int64 `json:"highQualityType" bson:"highQualityType"` // 优质APP推荐展示方式 0:应用图标 1:展示描述文字
|
||||
}
|
||||
|
||||
type CenterApplicationList []*CenterApplication
|
||||
|
||||
// 外部获取app
|
||||
type CenterApplicationReq struct {
|
||||
ParentAppId int64 `json:"parentAppId" binding:"required"` // 所属应用appId
|
||||
LocId *int32 `json:"locId"` // 位置id
|
||||
UserId *uint64 `json:"userId"` // 用户ID
|
||||
}
|
||||
|
||||
type CenterAppCategory struct {
|
||||
Id int64 `json:"id" bson:"_id,omitempty"`
|
||||
ParentAppId int64 `json:"parentAppId" bson:"parentAppId"`
|
||||
Name string `json:"name" bson:"name"` // 名称
|
||||
Desc string `json:"desc" bson:"desc"` // 描述
|
||||
Status bool `json:"status" bson:"status"` // 状态
|
||||
Rank int64 `json:"rank" bson:"rank"` // 应用排序
|
||||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` // 更新时间
|
||||
ImgType int64 `json:"imgType" bson:"imgType"` // 图片展示类型 0:应用图标 1.小图标 2.大图标
|
||||
}
|
||||
|
||||
type CenterAppCategoryList []*CenterAppCategory
|
||||
|
||||
type CenterApplicationRes struct {
|
||||
List CenterApplicationList `json:"list"` // 应用列表
|
||||
AppCategoryList CenterAppCategoryList `json:"appCategoryList"` // 列表
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 广告位置列表请求
|
||||
type ListAppLocReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId,过滤条件
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListAppLocRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AppLocInfo `json:"list"`
|
||||
}
|
||||
|
||||
type AppLocInfo struct {
|
||||
Id int64 `json:"id"` // 唯一id
|
||||
AppId int32 `json:"appId"` // 应用id
|
||||
AppName string `json:"appName"` // 应用名称
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
Name string `json:"name"` // 位置名称
|
||||
ImgSizeDesc string `json:"imgSizeDesc"` // 图片尺寸描述
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreatedAt time.Time `json:"createAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 添加广告位置信息请求
|
||||
type AddAppLocReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // 应用Id
|
||||
LocId *int32 `form:"locId" json:"locId" binding:"required"` // 位置id
|
||||
Name *string `form:"name" json:"name" binding:"required"` // 位置名称
|
||||
ImgSizeDesc string `form:"imgSizeDesc" json:"imgSizeDesc" binding:"omitempty"` // 图片尺寸描述
|
||||
Remark string `form:"remark" json:"remark" binding:"omitempty"` // 备注
|
||||
}
|
||||
|
||||
// 更新广告位置信息请求
|
||||
type UpdateAppLocReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"required"` // id
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // 应用id
|
||||
LocId *int32 `form:"locId" json:"locId" binding:"omitempty"` // 位置id
|
||||
Name *string `form:"name" json:"name" binding:"omitempty"` // 位置名称
|
||||
ImgSizeDesc *string `form:"imgSizeDesc" json:"imgSizeDesc" binding:"omitempty"` // 图片尺寸描述
|
||||
Remark *string `form:"remark" json:"remark" binding:"omitempty"` // 备注
|
||||
}
|
||||
|
||||
// 删除广告位置信息请求
|
||||
type DelAppLocReq struct {
|
||||
Id *int64 `form:"id" json:"id" binding:"required"` // 应用id
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RoleListReq struct {
|
||||
common.Page
|
||||
}
|
||||
|
||||
type RoleInfo struct {
|
||||
RoleId int64 `json:"roleId"` // id
|
||||
Role string `json:"role"` // 角色
|
||||
AuthJson string `json:"authJson"` // 权限json数据
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 修改时间
|
||||
}
|
||||
|
||||
type RoleListRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []RoleInfo `json:"list"`
|
||||
}
|
||||
|
||||
type AddRoleReq struct {
|
||||
Role *string `form:"role" json:"role" binding:"required"` // 角色
|
||||
AuthJson *string `form:"authJson" json:"authJson" binding:"required"` // 权限json数据
|
||||
}
|
||||
|
||||
type UpdateRoleReq struct {
|
||||
RoleId *int64 `form:"roleId" json:"roleId" binding:"required"` // id
|
||||
Role *string `form:"role" json:"role" binding:"omitempty"` // 角色
|
||||
AuthJson *string `form:"authJson" json:"authJson" binding:"omitempty"` // 权限json数据
|
||||
}
|
||||
|
||||
type DelRoleReq struct {
|
||||
RoleId *int64 `form:"roleId" json:"roleId" binding:"required"` // id
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package proto
|
||||
|
||||
// 发起提现
|
||||
type AgentWithdraw struct {
|
||||
Mobile string `form:"mobile" json:"mobile" binding:"required"` //手机号
|
||||
Captcha string `form:"captcha" json:"captcha" binding:"required"` //验证码
|
||||
PayMentAct string `form:"act" json:"act" binding:"required"` //交易账户
|
||||
PayMentName string `form:"actName" json:"actName" binding:"required"` //交易账户持有人
|
||||
PaymentMethod string `form:"paymentMethod" json:"paymentMethod" binding:"required"` //提现方式,alipay,bankcard,USDT
|
||||
Yuan float64 `form:"yuan" json:"yuan" binding:"required,min=100"` //提现金额
|
||||
WithdrawType int `form:"withdrawType" json:"withdrawType"` //提现类型 1:财务转账 0:提现
|
||||
AppId int32 `form:"appId" json:"appId" binding:"required"` //所选APP
|
||||
}
|
||||
|
||||
// 提现审核
|
||||
type WithdrawAllow struct {
|
||||
ID string `json:"id"` //订单id
|
||||
Allow bool `json:"allow"` //true:允许 false:拒绝
|
||||
StatusDesc string `json:"statusDesc"` //描述
|
||||
}
|
||||
|
||||
type TransStatus int
|
||||
|
||||
const (
|
||||
Transferred TransStatus = 1 //已转账
|
||||
TransRefund TransStatus = 2 //转账被拒绝
|
||||
)
|
||||
|
||||
// 财务转账回执
|
||||
type FinancialReceipt struct {
|
||||
ID string `form:"id" json:"id" binding:"required"` //ID
|
||||
TransState TransStatus `form:"transState" json:"transState" binding:"required"` //转账状态 1:已转账 2:转账被拒绝
|
||||
Remark string `form:"remark" json:"remark"` //备注
|
||||
}
|
||||
|
||||
// ExchgBack 回掉结构体
|
||||
type ExchgBack struct {
|
||||
OID string `json:"oid" binding:"required"` //支付平台订单号
|
||||
Money int64 `json:"money" binding:"required"` //兑换金额
|
||||
TradeNo string `json:"tradeNo" binding:"required"` //商户订单号
|
||||
Status string `json:"status"` //200成功
|
||||
Mark string `json:"mark"` //拒绝兑换理由
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 日常统计列表请求
|
||||
type ListBlocDailyStatReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocDailyStatRes struct {
|
||||
Total int64 `json:"total"`
|
||||
TotalInfo BlocDailyStatInfo `json:"totalInfo"`
|
||||
List []BlocDailyStatInfo `json:"list"`
|
||||
}
|
||||
|
||||
type BlocDailyStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
AppId int32 `json:"appId"` // appId
|
||||
AppName string `json:"appName"` // app名称
|
||||
TotalVisitCount int64 `json:"totalVisitCount"` // 日活
|
||||
TotalNewCount int64 `json:"totalNewCount"` // 新增
|
||||
TotalAmount int64 `json:"totalAmount"` // 总充值
|
||||
ARPU int64 `json:"ARPU"` // 人均充值
|
||||
ARPPU int64 `json:"ARPPU"` // 付费用户人均充值
|
||||
NewDirectCount int64 `json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `json:"newFissionCount"` // 新增裂变
|
||||
DirectVisitCount int64 `json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `json:"fissionVisitCount"` // 裂变访问数
|
||||
Day1RetainRate float64 `json:"day1RetainRate"` // 次日留存率
|
||||
Day3RetainRate float64 `json:"day3RetainRate"` // 3日留存率
|
||||
Day7RetainRate float64 `json:"day7RetainRate"` // 7日留存率
|
||||
DirectAmount int64 `json:"directAmount"` // 直推充值金额
|
||||
FissionAmount int64 `json:"fissionAmount"` // 裂变充值金额
|
||||
NewRechargeCount int64 `json:"newRechargeCount"` // 新增充值数
|
||||
NewRechargeAmount int64 `json:"newRechargeAmount"` // 新增充值金额
|
||||
OldRechargeAmount int64 `json:"oldRechargeAmount"` // 老用户充值金额
|
||||
DaichongAmout int64 `json:"daichongAmout"` // 代充充值金额
|
||||
OnlineAmount int64 `json:"onlineAmount"` // 在线充值金额
|
||||
NewRechargeRate float64 `json:"newRechargeRate"` // 新增充值率
|
||||
VisitRechargeRate float64 `json:"visitRechargeRate"` // 登陆充值率
|
||||
UserWithDrawAmount int64 `json:"userWithDrawAmount"` // 用户提现金额
|
||||
UserWithDrawPaymoneyAmount int64 `json:"userWithDrawPaymoneyAmount"` // 用户提现金额(实际到账)
|
||||
GameRechageAmount int64 `json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `json:"gameWithdrawAmount"` // 游戏提现
|
||||
TotalRechargeCount int64 `json:"totalRechargeCount"` // 总充值人数
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type ListBlocDailyStatTotalReq struct {
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocDailyStatTotalRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []BlocDailyStatTotalInfo `json:"list"`
|
||||
}
|
||||
|
||||
type BlocDailyStatTotalInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
TotalVisitCount int64 `json:"totalVisitCount"` // 日活
|
||||
TotalNewCount int64 `json:"totalNewCount"` // 新增
|
||||
TotalAmount int64 `json:"totalAmount"` // 总充值
|
||||
NewDirectCount int64 `json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `json:"newFissionCount"` // 新增裂变
|
||||
DirectVisitCount int64 `json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `json:"fissionVisitCount"` // 裂变访问数
|
||||
DirectAmount int64 `json:"directAmount"` // 直推充值金额
|
||||
FissionAmount int64 `json:"fissionAmount"` // 裂变充值金额
|
||||
NewRechargeCount int64 `json:"newRechargeCount"` // 新增充值数
|
||||
NewRechargeAmount int64 `json:"newRechargeAmount"` // 新增充值金额
|
||||
OldRechargeAmount int64 `json:"oldRechargeAmount"` // 老用户充值金额
|
||||
DaichongAmout int64 `json:"daichongAmout"` // 代充充值金额
|
||||
OnlineAmount int64 `json:"onlineAmount"` // 在线充值金额
|
||||
UserWithDrawAmount int64 `json:"userWithDrawAmount"` // 用户提现金额
|
||||
UserWithDrawPaymoneyAmount int64 `json:"userWithDrawPaymoneyAmount"` // 用户提现金额(实际到账)
|
||||
GameRechageAmount int64 `json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `json:"gameWithdrawAmount"` // 游戏提现
|
||||
TotalRechargeCount int64 `json:"totalRechargeCount"` // 总充值人数
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 日常统计列表请求
|
||||
type ListBlocRegisterDetailsReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocRegisterDetailsRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []BlocRegisterDetailsInfo `json:"list"`
|
||||
}
|
||||
|
||||
type BlocRegisterDetailsInfo struct {
|
||||
UserId string `json:"userId" bson:"userId"` // 用户ID
|
||||
AppName string `json:"appName" bson:"appName"` // appID
|
||||
SysType string `json:"sysType" bson:"sysType"` // 操作系统类型 安卓 IOS
|
||||
DevType string `json:"devType" bson:"devType"` // 设备类型
|
||||
Mobile string `json:"mobile" bson:"mobile"` // 手机号
|
||||
IP string `json:"ip,omitempty" bson:"ip"` // IP
|
||||
Name string `json:"name" bson:"name"` // 名称
|
||||
IsDirect bool `json:"isDirect" bson:"isDirect"` // true:直推用户
|
||||
RegisterTime time.Time `json:"registerTime" bson:"registerTime"` // 注册时间
|
||||
}
|
||||
|
||||
// 日常统计列表请求
|
||||
type ListBlocRechargeDetailsReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocRechargeDetailsRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []BlocRechargeDetailsInfo `json:"list"`
|
||||
}
|
||||
|
||||
type BlocRechargeDetailsInfo struct {
|
||||
UserId string `json:"userId" bson:"userId"` // 用户ID
|
||||
AppName string `json:"appName" bson:"appName"` // appID
|
||||
SysType string `json:"sysType" bson:"sysType"` // 操作系统类型 安卓 IOS
|
||||
DevType string `json:"devType" bson:"devType"` // 设备类型
|
||||
ChannelName string `json:"channelName" bson:"channelName"` // 支付渠道名字
|
||||
CID string `json:"cid" bson:"cid"` // 渠道id
|
||||
Type string `bson:"type" json:"type"` // 充值方式
|
||||
OrderId string `json:"orderId" bson:"orderId"` // 流水id
|
||||
Money int64 `json:"money" bson:"money"` // 充值金额 订单金额
|
||||
PayMoney int64 `json:"payMoney" bson:"payMoney"` // 实际到账金额 用户实际支付金额
|
||||
Status int `json:"status" bson:"status"` // 3付款成功
|
||||
SuccessAt time.Time `json:"successAt,omitempty" bson:"successAt,omitempty"` // 成功时间
|
||||
}
|
||||
|
||||
type ListBlocWithdrawDetailsReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocWithdrawDetailsRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ListBlocWithdrawDetailsInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ListBlocWithdrawDetailsInfo struct {
|
||||
UID string `json:"uid" bson:"uid"` //用户Id
|
||||
Name string `json:"name" bson:"name"` //用户名
|
||||
AppName string `json:"appName" bson:"appName"` // appID
|
||||
Amount int64 `json:"amount" bson:"amount"` //金币数量
|
||||
Money int64 `json:"money" bson:"money" binding:"required"` //提现金额
|
||||
PayMoney int64 `json:"payMoney" bson:"payMoney"` //实际到账
|
||||
PayType string `json:"payType" bson:"payType" binding:"required"` //提现方式,alipay,bankcard
|
||||
OID string `json:"oid" bson:"oid"` //第三方支付平台id
|
||||
ActName string `json:"actName" bson:"actName"` //交易账户持有人
|
||||
Act string `json:"act" bson:"act"` //交易账户
|
||||
UserIP string `json:"userIp" bson:"userIp"` //用户ip
|
||||
DeviceType string `json:"deviceType" bson:"deviceType"` //设备类型
|
||||
DevID string `json:"devID" bson:"devID"` //设备id
|
||||
Status int `json:"status" bson:"status"` //1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
StatusDesc string `json:"statusDesc" bson:"statusDesc"` //状态说明
|
||||
SuccessAt time.Time `json:"successAt" bson:"successAt"` //回调成功时间
|
||||
ReceivedAt time.Time `json:"receivedAt" bson:"receivedAt"` //到账时间 李秋山确认 三方出款时间
|
||||
}
|
||||
|
||||
type ListBlocRechargeChannelReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
ChannelName *string `form:"channelName" json:"channelName" binding:"omitempty"` // 渠道名称筛选
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListBlocRechargeChannelRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ListBlocRechargeChannelInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ListBlocRechargeChannelInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
ChannelName string `json:"channelName"` // 支付渠道名称
|
||||
BlocOrderMoney int64 `json:"blocOrderMoney"` // 订单金额
|
||||
BlocChannelRate int64 `json:"blocChannelRate"` // 费率
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/channelmod"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AgentLoginReq struct {
|
||||
Account *string `form:"account" json:"account" binding:"required"` // 账号
|
||||
Password *string `form:"password" json:"password" binding:"required"` // 密码
|
||||
ImgCode string `form:"imgCode" json:"imgCode"` // 图片验证码
|
||||
ImgID string `form:"imgID" json:"imgID"` // 图片编号
|
||||
}
|
||||
|
||||
type AgentLoginRes struct {
|
||||
Token string `json:"token"` // token
|
||||
Channel string `json:"channel"` // 渠道
|
||||
Detail *ChannelAgentInfo `json:"detail"` // 渠道详情
|
||||
}
|
||||
|
||||
type AgentImgVerifyCode struct {
|
||||
VerifyImg []byte `form:"verifyImg" json:"verifyImg"` // 验证码数据
|
||||
ImgId string `form:"imgId" json:"imgId"` // 验证码ID
|
||||
}
|
||||
|
||||
type AgentChannelInfoSearch struct {
|
||||
ID *string `json:"id"` // ID
|
||||
AppId *int32 `json:"appId"` // 渠道对应的appId
|
||||
Type *channelmod.ChannelType `json:"Type"` // 渠道类型:1 一级 2:二级
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ChannelAppInfoReq struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
}
|
||||
type ChannelAppInfo struct {
|
||||
AppId int32 `bson:"appId" json:"appId"` // 应用ID
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
LandingPage string `bson:"landingPage" json:"landingPage"` // 落地页
|
||||
}
|
||||
type ChannelAppInfoResp struct {
|
||||
List []ChannelAppInfo `bson:"list" json:"list"`
|
||||
}
|
||||
|
||||
type ChannelAgentInfo struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
AppIds []int32 `bson:"appIds" json:"appIds"` // 渠道对应的app
|
||||
UserName string `bson:"userName" json:"userName"` // 所有者
|
||||
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
||||
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
||||
Status bool `bson:"status" json:"status"` // 状态 开/关
|
||||
Mobile string `bson:"mobile" json:"mobile"` // 手机号
|
||||
Type channelmod.ChannelType `bson:"type" json:"type"` // 渠道类型:1 一级 2:二级
|
||||
Remark string `bson:"remark" json:"remark"` // 备注
|
||||
Lock bool `bson:"lock" json:"lock"` // 禁止登陆
|
||||
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
||||
ChildShowDivideRate bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 下级是否显示分成比例
|
||||
Wallet channelmod.Wallet `bson:"wallet" json:"wallet"` // 钱包地址
|
||||
AppType channelmod.AppType `bson:"appType" json:"appType"` // 应用类型
|
||||
PromoteMode channelmod.PromoteMode `bson:"promoteMode" json:"promoteMode"` // 推广类型
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
type AgentChannelInfoSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ChannelAgentInfo `json:"list"`
|
||||
}
|
||||
|
||||
type AgentChannelRuleUpdate struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
CPAPrice *int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate *int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
DivideRate *int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
||||
ChildShowDivideRate *bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 渠道:下级是否显示分成比例
|
||||
Remark *string `bson:"remark" json:"remark"` // 备注
|
||||
}
|
||||
|
||||
type AgentChannelInfoUpdate struct {
|
||||
Channel string `json:"channel"` // 渠道
|
||||
Mobile *string `json:"mobile"` // 手机号
|
||||
WalletAddr1 *string `json:"walletAddr1"` // 钱包地址1
|
||||
WalletAddr2 *string `json:"walletAddr2"` // 钱包地址2
|
||||
Status *bool `json:"status"` // 状态 开/关
|
||||
}
|
||||
|
||||
type AgentChannelPasswordUpdate struct {
|
||||
OldPassword string `json:"oldPassword"` // 代理商旧密码
|
||||
NewPassword string `json:"newPassword"` // 代理商新密码
|
||||
}
|
||||
|
||||
type AgentChannelPasswordReset struct {
|
||||
Channel string `json:"channel"` // 下级渠道
|
||||
Password string `json:"password"` // 新密码
|
||||
}
|
||||
|
||||
// AgentChannelInfoAdd 新增渠道
|
||||
type AgentChannelInfoAdd struct {
|
||||
Password string `json:"password"` // 代理商密码
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
WalletAddr1 string `json:"walletAddr1"` // 钱包地址1
|
||||
WalletAddr2 string `json:"walletAddr2"` // 钱包地址2
|
||||
Status bool `bson:"status"` // 状态 开/关
|
||||
Remark string `json:"remark"` // 备注
|
||||
}
|
||||
|
||||
// AgentDeductedStat 渠道后台查询结算
|
||||
type AgentDeductedStat struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
||||
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间
|
||||
VisitCount int64 `bson:"visitCount" json:"visitCount"` // 访问量
|
||||
DirectCount int64 `bson:"directCount" json:"directCount"` // 新增量(包含子渠道和渠道本身)
|
||||
DirectCountSelf int64 `bson:"directCountSelf" json:"directCountSelf"` // 自身渠道新增量
|
||||
DirectCountChild int64 `bson:"directCountChild" json:"directCountChild"` // 子渠道新增量
|
||||
Recharge int64 `bson:"recharge" json:"recharge"` // 充值金额(包含子渠道和渠道本身)
|
||||
RechargeSelf int64 `bson:"rechargeSelf" json:"rechargeSelf"` // 来自自身渠道充值金额
|
||||
RechargeChild int64 `bson:"rechargeChild" json:"rechargeChild"` // 来自子渠道充值金额
|
||||
Income int64 `bson:"income" json:"income"` // 当日收益(自身+子渠道)
|
||||
IncomeChild int64 `bson:"incomeChild" json:"incomeChild"` // 来自子渠道的当日收益
|
||||
IncomeSelf int64 `bson:"incomeSelf" json:"incomeSelf"` // 来自自身渠道的当日收益
|
||||
ChildRebate int64 `bson:"childRebate" json:"childRebate"` // 子渠道返佣
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type AgentChannelStatSearch struct {
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Channel *string `bson:"channel" json:"channel"` // 渠道
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type AgentChannelStatResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []*AgentDeductedStat `json:"list"`
|
||||
TotalInfo AgentDeductedStat `json:"totalInfo"`
|
||||
}
|
||||
|
||||
type AgentChannelStatOldSearch struct {
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Channel *string `bson:"channel" json:"channel"` // 渠道
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
// AgentChannelStat 渠道后台查询结算
|
||||
type AgentChannelStatOld struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间
|
||||
DirectCount int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 下载量
|
||||
VisitCount int64 `bson:"directVisitCount" json:"directVisitCount"` // 访问量
|
||||
RechargeAmount int64 `bson:"directAmount" json:"directAmount"` // 充值金额
|
||||
TodayIncome int64 `bson:"todayIncome" json:"todayIncome"` // 当日收益
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type AgentChannelStatOldResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AgentChannelStatOld `json:"list"`
|
||||
TotalInfo AgentChannelStatOld `json:"totalInfo"`
|
||||
}
|
||||
|
||||
type StatDataSimple struct {
|
||||
VisitCount int64 `bson:"visitCount" json:"visitCount"` // 访问总量(包含子渠道和渠道本身)
|
||||
DirectCount int64 `bson:"directCount" json:"directCount"` // 新增总量(包含子渠道和渠道本身)
|
||||
Recharge int64 `bson:"recharge" json:"recharge"` // 充值金额(包含子渠道和渠道本身)
|
||||
Income int64 `bson:"income" json:"income"` // 收益(自身+子渠道)
|
||||
}
|
||||
|
||||
type StatDataDetail struct {
|
||||
StatDataSimple
|
||||
DirectCountSelf int64 `bson:"directCountSelf" json:"directCountSelf"` // 自身渠道新增量
|
||||
DirectCountChild int64 `bson:"directCountChild" json:"directCountChild"` // 子渠道新增量
|
||||
RechargeSelf int64 `bson:"rechargeSelf" json:"rechargeSelf"` // 来自自身渠道充值金额
|
||||
RechargeChild int64 `bson:"rechargeChild" json:"rechargeChild"` // 来自子渠道充值金额
|
||||
IncomeChild int64 `bson:"incomeChild" json:"incomeChild"` // 子渠道的收益
|
||||
IncomeSelf int64 `bson:"incomeSelf" json:"incomeSelf"` // 自身渠道的收益
|
||||
ChildRebate int64 `bson:"childRebate" json:"childRebate"` // 子渠道返佣
|
||||
}
|
||||
|
||||
func (s *StatDataDetail) ToStatDataSimple() *StatDataSimple {
|
||||
return &s.StatDataSimple
|
||||
}
|
||||
|
||||
// AgentSummaryStatHome 渠道汇总
|
||||
type AgentSummaryStatHome struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
||||
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
||||
TotalStat *StatDataDetail `bson:"totalStat" json:"totalStat"` // 所有统计
|
||||
TodayStat *StatDataDetail `bson:"todayStat" json:"todayStat"` // 今日统计
|
||||
WeekStat *StatDataDetail `bson:"weekStat" json:"weekStat"` // 本周统计
|
||||
MonthStat *StatDataDetail `bson:"monthStat" json:"monthStat"` // 本月统计
|
||||
YearStat *StatDataDetail `bson:"yearStat" json:"yearStat"` // 本年统计
|
||||
}
|
||||
|
||||
func (s *AgentSummaryStatHome) ToAgentSummaryStatChild() *AgentSummaryStatChild {
|
||||
stat := &AgentSummaryStatChild{
|
||||
Channel: s.Channel,
|
||||
ParentAgent: s.ParentAgent,
|
||||
ChildCount: s.ChildCount,
|
||||
AppName: s.AppName,
|
||||
AppId: s.AppId,
|
||||
Settlement: s.Settlement,
|
||||
CPAPrice: s.CPAPrice,
|
||||
CPSRate: s.CPSRate,
|
||||
DivideRate: s.DivideRate,
|
||||
TotalStat: s.TotalStat.ToStatDataSimple(),
|
||||
TodayStat: s.TodayStat.ToStatDataSimple(),
|
||||
WeekStat: s.WeekStat.ToStatDataSimple(),
|
||||
MonthStat: s.MonthStat.ToStatDataSimple(),
|
||||
YearStat: s.YearStat.ToStatDataSimple(),
|
||||
}
|
||||
return stat
|
||||
}
|
||||
|
||||
type AgentSummaryStatHomeList []*AgentSummaryStatHome
|
||||
|
||||
func (a AgentSummaryStatHomeList) Len() int { return len(a) }
|
||||
func (a AgentSummaryStatHomeList) Less(i, j int) bool {
|
||||
return a[i].TotalStat.Income > a[j].TotalStat.Income
|
||||
}
|
||||
func (a AgentSummaryStatHomeList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
|
||||
type AgentSummaryStatHomeSearch struct {
|
||||
common.Page
|
||||
}
|
||||
|
||||
type AgentSummaryStatHomeResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List AgentSummaryStatHomeList `json:"list"`
|
||||
}
|
||||
|
||||
// AgentSummaryStatChild 下级渠道汇总
|
||||
type AgentSummaryStatChild struct {
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
||||
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
||||
TotalStat *StatDataSimple `bson:"totalStat" json:"totalStat"` // 所有统计
|
||||
TodayStat *StatDataSimple `bson:"todayStat" json:"todayStat"` // 今日统计
|
||||
WeekStat *StatDataSimple `bson:"weekStat" json:"weekStat"` // 本周统计
|
||||
MonthStat *StatDataSimple `bson:"monthStat" json:"monthStat"` // 本月统计
|
||||
YearStat *StatDataSimple `bson:"yearStat" json:"yearStat"` // 本年统计
|
||||
}
|
||||
|
||||
type AgentSummaryStatChildList []*AgentSummaryStatChild
|
||||
|
||||
type AgentSummaryStatChildSearch struct {
|
||||
common.Page
|
||||
}
|
||||
|
||||
type AgentSummaryStatChildResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List AgentSummaryStatChildList `json:"list"`
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 请求渠道码列表
|
||||
type ListChannelCodeReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
Channel *string `form:"channel" json:"channel" binding:"omitempty"` // 渠道
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode" binding:"omitempty"` // 渠道码
|
||||
IsAdmin *bool `form:"isAdmin" json:"isAdmin" binding:"omitempty"` // 是否是管理员
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 响应渠道码列表
|
||||
type ListChannelCodeRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ChannelCodeInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 渠道码信息
|
||||
type ChannelCodeInfo struct {
|
||||
ID string `json:"id"` // 公告id
|
||||
ChannelCode string `json:"channelCode"` // 渠道码
|
||||
AppId int32 `json:"appId"` // appId
|
||||
AppName string `json:"appName"` // app名称
|
||||
Channel string `json:"channel"` // 该渠道码所属渠道渠道
|
||||
ParentChannel string `json:"parentChannel"` // 该渠道码所属渠道渠道的父渠道
|
||||
// Settlement channelmod.SettlementWay `json:"settlement"` // 结算方式 cps/cpa/cpt
|
||||
// DeductionStatus bool `json:"deductionStatus"` // 是否需要扣量
|
||||
// DedNewRule DeductionRuleInfo `json:"dedNewRule"` // 新增扣量规则
|
||||
// DedRechargeRule DeductionRuleInfo `json:"dedRechargeRule"` // 充值扣量规则
|
||||
Status bool `json:"status"` // 状态 开/关
|
||||
Links []string `json:"links"` // 推广链接
|
||||
OpeninstallLink string `json:"openinstallLink"` // 推广链接
|
||||
SharePassword string `json:"sharePassword"` // 推广链接 密码
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 请求添加渠道码
|
||||
type AddChannelCodeReq struct {
|
||||
Channel *string `form:"channel" json:"channel" binding:"required"` // 渠道
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode" binding:"required"` // 渠道码
|
||||
Status *bool `form:"status" json:"status" binding:"required"` // 状态 开/关
|
||||
IsAdmin *bool `form:"isAdmin" json:"isAdmin" binding:"required"` // 是否是管理员
|
||||
}
|
||||
|
||||
// 请求修改渠道
|
||||
type UpdateChannelCodeReq struct {
|
||||
Id *string `form:"id" json:"id" binding:"required"` // ID
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode"` // 渠道码
|
||||
AppId *int32 `form:"appId" json:"appId"` // appId
|
||||
Status *bool `form:"status" json:"status" ` // 状态 开/关
|
||||
IsAdmin *bool `form:"isAdmin" json:"isAdmin"` // 是否是管理员
|
||||
SharePassword *string `form:"sharePassword" json:"sharePassword"` // 渠道码
|
||||
}
|
||||
|
||||
// 请求删除渠道
|
||||
type DelChannelCodeReq struct {
|
||||
ChannelCode *string `form:"channel" json:"channel" binding:"required"` // 渠道
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
IsAdmin *bool `form:"isAdmin" json:"isAdmin" binding:"required"` // 是否是管理员
|
||||
}
|
||||
|
||||
// 代理商渠道码列表请求
|
||||
type ListAgentChannelCodeReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
ChannelCode *string `json:"channelCode"` // 渠道码
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 代理商响应渠道码列表
|
||||
type ListAgentChannelCodeRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AgentChannelCodeInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 渠道码信息
|
||||
type AgentChannelCodeInfo struct {
|
||||
ChannelCode string `json:"channelCode"` // 渠道码
|
||||
AppId int32 `json:"appId"` // appId
|
||||
AppName string `json:"appName"` // app名称
|
||||
Channel string `json:"channel"` // 该渠道码所属渠道渠道
|
||||
ParentChannel string `json:"parentChannel"` // 该渠道码所属渠道渠道的父渠道
|
||||
Status bool `json:"status"` // 状态 开/关
|
||||
Links []string `json:"links"` // 推广链接
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 请求添加渠道码
|
||||
type AddAgentChannelCodeReq struct {
|
||||
Channel *string `form:"channel" json:"channel" binding:"required"` // 渠道
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode" binding:"required"` // 渠道码
|
||||
Status *bool `form:"status" json:"status" binding:"required"` // 状态 开/关
|
||||
}
|
||||
|
||||
// 请求修改渠道
|
||||
type UpdateAgentChannelCodeReq struct {
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode" binding:"required"` // 渠道码
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
Status *bool `form:"status" json:"status" binding:"required"` // 状态 开/关
|
||||
}
|
||||
|
||||
// 请求删除渠道
|
||||
type DelAgentChannelCodeReq struct {
|
||||
ChannelCode *string `form:"channel" json:"channel" binding:"required"` // 渠道码
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // appId
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 渠道码统计信息列表请求
|
||||
type BlocListChannelCodeStatReq struct {
|
||||
Channel *string `form:"channel" json:"channel" binding:"omitempty"` // 渠道
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
WithChild *bool `form:"withChild" json:"withChild" binding:"omitempty"` // 包含子渠道
|
||||
common.Page
|
||||
}
|
||||
|
||||
type BlocListChannelCodeStatRes struct {
|
||||
Total int64 `json:"total"`
|
||||
TotalInfo BlocChannelCodeStatInfo `json:"totalInfo"`
|
||||
List []BlocChannelCodeStatInfo `json:"list"`
|
||||
}
|
||||
|
||||
type BlocChannelCodeStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
ChannelCode string `json:"channelCode"` // 渠道码
|
||||
AppId int32 `json:"appId"` // appId
|
||||
AppName string `json:"appName"` // app名称
|
||||
Channel string `json:"channel"` // 该渠道码所属渠道渠道
|
||||
NewDirectCount int64 `json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount int64 `json:"newDeductionCount"` // 新增扣量(新增 = 新增直推+新增裂变+扣量)
|
||||
DirectVisitCount int64 `json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `json:"fissionVisitCount"` // 裂变访问数
|
||||
Day1RetainRate float64 `json:"day1RetainRate"` // 次日留存率
|
||||
Day3RetainRate float64 `json:"day3RetainRate"` // 3日留存率
|
||||
Day7RetainRate float64 `json:"day7RetainRate"` // 7日留存率
|
||||
RechargeAmount int64 `json:"rechargeAmount"` // 直推充值金额
|
||||
FissionAmount int64 `json:"fissionAmount"` // 裂变充值金额
|
||||
DeductionAmount int64 `json:"deductionAmount"` // 扣量金额
|
||||
NewRechargeCount int64 `json:"newRechargeCount"` // 新增充值数
|
||||
NewRechargeAmount int64 `json:"newRechargeAmount"` // 新增充值金额
|
||||
LandPageVisitCount int64 `json:"landPageVisitCount"` // 落地页访问次数
|
||||
Settlement string `json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
TodayIncome int64 `json:"todayIncome"` // 当日收益
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/channelmod"
|
||||
"stat/models/channelsettlementrecord"
|
||||
"stat/models/registermod"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// ChannelInfoSearch 渠道信息查询
|
||||
type ChannelInfoSearch struct {
|
||||
ID *string `json:"id"` // ID
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
AppId *int32 `json:"appId"` // 渠道对应的appId
|
||||
Type *channelmod.ChannelType `json:"Type"` // 渠道类型:1 一级 2:二级
|
||||
ParentChannel *string `json:"parentChannel"` // 父渠道 二级:存在父渠道
|
||||
UserName *string `json:"userName"` // 所有者
|
||||
Status *bool `json:"status"` // 状态 开/关
|
||||
Remark *string `json:"remark"` // 备注
|
||||
Mobile *string `json:"mobile"` // 手机号
|
||||
common.Page
|
||||
}
|
||||
type ChannelInfoSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelmod.ChannelInfoList `json:"list"`
|
||||
}
|
||||
|
||||
// ChannelInfoUpdate 渠道更新
|
||||
type ChannelInfoUpdate struct {
|
||||
ID string `json:"id,omitempty" binding:"required"` // ID
|
||||
Password *string `json:"password" bson:"password,omitempty"` // 渠道密码
|
||||
Status *bool `json:"status" bson:"status,omitempty"` // 状态 开/关
|
||||
Remark *string `json:"remark" bson:"remark,omitempty"` // 备注
|
||||
Mobile *string `json:"mobile" bson:"mobile,omitempty"` // 手机号
|
||||
ShowMagic *int32 `json:"showMagic" bson:"showMagic,omitempty"` // 异常登陆次数
|
||||
Lock *bool `json:"lock" bson:"lock,omitempty"` // 禁止登陆
|
||||
WalletAddr1 *string `json:"walletAddr1" bson:"wallet.addr1,omitempty"` // 钱包地址1
|
||||
WalletAddr2 *string `json:"walletAddr2" bson:"wallet.addr2,omitempty"` // 钱包地址2
|
||||
AutoGenApk *bool `bson:"autoGenApk" json:"autoGenApk,omitempty"` // 自动生成渠道包
|
||||
ChildShowDivideRate *bool `bson:"childShowDivideRate" json:"childShowDivideRate,omitempty"` // 下级是否显示分成比例
|
||||
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
|
||||
}
|
||||
|
||||
// ChannelOwnerUpdate 渠道所有者更新
|
||||
type ChannelOwnerUpdate struct {
|
||||
Channel string `json:"channel" bson:"channel" binding:"required"` // 渠道ID
|
||||
UserName string `json:"userName" bson:"userName"` // 所有者名字
|
||||
Mark string `json:"mark" bson:"mark"` // 备注
|
||||
}
|
||||
|
||||
// ChannelInfoAdd 新增渠道
|
||||
type ChannelInfoAdd struct {
|
||||
Channel string `json:"channel" binding:"required"` // 渠道
|
||||
Type channelmod.ChannelType `json:"type" binding:"required"` // 渠道类型:1 一级 2:二级
|
||||
ParentChannel string `json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
|
||||
Password string `json:"password"` // 代理商密
|
||||
Status bool `json:"status"` // 状态 开/关
|
||||
Remark string `json:"remark"` // 备注
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Lock bool `json:"lock"` // 禁止登陆
|
||||
ChildShowDivideRate bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 下级是否显示分成比例
|
||||
}
|
||||
|
||||
// ChannelInfoDelete 删除渠道信息
|
||||
type ChannelInfoDelete struct {
|
||||
ID string `json:"id,omitempty" binding:"required"` // ID
|
||||
}
|
||||
|
||||
// ChannelDeductionRuleSearch 渠道扣量规则查询
|
||||
type ChannelDeductionRuleSearch struct {
|
||||
AppId *int32 `json:"appId"` // 应用ID
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ChannelDeductionRuleSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelmod.ChannelDeductionRuleList `json:"list"`
|
||||
}
|
||||
|
||||
// ChannelDeductionRuleUpdate 更新扣量规则
|
||||
type ChannelDeductionRuleUpdate struct {
|
||||
ID string `json:"id" binding:"required"` // ID
|
||||
AppType *channelmod.AppType `json:"appType" bson:"appType,omitempty"` // 应用类型
|
||||
PromoteMode *channelmod.PromoteMode `json:"promoteMode" bson:"promoteMode,omitempty"` // 推广类型
|
||||
First *int32 `json:"first" bson:"first,omitempty" ` // 一阶(1单)
|
||||
Second *int32 `json:"second" bson:"second,omitempty"` // 二阶(2-3单)
|
||||
Third *int32 `json:"third" bson:"third,omitempty"` // 三阶(4-5单)
|
||||
Fourth *int32 `json:"fourth" bson:"fourth,omitempty"` // 四阶(6-10单)
|
||||
Fifth *int32 `json:"fifth" bson:"fifth,omitempty"` // 5阶(11单以上)
|
||||
CPAPrice *int64 `json:"cpaPrice" bson:"cpaPrice,omitempty"` // 单价
|
||||
CPSRate *int64 `json:"cpsRate" bson:"cpsRate,omitempty"` // CPS分成比列 0-100
|
||||
CPSBegin *int64 `json:"cpsBegin" bson:"cpsBegin,omitempty"` // CPS 开始扣量金额
|
||||
CPSDeductionRate *int64 `json:"cpsDeductionRate" bson:"cpsDeductionRate,omitempty"` // CPS 扣量比例
|
||||
BeginTime *time.Time `json:"deductionAt" bson:"deductionAt,omitempty"` // 扣量开始时间
|
||||
LandingPage *string `json:"landingPage" bson:"landingPage,omitempty"` // 落地页
|
||||
ProxyDeduction *int64 `json:"proxyDeduction" bson:"proxyDeduction,omitempty"` // 代理扣量比例
|
||||
DivideRate *int64 `json:"divideRate" bson:"divideRate,omitempty"` // 代理分成比例
|
||||
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
|
||||
AutoDeduction *bool `json:"autoDeduction" bson:"autoDeduction,omitempty"` // 自动扣量开关
|
||||
LessIncomeRate *float64 `json:"lessIncomeRate" bson:"lessIncomeRate,omitempty"` // 最低收益比 CPA低于该值开启扣量(0.1 - 3.0)
|
||||
}
|
||||
|
||||
// ChannelDeductionRuleAdd 新增扣量规则
|
||||
type ChannelDeductionRuleAdd struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // 应用ID
|
||||
Channel string `json:"channel" binding:"required"` // 渠道
|
||||
Settlement channelmod.SettlementWay `json:"settlement" binding:"required"` // 结算方式 cps/cpa/cpt/cpc (cpt/cpc 1-5阶设置100 不可编辑)
|
||||
AppType channelmod.AppType `json:"appType" bson:"appType,omitempty"` // 应用类型
|
||||
PromoteMode channelmod.PromoteMode `json:"promoteMode" bson:"promoteMode,omitempty"` // 推广类型
|
||||
First int32 `json:"first" binding:"min=0,max=100"` // 一阶
|
||||
Second int32 `json:"second" binding:"min=0,max=100"` // 二阶
|
||||
Third int32 `json:"third" binding:"min=0,max=100"` // 三阶
|
||||
Fourth int32 `json:"fourth" binding:"min=0,max=100"` // 四阶
|
||||
Fifth int32 `json:"fifth" binding:"min=0,max=100"` // 5阶
|
||||
CPAPrice int64 `json:"cpaPrice"` // 单价(分) 前端可设置1.80
|
||||
CPSRate int64 `json:"cpsRate" binding:"min=0,max=100"` // CPS分成比列
|
||||
CPSBegin int64 `json:"cpsBegin"` // CPS 开始扣量金额
|
||||
CPSDeductionRate int64 `json:"cpsDeductionRate"` // CPS 扣量比例
|
||||
LandingPage string `json:"landingPage"` // 落地页
|
||||
ProxyDeduction int64 `json:"proxyDeduction" binding:"min=0,max=100"` // 代理扣量比例
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 代理分成比例
|
||||
BeginTime time.Time `json:"deductionAt"` // 扣量开始时间(默认当前时间)
|
||||
AutoDeduction bool `json:"autoDeduction" bson:"autoDeduction"` // 自动扣量开关
|
||||
LessIncomeRate *float64 `json:"lessIncomeRate" bson:"lessIncomeRate"` // 最低收益比 CPA低于该值开启扣量(0.1 - 3.0)
|
||||
|
||||
}
|
||||
|
||||
type ChannelDeductionRuleDelete struct {
|
||||
ID string `json:"id,omitempty" binding:"required"` // ID
|
||||
}
|
||||
|
||||
// ChannelStatSearch 渠道统计(每天)查询
|
||||
type ChannelStatSearch struct {
|
||||
DayType *int8 `json:"dayType"` // 天数
|
||||
RankType *int8 `json:"rankType"` // 排序方式:统计时间+1充值,2新增,3收益
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
AppId *[]int32 `json:"appId"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
WithChild *bool `json:"withChild"` // 包含子渠道
|
||||
Detail *bool `json:"detail"` // true 渠道详细
|
||||
SumDate *time.Time `json:"sumDate"` // 哪一天
|
||||
UserName *string `json:"userName"` // 所有者
|
||||
Settlement *channelmod.SettlementWay `bson:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
common.Page
|
||||
}
|
||||
|
||||
func (s *ChannelStatSearch) CanCalcTotal() bool {
|
||||
return s.Start != nil && s.End != nil && s.AppId != nil && s.Channel != nil
|
||||
}
|
||||
|
||||
type ChannelStatSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
TotalInfo channelmod.ChannelStat `json:"totalInfo"`
|
||||
List channelmod.ChannelStatList `json:"list"`
|
||||
Income int64 `bson:"income" json:"income"` // 总收益
|
||||
Desc string `bson:"desc" json:"desc"` // 描述
|
||||
}
|
||||
|
||||
// 结算对话框搜索
|
||||
type ChannelStatSettlementSearch struct {
|
||||
Channel *string `json:"channel" binding:"required"` // 渠道
|
||||
AppId *int32 `json:"appId" binding:"required"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
WithChild *bool `json:"withChild"` // 包含子渠道
|
||||
UserName *string `json:"userName"` // 所有者
|
||||
Settlement *channelmod.SettlementWay `json:"settlement"` // 结算方式 cps/cpa/cpt/cpc/hz
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ChannelStatSettlementSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
TotalInfo channelmod.ChannelStat `json:"totalInfo"`
|
||||
List channelmod.ChannelStatList `json:"list"`
|
||||
Income int64 `bson:"income" json:"income"` // 总收益
|
||||
Desc string `bson:"desc" json:"desc"` // 描述
|
||||
}
|
||||
|
||||
type ChannelStatSettlementSearch2 struct {
|
||||
Channel *string `json:"channel" binding:"required"` // 渠道
|
||||
AppId *int32 `json:"appId" binding:"required"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
IsPayed *bool `json:"isPayed"` // 结算状态 true:已结算或正在结算,false:未结算
|
||||
UserName *string `json:"userName"` // 所有者
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ChannelStatSettlementSearch2Resp struct {
|
||||
Channel string `json:"channel"` // 渠道
|
||||
AppId int32 `json:"appId"` // appId
|
||||
TotalCount int64 `json:"totalCount"` // 总条数
|
||||
TotalInfo channelmod.ChannelStat `json:"totalInfo"` // 按总条数合计的数据
|
||||
TotalIncome int64 `json:"totalIncome"` // 总收益(列表的所有数据合计)
|
||||
TotalDesc string `json:"totalDesc"` // 总收益描述
|
||||
ValidCount int64 `json:"validCount"` // 有效条数
|
||||
ValidInfo channelmod.ChannelStat `json:"validInfo"` // 按有效条数合计的数据
|
||||
ValidIncome int64 `json:"validIncome"` // 有效收益(可结算的收益)
|
||||
ValidDesc string `json:"validDesc"` // 有效收益描述
|
||||
InvalidCount int64 `json:"invalidCount"` // 无效条数
|
||||
InvalidInfo channelmod.ChannelStat `json:"invalidInfo"` // 按无效条数合计的数据
|
||||
InvalidIncome int64 `json:"invalidIncome"` // 无效收益(不可结算的收益)
|
||||
InvalidDesc string `json:"invalidDesc"` // 无效收益描述
|
||||
List channelmod.ChannelStatList `json:"list"` // 全部记录
|
||||
RuleId primitive.ObjectID `json:"ruleId"` // 扣量规则ID
|
||||
Wallet channelmod.Wallet `json:"wallet"` // 钱包信息
|
||||
}
|
||||
|
||||
// ChannelSettlementSearch 渠道结算(每15分钟)
|
||||
type ChannelSettlementSearch struct {
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
WithChild *bool `json:"withChild"` // 包含子渠道
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ChannelSettlementSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelmod.ChannelSettlementList `json:"list"`
|
||||
}
|
||||
|
||||
type UserInfoSearch struct {
|
||||
UserId *int64 `json:"id"` // 用户ID
|
||||
AppId *int32 `json:"appId"` // 渠道对应的appId
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
IP *string `json:"ip"` // IP
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type UserInfoSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []registermod.RegisterMod `json:"list"`
|
||||
}
|
||||
|
||||
type GetSettlementApplicantListReq struct {
|
||||
}
|
||||
|
||||
type GetSettlementApplicantListResp struct {
|
||||
List []string `json:"list" bson:"list"`
|
||||
}
|
||||
|
||||
type GetApplyFormReq struct {
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ApplyFormRecord struct {
|
||||
ID primitive.ObjectID `json:"id,omitempty"` // ID
|
||||
Channel string `json:"channel"` // 渠道
|
||||
AppId int32 `json:"appId"` // appId
|
||||
BeginTime time.Time `json:"beginTime"` // 开始时间
|
||||
EndTime time.Time `json:"endTime"` // 结束时间
|
||||
TotalMoney int64 `json:"totalMoney"` // 计算出的总金额
|
||||
SettleMoney int64 `json:"settleMoney"` // 手动输入的要结算的真实金额()
|
||||
Settlement channelmod.SettlementWay `json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
Wallet channelmod.Wallet `json:"wallet"` // 钱包地址
|
||||
PayMoney int64 `json:"payMoney"` // 打款金额
|
||||
Usdt int64 `json:"usdt"` // 打款Usdt 还是分
|
||||
Status channelsettlementrecord.SettlementStatus `json:"status"` // 状态
|
||||
Remark string `json:"remark"` // 备注
|
||||
Pictures []string `json:"pictures"` // 上传的图片
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
}
|
||||
|
||||
type ApplyFormRecordList []*ApplyFormRecord
|
||||
|
||||
type GetApplyFormResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List ApplyFormRecordList `json:"list"`
|
||||
}
|
||||
|
||||
type SettlementInfoSearch struct {
|
||||
PayType *int8 `json:"payType"` // 支付类型,1ERC 2TRC 3銀行卡 4支付寶
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
Remark *string `json:"remark"` // 备注
|
||||
Status []channelsettlementrecord.SettlementStatus `json:"status"` // 状态数组
|
||||
Applicants []string `json:"applicants"` // 申请人列表
|
||||
common.Page
|
||||
}
|
||||
type SettlementInfoSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelsettlementrecord.ChannelSettlementRecordList `json:"list"`
|
||||
}
|
||||
|
||||
type SettlementInfoUpdate struct {
|
||||
ID primitive.ObjectID `json:"id" binding:"required"` // ID
|
||||
PayMoney *int64 `json:"payMoney"` // 打款金额
|
||||
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
|
||||
Remark *string `json:"remark"` // 备注
|
||||
Usdt *int64 `json:"usdt"` // 打款Usdt 还是分
|
||||
}
|
||||
|
||||
type SettlementInfoUpdate2 struct {
|
||||
ID primitive.ObjectID `json:"id" binding:"required"` // ID
|
||||
Remark *string `json:"remark"` // 备注
|
||||
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
|
||||
// 财务(可修改)
|
||||
PayMoney *int64 `json:"payMoney"` // 打款金额
|
||||
Usdt *int64 `json:"usdt"` // 打款Usdt 还是分
|
||||
|
||||
SettleMoney *int64 `json:"settleMoney"` // 申请结算的金额
|
||||
// 图片
|
||||
Pictures []string `json:"pictures"` // 上传的图片
|
||||
|
||||
}
|
||||
|
||||
// SettlementInfoAdd 渠道结算信息
|
||||
type SettlementInfoAdd struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // 应用ID
|
||||
Channel string `json:"channel" binding:"required"` // 渠道
|
||||
BeginTime time.Time `json:"beginTime" binding:"required"` // 开始时间
|
||||
EndTime time.Time `json:"endTime" binding:"required"` // 结束时间
|
||||
TotalMoney int64 `json:"totalMoney" binding:"required"` // 总金额
|
||||
}
|
||||
|
||||
// SettlementInfoAdd2 渠道结算信息
|
||||
type SettlementInfoAdd2 struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // 应用ID
|
||||
Channel string `json:"channel" binding:"required"` // 渠道
|
||||
TotalMoney int64 `json:"totalMoney"` // 总金额(提交的总金额,必须和按ids条数合计出来数据按ruleId扣量后一致)
|
||||
SettleMoney int64 `json:"settleMoney" binding:"required"` // 手动输入的要结算的金额(为什么和TotalMoney不一致,因为可能已经预付过了)
|
||||
RuleId primitive.ObjectID `json:"ruleId" binding:"required"` // 扣量RuleId
|
||||
SettleIds []primitive.ObjectID `json:"settleIds" binding:"required"` // 要结算的天记录ID列表
|
||||
BeginTime *time.Time `json:"beginTime"` // 开始时间
|
||||
EndTime *time.Time `json:"endTime"` // 结束时间
|
||||
Remark *string `json:"remark"` // 备注
|
||||
WalletAddr1 *string `json:"walletAddr1"` // 钱包地址1
|
||||
WalletAddr2 *string `json:"walletAddr2"` // 钱包地址2
|
||||
}
|
||||
|
||||
type SettlementCalcReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // 应用ID
|
||||
Channel string `json:"channel" binding:"required"` // 渠道
|
||||
BeginTime *time.Time `json:"beginTime"` // 开始时间
|
||||
EndTime *time.Time `json:"endTime"` // 结束时间
|
||||
RuleId primitive.ObjectID `json:"ruleId" binding:"required"` // 扣量RuleId
|
||||
SettleIds []primitive.ObjectID `json:"settleIds" binding:"required"` // 要结算的天记录ID列表
|
||||
}
|
||||
|
||||
type SettlementCalcResp struct {
|
||||
TotalCount int64 `json:"totalCount"` // 总条数
|
||||
TotalInfo channelmod.ChannelStat `json:"totalInfo"` // 按总条数合计的数据
|
||||
TotalIncome int64 `json:"totalIncome"` // 总收益(列表的所有数据合计)
|
||||
TotalDesc string `json:"totalDesc"` // 总收益描述
|
||||
}
|
||||
|
||||
type SettlementInfoDelete struct {
|
||||
ID primitive.ObjectID `json:"id" binding:"required"` // ID
|
||||
}
|
||||
|
||||
type SettlementInfoDetail struct {
|
||||
ID primitive.ObjectID `json:"id" binding:"required"` // ID
|
||||
common.Page
|
||||
}
|
||||
|
||||
type SettlementInfoDetailResp struct {
|
||||
Count int64 `json:"count"` // 总条数
|
||||
List channelmod.ChannelStatList `json:"list"` // 全部记录
|
||||
}
|
||||
|
||||
type SearchChannelStatComparedReq struct {
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
AppId *int32 `json:"appId"` // appId
|
||||
Start *time.Time `json:"start"` // 开始时间
|
||||
End *time.Time `json:"end"` // 结束时间
|
||||
WithChild *bool `json:"withChild"` // 包含子渠道
|
||||
Settlement *channelmod.SettlementWay `bson:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
common.Page
|
||||
}
|
||||
|
||||
type SearchChannelStatComparedResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelmod.ChannelStatYestodayList `json:"list"`
|
||||
}
|
||||
|
||||
// ChannelOwnerChangeInfoSearch 渠道所有者变更信息查询
|
||||
type ChannelOwnerChangeInfoSearch struct {
|
||||
ID *primitive.ObjectID `json:"id"` // ID
|
||||
Channel *string `json:"channel"` // 渠道
|
||||
OldUser *string `json:"oldUser"` // 变更前的所有者
|
||||
NewUser *string `json:"newUser"` // 变更后的所有者
|
||||
common.Page
|
||||
}
|
||||
type ChannelOwnerChangeInfoSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List channelmod.ChannelOwnerChangeList `json:"list"`
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 日常统计列表请求
|
||||
type ListDailyStatReq struct {
|
||||
AppId *[]int32 `form:"appId" json:"appId"` // appId
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListDailyHourStatReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId"` // appId
|
||||
SumHour *int `form:"sumHour" json:"sumHour"` // 小时数
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
type BlocDailyStatReq struct {
|
||||
StartTime *time.Time `form:"time" json:"time"` // 开始时间
|
||||
}
|
||||
|
||||
type ListDailyStatRes struct {
|
||||
Total int64 `json:"total"`
|
||||
TotalInfo *DailyStatInfo `json:"totalInfo"`
|
||||
List []*DailyStatInfo `json:"list"`
|
||||
}
|
||||
type HourStatText struct {
|
||||
Title string `json:"title"` //标题
|
||||
Desc string `json:"desc"` //描述
|
||||
Content string `json:"content"` //正文
|
||||
}
|
||||
|
||||
type AppHourDataStatInfoRes struct {
|
||||
Data []HourStatText `json:"data"`
|
||||
}
|
||||
|
||||
type DailyStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
AppId int32 `json:"appId"` // appId
|
||||
AppName string `json:"appName"` // app名称
|
||||
// 注册统计
|
||||
TotalNewCount int64 `json:"totalNewCount"` // 新增总数
|
||||
NewDirectCount int64 `json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount int64 `json:"newDeductionCount"` // 新增扣量
|
||||
NewNaturalCount int64 `json:"newNaturalCount"` // 自然新增
|
||||
NewWebCount int64 `json:"newWebCount"` // 官网注册
|
||||
NewDistrictCount int64 `json:"newDistrictCount"` // 渠道注册
|
||||
NewNormalCount int64 `json:"newNormalCount"` // 自来注册
|
||||
AndroidAddCount int64 `json:"androidAddCount"` // android新增
|
||||
IosAddCount int64 `json:"iosAddCount"` // ios新增
|
||||
// 轻量注册
|
||||
LightAddCount int64 `json:"lightAddCount"` // ##轻量注册
|
||||
LightGuestAddCount int64 `json:"lightGuestAddCount"` // 轻量游客
|
||||
LightFormalAddCount int64 `json:"lightFormalAddCount"` // 轻量注册
|
||||
LightDirectCount int64 `json:"lightDirectCount"` // 轻量直推注册
|
||||
LightFissionCount int64 `json:"lightFissionCount"` // 轻量裂变注册
|
||||
LightDeductionCount int64 `json:"lightDeductionCount"` // 轻量扣量注册
|
||||
LightNaturalCount int64 `json:"lightNaturalCount"` // 轻量自然注册
|
||||
LightWebCount int64 `json:"lightWebCount"` // 轻量官网注册
|
||||
LightDistrictCount int64 `json:"lightDistrictCount"` // 轻量渠道注册
|
||||
LightNormalCount int64 `json:"lightNormalCount"` // 轻量自来注册
|
||||
// H5注册
|
||||
H5FormalCount int64 `json:"h5FormalCount"` // H5正式注册
|
||||
H5AddCount int64 `json:"h5AddCount"` // H5新增
|
||||
H5PcAddCount int64 `json:"h5PcAddCount"` // H5Pc新增
|
||||
H5IosAddCount int64 `json:"h5IosAddCount"` // H5Ios新增
|
||||
H5AndroidAddCount int64 `json:"h5AndroidAddCount"` // H5Android新增
|
||||
// 访问统计
|
||||
TotalVisitCount int64 `json:"totalVisitCount"` // 日活
|
||||
DirectVisitCount int64 `json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `json:"fissionVisitCount"` // 裂变访问数
|
||||
DeductionVisitCount int64 `json:"deductionVisitCount"` // 扣量访问数
|
||||
NaturalVisitCount int64 `json:"naturalVisitCount"` // 自然访问数
|
||||
TodayDistrictVisitCount int64 `json:"todayDistrictVisitCount"` // 当日渠道访问量
|
||||
TodayWebVisitCount int64 `json:"todayWebVisitCount"` // 当日官网访问量
|
||||
TodayNormalVisitCount int64 `json:"todayNormalVisitCount"` // 当日自来访问量
|
||||
TodayIosVisitCount int64 `json:"todayIosVisitCount"` // 当日IOS访问量(日活)
|
||||
TodayAndroidVisitCount int64 `json:"todayAndroidVisitCount"` // 当日安卓访问量(日活)
|
||||
TodayH5VisitCount int64 `json:"todayH5VisitCount"` // 当日H5访问量(日活)
|
||||
TodayH5PcVisitCount int64 `json:"todayH5PcVisitCount"` // 当日H5Pc访问量(日活)
|
||||
TodayH5IosVisitCount int64 `json:"todayH5IosVisitCount"` // 当日H5Ios访问量(日活)
|
||||
TodayH5AndroidVisitCount int64 `json:"todayH5AndroidVisitCount"` // 当日H5Android访问量(日活)
|
||||
// 轻量访问
|
||||
LightVisitCount int64 `json:"lightVisitCount"` // 当日Light访问量
|
||||
LightDirectVisitCount int64 `json:"lightDirectVisitCount"` // 轻量直推访问
|
||||
LightFissionVisitCount int64 `json:"lightFissionVisitCount"` // 轻量裂变访问
|
||||
LightDeductionVisitCount int64 `json:"lightDeductionVisitCount"` // 轻量扣量访问
|
||||
LightNaturalVisitCount int64 `json:"lightNaturalVisitCount"` // 轻量自然访问
|
||||
LightWebVisitCount int64 `json:"lightWebVisitCount"` // 轻量官网访问
|
||||
LightDistrictVisitCount int64 `json:"lightDistrictVisitCount"` // 轻量渠道访问
|
||||
LightNormalVisitCount int64 `json:"lightNormalVisitCount"` // 轻量自来访问
|
||||
// 充值统计
|
||||
TotalAmount int64 `json:"totalAmount"` // 总充值
|
||||
DirectAmount int64 `json:"directAmount"` // 直推充值金额
|
||||
FissionAmount int64 `json:"fissionAmount"` // 裂变充值金额
|
||||
DeductionAmount int64 `json:"deductionAmount"` // 扣量充值金额
|
||||
NaturalAmount int64 `json:"naturalAmount"` // 自然充值
|
||||
TodayDistrictRecharge int64 `json:"todayDistrictRecharge"` // 当日渠道充值新增
|
||||
TodayWebRecharge int64 `json:"todayWebRecharge"` // 当日官网充值新增
|
||||
TodayNormalRecharge int64 `json:"todayNormalRecharge"` // 当日自来量充值新增
|
||||
TodayAndroidRecharge int64 `json:"todayAndroidRecharge"` // 当日android充值
|
||||
TodayIosRecharge int64 `json:"todayIosRecharge"` // 当日Ios充值
|
||||
TodayH5Recharge int64 `json:"todayH5Recharge"` // 当日H5充值
|
||||
TodayH5FormalRecharge int64 `json:"todayH5FormalRecharge"` // 当日H5Formal充值
|
||||
TodayH5PcRecharge int64 `json:"todayH5PcRecharge"` // 当日H5Pc充值
|
||||
TodayH5IosRecharge int64 `json:"todayH5IosRecharge"` // 当日H5Ios充值
|
||||
TodayH5AndroidRecharge int64 `json:"todayH5AndroidRecharge"` // 当日H5Android充值
|
||||
// 轻量充值次数
|
||||
LightRechargeCount int64 `json:"lightRechargeCount"` // 当日轻量充值次数
|
||||
LightDirectRechargeCount int64 `json:"lightDirectRechargeCount"` // 轻量直推充值次数
|
||||
LightFissionRechargeCount int64 `json:"lightFissionRechargeCount"` // 轻量裂变充值次数
|
||||
LightDeductionRechargeCount int64 `json:"lightDeductionRechargeCount"` // 轻量扣量充值次数
|
||||
LightNaturalRechargeCount int64 `json:"lightNaturalRechargeCount"` // 轻量自然充值次数
|
||||
LightWebRechargeCount int64 `json:"lightWebRechargeCount"` // 轻量官网充值次数
|
||||
LightDistrictRechargeCount int64 `json:"lightDistrictRechargeCount"` // 轻量渠道充值次数
|
||||
LightNormalRechargeCount int64 `json:"lightNormalRechargeCount"` // 轻量自来充值次数
|
||||
// 轻量充值钱数
|
||||
LightRechargeAmount int64 `json:"lightRechargeAmount"` // 当日轻量充值钱数
|
||||
LightDirectRechargeAmount int64 `json:"lightDirectRechargeAmount"` // 轻量直推充值钱数
|
||||
LightFissionRechargeAmount int64 `json:"lightFissionRechargeAmount"` // 轻量裂变充值钱数
|
||||
LightDeductionRechargeAmount int64 `json:"lightDeductionRechargeAmount"` // 轻量扣量充值钱数
|
||||
LightNaturalRechargeAmount int64 `json:"lightNaturalRechargeAmount"` // 轻量自然充值钱数
|
||||
LightWebRechargeAmount int64 `json:"lightWebRechargeAmount"` // 轻量官网充值钱数
|
||||
LightDistrictRechargeAmount int64 `json:"lightDistrictRechargeAmount"` // 轻量渠道充值钱数
|
||||
LightNormalRechargeAmount int64 `json:"lightNormalRechargeAmount"` // 轻量自来充值钱数
|
||||
// 其他充值
|
||||
ARPU int64 `json:"ARPU"` // 人均充值
|
||||
ARPPU int64 `json:"ARPPU"` // 付费用户人均充值
|
||||
VipPayByMoney int64 `json:"vipPayByMoney"` // 会员充值
|
||||
PayForAthor int64 `json:"payForAthor"` // 金币充值
|
||||
RepeatAmount int64 `json:"repeatAmount"` // 复冲金额
|
||||
RepeatVipMoney int64 `json:"repeatVipMoney"` // 复冲VIP
|
||||
GameRechageAmount int64 `json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `json:"gameWithdrawAmount"` // 游戏提现
|
||||
// 新用户和老用户充值
|
||||
OldRechargeAmount int64 `json:"oldRechargeAmount"` // 老用户充值金额
|
||||
OldVipRecharge int64 `json:"oldVipRecharge"` // 老用户VIP充值
|
||||
OldCoinRecharge int64 `json:"oldCoinRecharge"` // 老用户金币充值
|
||||
// 新增充值
|
||||
NewRechargeCount int64 `json:"newRechargeCount"` // 新增充值数
|
||||
NewRechargeAmount int64 `json:"newRechargeAmount"` // 新增充值金额
|
||||
NewVipRecharge int64 `json:"newVipRecharge"` // 新增VIP充值
|
||||
NewCoinRecharge int64 `json:"newCoinRecharge"` // 新增金币充值
|
||||
// 充值率
|
||||
NewRechargeRate float64 `json:"newRechargeRate"` // 新增充值率
|
||||
VisitRechargeRate float64 `json:"visitRechargeRate"` // 登陆充值率
|
||||
// 订单统计
|
||||
SuccessRechargeOrder int64 `json:"successRechargeOrder"` // 充值成功订单数
|
||||
TotalRechargeOrder int64 `json:"totalRechargeOrder"` // 拉起订单数
|
||||
RechargeSuccessRate string `json:"rechargeSuccessRate"` // 支付成功率
|
||||
// 留存率
|
||||
Day1RetainRate float64 `json:"day1RetainRate"` // 次日留存率
|
||||
Day3RetainRate float64 `json:"day3RetainRate"` // 3日留存率
|
||||
Day7RetainRate float64 `json:"day7RetainRate"` // 7日留存率
|
||||
// 落地页点击
|
||||
LandpageAndroidClick int64 `json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick int64 `json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick int64 `json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click int64 `json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
// 更新时间
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
type DailyStatInfoExport struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
TotalVisitCount int64 `json:"totalVisitCount"` // 总日活
|
||||
TotalNewCount int64 `json:"totalNewCount"` // 总新增
|
||||
TotalAmount int64 `json:"totalAmount"` // 总充值
|
||||
// 新增详细
|
||||
TotalNewCountAndroid int64 `json:"totalNewCountAndroid"` // android新增
|
||||
TotalNewCountIos int64 `json:"totalNewCountIos"` // ios新增
|
||||
TotalNewCountH5 int64 `json:"totalNewCountH5"` // H5新增
|
||||
TotalNewCountChannel int64 `json:"totalNewCountChannel"` // 渠道新增
|
||||
// 充值详细
|
||||
TotalAmountChannel int64 `json:"totalAmountAndroid"` // 渠道充值
|
||||
TotalAmountOldUser int64 `json:"totalAmountOldUser"` // 老用户充值
|
||||
TotalAmountNewUser int64 `json:"totalAmountNewUser"` // 新用户充值
|
||||
TotalRepeatAmount int64 `json:"totalRepeatAmount"` // 复冲金额
|
||||
TotalRepeatVipMoney int64 `json:"totalRepeatVipMoney"` // 复冲VIP
|
||||
// 订单统计
|
||||
TotalLunchOrder int64 `json:"totalLunchOrder"` // 拉起订单数
|
||||
TotalSuccessOrder int64 `json:"totalSuccessOrder"` // 成功订单数
|
||||
}
|
||||
|
||||
type ListDailyHourStatRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []*DailyHourStatInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ListLandPageStatRes struct {
|
||||
Total int64 `json:"total"`
|
||||
Summary DownloadStatInfo `json:"summary"`
|
||||
List []*DownloadStatInfo `json:"list"`
|
||||
}
|
||||
|
||||
type DailyHourStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间 按天对齐
|
||||
AppId int32 `json:"appId"` // appId
|
||||
SumHour int `json:"sumHour"` // 小时数
|
||||
AppName string `json:"appName"` // app名称
|
||||
// 注册
|
||||
NewTotalCount int64 `json:"newTotalCount"` // **新增总量
|
||||
NewDirectCount int64 `json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount int64 `json:"newDeductionCount"` // 新增扣量
|
||||
NewNaturalCount int64 `json:"newNaturalCount"` // 自然新增
|
||||
NewWebCount int64 `json:"newWebCount"` // **官网新增
|
||||
NewNormalCount int64 `json:"newNormalCount"` // **自来新增
|
||||
NewDistrictCount int64 `json:"newDistrictCount"` // **渠道新增
|
||||
NewAndroidCount int64 `json:"newAndroidCount"` // android新增
|
||||
NewIosCount int64 `json:"newIosCount"` // ios新增
|
||||
// 轻量注册
|
||||
NewLightCount int64 `json:"newLightCount"` // light新增
|
||||
NewLightGuestCount int64 `json:"newLightGuestCount"` // light新增安装
|
||||
NewLightFormalCount int64 `json:"newLightFormalCount"` // light新增注册
|
||||
NewLightDirectCount int64 `json:"newLightDirectCount"` // light新增直推
|
||||
NewLightFissionCount int64 `json:"newLightFissionCount"` // light新增裂变
|
||||
NewLightDeductionCount int64 `json:"newLightDeductionCount"` // light新增扣量
|
||||
NewLightNaturalCount int64 `json:"newLightNaturalCount"` // light自然新增
|
||||
NewLightWebCount int64 `json:"newLightWebCount"` // light官网新增
|
||||
NewLightNormalCount int64 `json:"newLightNormalCount"` // light自来新增
|
||||
NewLightDistrictCount int64 `json:"newLightDistrictCount"` // light渠道新增
|
||||
// H5注册
|
||||
NewH5Count int64 `json:"newH5Count"` // H5新增
|
||||
NewH5FormalCount int64 `json:"newH5FormalCount"` // H5注册新增
|
||||
NewH5PcCount int64 `json:"newH5PcCount"` // +H5PC新增
|
||||
NewH5IosCount int64 `json:"NewH5IosCount"` // +H5IOS新增
|
||||
NewH5AndroidCount int64 `json:"newH5AndroidCount"` // +H5Android新增
|
||||
// 访问
|
||||
TotalVisitCount int64 `json:"totalVisitCount"` // 访问总量
|
||||
DirectVisitCount int64 `json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `json:"fissionVisitCount"` // 裂变访问数
|
||||
NaturalVisitCount int64 `json:"naturalVisitCount"` // 自然访问数
|
||||
WebVisitCount int64 `json:"webVisitCount"` // 官网访问
|
||||
NormalVisitCount int64 `json:"normalVisitCount"` // 自来访问
|
||||
DistrictVisitCount int64 `json:"districtVisitCount"` // 渠道访问
|
||||
IosVisitCount int64 `json:"iosVisitCount"` // Ios访问量
|
||||
AndroidVisitCount int64 `json:"androidVisitCount"` // Android访问量
|
||||
LightVisitCount int64 `json:"lightVisitCount"` // light访问量
|
||||
LightVisitDirectCount int64 `json:"lightVisitDirectCount"` // light访问量直推
|
||||
LightVisitFissionCount int64 `json:"lightVisitFissionCount"` // light访问量裂变
|
||||
LightVisitDeductionCount int64 `json:"lightVisitDeductionCount"` // light访问量扣量
|
||||
LightVisitNaturalCount int64 `json:"lightVisitNaturalCount"` // light访问量自然
|
||||
LightVisitWebCount int64 `json:"lightVisitWebCount"` // light访问量官网
|
||||
LightVisitNormalCount int64 `json:"lightVisitNormalCount"` // light访问量自来
|
||||
LightVisitDistrictCount int64 `json:"lightVisitDistrictCount"` // light访问量渠道
|
||||
H5VisitCount int64 `json:"h5VisitCount"` // +H5访问量
|
||||
H5PcVisitCount int64 `json:"h5PcVisitCount"` // +H5Pc访问量
|
||||
H5IosVisitCount int64 `json:"h5IosVisitCount"` // +H5Ios访问量
|
||||
H5AndroidVisitCount int64 `json:"h5AndroidVisitCount"` // +H5Android访问量
|
||||
// 充值
|
||||
TotalAmount int64 `json:"totalAmount"` // 充值金额总量
|
||||
SuccessRechargeOrder int64 `json:"successRechargeOrder"` // 充值成功订单数
|
||||
DirectAmount int64 `json:"directAmount"` // 直推充值金额
|
||||
DirectAmountCount int64 `json:"directAmountCount"` // +直推充值订单数
|
||||
FissionAmount int64 `json:"fissionAmount"` // 裂变充值金额
|
||||
FissionAmountCount int64 `json:"fissionAmountCount"` // +裂变充值订单数
|
||||
NaturalAmount int64 `json:"naturalAmount"` // 自然充值
|
||||
NaturalAmountCount int64 `json:"naturalAmountCount"` // +自然充值订单数
|
||||
DeductionAmount int64 `json:"deductionAmount"` // 充值扣量
|
||||
DeductionAmountCount int64 `json:"deductionAmountCount"` // 充值扣量次数
|
||||
WebAmount int64 `json:"webAmount"` // 官网充值
|
||||
WebAmountCount int64 `json:"webAmountCount"` // 官网充值次数
|
||||
NormalAmount int64 `json:"normalAmount"` // 自来充值
|
||||
NormalAmountCount int64 `json:"normalAmountCount"` // 自来充值次数
|
||||
DistrictAmount int64 `json:"districtAmount"` // 渠道充值
|
||||
DistrictAmountCount int64 `json:"districtAmountCount"` // 渠道充值次数
|
||||
AndroidAmount int64 `json:"androidAmount"` // 安卓充值金额
|
||||
AndroidAmountCount int64 `json:"androidAmountCount"` // 安卓充值次数
|
||||
IosAmount int64 `json:"iosAmount"` // Ios充值金额
|
||||
IosAmountCount int64 `json:"iosAmountCount"` // Ios充值次数
|
||||
LightAmount int64 `json:"lightAmount"` // light充值金额
|
||||
LightAmountCount int64 `json:"lightAmountCount"` // light充值次数
|
||||
LightDirectAmount int64 `json:"lightDirectAmount"` // light充值金额直推
|
||||
LightDirectAmountCount int64 `json:"lightDirectAmountCount"` // light充值次数直推
|
||||
LightFissionAmount int64 `json:"lightFissionAmount"` // light充值金额裂变
|
||||
LightFissionAmountCount int64 `json:"lightFissionAmountCount"` // light充值次数裂变
|
||||
LightDeductionAmount int64 `json:"lightDeductionAmount"` // light充值金额扣量
|
||||
LightDeductionAmountCount int64 `json:"lightDeductionAmountCount"` // light充值次数扣量
|
||||
LightNaturalAmount int64 `json:"lightNaturalAmount"` // light充值金额自然
|
||||
LightNaturalAmountCount int64 `json:"lightNaturalAmountCount"` // light充值次数自然
|
||||
LightWebAmount int64 `json:"lightWebAmount"` // light充值金额官网
|
||||
LightWebAmountCount int64 `json:"lightWebAmountCount"` // light充值次数官网
|
||||
LightNormalAmount int64 `json:"lightNormalAmount"` // light充值金额自来
|
||||
LightNormalAmountCount int64 `json:"lightNormalAmountCount"` // light充值次数自来
|
||||
LightDistrictAmount int64 `json:"lightDistrictAmount"` // light充值金额渠道
|
||||
LightDistrictAmountCount int64 `json:"lightDistrictAmountCount"` // light充值次数渠道
|
||||
H5Amount int64 `json:"h5Amount"` // +H5充值金额
|
||||
H5AmountCount int64 `json:"h5AmountCount"` // +H5充值次数
|
||||
H5FormalAmount int64 `json:"h5FormalAmount"` // 当日H5Formal充值
|
||||
H5FormalAmountCount int64 `json:"h5FormalAmountCount"` // 当日H5Formal充值次数
|
||||
H5PcAmount int64 `json:"h5PcAmount"` // 当日H5Pc充值
|
||||
H5PcAmountCount int64 `json:"h5PcAmountCount"` // 当日H5Pc充值次数
|
||||
H5IosAmount int64 `json:"todayH5IosRecharge"` // 当日H5Ios充值
|
||||
H5IosAmountCount int64 `json:"h5IosAmountCount"` // 当日H5Ios充值次数
|
||||
H5AndroidAmount int64 `json:"h5AndroidAmount"` // 当日H5Android充值
|
||||
H5AndroidAmountCount int64 `json:"h5AndroidAmountCount"` // 当日H5Android充值次数
|
||||
|
||||
RepeatAmount int64 `json:"repeatAmount"` // 复冲金额
|
||||
RepeatAmountCount int64 `json:"repeatAmountCount"` // +复冲订单数
|
||||
VipPayByMoney int64 `json:"vipPayByMoney"` // 会员购买
|
||||
VipPayByAmount int64 `json:"vipPayByAmount"` // 金币购买
|
||||
VipRepeatAmount int64 `json:"vipRepeatAmount"` // VIP复冲金额
|
||||
TotalRechargeOrder int64 `json:"totalRechargeOrder"` // 拉起订单数
|
||||
RechargeSuccessRate string `json:"rechargeSuccessRate"` // 支付成功率
|
||||
GameRechageAmount int64 `json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `json:"gameWithdrawAmount"` // 游戏提现
|
||||
|
||||
// 新用户和老用户充值
|
||||
OldRechargeAmount int64 `json:"oldRechargeAmount"` // ¥老用户充值金额
|
||||
OldVipRecharge int64 `json:"oldVipRecharge"` // ¥老用户VIP充值
|
||||
OldCoinRecharge int64 `json:"oldCoinRecharge"` // ¥老用户金币充值
|
||||
// 新增充值
|
||||
NewRechargeCount int64 `json:"newRechargeCount"` // 新增充值数
|
||||
NewRechargeAmount int64 `json:"newRechargeAmount"` // 新增充值金额
|
||||
NewVipRecharge int64 `json:"newVipRecharge"` // ¥新增VIP充值
|
||||
NewCoinRecharge int64 `json:"newCoinRecharge"` // ¥新增金币充值
|
||||
|
||||
// 落地页点击
|
||||
LandpageAndroidClick int64 `json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick int64 `json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick int64 `json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click int64 `json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type ListDownloadSummaryRes struct {
|
||||
List []DownloadSummaryInfo `json:"list"`
|
||||
}
|
||||
|
||||
type DownloadSummaryInfo struct {
|
||||
AppId int `json:"appId" bson:"_id"`
|
||||
Total int `json:"total" bson:"total"`
|
||||
}
|
||||
|
||||
// 日常统计列表请求
|
||||
type ChannelStatExportReq struct {
|
||||
AppId *[]int32 `form:"appId" json:"appId"` // appId
|
||||
Channel *string `form:"channel" json:"channel"` // 渠道
|
||||
StartTime *time.Time `form:"startTime" json:"startTime"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime"` // 结束时间
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package proto
|
||||
|
||||
import "time"
|
||||
|
||||
// 请求曲线图数据
|
||||
type ListDistrictMinuteStatReq struct {
|
||||
SumDate *time.Time `form:"sumDate" json:"sumDate" binding:"required"` // 请求日的零点时间
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode"` // 请求的渠道码
|
||||
ChannelRemark *string `form:"channelRemark" json:"channelRemark"` // 渠道备注
|
||||
AppId *int32 `form:"appId" json:"appId"` // 应用id
|
||||
}
|
||||
|
||||
type ListDistrictMinuteStatRes struct {
|
||||
AppInfo AppInfoRes `json:"appInfo"` // app信息
|
||||
TodayGraphList []DistrictMinuteStatInfo `json:"todayGraphList"` // 今日曲线图数据
|
||||
YesterdayGraphList []DistrictMinuteStatInfo `json:"yesterdayGraphList"` // 昨日曲线图数据
|
||||
}
|
||||
|
||||
type DistrictMinuteStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间,当日零点时间
|
||||
NewCount int64 `json:"newCount"` // 新增数
|
||||
AndroidAddCount int64 `json:"androidAddCount"` // android新增
|
||||
IosAddCount int64 `json:"iosAddCount"` // ios新增
|
||||
FissionCount int64 `json:"fissionCount"` // 新增裂变
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/domainmod"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// 请求域名列表
|
||||
type ListDomainInfoReq struct {
|
||||
Name *string `json:"name"`
|
||||
AppId *int32 `json:"appId"`
|
||||
Enable *bool `json:"enable"`
|
||||
Category *domainmod.Category `json:"category" ` // 分类
|
||||
Status *domainmod.CheckStatus `json:"status"` // 状态
|
||||
Check *domainmod.CheckType `json:"check"` // 检测方式
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 响应域名列表
|
||||
type ListDomainInfoRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List domainmod.DomainList `json:"list"`
|
||||
}
|
||||
|
||||
// 添加域名
|
||||
type AddDomainInfoReq struct {
|
||||
domainmod.Domain
|
||||
}
|
||||
|
||||
// 修改域名
|
||||
type UpdateDomainInfoReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"`
|
||||
Update domainmod.DomainDoc `json:"update"`
|
||||
}
|
||||
|
||||
// 删除域名
|
||||
type DelDomainInfoReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"`
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type TgMsgType int32
|
||||
|
||||
const (
|
||||
TgMsgTypeNone TgMsgType = 0
|
||||
TgMsgTypeBackendRechargeMonitor TgMsgType = 1 // 后台充值监控
|
||||
)
|
||||
|
||||
type SendTgMessageReq struct {
|
||||
AppId int32 `json:"appId"`
|
||||
MsgType TgMsgType `json:"msgType"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type SendTgMessageRes struct {
|
||||
}
|
||||
|
||||
// InnerRechargeReq
|
||||
type InnerRechargeReq struct {
|
||||
InnerId int32 `json:"innerId"`
|
||||
Begin time.Time `json:"begin"`
|
||||
End time.Time `json:"end"`
|
||||
}
|
||||
|
||||
// InnerRechargeReq
|
||||
type InnerRechargeBotcmdReq struct {
|
||||
InnerId int32 `json:"innerId"`
|
||||
BeginTime time.Time `json:"beginTime"`
|
||||
EndTime time.Time `json:"endTime"`
|
||||
}
|
||||
|
||||
type InnerDailyMap struct {
|
||||
Id string `json:"id"`
|
||||
List []*InnerDailyRecharge `json:"list"`
|
||||
}
|
||||
type InnerDailyRecharge struct {
|
||||
AppId int32 `json:"appId"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
DateTime string `json:"dateTime"`
|
||||
SumDate time.Time `json:"sumDate"`
|
||||
DailyVistCount int64 `json:"dailyVistCount"`
|
||||
DailyRegister int64 `json:"dailyRegister"`
|
||||
DailyAppAmount int64 `json:"dailyAppAmount"`
|
||||
DailyGameAmount int64 `json:"dailyGameAmount"`
|
||||
RechargeOrder int64 `json:"rechargeOrder"`
|
||||
CellType int64 `json:"cellType"`
|
||||
IsOld bool `json:"isOld"`
|
||||
BeginRow int `json:"beginRow"`
|
||||
BeginCol int `json:"beginCol"`
|
||||
}
|
||||
|
||||
type InnerDailyRechargeList struct {
|
||||
List []*InnerDailyRecharge `json:"List"`
|
||||
}
|
||||
|
||||
type InnerDailyRechargeResp struct {
|
||||
Code int32 `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Tip string `json:"tip"`
|
||||
Data InnerDailyRechargeList `json:"data"`
|
||||
Time time.Time `json:"time"`
|
||||
}
|
||||
|
||||
/*
|
||||
type InnerRechargeXlsl struct {
|
||||
BeginRow int `json:"beginRow"`
|
||||
BeginCol int `json:"beginCol"`
|
||||
Recharge *InnerDailyRecharge `json:"recharge"`
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,71 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/landPageConfig"
|
||||
"time"
|
||||
)
|
||||
|
||||
// LandingPageConfig
|
||||
type LandingPageConfig struct {
|
||||
Title string `json:"title" bson:"title"` //主题
|
||||
Desc string `json:"desc" bson:"desc"` //描述
|
||||
Actor string `json:"actor" bson:"actor"` //演员
|
||||
Bango string `json:"bango" bson:"bango"` //番号,唯一
|
||||
AddedTime time.Time `json:"addedTime" bson:"addedTime"` //上架时间(审核通过时间)
|
||||
Picture string `json:"picture" bson:"picture"` //图片
|
||||
Media string `json:"media" bson:"media"` //视频
|
||||
Rank int64 `json:"rank" bson:"rank"` //排序
|
||||
}
|
||||
type LandingPageConfigList []*LandingPageConfig
|
||||
|
||||
// 响应落地页配置列表
|
||||
type LandPageConfigListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List landPageConfig.LandPageConfigList `json:"list"`
|
||||
}
|
||||
|
||||
// 新增落地页账号
|
||||
type AddLandPageConfigReq struct {
|
||||
AppId *int32 `json:"appId" binding:"required"` //appId
|
||||
LandPageType *int8 `json:"landPageType" binding:"required"` //类型,1PC端,2移动端
|
||||
Title *string `json:"title" binding:"required"` //主题
|
||||
Desc *string `json:"desc" bson:"desc"` //描述
|
||||
Actor *string `json:"actor" bson:"actor"` //演员
|
||||
Bango *string `json:"bango" bson:"bango"` //番号,唯一
|
||||
AddedTime *time.Time `json:"addedTime" bson:"addedTime"` //上架时间(审核通过时间)
|
||||
Picture *string `json:"picture" bson:"picture"` //图片
|
||||
Media *string `json:"media" bson:"media"` //视频
|
||||
Rank *int64 `json:"rank" bson:"rank"` //排序
|
||||
Status *bool `json:"status"` //状态
|
||||
}
|
||||
|
||||
// 更新落地页信息
|
||||
type UpdateLandPageConfigReq struct {
|
||||
ID int64 `json:"id" binding:"required"` //Id
|
||||
Title *string `json:"title" binding:"required"` //主题
|
||||
Desc *string `json:"desc" bson:"desc"` //描述
|
||||
Actor *string `json:"actor" bson:"actor"` //演员
|
||||
Bango *string `json:"bango" bson:"bango"` //番号,唯一
|
||||
AddedTime *time.Time `json:"addedTime" bson:"addedTime"` //上架时间(审核通过时间)
|
||||
Picture *string `json:"picture" bson:"picture"` //图片
|
||||
Media *string `json:"media" bson:"media"` //视频
|
||||
Rank *int64 `json:"rank" bson:"rank"` //排序
|
||||
Status *bool `json:"status"` //状态
|
||||
}
|
||||
|
||||
type DelLandPageConfigReq struct {
|
||||
ID int64 `form:"id" json:"id" binding:"required"` //Id
|
||||
}
|
||||
|
||||
type FindLandPageConfigReq struct {
|
||||
AppId *int32 `json:"appId"` //appId
|
||||
Type *int8 `json:"type"`
|
||||
Status *bool `json:"status"`
|
||||
common.Page
|
||||
}
|
||||
type GetLandPageConfigByTypeReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"` //appId
|
||||
Type int8 `json:"type"`
|
||||
common.Page
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package proto
|
||||
|
||||
import "stat/models/downloadstat"
|
||||
|
||||
type ConversionRate struct {
|
||||
VisitToDownloadRate float64 `json:"visitToDownloadRate"` // 浏览下载转化率
|
||||
VisitToInstallRate float64 `json:"visitToInstallRate"` // 浏览安装转化率
|
||||
DownloadToInstallRate float64 `json:"downloadToInstallRate"` // 下载安装转化率
|
||||
}
|
||||
|
||||
type DownloadStatInfo struct {
|
||||
downloadstat.Stat
|
||||
ConversionRate
|
||||
}
|
||||
|
||||
func (s *DownloadStatInfo) CalcConversionRate() {
|
||||
if s.VisitUnique != 0 {
|
||||
s.VisitToDownloadRate = float64(s.DownUnique*100) / float64(s.VisitUnique)
|
||||
s.VisitToInstallRate = float64(s.InstallUnique*100) / float64(s.VisitUnique)
|
||||
}
|
||||
if s.DownUnique != 0 {
|
||||
s.DownloadToInstallRate = float64(s.InstallUnique*100) / float64(s.DownUnique)
|
||||
}
|
||||
}
|
||||
|
||||
func StatSummation(base, value *DownloadStatInfo) {
|
||||
downloadstat.StatSummation(&base.Stat, &value.Stat)
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package proto
|
||||
|
||||
import "stat/common"
|
||||
|
||||
// LandingPageInfo 落地页管理
|
||||
type LandingPageInfo struct {
|
||||
ID int64 `form:"id" json:"id"` //Id
|
||||
AppId int32 `form:"appId" json:"appId"` //appId
|
||||
Url string `form:"url" json:"url"` //Url
|
||||
Status bool `form:"status" json:"status" binding:"required"` //状态 默认true
|
||||
ChannelCode string `form:"channelCode" json:"channelCode"` //渠道码
|
||||
Type int32 `form:"type" json:"type" binding:"required"` //类型 1:渠道 2:分享
|
||||
Remark string `form:"remark" json:"remark"` //备注
|
||||
}
|
||||
|
||||
// 响应落地页列表
|
||||
type LandingPageListRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []LandingPageInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 新增落地页账号
|
||||
type AddLandingPageReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` //appId
|
||||
Url *string `form:"url" json:"url" binding:"required"` //Url
|
||||
Status *bool `form:"status" json:"status" binding:"required"` //状态 默认true
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode"` //渠道码
|
||||
Remark *string `form:"remark" json:"remark"` //备注
|
||||
Type *int32 `form:"type" json:"type" binding:"required"` //类型 1:渠道 2:分享
|
||||
}
|
||||
|
||||
// 更新落地页信息
|
||||
type UpdateLandingPageReq struct {
|
||||
ID int64 `form:"id" json:"id" binding:"required"` //Id
|
||||
Status *bool `form:"status" json:"status" binding:"omitempty"` //状态 默认true
|
||||
Url *string `form:"url" json:"url" binding:"omitempty"` //Url
|
||||
ChannelCode *string `form:"channelCode" json:"channelCode"` //渠道码
|
||||
Remark *string `form:"remark" json:"remark" binding:"omitempty"` //备注
|
||||
Type *int32 `form:"type" json:"type" binding:"required"` //类型 1:渠道 2:分享
|
||||
}
|
||||
|
||||
type DelLandingPageReq struct {
|
||||
ID int64 `form:"id" json:"id" binding:"required"` //Id
|
||||
}
|
||||
|
||||
type FindLandingPageReq struct {
|
||||
AppId int32 `form:"appId" json:"appId" binding:"required"` //appId
|
||||
common.Page
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/models/landpageImg"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LandpagePictureSearch struct {
|
||||
Name *string `json:"name" bson:"name"` // 分类名称
|
||||
Status *bool `json:"status" bson:"status"` // 是否启用
|
||||
PageNum int64 `json:"pageNum"`
|
||||
PageSize int64 `json:"pageSize"`
|
||||
}
|
||||
|
||||
type LandpagePictureSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List landpageImg.LandpageImgList `json:"list"`
|
||||
}
|
||||
|
||||
type LandpagePictureUpdate struct {
|
||||
Name *string `bson:"name,omitempty" json:"name,omitempty"` // 名称
|
||||
PcAvatar *string `json:"pcAvatar" bson:"pcAvatar,omitempty"` // PC端图片
|
||||
MobileAvatar *string `json:"mobileAvatar" bson:"mobileAvatar,omitempty"` // 移动端图片
|
||||
PcBackgroud *string `json:"pcBackgroud" bson:"pcBackgroud,omitempty"` // PC端背景图
|
||||
MobileBackgroud *string `json:"mobileBackgroud" bson:"mobileBackgroud,omitempty"` // 移动端背景图
|
||||
Music *string `json:"music" bson:"music,omitempty"` // 音频文件
|
||||
Rank *int64 `json:"rank" bson:"rank,omitempty"` // 排序
|
||||
Status *bool `json:"status,omitempty" bson:"status,omitempty"` // 是否启用
|
||||
PcTitle *string `json:"pcTitle" bson:"pcTitle,omitempty"` // PC端标语
|
||||
MobileTiltle *string `json:"mobileTiltle" bson:"mobileTiltle,omitempty"` // 移动端标语
|
||||
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
|
||||
}
|
||||
|
||||
type LandpagePictureUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
Param *LandpagePictureUpdate `json:"param"` // 参数
|
||||
}
|
||||
type LandpagePictureAddReq struct {
|
||||
landpageImg.LandpageImg
|
||||
}
|
||||
type LandpagePictureDelReq struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/models/mediatag"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MediaTagSearch struct {
|
||||
Name *string `json:"name" bson:"name"` // 分类名称
|
||||
Status *bool `json:"status" bson:"status"` // 是否启用
|
||||
Type *mediatag.MediaTagType `json:"type" bson:"type"` // 类别
|
||||
PageNum int64 `json:"pageNum"`
|
||||
PageSize int64 `json:"pageSize"`
|
||||
}
|
||||
|
||||
type MediaTagSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List mediatag.MediaTagList `json:"list"`
|
||||
}
|
||||
|
||||
type MediaTagUpdate struct {
|
||||
Name *string `bson:"name,omitempty" json:"name,omitempty"` // 名称
|
||||
Rank *int64 `json:"rank" bson:"rank,omitempty"` // 排序
|
||||
Status *bool `json:"status,omitempty" bson:"status,omitempty"` // 是否启用
|
||||
Type *mediatag.MediaTagType `json:"type" bson:"type,omitempty"` // 类
|
||||
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
|
||||
}
|
||||
|
||||
type MediaTagUpdateReq struct {
|
||||
Id string `json:"id"`
|
||||
Param *MediaTagUpdate `json:"param"` // 参数
|
||||
}
|
||||
type MediaTagAddReq struct {
|
||||
mediatag.MediaTag
|
||||
}
|
||||
type MediaTagDelReq struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package proto
|
||||
|
||||
import "time"
|
||||
|
||||
// 请求曲线图数据
|
||||
type ListMinuteStatReq struct {
|
||||
SumDate *time.Time `form:"sumDate" json:"sumDate" binding:"required"` // 请求日的零点时间
|
||||
CompareTime *time.Time `form:"compareTime" json:"compareTime"` // 对比时间
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // 应用id
|
||||
}
|
||||
|
||||
type ListMinuteStatRes struct {
|
||||
AppInfo AppInfoRes `json:"appInfo"` // app信息
|
||||
TodayGraphList []MinuteStatInfo `json:"todayGraphList"` // 今日曲线图数据
|
||||
YesterdayGraphList []MinuteStatInfo `json:"yesterdayGraphList"` // 昨日曲线图数据
|
||||
}
|
||||
|
||||
type MinuteStatInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间,当日零点时间
|
||||
NewCount int64 `json:"newCount"` // 新增数
|
||||
AndroidAddCount int64 `json:"androidAddCount"` // android新增
|
||||
IosAddCount int64 `json:"iosAddCount"` // ios新增
|
||||
H5AddCount int64 `json:"h5AddCount"` // H5新增
|
||||
RechargetCount int64 `json:"rechageCount"` // 充值订单
|
||||
RechargetMoney int64 `json:"rechageMoney"` // 充值金额
|
||||
AccessCount int64 `json:"accessCount"` // 访问量
|
||||
AndroidAccessCount int64 `json:"androidAccessCount"` // android访问量
|
||||
IosAccessCount int64 `json:"iosAccessCount"` // ios访问量
|
||||
LandpageAndroidClick int64 `json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick int64 `json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick int64 `json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click int64 `json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
LightGuestAddCount int64 `json:"lightGuestAddCount"` // 轻量版新增
|
||||
}
|
||||
|
||||
type ListHourStatLineReq struct {
|
||||
SumDate *time.Time `form:"sumDate" json:"sumDate" binding:"required"` // 请求日的零点时间
|
||||
CompareTime *time.Time `form:"compareTime" json:"compareTime"` // 对比时间
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"required"` // 应用id
|
||||
}
|
||||
|
||||
type ListHourStatLineResp struct {
|
||||
AppInfo AppInfoRes `json:"appInfo"` // app信息
|
||||
TodayGraphList []ListHourStatLineInfo `json:"todayGraphList"` // 今日曲线图数据
|
||||
YesterdayGraphList []ListHourStatLineInfo `json:"yesterdayGraphList"` // 昨日曲线图数据
|
||||
}
|
||||
|
||||
type ListHourStatLineInfo struct {
|
||||
SumDate time.Time `json:"sumDate"` // 记录时间,当日零点时间
|
||||
HourNew int64 `json:"hourNew" bson:"hourNew"` // 新增
|
||||
HourNewDistrict int64 `json:"hourNewDistrict" bson:"hourNewDistrict"` // 渠道新增
|
||||
HourNewWeb int64 `json:"hourNewWeb" bson:"hourNewWeb"` // 官网新增
|
||||
HourNewNormal int64 `json:"hourNewNormal" bson:"hourNewNormal"` // 自来量新增
|
||||
HourAndroidNew int64 `json:"hourAndroidNew" bson:"hourAndroidNew"` // android新增
|
||||
HourIosNew int64 `json:"hourIosNew" bson:"hourIosNew"` // Ios新增
|
||||
HourH5New int64 `json:"hourH5New" bson:"hourH5New"` // H5新增
|
||||
HourH5PcNew int64 `json:"hourH5PcNew" bson:"hourH5PcNew"` // H5Pc新增
|
||||
HourH5IosNew int64 `json:"hourH5IosNew" bson:"hourH5IosNew"` // H5Ios新增
|
||||
HourH5AndroidNew int64 `json:"hourH5AndroidNew" bson:"hourH5AndroidNew"` // H5Android新增
|
||||
////////
|
||||
HourDistrictRecharge int64 `json:"hourDistrictRecharge" bson:"hourDistrictRecharge"` // 渠道充值
|
||||
HourWebRecharge int64 `json:"hourWebRecharge" bson:"hourWebRecharge"` // 官网充值
|
||||
HourNormalRecharge int64 `json:"hourNormalRecharge" bson:"hourNormalRecharge"` // 自来量充值
|
||||
HourVipRecharge int64 `json:"hourVipRecharge" bson:"hourVipRecharge"` // VIP充值
|
||||
HourDistrictVip int64 `json:"hourDistrictVip" bson:"hourDistrictVip"` // 渠道VIP充值
|
||||
HourWebVip int64 `json:"hourWebVip" bson:"hourWeVip"` // 官网VIP充值
|
||||
HourNormalVip int64 `json:"hourNormalVip" bson:"hourNormalVip"` // 自来量VIP充值
|
||||
HourAndroidRecharge int64 `json:"hourAndroidRecharge" bson:"hourAndroidRecharge"` // android充值
|
||||
HourIosRecharge int64 `json:"hourIosRecharge" bson:"hourIosRecharge"` // Ios充值
|
||||
HourH5Recharge int64 `json:"HourH5Recharge" bson:"HourH5Recharge"` // H5充值
|
||||
HourH5PcRecharge int64 `json:"hourH5PcRecharge" bson:"hourH5PcRecharge"` // H5Pc充值
|
||||
HourH5IosRecharge int64 `json:"hourH5IosRecharge" bson:"hourH5IosRecharge"` // H5Ios充值
|
||||
HourH5AndroidRecharge int64 `json:"hourH5AndroidRecharge" bson:"hourH5AndroidRecharge"` // H5Android充值
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common/statutils"
|
||||
"stat/models/monitormod"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MonitorSearch struct {
|
||||
Name *string `json:"name" bson:"name"` // 分类名称
|
||||
AppId *int32 `json:"appId" bson:"appId"` // appId
|
||||
Status *bool `json:"status" bson:"status"` // 是否启用
|
||||
Device *statutils.DeviceName `json:"device" bson:"device"` // 设备类型
|
||||
Category *monitormod.MonitorCategory `json:"category" bson:"category"` // 监控分类
|
||||
PageNum int64 `json:"pageNum"`
|
||||
PageSize int64 `json:"pageSize"`
|
||||
}
|
||||
|
||||
type MonitorSearchResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List monitormod.MonitorList `json:"list"`
|
||||
}
|
||||
|
||||
type MonitorUpdate struct {
|
||||
Name *string `json:"name" bson:"name,omitempty"` // 分类名称
|
||||
AppId *int32 `bson:"appId" json:"appId,omitempty"` // appId
|
||||
Status *bool `json:"status" bson:"status,omitempty"` // 是否启用
|
||||
Category *monitormod.MonitorCategory `bson:"category" json:"category"` // 分类
|
||||
Device *statutils.DeviceName `bson:"device" json:"device"` // 设备
|
||||
Duration *int64 `bson:"duration" json:"duration"` // 时间段,单位分钟
|
||||
Compare *monitormod.Compare `bson:"compare" json:"compare"` // 比较
|
||||
Threshold *int64 `bson:"threshold" json:"threshold"` // 阀值
|
||||
Comment *string `bson:"comment" json:"comment"` // 注释
|
||||
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
|
||||
}
|
||||
|
||||
type MonitorUpdateReq struct {
|
||||
Id string `json:"id" binding:"required"`
|
||||
Param *MonitorUpdate `json:"param" binding:"required"` // 参数
|
||||
}
|
||||
type MonitorAddReq struct {
|
||||
monitormod.Monitor
|
||||
}
|
||||
type MonitorDelReq struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ListOpLogReq struct {
|
||||
Operator *string `form:"operator" json:"operator" binding:"omitempty"` // 操作人员
|
||||
IsAdmin *bool `form:"isAdmin" json:"isAdmin" binding:"omitempty"` // 是否是管理员 true: 管理员 false: 代理商
|
||||
Router *string `form:"router" json:"router" binding:"omitempty"` // 路由
|
||||
common.Page
|
||||
}
|
||||
|
||||
type ListOpLogRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []OpLogInfo `json:"list"`
|
||||
}
|
||||
|
||||
type OpLogInfo struct {
|
||||
Operator string `json:"operator"` // 操作人员
|
||||
Router string `json:"router"` // 接口路由
|
||||
Data string `json:"data"` // 操作数据
|
||||
IsAdmin bool `json:"isAdmin"` // 是否是管理员
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package proto
|
||||
|
||||
import "time"
|
||||
|
||||
type ChannelAuthReq struct {
|
||||
SharePassword string `json:"sharePassword" form:"sharePassword" binding:"required"`
|
||||
AppId int32 `json:"appId" form:"appId" binding:"required"`
|
||||
ChannelId string `json:"channelId" form:"channelId" binding:"required"`
|
||||
}
|
||||
|
||||
type ChannelInfoReq struct {
|
||||
AppId int32 `json:"appId" form:"appId" binding:"required"`
|
||||
ChannelId string `json:"channelId" form:"channelId" binding:"required"`
|
||||
}
|
||||
|
||||
type ChannelInfoResp struct {
|
||||
Platform string `json:"platform" form:"platform"`
|
||||
AppIcon string `json:"appIcon" form:"appIcon"`
|
||||
AppName string `json:"appName" form:"appName"`
|
||||
ChannelCode string `json:"channelCode" form:"channelCode"`
|
||||
ChannelName string `json:"channelName" form:"channelName"`
|
||||
}
|
||||
|
||||
type OpenInstallReq struct {
|
||||
AppId int32 `json:"appId" form:"appId" binding:"required"`
|
||||
ChannelId string `json:"channelId" form:"channelId" binding:"required"`
|
||||
StartTime time.Time `json:"startTime" form:"startTime" time_format:"2006/01/02"`
|
||||
EndTime time.Time `json:"endTime" form:"endTime" time_format:"2006/01/02"`
|
||||
}
|
||||
|
||||
type GrowthData struct {
|
||||
// Day1 []int64 `json:"1日后留存数"`
|
||||
// Day7 []int64 `json:"7日后留存数"`
|
||||
// Day30 []int64 `json:"30日后留存数"`
|
||||
Installation []int64 `json:"安装量"`
|
||||
Exposure []int64 `json:"曝光量"`
|
||||
Register []int64 `json:"注册量"`
|
||||
Click []int64 `json:"点击量"`
|
||||
}
|
||||
|
||||
type GrowthResp struct {
|
||||
Time []time.Time `json:"time" form:"time"`
|
||||
Data GrowthData `json:"data" form:"data"`
|
||||
}
|
||||
|
||||
type TotalData struct {
|
||||
// Day1 int64 `json:"平均1日后留存率"`
|
||||
// Day7 int64 `json:"平均7日后留存率"`
|
||||
// Day30 int64 `json:"平均30日后留存率"`
|
||||
Installation int64 `json:"安装量"`
|
||||
Exposure int64 `json:"曝光量"`
|
||||
Click int64 `json:"点击量"`
|
||||
Register int64 `json:"注册量"`
|
||||
}
|
||||
|
||||
type TotalResp struct {
|
||||
Installation int64 `json:"安装量"`
|
||||
Exposure int64 `json:"曝光量"`
|
||||
Click int64 `json:"点击量"`
|
||||
Register int64 `json:"注册量"`
|
||||
Active int64 `json:"访问量"`
|
||||
Recharge int64 `json:"充值"`
|
||||
}
|
||||
|
||||
type ActiveData struct {
|
||||
Active []int64 `json:"活跃用户数"`
|
||||
}
|
||||
|
||||
type ActiveResp struct {
|
||||
Time []time.Time `json:"time" form:"time"`
|
||||
Data ActiveData `json:"data" form:"data"`
|
||||
}
|
||||
|
||||
type AllStatsData struct {
|
||||
Recharge []int64 `json:"充值金额"`
|
||||
// .........
|
||||
}
|
||||
|
||||
type AllStatsResp struct {
|
||||
Time []time.Time `json:"time" form:"time"`
|
||||
Data AllStatsData `json:"data" form:"data"`
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"stat/common"
|
||||
"stat/models/botdailyhourstat"
|
||||
"time"
|
||||
)
|
||||
|
||||
type BotDailyHourListReq struct {
|
||||
common.Page
|
||||
SumDateStart time.Time `json:"sumDateStart" binding:"required"`
|
||||
SumDateStop time.Time `json:"sumDateStop" binding:"required"`
|
||||
AppId *int32 `json:"appId"`
|
||||
}
|
||||
|
||||
type BotDailyHourListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List botdailyhourstat.BotHourStatList `json:"list"`
|
||||
}
|
||||
|
||||
type BotMonthStatReq struct {
|
||||
Month time.Time `json:"month" binding:"required"` // 只关注这个日期的年月
|
||||
AppId *int32 `json:"appId"` // 如果AppId为空,则计算所有APP
|
||||
}
|
||||
|
||||
type BotMonthStatResp struct {
|
||||
List botdailyhourstat.BotHourStatList `json:"list"`
|
||||
}
|
||||
|
||||
type BotDailyHourOneReq struct {
|
||||
Id primitive.ObjectID `json:"id" binding:"required"`
|
||||
SumDate time.Time `json:"sumDate"`
|
||||
AppId int32 `json:"appId"`
|
||||
}
|
||||
|
||||
type BotDailyHourOneResp struct {
|
||||
Stat *botdailyhourstat.BotHourStat `json:"stat"`
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/models/tfpackagemod"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type AddTFReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // appID
|
||||
DownloadUrl string `json:"downloadUrl" binding:"required"` // 下载链接
|
||||
DayMaxDownloadNum int64 `json:"dayMaxDownloadNum" binding:"required"` // 当天设置最大下载数量
|
||||
HourMaxDownloadNum int64 `json:"hourMaxDownloadNum" binding:"required"` // 每小时设置最大下载数量
|
||||
Status tfpackagemod.TFStatus `json:"status"` // 状态;0未使用,1下架,2上架
|
||||
}
|
||||
|
||||
type DelTFReq struct {
|
||||
Id primitive.ObjectID `json:"id"` //
|
||||
}
|
||||
|
||||
type UpdateTFReq struct {
|
||||
Id primitive.ObjectID `json:"id"` //
|
||||
AppId *int32 `json:"appId"` // appID
|
||||
DownloadUrl *string `json:"downloadUrl"` // 下载链接
|
||||
DayMaxDownloadNum *int64 `json:"dayMaxDownloadNum"` // 当天设置最大下载数量
|
||||
HourMaxDownloadNum *int64 `json:"hourMaxDownloadNum"` // 每小时设置最大下载数量
|
||||
Status *tfpackagemod.TFStatus `json:"status"` // 状态;0未使用,1下架,2上架
|
||||
}
|
||||
|
||||
type GetTFReq struct {
|
||||
AppId *int32 `json:"appId"` // appID
|
||||
Status *tfpackagemod.TFStatus `json:"status"`
|
||||
PageNum int64 `json:"pageNum"`
|
||||
PageSize int64 `json:"pageSize"`
|
||||
}
|
||||
|
||||
type GetTFResp struct {
|
||||
Total int64 `json:"total"`
|
||||
tfpackagemod.TfPackageList
|
||||
}
|
||||
|
||||
// 缓存
|
||||
type TfCacheInfo struct {
|
||||
Id primitive.ObjectID `json:"id"` //
|
||||
AppId int32 `json:"appId"` // appID
|
||||
DownloadUrl string `json:"downloadUrl"`
|
||||
DayMaxDownloadNum int64 `json:"dayMaxDownloadNum"` // 当天设置最大下载数量
|
||||
HourMaxDownloadNum int64 `json:"hourMaxDownloadNum"` // 每小时设置最大下载数量
|
||||
DayDownloadedNum int64 `bson:"dayDownloadedNum" json:"dayDownloadedNum"` // 当天已经下载数量
|
||||
HourDLNum int64 `bson:"hourDlNum" json:"hourDlNum"` // 每小时实际下载数量
|
||||
LastDownloadTime time.Time `json:"lastDownload"` // 上一次下载时间
|
||||
CountDownloadNum int64 `bson:"countDownloadNum" json:"countDownloadNum"` // 总已经下载数量
|
||||
Status tfpackagemod.TFStatus `json:"status"` // 状态;0未使用,1下架,2上架
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 全民代理查询
|
||||
type UserInviteUserListReq struct {
|
||||
PageNumber int64 `form:"pageNumber" json:"pageNumber" binding:"required,min=1"` // 当前页
|
||||
PageSize int64 `form:"pageSize" json:"pageSize" binding:"required,min=1,max=50"` // 每页条数
|
||||
UserId uint64 `form:"userId" json:"userId" binding:"required"` // 用户ID
|
||||
Appid int32 `form:"appId" json:"appId" binding:"required"` // APPID
|
||||
}
|
||||
|
||||
type UserInviteUserListRes struct {
|
||||
Total int64 `json:"total"`
|
||||
BindUser int64 `json:"bindUser"`
|
||||
List []UserInviteUserInfo `json:"list"`
|
||||
}
|
||||
|
||||
type UserInviteUserInfo struct {
|
||||
UserId uint64 `json:"userId"`
|
||||
Name string `json:"name"`
|
||||
BindPhone string `json:"bindPhone"` // true 绑定
|
||||
CreateAt time.Time `json:"createAt"` // 注册时间
|
||||
}
|
||||
|
||||
type UserInviteIncomeListReq struct {
|
||||
PageNumber int64 `form:"pageNumber" json:"pageNumber" binding:"required,min=1"` // 当前页
|
||||
PageSize int64 `form:"pageSize" json:"pageSize" binding:"required,min=1,max=50"` // 每页条数
|
||||
UserId uint64 `form:"userId" json:"userId" binding:"required"` // 用户ID
|
||||
Appid int32 `form:"appId" json:"appId" binding:"required"` // APPID
|
||||
}
|
||||
|
||||
type UserInviteIncomeListRes struct {
|
||||
TotalInvites int64 `json:"totalInvites"`
|
||||
TodayInvites int64 `json:"todayInvites"`
|
||||
// YesterdayInvites int64 `json:"yesterdayInvites"`
|
||||
// MouthInvites int64 `json:"mouthInvites"`
|
||||
TotalInviteAmount int64 `json:"totalInviteAmount"`
|
||||
TodayInviteAmount int64 `json:"todayInviteAmount"`
|
||||
Total int64 `json:"total"`
|
||||
List []UserInviteIncomeInfo `json:"list"`
|
||||
}
|
||||
|
||||
type UserInviteIncomeInfo struct {
|
||||
UserId uint64 `json:"userId"` // 充值用户
|
||||
UserName string `json:"userName"` // 用户名称
|
||||
IncomeAmount int64 `json:"incomeAmount"` // 收入金币
|
||||
IncomeRate float64 `json:"incomeRate"` // 分成比例
|
||||
RechargeAt time.Time `json:"rechargeAt"` // 充值时间
|
||||
}
|
||||
|
||||
type UserInviteInfoReq struct {
|
||||
PageNumber int64 `form:"pageNumber" json:"pageNumber" binding:"required,min=1"` // 当前页
|
||||
PageSize int64 `form:"pageSize" json:"pageSize" binding:"required,min=1,max=50"` // 每页条数
|
||||
UserId uint64 `form:"userId" json:"userId" binding:"required"` // 用户ID
|
||||
Appid int32 `form:"appId" json:"appId" binding:"required"` // APPID
|
||||
}
|
||||
|
||||
type UserDistrictReq struct {
|
||||
AppId int32 `form:"appId" json:"appId" binding:"required"` // APPID
|
||||
DistrictCode string `json:"dc"` // 剪切板信息 dc(渠道)
|
||||
PromSeqe string `json:"pc"` // 剪切板信息 pc(代理)
|
||||
IP string `json:"ip"` // IP信息
|
||||
SysType string `json:"sysType"` // 操作系统类型 安卓 IOS
|
||||
}
|
||||
|
||||
type UserDistrictCodeReq struct {
|
||||
AppId int32 `form:"appId" json:"appId" binding:"required"` // AppId
|
||||
UserIds []uint64 `form:"userIds" json:"userIds" binding:"required"` // 用户ID
|
||||
}
|
||||
type UserDistrictCodeInfo struct {
|
||||
UserId uint64 `form:"userId" json:"userId" binding:"required"` // 用户ID
|
||||
DistrictCode string `json:"districtCode" bson:"districtCode"` // 渠道码(兼容天宇老业务,查询本地(log_register)失败使用)
|
||||
RegisterTime time.Time `json:"registerTime,omitempty" bson:"registerTime"` // 注册时间
|
||||
}
|
||||
type UserDistrictCodeResp struct {
|
||||
UserList []UserDistrictCodeInfo `form:"userList" json:"userList" binding:"required"` // 用户列表
|
||||
}
|
||||
|
||||
type UserDistrictInfo struct {
|
||||
IsDirect bool `json:"isDirect"` // 是否是直推
|
||||
DistrictCode string `json:"districtCode"` // 渠道码
|
||||
ParentPromCode string `json:"parentPromCode"` // 全民代理 上级用户推广码
|
||||
ParentId uint64 `json:"parentId"` // 全名代理 上级用户
|
||||
ParentInviteCount int64 `json:"parentInviteCount"` // 全名代理 上级用户下级用户
|
||||
}
|
||||
|
||||
type ListUserInviteReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
UserId *uint64 `form:"userId" json:"userId" binding:"omitempty"` // 渠道
|
||||
UserName *string `form:"userName" json:"userName" binding:"omitempty"` // 用户名称
|
||||
Remark *string `form:"remark" json:"remark" binding:"omitempty"` // 备注
|
||||
common.Page
|
||||
}
|
||||
type ListUserInviteRes struct {
|
||||
Total int64 `json:"total"`
|
||||
TodayInviteUser int64 `json:"todayInviteUser"` // 今日新增人数
|
||||
YesterdayInviteUser int64 `json:"yesterdayInviteUser"` // 昨日新增人数
|
||||
TodayRechargeAmount int64 `json:"todayRechargeAmount"` // 今日充值金额
|
||||
YesterdayRechargeAmount int64 `json:"yesterdayRechargeAmount"` // 昨日充值金额
|
||||
List []ListUserInviteInfo `json:"list"`
|
||||
}
|
||||
|
||||
type ListUserInviteInfo struct {
|
||||
UserId uint64 `json:"userId" bson:"userId"` // 用户ID
|
||||
AppId int32 `json:"appId" bson:"appId"` // appID
|
||||
AppName string `json:"appName"` // app名称
|
||||
UserName string `json:"userName"` // 用户名称
|
||||
PromCode string `json:"promCode" bson:"promCode"` // 用户推广序列
|
||||
BalanceCent int64 `json:"balance"` // 累计充值单位:分
|
||||
BalanceIncome int64 `json:"balanceIncome"` // 累计收益:分
|
||||
DeductionBalanceCent int64 `json:"deductionBalanceCent"` // 累计扣量单位:分
|
||||
InviteUser int64 `json:"inviteUser"` // 推广总人数
|
||||
TodayInviteUser int64 `json:"todayInviteUser"` // 今日推广人数 (定时器每天0)
|
||||
DeductionRatio float64 `json:"deductionRatio"` // 扣量比例 0.0-1.00 默认:0.2
|
||||
DeductionLowerOutset int64 `json:"deductionLowerOutset" ` // 扣量起点 默认:2000元开始扣
|
||||
CreatedAt time.Time `json:"createdAt"` // 创建时间
|
||||
}
|
||||
|
||||
type UpdateUserInviteInfo struct {
|
||||
UserId uint64 `json:"userId" bson:"userId" binding:"required"` // 用户ID
|
||||
AppId int32 `json:"appId" bson:"appId" binding:"required"` // appID
|
||||
DeductionRatio float64 `json:"deductionRatio" binding:"required"` // 扣量比例 0.0-1.00 默认:0.2
|
||||
DeductionLowerOutset int64 `json:"deductionLowerOutset" binding:"required"` // 扣量起点 默认:2000元开始扣
|
||||
Remark string `json:"remark"` // 备注
|
||||
}
|
||||
|
||||
type ListUserInviteOrderReq struct {
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // appId
|
||||
UserId *uint64 `form:"userId" json:"userId" binding:"omitempty"` // 渠道
|
||||
IsDeduction *bool `json:"isDeduction" bson:"isDeduction" binding:"omitempty"` // 是否是扣量订单
|
||||
OrderId *string `json:"orderId" bson:"orderId" binding:"omitempty"` // 流水id
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 结束时间
|
||||
common.Page
|
||||
}
|
||||
type ListUserInviteOrderRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ListUserInviteOrder `json:"list"`
|
||||
}
|
||||
|
||||
type ListUserInviteOrder struct {
|
||||
UserId uint64 `json:"userId" bson:"userId"` // 用户ID
|
||||
UserName string `json:"userName" bson:"userName"` // 用户名称
|
||||
AppId int32 `json:"appId" bson:"appId"` // appID
|
||||
AppName string `json:"appName"` // app名称
|
||||
InvitedUserId uint64 `json:"invitedUserId" bson:"invitedUserId"` // 充值用户
|
||||
PromCode string `json:"promCode" bson:"promCode"` // 用户推广序列
|
||||
IsDeduction bool `json:"isDeduction" bson:"isDeduction"` // 是否是扣量订单
|
||||
OrderId string `json:"orderId" bson:"orderId"` // 流水id
|
||||
Money int64 `json:"money" bson:"money"` // 充值金额 订单金额
|
||||
PayMoney int64 `json:"payMoney" bson:"payMoney"` // 实际到账金额 用户实际支付金额
|
||||
IncomeAmount int64 `json:"incomeAmount" bson:"incomeAmount"` // 收入金币
|
||||
IncomeRate float64 `json:"incomeRate" bson:"incomeRate"` // 分成比例
|
||||
CallBack int `json:"callBack" bson:"callBack"` // 回调成功
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"stat/models/versionMod"
|
||||
)
|
||||
|
||||
// VersionInfo 版本信息
|
||||
type VersionInfo struct {
|
||||
Id int64 `from:"_id" json:"id"` // ID
|
||||
AppId int32 `from:"appId" json:"appId"` //APPID
|
||||
AppName string `from:"appname" json:"appname"` //APP名称
|
||||
VersionNum string `from:"versionNum" json:"versionNum"` //版本号
|
||||
Terminal string `from:"terminal" json:"terminal"` //终端ios android
|
||||
Link []string `from:"link" json:"link"` //下载链接
|
||||
Info string `from:"info" json:"info"` //版本描述
|
||||
PackageType versionMod.PkgType `from:"packageType" json:"packageType"` //包类型:1-企业包、2-商店包、3-tf、4-超级签
|
||||
IsForceUpdate bool `from:"isForceUpdate" json:"isForceUpdate"` //是否强更
|
||||
MinVersion string `from:"minVersion" json:"minVersion"` //最小版本
|
||||
Status bool `from:"status" json:"status"` //是否启用
|
||||
Size string `from:"size" json:"size"` //更新版本大小M
|
||||
BackLink string `from:"backLink" json:"backLink"` //企业签(备用连接)
|
||||
Md5 string `from:"md5" json:"md5"` //MD5验证
|
||||
}
|
||||
|
||||
type VersionListReq struct {
|
||||
AppId *int32 `from:"appId" json:"appId"` //APPID
|
||||
common.Page
|
||||
}
|
||||
|
||||
type VersionListResp struct {
|
||||
Count int64 `json:"count" ` //总条数
|
||||
Data []*VersionInfo `json:"data" ` //数据
|
||||
}
|
||||
|
||||
type VersionDelReq struct {
|
||||
Id int64 `from:"id" json:"id" binding:"required"` //版本ID
|
||||
}
|
||||
|
||||
type VersionAddReq struct {
|
||||
AppId int32 `from:"appId" json:"appId" binding:"required"` //APPID
|
||||
VersionNum string `from:"versionNum" json:"versionNum" binding:"required"` //版本号
|
||||
Terminal string `from:"terminal" json:"terminal" binding:"required" ` //终端 ios android(安卓,苹果下拉框选择)
|
||||
Link []string `from:"link" json:"link" binding:"required"` //下载链接
|
||||
Info string `from:"info" json:"info" binding:"omitempty"` //版本描述
|
||||
PackageType versionMod.PkgType `from:"packageType" json:"packageType" binding:"required"` //包类型:1-企业包、2-商店包、3-tf包(下拉框)
|
||||
IsForceUpdate bool `from:"isForceUpdate" json:"isForceUpdate" binding:"omitempty"` //是否强更
|
||||
MinVersion string `from:"minVersion" json:"minVersion" binding:"omitempty"` //最小版本
|
||||
Status bool `from:"status" json:"status"` //是否启用
|
||||
Size string `from:"size" json:"size" binding:"omitempty" ` //更新版本大小M
|
||||
BackLink string `from:"backLink" json:"backLink" binding:"omitempty"` //企业签
|
||||
Md5 string `from:"md5" json:"md5" binding:"omitempty"` //MD5验证
|
||||
}
|
||||
|
||||
type VersionUpdateReq struct {
|
||||
Id int64 `from:"_id" json:"id" binding:"required"` // ID
|
||||
AppId *int32 `from:"appId" json:"appId" binding:"omitempty"` //APPID
|
||||
VersionNum *string `from:"versionNum" json:"versionNum" binding:"omitempty"` //版本号
|
||||
Terminal *string `from:"terminal" json:"terminal" binding:"omitempty"` //终端ios android
|
||||
Link *[]string `from:"link" json:"link" binding:"omitempty"` //下载链接
|
||||
Info *string `from:"info" json:"info" binding:"omitempty"` //版本描述
|
||||
PackageType *versionMod.PkgType `from:"packageType" json:"packageType" binding:"omitempty"` //包类型:1-企业包、2-商店包、3-tf
|
||||
IsForceUpdate *bool `from:"isForceUpdate" json:"isForceUpdate" binding:"omitempty"` //是否强更
|
||||
MinVersion *string `from:"minVersion" json:"minVersion" binding:"omitempty"` //最小版本
|
||||
Status *bool `from:"status" json:"status" binding:"omitempty"` //是否启用
|
||||
BackLink *string `from:"backLink" json:"backLink" binding:"omitempty"` //企业签
|
||||
Size *string `from:"size" json:"size" binding:"omitempty"` //更新版本大小M
|
||||
Md5 *string `from:"md5" json:"md5" binding:"omitempty"` //MD5验证
|
||||
}
|
||||
|
||||
// 点击按钮(上报客户端IP信息和渠道信息)
|
||||
type PageButtonClickReq struct {
|
||||
AppId int32 `json:"appId"` //AppID
|
||||
Ip string `from:"ip" json:"ip"` //ip
|
||||
Channel string `from:"channel" json:"channel"` //渠道(json字符串)
|
||||
Domain string `from:"domain" json:"domain"` //落地页域名
|
||||
PackageType versionMod.PkgType `from:"packageType" json:"packageType"` //包类型 1:企业包 2:商店包 3:TF包 4:超级签 5:轻量版
|
||||
Terminal string `from:"terminal" json:"terminal" binding:"required"` //终端ios android
|
||||
}
|
||||
|
||||
type TfInfo struct {
|
||||
AppName string `bson:"appName" json:"appName"` //应用名称
|
||||
AppIcon string `bson:"appIcon" json:"appIcon"` //应用图标
|
||||
URL string `bson:"url" json:"url"` //URL
|
||||
BackUrl string `bson:"backUrl" json:"BackUrl"` //企业签URL
|
||||
}
|
||||
|
||||
// 返回下载链接
|
||||
type PageButtonClickResp struct {
|
||||
VersionNum string `from:"versionNum" json:"versionNum"` //版本号
|
||||
Terminal string `from:"terminal" json:"terminal"` //终端ios android light
|
||||
Link []string `from:"link" json:"link"` //下载链接
|
||||
Tf []TfInfo `from:"tf" json:"tf"` //TFinfo
|
||||
BackUrl string `bson:"backUrl" json:"BackUrl"` //企业签URL (不用)
|
||||
PackageType versionMod.PkgType `from:"packageType" json:"packageType" binding:"required"` //包类型 1:企业包 2:商店包 3:TF包
|
||||
Status bool `from:"status" json:"status"` //是否启用
|
||||
LightData []byte `from:"lightData" json:"lightData"` //如果是轻量版,返回数据
|
||||
}
|
||||
|
||||
// 落地页获取显示的按钮信息(appid标示具体应用)
|
||||
type PageButtonListReq struct {
|
||||
AppId int32 `from:"appId" json:"appId"` //AppID
|
||||
Ip string `from:"ip" json:"ip"` //ip
|
||||
Domain string `from:"domain" json:"domain"` //落地页域名
|
||||
Channel string `from:"channel" json:"channel"` //渠道(json字符串)
|
||||
}
|
||||
|
||||
// 落地页获取显示的按钮信息
|
||||
type PageButtonListResp struct {
|
||||
IosDown bool `json:"iosDown"` // 显示完整版,是企业包
|
||||
IosStore bool `json:"iosStore"` // 显示商店包
|
||||
IosTF bool `json:"iosTF"` // TF包
|
||||
IosH5 bool `json:"iosH5"` // H5跳转链接
|
||||
IosLink string `json:"iosLink"` // 商店包下载链接
|
||||
AndroidButton int `json:"androidButton"` // android下载按钮
|
||||
HasChannelApk bool `json:"hasChannelApk"` // 有安卓渠道包
|
||||
PictureList []PageButtonPicture `json:"pictureList"` // 资源数据
|
||||
Contact ContactInfo `json:"contact"` // 联系方式
|
||||
}
|
||||
|
||||
type PageButtonPicture struct {
|
||||
PcAvatar string `json:"pcAvatar" bson:"pcAvatar"` // PC端图片
|
||||
MobileAvatar string `json:"mobileAvatar" bson:"mobileAvatar"` // 移动端图片
|
||||
PcBackgroud string `json:"pcBackgroud" bson:"pcBackgroud"` // PC端背景图
|
||||
MobileBackgroud string `json:"mobileBackgroud" bson:"mobileBackgroud"` // 移动端背景图
|
||||
Music string `json:"music" bson:"music"` // 音频文件
|
||||
PcTitle string `json:"pcTitle" bson:"pcTitle"` // PC端标语
|
||||
MobileTiltle string `json:"mobileTiltle" bson:"mobileTiltle"` // 移动端标语
|
||||
}
|
||||
type ContactInfo struct {
|
||||
Telegram string `json:"telegram" bson:"telegram"` // PC端图片
|
||||
Paoto string `json:"paoto" bson:"paoto"` // 土豆
|
||||
Madou string `json:"madou" bson:"madou"` // 官网
|
||||
}
|
||||
|
||||
type PacketType int32
|
||||
|
||||
const (
|
||||
PacketTypeEnterprise PacketType = 1 // 企业签
|
||||
PacketTypeShop PacketType = 2 // 商店包
|
||||
PacketTypeTestFlight PacketType = 3 // TF包
|
||||
)
|
||||
|
||||
type AppVersionReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"` // AppID
|
||||
SysType string `json:"sysType,omitempty"` // 终端类型
|
||||
PktType PacketType `json:"pktType,omitempty"` // 包类型
|
||||
CurVersion string `json:"curVersion,omitempty"` // 当前版本
|
||||
CurPackageName string `json:"curPackageName,omitempty"` // 包名
|
||||
}
|
||||
|
||||
type AppVersionResp struct {
|
||||
HasNewVersion bool `json:"hasNewVersion,omitempty"` // 是否存在新版本
|
||||
ServerVersion string `json:"serverVersion,omitempty"` // 服务器新版本
|
||||
DownloadLink []string `json:"downloadLink,omitempty"` // 下载地址
|
||||
Description string `json:"description,omitempty"` // 描述
|
||||
IsForceUpdate bool `json:"isForceUpdate,omitempty"` // 是否强制升级
|
||||
}
|
||||
|
||||
type ShareUrlReq struct {
|
||||
AppId int32 `from:"appid" json:"appid"` // AppID
|
||||
}
|
||||
|
||||
// 落地页获取显示的按钮信息
|
||||
type ShareUrlResp struct {
|
||||
Url []string `form:"url" json:"url"` // 分享地址
|
||||
}
|
||||
|
||||
type ChannelDownLoadLinkReq struct {
|
||||
AppId int32 `form:"appId" json:"appId"` // AppID
|
||||
Channel string `form:"channel" json:"channel"` // 商区渠道号
|
||||
}
|
||||
|
||||
type ChannelDownLoadLinkResp struct {
|
||||
DownLoadLink string `json:"downLoadLink"` // 下载链接
|
||||
CmdInfo string `json:"cmdInfo"` // 下载链接
|
||||
}
|
||||
|
||||
type H5ConfigReq struct {
|
||||
AppId int32 `form:"appId" json:"appId"` // AppID
|
||||
DC string `form:"dc" json:"dc"` // 商区渠道号
|
||||
PC string `form:"pc" json:"pc"` // 用户渠道号,即用户邀请码
|
||||
Domain string `from:"domain" json:"domain"` // 落地页域名
|
||||
}
|
||||
|
||||
type H5ConfigV2Resp struct {
|
||||
URL string `form:"url" json:"url"` // 描述文件链接
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 请求转账订单
|
||||
type ListWithdrawOrderReq struct {
|
||||
Channel *string `form:"channel" json:"channel" binding:"omitempty"` // 筛选条件 过滤条件-渠道
|
||||
Status *int `form:"status" json:"status" binding:"omitempty"` // 筛选条件 1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
Act *string `form:"act" json:"act" binding:"omitempty"` // 筛选条件 交易账户
|
||||
AppId *int32 `form:"appId" json:"appId" binding:"omitempty"` // 筛选条件 APP
|
||||
OID *string `form:"oid" json:"oid" binding:"omitempty"` // 筛选条件 第三方支付平台id
|
||||
PayType *string `form:"payType" json:"payType" binding:"omitempty"` // 筛选条件 提现方式,alipay,bankcard,usdt
|
||||
TimeFilter *int64 `form:"timeFilter" json:"timeFilter" binding:"omitempty"` // 时间过滤类型 1:提现申请时间 2:第三方支付时间 3:第三方回调成功时间
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 筛选条件 过滤条件-开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 筛选条件 过滤条件-结束时间
|
||||
DistrictRemark *string `form:"districtRemark" json:"districtRemark" binding:"omitempty"` // 备注过滤
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 转账订单结果
|
||||
type ListWithdrawOrderRes struct {
|
||||
Total int64 `json:"total"`
|
||||
List []WithdrawOrderInfo `json:"list"`
|
||||
}
|
||||
|
||||
// 提现订单信息
|
||||
type WithdrawOrderInfo struct {
|
||||
ID string `json:"id"` //流水id
|
||||
Channel string `json:"channel" ` //渠道
|
||||
AppId int32 `json:"appId"` //应用名称
|
||||
AppName string `json:"appName"` //应用名称
|
||||
OID string `json:"oid" ` //第三方支付平台id
|
||||
Money int64 `json:"money"` //提现金额
|
||||
PayMoney int64 `json:"payMoney" ` //实际到账
|
||||
PayType string `json:"payType"` //提现方式,alipay,bankcard
|
||||
ActName string `json:"actName" ` //交易账户持有人
|
||||
Act string `json:"act" ` //交易账户
|
||||
Status int `json:"status" ` //1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
StatusDesc string `json:"statusDesc" ` //状态说明
|
||||
CheckedAt time.Time `json:"checkedAt" ` //审核时间
|
||||
ProgressAt time.Time `json:"progressAt" ` //第三方下单成功时间
|
||||
FailureAt *time.Time `json:"failureAt,omitempty" ` //回调失败时间
|
||||
SuccessAt *time.Time `json:"successAt,omitempty" ` //回调成功时间
|
||||
UpdatedAt time.Time `json:"updatedAt" ` //刷新时间
|
||||
CreatedAt time.Time `json:"createdAt" ` //提现申请时间
|
||||
ReceivedAt time.Time `json:"receivedAt" ` //到账时间
|
||||
Operator string `json:"operator"` //操作人员
|
||||
DistrictRemark string `json:"districtRemark" ` //备注
|
||||
}
|
||||
|
||||
// 代理商请求转账订单
|
||||
type ListWithdrawOrderAgentReq struct {
|
||||
Status *int `form:"status" json:"status" binding:"omitempty"` // 筛选条件 1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
Act *string `form:"act" json:"act" binding:"omitempty"` // 筛选条件 交易账户
|
||||
OID *string `form:"oid" json:"oid" binding:"omitempty"` // 筛选条件 第三方支付平台id
|
||||
PayType *string `form:"payType" json:"payType" binding:"omitempty"` // 筛选条件 提现方式,alipay,bankcard
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 筛选条件 过滤条件-开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 筛选条件 过滤条件-结束时间
|
||||
common.Page
|
||||
}
|
||||
|
||||
// 导出提现订单请求
|
||||
type ExportWithdrawOrderReq struct {
|
||||
Channel *string `form:"channel" json:"channel" binding:"omitempty"` // 筛选条件 过滤条件-渠道
|
||||
Status *int `form:"status" json:"status" binding:"omitempty"` // 筛选条件 1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
Act *string `form:"act" json:"act" binding:"omitempty"` // 筛选条件 交易账户
|
||||
OID *string `form:"oid" json:"oid" binding:"omitempty"` // 筛选条件 第三方支付平台id
|
||||
PayType *string `form:"payType" json:"payType" binding:"omitempty"` // 筛选条件 提现方式,alipay,bankcard
|
||||
TimeFilter *int64 `form:"timeFilter" json:"timeFilter" binding:"omitempty"` // 时间过滤类型 1:提现申请时间 2:第三方支付时间 3:第三方回调成功时间
|
||||
StartTime *time.Time `form:"startTime" json:"startTime" binding:"omitempty"` // 筛选条件 过滤条件-开始时间
|
||||
EndTime *time.Time `form:"endTime" json:"endTime" binding:"omitempty"` // 筛选条件 过滤条件-结束时间
|
||||
}
|
||||
|
||||
// 提现订单信息
|
||||
type WithdrawOrderExportInfo struct {
|
||||
ID string `json:"id"` //流水id
|
||||
Channel string `json:"channel" ` //渠道
|
||||
AppName string `json:"appName"` //应用列表
|
||||
OID string `json:"oid" ` //第三方支付平台id
|
||||
Money int64 `json:"money"` //提现金额
|
||||
PayMoney int64 `json:"payMoney" ` //实际到账
|
||||
PayType string `json:"payType"` //提现方式,alipay,bankcard
|
||||
ActName string `json:"actName" ` //交易账户持有人
|
||||
Act string `json:"act" ` //交易账户
|
||||
Status string `json:"status" ` //1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
|
||||
StatusDesc string `json:"statusDesc" ` //状态说明
|
||||
CheckedAt time.Time `json:"checkedAt" ` //审核时间
|
||||
ProgressAt time.Time `json:"progressAt" ` //第三方下单成功时间
|
||||
FailureAt *time.Time `json:"failureAt,omitempty" ` //回调失败时间
|
||||
SuccessAt *time.Time `json:"successAt,omitempty" ` //回调成功时间
|
||||
UpdatedAt time.Time `json:"updatedAt" ` //刷新时间
|
||||
CreatedAt time.Time `json:"createdAt" ` //提现申请时间
|
||||
ReceivedAt time.Time `json:"receivedAt" ` //到账时间
|
||||
DistrictRemark string `json:"districtRemark" ` //备注
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package statApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/statSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 游戏统计
|
||||
// @Summary 提现列表
|
||||
// @Description 提现列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocWithdrawDetailsReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocWithdrawDetailsRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/game/withdraw/list [POST]
|
||||
func GameWithdrawDetails(ctx *gin.Context) {
|
||||
param := proto.ListBlocWithdrawDetailsReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.GameWithdrawList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary日常统计充值详情(集团)
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocRechargeDetailsReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocRechargeDetailsRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/game/recharge/list [POST]
|
||||
func GameRechargerDetails(ctx *gin.Context) {
|
||||
param := proto.ListBlocRechargeDetailsReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.GameRechargeList(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
package statApi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/botser"
|
||||
"stat/service/innerserverser"
|
||||
"stat/service/landpageSer"
|
||||
"stat/service/statSer"
|
||||
"stat/statg"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 渠道码统计
|
||||
// @Summary 渠道码统计(集团)
|
||||
// @Description 渠道码统计(集团)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.BlocListChannelCodeStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.BlocListChannelCodeStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocChannelCodeStat/list [POST]
|
||||
func ListBlocChannelCodeStat(ctx *gin.Context) {
|
||||
param := &proto.BlocListChannelCodeStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListBlocChannelCodeStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 渠道码统计
|
||||
// @Summary 渠道码统计(集团)
|
||||
// @Description 渠道码统计(集团)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.BlocListChannelCodeStatReq{} true "参数列表"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocChannelCodeStat/export [GET]
|
||||
func ExportBlocChannelCodeStat(ctx *gin.Context) {
|
||||
param := &proto.BlocListChannelCodeStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
fPath, err := statSer.ListBlocChannelExport(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计列表
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDailyStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/dailyStat/list [POST]
|
||||
func ListDailyStat(ctx *gin.Context) {
|
||||
param := proto.ListDailyStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListDailyStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计列表导出
|
||||
// @Description 日常统计列表导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDailyStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/dailyStat/export [POST]
|
||||
func ListDailyStatExport(ctx *gin.Context) {
|
||||
param := proto.ListDailyStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
fPath, serr := statSer.ListDailyStatExport(ctx, param)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filepath.Base(fPath)))
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.File(fPath)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计列表
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyHourStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDailyHourStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/dailyhour/list [POST]
|
||||
func ListDailyHourStat(ctx *gin.Context) {
|
||||
param := &proto.ListDailyHourStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListDailyHourStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计导出
|
||||
// @Description 日常统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyHourStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDailyHourStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/dailyhour/export [POST]
|
||||
func ListDailyHourStatExport(ctx *gin.Context) {
|
||||
param := &proto.ListDailyHourStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
buf, err := statSer.ListDailyHourStatExport(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.DownloadFileError, err.Error())
|
||||
return
|
||||
}
|
||||
header := map[string]string{
|
||||
"Content-Disposition": fmt.Sprintf("attachment; filename=export.xlsx"),
|
||||
}
|
||||
ctx.DataFromReader(http.StatusOK, int64(buf.Len()), "application/octet-stream", buf, header)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计列表(集团)
|
||||
// @Description 日常统计列表(集团)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocDailyStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocDailyStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocDailyStat/list [POST]
|
||||
func ListBlocDailyStat(ctx *gin.Context) {
|
||||
param := proto.ListBlocDailyStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.BlocListDailyStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常汇总列表(集团)
|
||||
// @Description 日常统计列表(集团)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocDailyStatTotalReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocDailyStatTotalRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/blocDailyStatTotal/list [POST]
|
||||
func ListBlocDailyTotalStat(ctx *gin.Context) {
|
||||
param := proto.ListBlocDailyStatTotalReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.BlocListDailyTotalStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary日常统计注册详情(集团)
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocRegisterDetailsReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocRegisterDetailsRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocRegisterDetails/list [POST]
|
||||
func ListBlocRegisterDetails(ctx *gin.Context) {
|
||||
param := proto.ListBlocRegisterDetailsReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.BlocListRegisterDetailsInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary日常统计注册详情(集团)
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocWithdrawDetailsReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocWithdrawDetailsRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocBlocWithdrawDetails/list [POST]
|
||||
func ListBlocWithdrawDetails(ctx *gin.Context) {
|
||||
param := proto.ListBlocWithdrawDetailsReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.BlocListWithdrawDetailsInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 支付渠道统计
|
||||
// @Description 支付渠道统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocRechargeChannelReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocRechargeChannelRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/BlocRechargeChannel/list [POST]
|
||||
func ListBlocRechargeChannel(ctx *gin.Context) {
|
||||
param := proto.ListBlocRechargeChannelReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListBlocRechargeChannelInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary日常统计充值详情(集团)
|
||||
// @Description 日常统计列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListBlocRechargeDetailsReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListBlocRechargeDetailsRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/blocRechargeDetails/list [POST]
|
||||
func ListBlocRechargerDetails(ctx *gin.Context) {
|
||||
param := proto.ListBlocRechargeDetailsReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.BlocListRechargeDetailsInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 主后台首页曲线图
|
||||
// @Summary 曲线图列表数据
|
||||
// @Description 曲线图列表数据
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListMinuteStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListMinuteStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/minuteStat/list [POST]
|
||||
func ListMinuteStat(ctx *gin.Context) {
|
||||
param := proto.ListMinuteStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListMinuteStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 主后台首页曲线图
|
||||
// @Summary 曲线图列表数据
|
||||
// @Description 曲线图列表数据
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListHourStatLineReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListHourStatLineResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/hourStat/list [POST]
|
||||
func ListHourStatLine(ctx *gin.Context) {
|
||||
param := proto.ListHourStatLineReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := statSer.ListHourStatLine(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 落地页每日统计
|
||||
// @Description 落地页每日统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListLandPageStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPage/daily/list [POST]
|
||||
func ListLandPageDailyStat(ctx *gin.Context) {
|
||||
param := proto.ListDailyStatReq{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := landpageSer.ListDailyStat(ctx, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 落地页小时统计
|
||||
// @Description 落地页小时统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyHourStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListLandPageStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPage/hour/list [POST]
|
||||
func ListLandPageHourStat(ctx *gin.Context) {
|
||||
param := &proto.ListDailyHourStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := landpageSer.ListDailyHourStat(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 落地页下载数统计
|
||||
// @Description 落地下载数统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} proto.ListDownloadSummaryRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landPage/summary/downTotal/list [POST]
|
||||
func ListLandPageSummaryDownTotal(ctx *gin.Context) {
|
||||
data, err := landpageSer.ListSummaryDownload(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计导出
|
||||
// @Description 日常统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListDailyHourStatReq true "参数列表"
|
||||
// @Success 200 {object} proto.ListDailyHourStatRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/daily-stat/jtspV2 [POST]
|
||||
func GetBlocDailyStatTgbotInfo(ctx *gin.Context) {
|
||||
param := &proto.BlocDailyStatReq{}
|
||||
if err := ctx.ShouldBind(param); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data := botser.GetBlocDailyStatTgbotInfo(ctx, *param.StartTime)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计导出
|
||||
// @Description 日常统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} proto.AppHourDataStatInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/daily-stat/hour [POST]
|
||||
func GetAppHourDataStatInfo(ctx *gin.Context) {
|
||||
|
||||
data := make([]proto.HourStatText, 0)
|
||||
|
||||
// 发送消息 统计数据
|
||||
curStatTime := utils.RecentMinute(time.Now(), 60) // 按60分钟对齐
|
||||
endpoints := statg.GlobalEndpoints.GetIndexEndpoints(statg.Conf.ServerIndex).GetBotStatEndpoints()
|
||||
|
||||
for _, end := range endpoints {
|
||||
id := end.AppId
|
||||
tm := curStatTime
|
||||
text, title, desc, err := botser.DailyBotReportInfo(ctx, id, tm)
|
||||
if err == nil {
|
||||
data = append(data, proto.HourStatText{
|
||||
Title: title,
|
||||
Content: text,
|
||||
Desc: desc,
|
||||
})
|
||||
}
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计导出
|
||||
// @Description 日常统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} proto.AppHourDataStatInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/daily-stat/rank [POST]
|
||||
func GetAppHourDataStatInfoRank(ctx *gin.Context) {
|
||||
|
||||
curStatTime := utils.RecentMinute(time.Now(), 60)
|
||||
// 发送消息 统计数据
|
||||
_, buf, _ := botser.DailyBotRankTaskInfo(ctx, curStatTime)
|
||||
if buf != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, buf)
|
||||
} else {
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags 日常统计
|
||||
// @Summary 日常统计导出
|
||||
// @Description 日常统计导出
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} proto.AppHourDataStatInfoRes "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/daily-stat/total [POST]
|
||||
func GetTianyuAppDailyData(ctx *gin.Context) {
|
||||
|
||||
// 发送消息 统计数据
|
||||
resp, _ := innerserverser.TianyuAppDailyData(ctx)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package userinviteapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"stat/api/proto"
|
||||
"stat/common/log"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/userinviteser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 全民代理
|
||||
// @Summary 全民代理
|
||||
// @Description 传入用户信息登录
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdminLoginReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /userInvite/district [POST]
|
||||
func UserDistictInfo(ctx *gin.Context) {
|
||||
param := proto.UserDistrictReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := userinviteser.UserDistictInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("district info", log.Any("request", param), log.Any("resp", data))
|
||||
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
// @Tags 全民代理
|
||||
// @Summary 全民代理
|
||||
// @Description 传入用户信息登录
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.AdminLoginReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Router /user/districtcode [POST]
|
||||
func UserDistrictCode(ctx *gin.Context) {
|
||||
param := proto.UserDistrictCodeReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := userinviteser.UserDistrictCodeInfo(ctx, param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("district info", log.Any("request", param), log.Any("resp", data))
|
||||
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package versionApi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/models/landingPage"
|
||||
"stat/service/versionSer"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 点击下载[跨服支持所有app]
|
||||
// @Description 点击下载事件[跨服支持所有app]
|
||||
// @Param req body proto.PageButtonClickReq true "参数页码"
|
||||
// @Success 200 {object} proto.PageButtonClickResp "ok"
|
||||
// @Router /api/stat/version/crossbottonclick [post]
|
||||
func CrossButtonClick(ctx *gin.Context) {
|
||||
param := proto.PageButtonClickReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
ip := ctx.ClientIP()
|
||||
userAgent := ctx.Request.Header.Get("User-Agent")
|
||||
data, err := versionSer.CrossButtonClick(ctx, userAgent, ip, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 点击下载事件
|
||||
// @Description 点击下载事件
|
||||
// @Param req body proto.PageButtonClickReq true "参数页码"
|
||||
// @Success 200 {object} proto.PageButtonClickResp "ok"
|
||||
// @Router /api/stat/version/bottonclick [post]
|
||||
func LandingpageButtonClick(ctx *gin.Context) {
|
||||
param := proto.PageButtonClickReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
userAgent := ctx.Request.Header.Get("User-Agent")
|
||||
ip := ctx.ClientIP()
|
||||
data, err := versionSer.PageButtonClick(ctx, userAgent, ip, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 下载按钮
|
||||
// @Description 下载按钮
|
||||
// @Param req body proto.PageButtonListReq true "参数页码"
|
||||
// @Success 200 {object} proto.PageButtonListResp "ok"
|
||||
// @Router /api/stat/version/bottonlist [post]
|
||||
func LandingpageButtonList(ctx *gin.Context) {
|
||||
param := proto.PageButtonListReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
userAgent := ctx.Request.Header.Get("User-Agent")
|
||||
isIos := strings.Contains(userAgent, "iPhone")
|
||||
ip := ctx.ClientIP()
|
||||
data, err := versionSer.PageButtonList(ctx, isIos, ip, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 下载按钮
|
||||
// @Description 下载按钮
|
||||
// @Param req body proto.ShareUrlReq true "参数页码"
|
||||
// @Success 200 {object} proto.PageButtonListResp "ok"
|
||||
// @Router /api/stat/share/list [post]
|
||||
func ShareUrlList(ctx *gin.Context) {
|
||||
param := proto.ShareUrlReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := landingPage.FindShareLandingPage(ctx, param.AppId)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := proto.ShareUrlResp{
|
||||
Url: make([]string, 0),
|
||||
}
|
||||
for _, v := range data {
|
||||
resp.Url = append(resp.Url, v.Url)
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 获取H5下载
|
||||
// @Description 获取H5下载
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.H5ConfigReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/version/h5/config [POST]
|
||||
func GetH5Config(ctx *gin.Context) {
|
||||
ip := ctx.ClientIP()
|
||||
var req = &proto.H5ConfigReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
userAgent := ctx.Request.Header.Get("User-Agent")
|
||||
data, fileName := versionSer.GetH5Config(ctx, req, userAgent, ip)
|
||||
|
||||
ctx.Header("Content-Type", "application/octet-stream")
|
||||
ctx.Header("Content-Disposition", "attachment; filename="+fileName)
|
||||
ctx.Header("Content-Transfer-Encoding", "binary")
|
||||
ctx.Writer.Write(data)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 获取H5下载
|
||||
// @Description 获取H5下载
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.ChannelDownLoadLinkReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/version/channel/newLink [POST]
|
||||
func NewChannelDownLoadLink(ctx *gin.Context) {
|
||||
var req = &proto.ChannelDownLoadLinkReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
resp := versionSer.NewChannelDownLoadLink(ctx, req)
|
||||
|
||||
if resp == nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, "")
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 落地页
|
||||
// @Summary 获取H5下载
|
||||
// @Description 获取H5下载
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.H5ConfigReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/version/h5/config/v2 [POST]
|
||||
func GetH5ConfigV2(ctx *gin.Context) {
|
||||
ip := ctx.ClientIP()
|
||||
var req = &proto.H5ConfigReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
resp := versionSer.GetH5ConfigV2(ctx, req, ip)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package versionApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/landpageSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 落地页资源
|
||||
// @Summary 分组分页获取落地页资源
|
||||
// @Description 分组分页获取落地页资源
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.LandpagePictureSearch true "参数列表"
|
||||
// @Success 200 {object} proto.LandpagePictureSearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/web/landpage/picture/list [POST]
|
||||
func GetLandpagePicture(ctx *gin.Context) {
|
||||
var req = &proto.LandpagePictureSearch{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
resp, serr := landpageSer.LandpagePicture(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 落地页资源
|
||||
// @Summary 添加一个落地页资源
|
||||
// @Description 添加一个落地页资源
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.LandpagePictureAddReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/web/landpage/picture/add [POST]
|
||||
func AddOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.LandpagePictureAddReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
serr := landpageSer.AddLandpagePicture(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 proto.LandpagePictureDelReq true "参数列表"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landpage/picture/del [POST]
|
||||
func DelOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.LandpagePictureDelReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
serr := landpageSer.DelLandpagePicture(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 proto.LandpagePictureUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/landpage/picture/update [POST]
|
||||
func UpdateOneLandpage(ctx *gin.Context) {
|
||||
var req = &proto.LandpagePictureUpdateReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := landpageSer.UpdateLandpagePicture(ctx, req)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, serr)
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package versionApi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/opLogSer"
|
||||
"stat/service/versionSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 版本管理
|
||||
// @Summary 版本列表
|
||||
// @Description 版本列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body common.Page true "参数列表"
|
||||
// @Success 200 {object} proto.VersionListResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/version/list [POST]
|
||||
func VersionList(ctx *gin.Context) {
|
||||
var req proto.VersionListReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := versionSer.ListVersion(ctx, &req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, data)
|
||||
}
|
||||
|
||||
// @Tags 版本管理
|
||||
// @Summary 版本删除
|
||||
// @Description 版本删除
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.VersionDelReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/version/del [POST]
|
||||
func VersionDelete(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var param proto.VersionDelReq
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
err = versionSer.DeleteVersion(ctx, param.Id)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 版本管理
|
||||
// @Summary 版本添加
|
||||
// @Description 版本添加
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.VersionAddReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/version/add [POST]
|
||||
func VersionAdd(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var param proto.VersionAddReq
|
||||
if err := ctx.ShouldBindJSON(¶m); nil != err {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err = versionSer.AddVersion(ctx, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 版本管理
|
||||
// @Summary 版本更新
|
||||
// @Description 版本更新
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.VersionUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/version/update [POST]
|
||||
func VersionUpdate(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var param proto.VersionUpdateReq
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
err = versionSer.UpdateVersion(ctx, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 版本管理
|
||||
// @Summary App获取版本
|
||||
// @Description app获取版本
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.VersionUpdateReq true "参数列表"
|
||||
// @Success 200 {object} proto.AppVersionResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/stat/version/app [POST]
|
||||
func AppVersion(ctx *gin.Context) {
|
||||
|
||||
var param proto.AppVersionReq
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
data, err := versionSer.AppVersion(ctx, ¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package web_appcategory
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/common/stdLog"
|
||||
"stat/models/appcategory"
|
||||
"stat/service/srv_appcategory"
|
||||
)
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 添加分类
|
||||
// @Description 添加分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body appcategory.AppCategory true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/add [POST]
|
||||
func AddAppCategory(ctx *gin.Context) {
|
||||
params := &appcategory.AppCategory{}
|
||||
err := ctx.ShouldBind(params)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
serr := srv_appcategory.AddAppCategory(ctx, params)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 删除分类
|
||||
// @Description 删除分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategoryDelReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/del [POST]
|
||||
func DelAppCategory(ctx *gin.Context) {
|
||||
param := &srv_appcategory.AppCategoryDelReq{}
|
||||
err := ctx.ShouldBind(param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := srv_appcategory.DelAppCategory(ctx, param.Id)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 更新分类
|
||||
// @Description 更新分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategoryUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/update [POST]
|
||||
func UpdateAppCategory(ctx *gin.Context) {
|
||||
params := &srv_appcategory.AppCategoryUpdateReq{}
|
||||
err := ctx.ShouldBind(params)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := srv_appcategory.UpdateAppCategory(ctx, params.Id, ¶ms.Param)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 查询分类列表
|
||||
// @Description 查询分类列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategorySearch true "参数列表"
|
||||
// @Success 200 {object} srv_appcategory.AppCategorySearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/list [POST]
|
||||
func GetAppCategories(ctx *gin.Context) {
|
||||
param := &srv_appcategory.AppCategorySearch{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
result, sErr := srv_appcategory.GetAppCategory(ctx, param)
|
||||
if sErr != nil {
|
||||
stdLog.ServerJSON(ctx, sErr.Code, sErr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package web_application
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/models/applicationmod"
|
||||
"stat/service/applicationser"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 添加应用
|
||||
// @Description 添加应用
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body applicationmod.Application true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/add [POST]
|
||||
func AddApplication(ctx *gin.Context) {
|
||||
params := &applicationmod.Application{}
|
||||
err := ctx.ShouldBind(params)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
serr := applicationser.AddApplication(ctx, params, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, params)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
|
||||
}
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 删除应用
|
||||
// @Description 删除应用
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.DelAppReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/del [POST]
|
||||
func DelApplication(ctx *gin.Context) {
|
||||
param := &proto.DelAppReq{}
|
||||
err := ctx.ShouldBind(param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
serr := applicationser.DelApplication(ctx, param.Id, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, param)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 更新应用
|
||||
// @Description 更新应用
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body applicationmod.AppUpdate true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/update [POST]
|
||||
func UpdateApplication(ctx *gin.Context) {
|
||||
req := &applicationmod.AppUpdate{}
|
||||
err := ctx.ShouldBind(req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
serr := applicationser.UpdateApplication(ctx, req, account)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 增加操作日志
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 查询应用列表
|
||||
// @Description 查询应用列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.GetApplicationsReq true "参数列表"
|
||||
// @Success 200 {object} proto.GetApplicationsResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/list [POST]
|
||||
func GetApplications(ctx *gin.Context) {
|
||||
param := &proto.GetApplicationsReq{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
result, sErr := applicationser.GetAppList(ctx, param)
|
||||
if sErr != nil {
|
||||
stdLog.ServerJSON(ctx, sErr.Code, sErr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package web_applicationstat
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/srv_applicationstat"
|
||||
)
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 查询应用统计
|
||||
// @Description 查询应用统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_applicationstat.GetApplicationStatReq true "参数列表"
|
||||
// @Success 200 {object} srv_applicationstat.GetApplicationStatResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/stat [POST]
|
||||
func GetApplicationStat(ctx *gin.Context) {
|
||||
param := &srv_applicationstat.GetApplicationStatReq{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
result, sErr := srv_applicationstat.GetAppStatList(ctx, param)
|
||||
if sErr != nil {
|
||||
stdLog.ServerJSON(ctx, sErr.Code, sErr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
|
||||
// @Tags 应用中心
|
||||
// @Summary 查询应用统计
|
||||
// @Description 查询应用统计
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_applicationstat.GetApplicationStatTotalReq true "参数列表"
|
||||
// @Success 200 {object} srv_applicationstat.GetApplicationStatTotalResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/apps/stattotal [POST]
|
||||
func GetApplicationTotalStat(ctx *gin.Context) {
|
||||
param := &srv_applicationstat.GetApplicationStatTotalReq{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
result, sErr := srv_applicationstat.GetAppTotalStatList(ctx, param)
|
||||
if sErr != nil {
|
||||
stdLog.ServerJSON(ctx, sErr.Code, sErr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
Reference in New Issue
Block a user