Initial commit

This commit is contained in:
2026-05-20 16:13:58 +08:00
commit ceffbe382e
500 changed files with 157469 additions and 0 deletions
+216
View File
@@ -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(&param); 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(&param); 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(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
return
}
if res, err := botser.RecvTgMessage(ctx, &param); 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(&param); 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(&param); 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(&param); 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(&param); 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(&param); 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)
}