Browse Source

提交管理后台

master
wserver/wangdisen 3 years ago
parent
commit
2df5ba9b4d
  1. 49
      api/v1/game/basicinfo.go
  2. 50
      api/v1/game/mail.go
  3. 26
      api/v1/game/manage.go
  4. 62
      api/v1/game/order.go
  5. 19
      go.mod
  6. 58
      go.sum
  7. 6
      internal/consts/consts.go
  8. 34
      internal/controller/baseinfo_role.go
  9. 24
      internal/controller/game_mail.go
  10. 25
      internal/controller/game_order.go
  11. 27
      internal/dao/gm_operate_log.go
  12. 93
      internal/dao/internal/gm_operate_log.go
  13. 26
      internal/model/do/gm_operate_log.go
  14. 83
      internal/model/entity/base_info.go
  15. 24
      internal/model/entity/gm_operate_log.go
  16. 16
      internal/router/router.go
  17. 1
      internal/service/sys_init.go
  18. 85
      internal/serviceGame/basicinfo_game_role.go
  19. 66
      internal/serviceGame/internal/basicinfo.go
  20. 64
      internal/serviceGame/internal/dbinit.go
  21. 111
      internal/serviceGame/internal/mail.go
  22. 83
      internal/serviceGame/internal/mqtt_client.go
  23. 62
      internal/serviceGame/internal/online.go
  24. 63
      internal/serviceGame/internal/order.go
  25. 101
      internal/serviceGame/mail.go
  26. 91
      internal/serviceGame/order.go
  27. 2
      main.go
  28. 2687
      resource/data/gfast-v3.sql

49
api/v1/game/basicinfo.go

@ -0,0 +1,49 @@
package game
import (
"github.com/gogf/gf/v2/frame/g"
"tyj_admin/internal/model/entity"
)
type RoleSearchReq struct {
g.Meta `path:"/basicinfo/rolelist" tags:"账号的所有角色" method:"get" summary:"角色列表"`
Account string `p:"account" v:"required#账号ID不能为空"`
}
type RoleSearchRes struct {
g.Meta `mime:"application/json"`
RoleList []*entity.RolePost `json:"list"`
}
type RoleDetailReq struct {
g.Meta `path:"/basicinfo/detail" tags:"角色详情" method:"get" summary:"详情"`
Uid int32 `p:"Uid" v:"required#角色ID不能为空"`
Channel int `p:"channel" v:"required#渠道不能为空"`
}
type RoleDetailRes struct {
g.Meta `mime:"application/json"`
RoleDetail *entity.RoleDetail `json:"roleDetail"`
}
type RoleOnlineReq struct {
g.Meta `path:"/basicinfo/online" tags:"在线列表" method:"get" summary:"玩家在线列表"`
ServerId int32 `p:"serverId" v:"required#服务器ID不能为空"`
}
type RoleOnlineRes struct {
g.Meta `mime:"application/json"`
Onlines []*entity.Online `json:"onlines"`
}
type AccountReq struct {
g.Meta `path:"/basicinfo/account" tags:"账号数据" method:"get" summary:"总服账号数据"`
Account string `p:"account"`
Tel string `p:"tel"`
Ident string `p:"ident"`
Name string `p:"name"`
}
type AccountRes struct {
g.Meta `mime:"application/json"`
Accounts []*entity.AccountInfo `json:"list"`
}

50
api/v1/game/mail.go

@ -0,0 +1,50 @@
package game
import (
"github.com/gogf/gf/v2/frame/g"
"tyj_admin/internal/model/entity"
)
type MailsSearchReq struct {
g.Meta `path:"/mail/list" tags:"查询邮件" method:"get" summary:"邮件列表"`
ServerId string `p:"serverId" v:""`
Uid string `p:"uid"`
LowTime int64 `p:"lowTime"`
UpperTime int64 `p:"upperTime"`
}
type MailsSearchRes struct {
g.Meta `mime:"application/json"`
Mails []*entity.Mail `json:"mails"`
}
type MailSendReq struct {
g.Meta `path:"/mail/send" tags:"发送邮件" method:"post"`
ServerId string `p:"serverId" v:"required#区服不能为空"`
To string `p:"to" `
GmName string `p:"gmName" v:"required#GMm名字不能为空"`
Type string `p:"type" v:"required#邮件类型不能为空"`
Time int64 `p:"time"`
Expired int64 `p:"expired" `
NewGet string `p:"newGet" v:"required#类型不能为空"`
RepeatedCollection interface{} `p:"repeatedCollection" v:"required#领取类型不能为空"`
Title string `p:"title" v:"required#标题不能为空"`
Content string `p:"content" v:"required#邮件内容不能为空"`
Drops string `p:"drops" `
Remark string `p:"remark" v:"required#说明不能为空"`
}
type MailSendRes struct {
}
//type OnlineSearchReq struct {
// g.Meta `path:"/online/list" tags:"在线玩家" method:"get" summary:"在线玩家列表"`
// ServerId string `p:"serverId" v:""`
// Uid string `p:"uid"`
// LowTime int64 `p:"lowTime"`
// UpperTime int64 `p:"upperTime"`
//}
//
//type OnlineSearchRes struct {
// g.Meta `mime:"application/json"`
// Lines []*entity.Online `json:"lines"`
//}

26
api/v1/game/manage.go

@ -0,0 +1,26 @@
package game
import "github.com/gogf/gf/v2/frame/g"
// 修改GM权限
type ChangeGmReq struct {
g.Meta `path:"/mange/changegm" tags:"修改GM权限" method:"post" summary:"修改GM权限"`
Account string `p:"account"`
ChangeValue int `p:"changeValue"` //0开,1关
ServerId int `p:"serverId"` //0,总服,其他分服
}
type ChangeGmRes struct {
Account string `p:"account"`
ServerId int `p:"serverId"` //0,总服,其他分服
}
type SearchGmReq struct {
g.Meta `path:"/mange/searchgm" tags:"修改GM权限" method:"post" summary:"修改GM权限"`
Account string `p:"account"`
ServerId int `p:"serverId"` //0,总服,其他分服
}
type SearchGmRes struct {
Result int `p:"result"`
}

62
api/v1/game/order.go

@ -0,0 +1,62 @@
package game
import (
"github.com/gogf/gf/v2/frame/g"
"tyj_admin/internal/model/entity"
)
type OrderSearchReq struct {
g.Meta `path:"/order/list" tags:"查询订单" method:"get" summary:"订单列表"`
SearchType int `p:"searchType"` //1.账号查询,2角色UID查询,3 时间段查询 4.订单号查询
Id string `p:"id"`
OrderId string `p:"orderId"`
ServerId int `p:"serverId"`
Uid int32 `p:"uid"`
Account string `p:"account"` //rechargeorder表的 uid
Channel string `p:"channel"'` //渠道
LowTime int64 `p:"lowTime"`
UpTime int64 `p:"upTime"`
}
type OrderSearchRes struct {
g.Meta `mime:"application/json"`
Orders []*entity.Order `json:"list"`
}
type OrderCountReq struct {
g.Meta `path:"/order/count" tags:"查询订单" method:"get" summary:"订单列表"`
Amount int `p:"amount"`
CompareType int `p:"compareType"`
Gender int `p:"gender"`
LowAge int `p:"lowAge"`
UpAge int `p:"upAge"`
ServerId int `p:"serverId"`
}
type OrderCountRes struct {
g.Meta `mime:"application/json"`
Orders []*entity.OrderCount `json:"list"`
}
// 充值
type OrderDepositReq struct {
g.Meta `path:"/order/deposit" tags:"充值" method:"post" summary:"补单充值"`
Account string `p:"account"`
DepositId int `p:"depositId"`
ServerId int `p:"serverId"`
}
type OrderDepositRes struct {
}
// 加游戏币
type AddCoinReq struct {
g.Meta `path:"/order/addcoin" tags:"修改游戏币" method:"post" summary:"修改游戏币"`
Uid string `p:"uid"`
Amount int `p:"amount"`
AmountType int `p:"amountType"`
ServerId int `p:"serverId"`
}
type AddCoinRes struct {
}

19
go.mod

@ -4,14 +4,18 @@ go 1.19
require (
github.com/casbin/casbin/v2 v2.57.0
github.com/eclipse/paho.mqtt.golang v1.4.2
github.com/go-redis/redis/v8 v8.11.5
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.4
github.com/gogf/gf/v2 v2.2.4
github.com/mojocn/base64Captcha v1.3.5
github.com/mssola/user_agent v0.5.3
github.com/qiniu/qmgo v1.1.4
github.com/shirou/gopsutil v2.21.11+incompatible
github.com/tencentyun/cos-go-sdk-v5 v0.7.40
github.com/tiger1103/gfast-cache v0.1.1
github.com/tiger1103/gfast-token v1.0.1
go.mongodb.org/mongo-driver v1.9.0
gopkg.in/yaml.v3 v3.0.1
)
@ -27,13 +31,19 @@ require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grokify/html-strip-tags-go v0.0.1 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
@ -41,14 +51,21 @@ require (
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/sdk v1.7.0 // indirect
go.opentelemetry.io/otel/trace v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f // indirect
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 // indirect
)

58
go.sum

@ -20,6 +20,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4=
github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@ -34,11 +36,21 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.4 h1:dUT1BbQ6RRiEDiBLj57jBx0y/WkD9KiDbmcCp9vE0w8=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.4/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk=
@ -60,9 +72,12 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
@ -79,6 +94,15 @@ github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
@ -92,6 +116,7 @@ github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGg
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mojocn/base64Captcha v1.3.5 h1:Qeilr7Ta6eDtG4S+tQuZ5+hO+QHbiGAJdi4PfoagaA0=
github.com/mojocn/base64Captcha v1.3.5/go.mod h1:/tTTXn4WTpX9CfrmipqRytCpJ27Uw3G6I7NcP2WwcmY=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ=
github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60=
github.com/mssola/user_agent v0.5.3 h1:lBRPML9mdFuIZgI2cmlQ+atbpJdLdeVl2IDodjBR578=
@ -113,13 +138,20 @@ github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/qiniu/qmgo v1.1.4 h1:6UJBn4laLXRc5kqzhijiPW/TUcOEa1GuW2Q5bV9yCDE=
github.com/qiniu/qmgo v1.1.4/go.mod h1:gTj5P+fOyGwtTkumPa8YTFspsf0Ndpw+MtRPwU1FHL4=
github.com/shirou/gopsutil v2.21.11+incompatible h1:lOGOyCG67a5dv2hq5Z1BLDUqqKp3HkbjPcz5j6XMS0U=
github.com/shirou/gopsutil v2.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@ -127,6 +159,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4=
github.com/tencentyun/cos-go-sdk-v5 v0.7.40 h1:W6vDGKCHe4wBACI1d2UgE6+50sJFhRWU4O8IB2ozzxM=
github.com/tencentyun/cos-go-sdk-v5 v0.7.40/go.mod h1:4dCEtLHGh8QPxHEkgq+nFaky7yZxQuYwgSJM87icDaw=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tiger1103/gfast-cache v0.1.1 h1:qwhw0VUyr539lLmiJCNCoU2dDdHZxozHMuXlvaTPm5Q=
github.com/tiger1103/gfast-cache v0.1.1/go.mod h1:jAmIERI//MmLpUcOI3+7axmSir+t/ufpVc2N3Ryw6VE=
github.com/tiger1103/gfast-token v1.0.1 h1:507HTgEmq+dZ+TnFndy+hC+Ezj/jTQR74qhM85Szw/E=
@ -135,10 +169,20 @@ github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+Kd
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.mongodb.org/mongo-driver v1.9.0 h1:f3aLGJvQmBl8d9S40IL+jEyBC6hfLPbJjv9t5hEM9ck=
go.mongodb.org/mongo-driver v1.9.0/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY=
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM=
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
@ -151,6 +195,8 @@ go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f h1:aZp0e2vLN4MToVqnjNEYEtrEA8RH8U8FN1CU7JgqsPU=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75 h1:TbGuee8sSq15Iguxu4deQ7+Bqq/d2rsQejGcEtADAMQ=
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@ -159,6 +205,7 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
@ -167,7 +214,9 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -175,6 +224,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -191,20 +241,25 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 h1:GLw7MR8AfAG2GmGcmVgObFOHXYypgGjnGno25RDwn3Y=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@ -214,8 +269,9 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=

6
internal/consts/consts.go

@ -3,3 +3,9 @@ package consts
const (
PageSize = 10 //分页长度
)
const (
RECHARGE_COLLECTION = "rechargeOrder"
ACCOUNT_COLLECTION = "account"
FACEBACK_COLLECTION = "faceback"
)

34
internal/controller/baseinfo_role.go

@ -0,0 +1,34 @@
package controller
import (
"context"
"tyj_admin/api/v1/game"
"tyj_admin/internal/serviceGame"
)
var GameRole = gameRoleController{}
type gameRoleController struct {
BaseController
}
// list 玩家角色列表
func (c *gameRoleController) List(ctx context.Context, req *game.RoleSearchReq) (res *game.RoleSearchRes, err error) {
res, err = serviceGame.GameRole().GetGameRoleListSearch(ctx, req)
return
}
func (c *gameRoleController) RoleDetail(ctx context.Context, req *game.RoleDetailReq) (res *game.RoleDetailRes, err error) {
res, err = serviceGame.GameRole().GetRoleDetail(ctx, req)
return res, err
}
func (c *gameRoleController) OnlineList(ctx context.Context, req *game.RoleOnlineReq) (res *game.RoleOnlineRes, err error) {
res, err = serviceGame.GameRole().GetOnlineList(ctx, req)
return res, err
}
func (c *gameRoleController) AccountList(ctx context.Context, req *game.AccountReq) (res *game.AccountRes, err error) {
res, err = serviceGame.GameRole().GetAccount(ctx, req)
return res, err
}

24
internal/controller/game_mail.go

@ -0,0 +1,24 @@
package controller
import (
"context"
"tyj_admin/api/v1/game"
"tyj_admin/internal/serviceGame"
)
var GameMail = mailController{}
type mailController struct {
BaseController
}
// mail 列表
func (c *mailController) MialList(ctx context.Context, req *game.MailsSearchReq) (res *game.MailsSearchRes, err error) {
res, err = serviceGame.GameMail().GetMailList(ctx, req)
return
}
func (c *mailController) SendMail(ctx context.Context, req *game.MailSendReq) (res *game.MailSendRes, err error) {
res, err = serviceGame.GameMail().SendMail(ctx, req)
return
}

25
internal/controller/game_order.go

@ -0,0 +1,25 @@
package controller
import (
"context"
"tyj_admin/api/v1/game"
"tyj_admin/internal/serviceGame"
)
var GameOrder = orderController{}
type orderController struct {
BaseController
}
// mail 列表
func (c *mailController) OrderList(ctx context.Context, req *game.OrderSearchReq) (res *game.OrderSearchRes, err error) {
res, err = serviceGame.GameOrder().GetOrders(ctx, req)
return
}
// 订单统计数据
func (c *mailController) OrderCount(ctx context.Context, req *game.OrderCountReq) (res *game.OrderCountRes, err error) {
res, err = serviceGame.GameOrder().GetOrderCount(ctx, req)
return
}

27
internal/dao/gm_operate_log.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"tyj_admin/internal/dao/internal"
)
// internalGmOperateLogDao is internal type for wrapping internal DAO implements.
type internalGmOperateLogDao = *internal.GmOperateLogDao
// gmOperateLogDao is the data access object for table gm_operate_log.
// You can define custom methods on it to extend its functionality as you wish.
type gmOperateLogDao struct {
internalGmOperateLogDao
}
var (
// GmOperateLog is globally public accessible object for table gm_operate_log operations.
GmOperateLog = gmOperateLogDao{
internal.NewGmOperateLogDao(),
}
)
// Fill with you ideas below.

93
internal/dao/internal/gm_operate_log.go

@ -0,0 +1,93 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// GmOperateLogDao is the data access object for table gm_operate_log.
type GmOperateLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns GmOperateLogColumns // columns contains all the column names of Table for convenient usage.
}
// GmOperateLogColumns defines and stores column names for table gm_operate_log.
type GmOperateLogColumns struct {
Id string // ID
OperateType string // 操作类型,1修改名称,2发送邮件
CreateName string // GM用户名
MailId string // 邮件id
ChannelId string // 区服ID
Uid string // 角色ID
Remark string // 备注
CreatedBy string // 创建人
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
DeletedAt string // 删除时间
}
// gmOperateLogColumns holds the columns for table gm_operate_log.
var gmOperateLogColumns = GmOperateLogColumns{
Id: "id",
OperateType: "operate_type",
CreateName: "create_name",
MailId: "mail_id",
ChannelId: "channel_id",
Uid: "uid",
Remark: "remark",
CreatedBy: "created_by",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewGmOperateLogDao creates and returns a new DAO object for table data access.
func NewGmOperateLogDao() *GmOperateLogDao {
return &GmOperateLogDao{
group: "default",
table: "gm_operate_log",
columns: gmOperateLogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *GmOperateLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *GmOperateLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *GmOperateLogDao) Columns() GmOperateLogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *GmOperateLogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *GmOperateLogDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *GmOperateLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

26
internal/model/do/gm_operate_log.go

@ -0,0 +1,26 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// GmOperateLog is the golang structure of table gm_operate_log for DAO operations like Where/Data.
type GmOperateLog struct {
g.Meta `orm:"table:gm_operate_log, do:true"`
Id interface{} // ID
OperateType interface{} // 操作类型,1修改名称,2发送邮件
CreateName interface{} // GM用户名
MailId interface{} // 邮件id
ChannelId interface{} // 区服ID
Uid interface{} // 角色ID
Remark interface{} // 备注
CreatedBy interface{} // 创建人
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 修改时间
DeletedAt *gtime.Time // 删除时间
}

83
internal/model/entity/base_info.go

@ -0,0 +1,83 @@
package entity
import "go.mongodb.org/mongo-driver/bson/primitive"
type RolePost struct {
Uid int64 `json:"uid" description:"桃园ID"`
Name string `json:"name" description:"桃园名字"`
Region int `json:"region" description:"区服"`
TotalTime int64 `json:"totalTime" description:"总在线时间"`
RechargeTotal int32 `json:"rechargeTotal" description:"累计充值"`
CreateTime primitive.DateTime `json:"createTime" description:"创建时间"`
LastLeaveTime primitive.DateTime `json:"lastLeaveTime" description:"修改时间"`
}
type RoleDetail struct {
Uid int64 `json:"uid" description:"桃园ID"`
Name string `json:"name" description:"桃园名字"`
Boom int32 `json:"boom" description:"繁荣度"`
VillageScale int32 `json:"villageScale" description:"规模等级"`
GiftIds []int32 `json:"giftIds" description:"礼包码"`
Account string `json:"account" description:"账号名字"`
}
type Mail struct {
Id string `json:"id" description:"邮件ID"`
ServerId string `json:"serverId" bson:"serverId" description:"服务器ID"`
C_date interface{} `json:"c_date" bson:"c_date" description:"邮件创建时间"`
To interface{} `json:"to" description:"邮件发送对象"`
From string `json:"from" description:"发送者"`
GmName string `json:"gmName" bson:"gmName" description:"GM名字"`
Type string `json:"type" description:"1 奖励,2活动,3公告"`
Expired int64 `json:"expired" description:"过期时间"`
Time int64 `json:"time" description:"发送时间,0表示马上发送"`
NewGet string `json:"newGet" bson:"newGet" description:"新玩家可领取"`
RepeatedCollection interface{} `json:"repeatedCollection" bson:"repeatedCollection" description:"1表示可以重复领取"`
Title string `json:"title" description:"标题"`
Content string `json:"content" description:"邮件内容"`
Drops []Drop `json:"drops" bson:"drops" description:"赠送物品"`
Remark string `json:"remark" description:"发送理由"`
}
type Drop struct {
Id string `json:"id" bson:"id"`
Num string `json:"num" bson:"num"`
}
type Order struct {
Id string `json:"_id" description:"订单ID"`
Uid string `json:"uid" description:"账号uid"`
Server int32 `json:"server" description:"服务器id"`
Money int32 `json:"money" description:"充值数额"`
Timestamp int64 `json:"timestamp" description:"订单时间"`
RechargeId int32 `json:"rechargeId" description:"商品ID"`
CreateTime interface{} `json:"createTime" description:"本条记录产生的时间"`
OrderId string `json:"orderId" description:"渠道订单ID"`
State int32 `json:"state" description:"订单状态 3: 金额问题; 8:年龄不足,身份未认证,账号不存在;7:获取账号失败;6:获取订单充值配置失败,订单配置与充值金额不匹配;4:充值达到上限;5:订单验证失败;10:令牌验证失败;1:参数错误,2成功,9:分服http error"`
}
type OrderCount struct {
ServerId int `json:"serverId"`
Num int32 `json:"num" description:"充值人数"`
Times int32 `json:"times" description:"充值笔数"`
AllMoney int32 `json:"allMoney" `
TotalMoney int32 `json:"totalMoney" `
TotalNum int32 `json:"totalNum" description:"总充值人数"`
TotalTimes int32 `json:"totalTimes" description:"总充值笔数"`
}
type Online struct {
ConnectId string `json:"connectId"`
Uid int32 `json:"uid"`
Address string `json:"address"`
LoginTime int64 `json:"loginTime"`
}
type AccountInfo struct {
Account string `json:"account"`
TrueName string `json:"trueName"`
IdentityCard string `json:"identityCard"`
Tel string `json:"tel"`
LastLeaveTime primitive.DateTime `json:"lastLeaveTime"`
CreateTime primitive.DateTime `json:"createTime"`
LeftPlayTime int64 `json:"leftPlayTime"`
}

24
internal/model/entity/gm_operate_log.go

@ -0,0 +1,24 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// GmOperateLog is the golang structure for table gm_operate_log.
type GmOperateLog struct {
Id uint64 `json:"id" description:"ID"`
OperateType int `json:"operateType" description:"操作类型,1修改名称,2发送邮件"`
CreateName string `json:"createName" description:"GM用户名"`
MailId string `json:"mailId" description:"邮件id"`
ChannelId int `json:"channelId" description:"区服ID"`
Uid int `json:"uid" description:"角色ID"`
Remark string `json:"remark" description:"备注"`
CreatedBy uint64 `json:"createdBy" description:"创建人"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
DeletedAt *gtime.Time `json:"deletedAt" description:"删除时间"`
}

16
internal/router/router.go

@ -23,6 +23,8 @@ func BindController(group *ghttp.RouterGroup) {
DemoBindController(group)
// 绑定公共路由
CommonBindController(group)
GameBindController(group)
})
}
@ -84,3 +86,17 @@ func SystemBindController(group *ghttp.RouterGroup) {
)
})
}
func GameBindController(group *ghttp.RouterGroup) {
group.Group("/game", func(group *ghttp.RouterGroup) {
group.Middleware(service.Middleware().MiddlewareCORS)
service.SysGfToken().Middleware(group)
//context拦截器
group.Middleware(service.Middleware().Ctx, service.Middleware().Auth)
group.Bind(
controller.GameRole,
controller.GameMail,
controller.GameOrder,
)
})
}

1
internal/service/sys_init.go

@ -120,6 +120,7 @@ func (s *sysInit) LoadConfigFile() (err error) {
if err != nil {
return
}
return
}

85
internal/serviceGame/basicinfo_game_role.go

@ -0,0 +1,85 @@
package serviceGame
import (
"context"
"encoding/json"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"tyj_admin/api/v1/game"
"tyj_admin/internal/model/entity"
"tyj_admin/internal/serviceGame/internal"
)
type IGameRole interface {
GetGameRoleListSearch(ctx context.Context, req *game.RoleSearchReq) (res *game.RoleSearchRes, err error)
GetRoleDetail(ctx context.Context, req *game.RoleDetailReq) (res *game.RoleDetailRes, err error)
GetOnlineList(ctx context.Context, req *game.RoleOnlineReq) (res *game.RoleOnlineRes, err error)
GetAccount(ctx context.Context, req *game.AccountReq) (res *game.AccountRes, err error)
}
type gameRoleImpl struct {
}
var gameRoleService = gameRoleImpl{}
func GameRole() IGameRole {
return &gameRoleService
}
// 获取玩家角色列表
func (s *gameRoleImpl) GetGameRoleListSearch(ctx context.Context, req *game.RoleSearchReq) (res *game.RoleSearchRes, err error) {
res = new(game.RoleSearchRes)
g.Try(ctx, func(ctx context.Context) {
res.RoleList, err = internal.GetRoleList(ctx, req.Account)
})
return
}
// 获取角色详情
func (s *gameRoleImpl) GetRoleDetail(ctx context.Context, req *game.RoleDetailReq) (res *game.RoleDetailRes, err error) {
res = new(game.RoleDetailRes)
g.Try(ctx, func(ctx context.Context) {
res.RoleDetail, err = internal.GetRoleDetail(ctx, req.Uid, req.Channel)
})
return
}
func (m *gameRoleImpl) GetOnlineList(ctx context.Context, req *game.RoleOnlineReq) (res *game.RoleOnlineRes, err error) {
res = new(game.RoleOnlineRes)
mqttMsg := internal.MqttOnlineReq{1, "onlineUser"}
js, err := json.Marshal(mqttMsg)
connectCh := make(chan *internal.MqttOnlineRes)
defer close(connectCh)
server := "192.168.2.100:3005"
internal.SendMqttOnline(js, connectCh, server)
var result *internal.MqttOnlineRes
for {
select {
case result = <-connectCh:
if result.Error != nil {
err = gerror.New("失败")
return
} else {
for _, v := range result.Body {
for _, login := range v.LoginedList {
info := new(entity.Online)
info.ConnectId = v.ServerId
info.Uid = login.Uid
info.LoginTime = login.LoginTime
info.Address = login.Address
res.Onlines = append(res.Onlines, info)
}
}
return
}
}
}
return
}
func (m *gameRoleImpl) GetAccount(ctx context.Context, req *game.AccountReq) (res *game.AccountRes, err error) {
res = new(game.AccountRes)
res.Accounts, err = internal.GetAccountList(ctx, req.Account, req.Tel, req.Ident, req.Name)
return
}

66
internal/serviceGame/internal/basicinfo.go

@ -0,0 +1,66 @@
package internal
import (
"context"
"encoding/json"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"go.mongodb.org/mongo-driver/bson"
"tyj_admin/internal/model/entity"
)
func GetServerList(account string, ctx context.Context) []int {
rdbTop := RedisDbList[0]
rdbTop.Do(ctx, "select", 0)
var m []int
result := rdbTop.HGet(ctx, "accounts", account)
json.Unmarshal([]byte(result.Val()), &m)
return m
}
func GetRoleList(ctx context.Context, account string) (RoleList []*entity.RolePost, err error) {
serverList := GetServerList(account, ctx)
for _, v := range serverList {
one := &entity.RolePost{}
ds := MongoDatabaseList[v]
err = ds.Collection("colony").Find(ctx, bson.M{"account": account}).One(one)
if err != nil {
return
}
one.Region = v
RoleList = append(RoleList, one)
fmt.Println("one")
}
return RoleList, err
}
func GetRoleDetail(ctx context.Context, uid int32, serverId int) (roleDetail *entity.RoleDetail, err error) {
if serverId > len(MongoDatabaseList)+1 || serverId <= 0 {
err = gerror.New("not find server mongo")
return
}
err = MongoDatabaseList[serverId].Collection("colony").Find(ctx, bson.M{"uid": uid}).One(roleDetail)
return
}
func GetAccountList(ctx context.Context, account string, tel string, ident string, name string) (AccountList []*entity.AccountInfo, err error) {
filtter := bson.M{}
if len(account) > 0 {
filtter["account"] = account
}
if len(tel) > 0 {
filtter["telephone"] = tel
}
if len(ident) > 0 {
filtter["identityCard"] = ident
}
if len(name) > 0 {
filtter["trueName"] = name
}
err = MongoDatabaseList[0].Collection("account").Find(ctx, filtter).All(&AccountList)
return
}

64
internal/serviceGame/internal/dbinit.go

@ -0,0 +1,64 @@
package internal
import (
"context"
"github.com/go-redis/redis/v8"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/qiniu/qmgo"
"time"
)
var (
MongoDatabaseList []*qmgo.Database
RedisDbList []*redis.Client
)
func init() {
//加载游戏相关配置
ctx := gctx.New()
mongoCfg, err := g.Cfg().Get(ctx, "game.mongo")
if err != nil {
return
}
MongoInit(mongoCfg.Maps())
redisCfg, err := g.Cfg().Get(ctx, "game.redis")
if err != nil {
return
}
RedisInit(redisCfg.Maps())
}
func MongoInit(config []map[string]interface{}) {
ctx := context.Background()
for _, v := range config {
client, err := qmgo.NewClient(ctx, &qmgo.Config{Uri: v["link"].(string)})
if err != nil {
panic(err)
}
db := client.Database(v["name"].(string))
MongoDatabaseList = append(MongoDatabaseList, db)
}
}
func RedisInit(config []map[string]interface{}) {
for _, v := range config {
rdb := redis.NewClient(&redis.Options{
Addr: v["address"].(string),
DialTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
PoolSize: 10,
PoolTimeout: 30 * time.Second,
})
RedisDbList = append(RedisDbList, rdb)
}
ctx := context.Background()
Test(ctx)
}
func Test(ctx context.Context) {
}

111
internal/serviceGame/internal/mail.go

@ -0,0 +1,111 @@
package internal
import (
"context"
"encoding/json"
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"
"go.mongodb.org/mongo-driver/bson"
"strings"
"tyj_admin/internal/model/entity"
)
func GetMails(ctx context.Context, uid string, serverId string, createTime1 int64, createTime2 int64) (mailList []*entity.Mail, err error) {
filter := bson.M{}
if len(uid) > 0 {
filter["to"] = uid
}
if len(serverId) > 0 {
filter["serverId"] = serverId
}
if createTime1 >= 0 && createTime2 > createTime1 {
filter["c_date"] = bson.M{"$lte": createTime2}
}
err = MongoDatabaseList[0].Collection("mail").Find(ctx, filter).All(&mailList)
return
}
func AddMail(ctx context.Context, mail entity.Mail) (err error) {
ss, err := MongoDatabaseList[0].Collection("mail").InsertOne(ctx, mail)
fmt.Println("ss %v", ss)
return
}
type MailBody struct {
entity.Mail
ModuleType string `json:"moduleType"`
}
type MqttMail struct {
ReqId int64 `json:"reqId"`
ModuleId string `json:"moduleId"`
Body MailBody `json:"body"`
}
func SendMqttMail(msg interface{}, c chan bool, server string) {
registerFunc := func(client mqtt.Client, qtmsg mqtt.Message) {
ss := string(msg.([]byte))
fmt.Println(ss)
err := ClientSend("client", 0, false, ss)
if err != nil {
c <- false
}
//ClientSend("client", 0, false, `{"reqId":3,"moduleId":"webadmin","body":{"uids":"lq0001","gm":1,"moduleType":"changeGM"}}`)
}
mailFunc := func(client mqtt.Client, qtmsg mqtt.Message) {
res := &MqttResult{}
client.Disconnect(1)
ss := string(qtmsg.Payload())
ss = ss[1 : len(ss)-1]
ss = strings.Replace(ss, "\\", "", -1)
err := json.Unmarshal([]byte(ss), res)
if err == nil && res.RespId == 1 {
c <- true
return
}
fmt.Println("error" + err.Error())
c <- false
}
if NewMqttClient(registerFunc, mailFunc, server) != nil {
c <- false
}
}
type MqttResult struct {
RespId int `json:"respId"`
Error interface{} `json:"error"`
}
//func Mailcallback(c mqtt.Client, msg mqtt.Message) {
// res := &MqttResult{}
// c.Disconnect(1)
// fmt.Println(string(msg.Payload()))
// ss := string(msg.Payload())
// ss = ss[1 : len(ss)-1]
// ss = strings.Replace(ss, "\\", "", -1)
// fmt.Println(ss)
// err := json.Unmarshal([]byte(ss), res)
// if err == nil && res.RespId == 1 {
// ch <- true
// return
// }
// fmt.Println("error" + err.Error())
// ch <- false
//
//}
//
//func RegisterCallback(c mqtt.Client, msg mqtt.Message) {
// ss := string(Payload.([]byte))
// fmt.Println(ss)
// err := ClientSend("client", 0, false, ss)
// if err != nil {
// ch <- false
// }
// //ClientSend("client", 0, false, `{"reqId":3,"moduleId":"webadmin","body":{"uids":"lq0001","gm":1,"moduleType":"changeGM"}}`)
//
//}

83
internal/serviceGame/internal/mqtt_client.go

@ -0,0 +1,83 @@
package internal
import (
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/gogf/gf/v2/errors/gerror"
)
var client mqtt.Client
func NewMqttClient(registerCallback mqtt.MessageHandler, callback mqtt.MessageHandler, server string) error {
if client == nil {
opts := mqtt.NewClientOptions()
opts.AddBroker(server) // 这个中转服务器不需要任何账号密码
opts.SetClientID("go_mqtt_client1")
opts.KeepAlive = 10
// opts.SetUsername("")
// opts.SetPassword("")
opts.OnConnect = func(c mqtt.Client) {
fmt.Println("MQTT链接成功!")
//ClientSend("client", 0, false, msg)
//ClientSend("client", 0, false, `{"reqId":3,"moduleId":"webadmin","body":{"uids":"lq0001","gm":0,"moduleType":"changeGM","moduleId":"webadmin","clientId":"pomelo_cli_1669166814692","username":"monitor"}}`)
ClientSend("register", 0, false, `{"type":"client","id":1,"username":"monitor","password":"monitor","md5":false}`)
//ClientSend("monitor", 0, false, `{"type":"client","moduleId":"webadmin","body":{"uids":"","gm":1,"moduleType":"changeGM","moduleId":"webadmin"}}`)
}
opts.OnConnectionLost = func(c mqtt.Client, err error) {
//NewClient()
}
client = mqtt.NewClient(opts)
}
if token := client.Connect(); token.Wait() && token.Error() != nil {
fmt.Println(token.Error())
return gerror.New("GM工具无法连接游戏服务器")
}
client.Subscribe("register", 0, registerCallback)
client.Subscribe("client", 0, callback)
return nil
}
func ClientSend(topic string, qos byte, retained bool, payload interface{}) error {
token := client.Publish(topic, qos, retained, payload)
if token != nil {
token.Wait()
if token.Error() != nil {
fmt.Println(topic+"失败!", token.Error())
return token.Error()
}
}
fmt.Println("消息发布成功!" + topic)
return nil
}
// 订阅消息
func ClientSubscribe(topic string, qos byte, callback mqtt.MessageHandler, err func(error)) {
if token := client.Subscribe(topic, qos, func(c mqtt.Client, msg mqtt.Message) {
callback(c, msg)
}); token.Wait() && token.Error() != nil {
err(token.Error())
}
}
func errorcallback(err error) {
fmt.Println("err:", err.Error())
}
func registerCallback(c mqtt.Client, msg mqtt.Message) {
fmt.Println("registerCallback:", string(msg.Payload()))
ClientSend("client", 0, false, `{"reqId":3,"moduleId":"webadmin","body":{"uids":"lq0001","gm":1,"moduleType":"changeGM"}}`)
ClientSend("client", 0, false, `{"reqId":3,"moduleId":"onlineUser","body":{}}`)
}
func clientCallback(c mqtt.Client, msg mqtt.Message) {
fmt.Println("clientCallback:", string(msg.Payload()))
}

62
internal/serviceGame/internal/online.go

@ -0,0 +1,62 @@
package internal
import (
"encoding/json"
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"
"strings"
)
type MqttOnlineReq struct {
ReqId int64 `json:"reqId"`
ModuleId string `json:"moduleId"`
}
type MqttOnlineRes struct {
RespId int `json:"respId"`
Error interface{} `json:"error"`
Body map[string]OnlineBody `json:"body"`
}
type OnlineBody struct {
ServerId string `json:"serverId"`
LoginedList []OnlineLoginInfo `json:"loginedList"`
}
type OnlineLoginInfo struct {
LoginTime int64 `json:"loginTime"`
Uid int32 `json:"uid"`
Address string `json:"address"`
}
func SendMqttOnline(msg interface{}, c chan *MqttOnlineRes, server string) {
registerFunc := func(client mqtt.Client, qtmsg mqtt.Message) {
ss := string(msg.([]byte))
fmt.Println(ss)
err := ClientSend("client", 0, false, ss)
if err != nil {
c <- &MqttOnlineRes{Error: err}
}
//ClientSend("client", 0, false, `{"reqId":3,"moduleId":"webadmin","body":{"uids":"lq0001","gm":1,"moduleType":"changeGM"}}`)
}
callback := func(client mqtt.Client, qtmsg mqtt.Message) {
res := &MqttOnlineRes{}
client.Disconnect(1)
ss := string(qtmsg.Payload())
ss = ss[1 : len(ss)-1]
ss = strings.Replace(ss, "\\", "", -1)
err := json.Unmarshal([]byte(ss), res)
if err == nil && res.RespId == 1 {
c <- res
return
}
c <- &MqttOnlineRes{Error: err}
}
if err := NewMqttClient(registerFunc, callback, server); err != nil {
c <- &MqttOnlineRes{Error: err}
}
}

63
internal/serviceGame/internal/order.go

@ -0,0 +1,63 @@
package internal
import (
"context"
"github.com/qiniu/qmgo"
"go.mongodb.org/mongo-driver/bson"
"tyj_admin/internal/model/entity"
)
func GetOrdersByAccount(ctx context.Context, account string) (orders []*entity.Order, err error) {
bm := bson.M{"uid": account}
err = MongoDatabaseList[0].Collection("rechargeOrder").Find(ctx, bm).All(&orders)
return
}
func GetOrdersByTime(ctx context.Context, lowTime int64, upperTime int64) (orders []*entity.Order, err error) {
bm := bson.M{"timestamp": bson.M{"$gte": lowTime, "$lte": upperTime}}
err = MongoDatabaseList[0].Collection("rechargeOrder").Find(ctx, bm).All(&orders)
return
}
func GetOrdersByOrderId(ctx context.Context, orderId string) (orders []*entity.Order, err error) {
bm := bson.M{"_id": orderId}
err = MongoDatabaseList[0].Collection("rechargeOrder").Find(ctx, bm).All(&orders)
return
}
func GetorderCount(ctx context.Context, filter bson.M, serverId int) (Orders []*entity.OrderCount, err error) {
if serverId == 0 {
for i := 1; i < len(MongoDatabaseList); i++ {
orderCount := new(entity.OrderCount)
orderCount.ServerId = i
serverMatch := bson.D{{"$match", bson.M{"server": i}}}
matchStage := bson.D{{"$match", filter}}
groupStage := bson.D{{"group", bson.M{"uid": `$uid`, "server": `$server`}}}
var in []bson.M
MongoDatabaseList[0].Collection("rechargeOrder").Aggregate(ctx, qmgo.Pipeline{serverMatch, matchStage, groupStage}).All(&in)
orderCount.Num = 1
groupStage = bson.D{{"group", bson.M{"totalMoney": bson.M{"$sum": "$money"}, "times": bson.M{"$sum": 1}}}}
var in2 []bson.M
MongoDatabaseList[0].Collection("rechargeOrder").Aggregate(ctx, qmgo.Pipeline{serverMatch, groupStage}).All(&in2)
}
} else {
orderCount := new(entity.OrderCount)
orderCount.ServerId = serverId
serverMatch := bson.D{{"$match", bson.M{"server": serverId}}}
matchStage := bson.D{{"$match", filter}}
groupStage := bson.D{{"group", bson.M{"uid": `$uid`, "server": `$server`}}}
var in []bson.M
MongoDatabaseList[0].Collection("rechargeOrder").Aggregate(ctx, qmgo.Pipeline{serverMatch, matchStage, groupStage}).All(&in)
orderCount.Num = 1
groupStage = bson.D{{"group", bson.M{"totalMoney": bson.M{"$sum": "$money"}, "times": bson.M{"$sum": 1}}}}
var in2 []bson.M
MongoDatabaseList[0].Collection("rechargeOrder").Aggregate(ctx, qmgo.Pipeline{serverMatch, groupStage}).All(&in2)
}
return
}

101
internal/serviceGame/mail.go

@ -0,0 +1,101 @@
package serviceGame
import (
"context"
"encoding/json"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/guid"
"strings"
"time"
"tyj_admin/api/v1/game"
"tyj_admin/internal/model/entity"
"tyj_admin/internal/serviceGame/internal"
)
type IGameMail interface {
GetMailList(ctx context.Context, req *game.MailsSearchReq) (res *game.MailsSearchRes, err error)
SendMail(ctx context.Context, req *game.MailSendReq) (res *game.MailSendRes, err error)
}
type gameMailImpl struct {
}
var gameMailService = gameMailImpl{}
func GameMail() IGameMail {
return &gameMailService
}
func (m *gameMailImpl) GetMailList(ctx context.Context, req *game.MailsSearchReq) (res *game.MailsSearchRes, err error) {
res = new(game.MailsSearchRes)
g.Try(ctx, func(ctx context.Context) {
res.Mails, err = internal.GetMails(ctx, req.Uid, req.ServerId, req.LowTime, req.UpperTime)
})
return
}
func (m *gameMailImpl) SendMail(ctx context.Context, req *game.MailSendReq) (res *game.MailSendRes, err error) {
res = new(game.MailSendRes)
mqttMail := internal.MqttMail{}
//mail := entity.Mail{}
mqttMail.Body.Mail.C_date = time.Now().UnixMilli()
mqttMail.Body.Mail.Id = guid.S()
mqttMail.Body.Mail.ServerId = req.ServerId
mqttMail.Body.Mail.Time = req.Time
mqttMail.Body.Mail.To = req.To
mqttMail.Body.Mail.From = "陶渊明"
mqttMail.Body.Mail.GmName = req.GmName
mqttMail.Body.Mail.Type = req.Type
mqttMail.Body.Mail.Expired = req.Expired
mqttMail.Body.Mail.NewGet = req.NewGet
mqttMail.Body.Mail.RepeatedCollection = req.RepeatedCollection
mqttMail.Body.Mail.Title = req.Title
mqttMail.Body.Mail.Content = req.Content
mqttMail.Body.Mail.Drops = GetDrops(req.Drops)
mqttMail.Body.Mail.Remark = req.Remark
mqttMail.Body.ModuleType = "sendMail"
mqttMail.ModuleId = "webadmin"
mqttMail.ReqId = 1
js, err := json.Marshal(mqttMail)
connectCh := make(chan bool)
server := "192.168.2.100:3005"
defer close(connectCh)
internal.SendMqttMail(js, connectCh, server)
var result bool
for {
select {
case result = <-connectCh:
if result == false {
err = gerror.New("失败")
return
} else {
return
}
}
}
internal.AddMail(ctx, mqttMail.Body.Mail)
return
}
func GetDrops(drop string) []entity.Drop {
var realDrops []entity.Drop
if len(drop) == 0 {
return realDrops
}
drops := strings.Split(drop, ",")
for _, v := range drops {
temp := strings.Split(v, ":")
if len(temp) != 2 {
continue
}
ss := entity.Drop{temp[0], temp[1]}
realDrops = append(realDrops, ss)
}
return realDrops
}

91
internal/serviceGame/order.go

@ -0,0 +1,91 @@
package serviceGame
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/bson"
"time"
"tyj_admin/api/v1/game"
"tyj_admin/internal/model/entity"
"tyj_admin/internal/serviceGame/internal"
)
type IGameOrder interface {
GetOrders(ctx context.Context, req *game.OrderSearchReq) (res *game.OrderSearchRes, err error)
GetOrderCount(ctx context.Context, req *game.OrderCountReq) (res *game.OrderCountRes, err error)
}
type gameOrderImpl struct {
}
var gameOrderService = gameOrderImpl{}
func GameOrder() IGameOrder {
return &gameOrderService
}
func (o gameOrderImpl) GetOrders(ctx context.Context, req *game.OrderSearchReq) (res *game.OrderSearchRes, err error) {
account := req.Account
role := new(entity.RoleDetail)
res = new(game.OrderSearchRes)
if req.SearchType == 1 { //账号+渠道查询
if len(req.Channel) > 0 {
account = req.Channel + "_" + account
}
g.Try(ctx, func(ctx context.Context) {
res.Orders, err = internal.GetOrdersByAccount(ctx, account)
})
} else if req.SearchType == 2 { //角色UID+区服
role, err = internal.GetRoleDetail(ctx, req.Uid, req.ServerId)
if err != nil {
return
}
account = role.Account
g.Try(ctx, func(ctx context.Context) {
res.Orders, err = internal.GetOrdersByAccount(ctx, account)
})
} else if req.SearchType == 3 { //时间段查询
g.Try(ctx, func(ctx context.Context) {
res.Orders, err = internal.GetOrdersByTime(ctx, req.LowTime, req.UpTime)
})
} else if req.SearchType == 4 { //时间段查询
g.Try(ctx, func(ctx context.Context) {
res.Orders, err = internal.GetOrdersByOrderId(ctx, req.OrderId)
})
}
return
}
func (o gameOrderImpl) GetOrderCount(ctx context.Context, req *game.OrderCountReq) (res *game.OrderCountRes, err error) {
filter := bson.M{}
if req.Amount > 0 {
switch req.CompareType {
case 1:
filter["money"] = req.Amount
case 2:
filter["money"] = bson.M{"$lte": req.Amount}
case 3:
filter["money"] = bson.M{"$lt": req.Amount}
case 4:
filter["money"] = bson.M{"$gt": req.Amount}
case 5:
filter["money"] = bson.M{"$gte": req.Amount}
}
}
if req.Gender > 0 {
filter["gender"] = req.Gender
}
if req.LowAge >= 0 && req.UpAge > 0 {
low := (time.Now().AddDate(-req.UpAge, 0, 0)).Unix()
up := (time.Now().AddDate(-req.LowAge, 0, 0)).Unix()
filter["bearTime"] = bson.M{"$gte": low, "$lte": up}
}
g.Try(ctx, func(ctx context.Context) {
res.Orders, err = internal.GetorderCount(ctx, filter, req.ServerId)
})
return
}

2
main.go

@ -8,6 +8,7 @@ import (
"tyj_admin/internal/cmd"
_ "tyj_admin/internal/packed"
"tyj_admin/internal/service"
_ "tyj_admin/internal/serviceGame"
)
func init() {
@ -19,6 +20,7 @@ func init() {
g.Log().Panic(ctx, err)
}
}
}
func main() {

2687
resource/data/gfast-v3.sql

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save