123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- package controller
- import (
- "github.com/gin-gonic/gin"
- "github.com/mhaya/game/game_cluster/nodes/webadmin/entity"
- "github.com/mhaya/game/game_cluster/nodes/webadmin/service"
- )
- type Synthesis struct {
- sev *service.Synthesis
- }
- func NewSynthesis() *Synthesis {
- return &Synthesis{
- sev: service.NewSynthesis(),
- }
- }
- // FindUserLogDaily 查询用户日活跃
- func (s *Synthesis) FindUserLogDaily(ctx *gin.Context) {
- req := &entity.UserLogDailyReq{}
- if err := ctx.ShouldBindJSON(req); err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- }
- resp, err := s.sev.FindMDBUserLogDaily(req)
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- }
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- "data": resp,
- })
- }
- // FindUserRetention 查询用户留存
- func (s *Synthesis) FindUserRetention(ctx *gin.Context) {
- req := &entity.UserRetentionReq{}
- if err := ctx.ShouldBindJSON(req); err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- }
- resp, err := s.sev.FindUserRetention(req)
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- } else {
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- "data": resp,
- })
- }
- }
- // FindUserCountryCount 查询用户国家分布
- func (s *Synthesis) FindUserCountryCount(ctx *gin.Context) {
- resp, err := s.sev.FindUserCountryCount()
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- } else {
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- "data": resp,
- })
- }
- }
- // FindWithdrawal 查询提现记录
- func (s *Synthesis) FindWithdrawal(ctx *gin.Context) {
- req := &entity.UserWithdrawalReq{}
- if err := ctx.ShouldBindJSON(req); err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- }
- resp, err := s.sev.FindWithdrawal(req)
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- } else {
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- "data": resp,
- })
- }
- }
- // WithdrawalStatus 修改提现状态
- func (s *Synthesis) WithdrawalStatus(ctx *gin.Context) {
- req := &entity.UserWithdrawalStatus{}
- if err := ctx.ShouldBindJSON(req); err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- }
- err := s.sev.WithdrawalStatus(req)
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- } else {
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- })
- }
- }
- // FindUserLevel 查询用户等级
- func (s *Synthesis) FindUserLevel(ctx *gin.Context) {
- resp, err := s.sev.FindUserLevel()
- if err != nil {
- ctx.JSON(200, gin.H{
- "code": 400,
- "msg": err.Error(),
- })
- return
- } else {
- ctx.JSON(200, gin.H{
- "code": 200,
- "msg": "success",
- "data": resp,
- })
- }
- }
|