pet-ai/server/plugin/wechat-integration/api/mp_statistics_api.go

131 lines
3.7 KiB
Go

package api
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type MpStatisticsApi struct{}
// GetUserSummary 获得粉丝增减数据
// @Tags MpStatistics
// @Summary 获得粉丝增减数据
// @Description 获得粉丝增减数据
// @Accept json
// @Produce json
// @Param accountId query int true "公众号账号ID"
// @Param date query string true "日期"
// @Success 200 {object} response.Response "获取成功"
// @Router /wechat/mp/statistics/user-summary [get]
func (m *MpStatisticsApi) GetUserSummary(c *gin.Context) {
accountId := c.Query("accountId")
date := c.Query("date")
// TODO: 实现粉丝增减数据获取逻辑
global.GVA_LOG.Info("获取粉丝增减数据", zap.String("accountId", accountId), zap.String("date", date))
// 模拟数据
data := []map[string]interface{}{
{
"refDate": "2025-08-04",
"userSource": 0,
"newUser": 12,
"cancelUser": 3,
"cumulateUser": 1350,
},
}
response.OkWithData(data, c)
}
// GetUserCumulate 获得粉丝累计数据
// @Tags MpStatistics
// @Summary 获得粉丝累计数据
// @Description 获得粉丝累计数据
// @Accept json
// @Produce json
// @Param accountId query int true "公众号账号ID"
// @Param date query string true "日期"
// @Success 200 {object} response.Response "获取成功"
// @Router /wechat/mp/statistics/user-cumulate [get]
func (m *MpStatisticsApi) GetUserCumulate(c *gin.Context) {
accountId := c.Query("accountId")
date := c.Query("date")
// TODO: 实现粉丝累计数据获取逻辑
global.GVA_LOG.Info("获取粉丝累计数据", zap.String("accountId", accountId), zap.String("date", date))
// 模拟数据
data := []map[string]interface{}{
{
"refDate": "2025-08-04",
"cumulateUser": 1350,
},
}
response.OkWithData(data, c)
}
// GetUpstreamMessage 获取消息发送概况数据
// @Tags MpStatistics
// @Summary 获取消息发送概况数据
// @Description 获取消息发送概况数据
// @Accept json
// @Produce json
// @Param accountId query int true "公众号账号ID"
// @Param date query string true "日期"
// @Success 200 {object} response.Response "获取成功"
// @Router /wechat/mp/statistics/upstream-message [get]
func (m *MpStatisticsApi) GetUpstreamMessage(c *gin.Context) {
accountId := c.Query("accountId")
date := c.Query("date")
// TODO: 实现消息发送概况数据获取逻辑
global.GVA_LOG.Info("获取消息发送概况数据", zap.String("accountId", accountId), zap.String("date", date))
// 模拟数据
data := []map[string]interface{}{
{
"refDate": "2025-08-04",
"msgType": 1,
"msgUser": 45,
"msgCount": 128,
},
}
response.OkWithData(data, c)
}
// GetInterfaceSummary 获取接口调用概况数据
// @Tags MpStatistics
// @Summary 获取接口调用概况数据
// @Description 获取接口调用概况数据
// @Accept json
// @Produce json
// @Param accountId query int true "公众号账号ID"
// @Param date query string true "日期"
// @Success 200 {object} response.Response "获取成功"
// @Router /wechat/mp/statistics/interface-summary [get]
func (m *MpStatisticsApi) GetInterfaceSummary(c *gin.Context) {
accountId := c.Query("accountId")
date := c.Query("date")
// TODO: 实现接口调用概况数据获取逻辑
global.GVA_LOG.Info("获取接口调用概况数据", zap.String("accountId", accountId), zap.String("date", date))
// 模拟数据
data := []map[string]interface{}{
{
"refDate": "2025-08-04",
"callbackCount": 256,
"failCount": 2,
"totalTimeCost": 1280,
"maxTimeCost": 45,
},
}
response.OkWithData(data, c)
}