generated from root/miduo_server
单服黑名单,充值排行
parent
26a9a99f92
commit
32190499bf
|
|
@ -586,6 +586,42 @@ func (action *Action) PlayerInfo(r *ghttp.Request) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (action *Action) PlayerRegisterInfo(r *ghttp.Request) {
|
||||||
|
form := base.NewForm(r.GetQueryMap())
|
||||||
|
page := g.ListAnyAny{}
|
||||||
|
//f:=&form
|
||||||
|
openid := r.Form.Get("openid")
|
||||||
|
if openid == "" {
|
||||||
|
base.Succ(r,
|
||||||
|
g.Map{
|
||||||
|
"page": form.Page,
|
||||||
|
"rows": page,
|
||||||
|
"total": form.TotalPage,
|
||||||
|
"records": form.TotalSize,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result := gameinfo.ModelUserRegisterInfo.FindOne("openId", openid)
|
||||||
|
var userRegisterInfo gameinfo.UserRegisterInfo
|
||||||
|
err := result.Decode(&userRegisterInfo)
|
||||||
|
if err != nil {
|
||||||
|
base.Fail(r, "查询失败")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dmap := gmap.NewStrAnyMap()
|
||||||
|
dmap.Set("id", userRegisterInfo.Id)
|
||||||
|
dmap.Set("openId", userRegisterInfo.OpenId)
|
||||||
|
page = append(page, gconv.Map(dmap))
|
||||||
|
fmt.Println(len(page))
|
||||||
|
|
||||||
|
base.Succ(r,
|
||||||
|
g.Map{
|
||||||
|
"rows": page,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (action *Action) Lv(r *ghttp.Request) {
|
func (action *Action) Lv(r *ghttp.Request) {
|
||||||
form := base.NewForm(r.GetMap())
|
form := base.NewForm(r.GetMap())
|
||||||
serverid := form.Params["serverid"]
|
serverid := form.Params["serverid"]
|
||||||
|
|
@ -2041,3 +2077,76 @@ func (action *Action) GetUserItemList(r *ghttp.Request) {
|
||||||
"current": 0,
|
"current": 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询充值排行榜
|
||||||
|
func (action *Action) GetRechargeRank(r *ghttp.Request) {
|
||||||
|
var timeLayoutStr = "2006-01-02 15:04:05"
|
||||||
|
form := base.NewForm(r.GetMap())
|
||||||
|
startTimeStr := form.Params["startTime"]
|
||||||
|
endTimeStr := form.Params["endTime"]
|
||||||
|
serverId := gconv.Int(form.Params["serverid"])
|
||||||
|
if startTimeStr == "" || endTimeStr == "" {
|
||||||
|
base.Fail(r, "请选择查询的时间范围")
|
||||||
|
}
|
||||||
|
startTime, err := time.Parse(timeLayoutStr, startTimeStr)
|
||||||
|
if err != nil {
|
||||||
|
base.Fail(r, "时间格式有误")
|
||||||
|
}
|
||||||
|
endTime, err := time.Parse(timeLayoutStr, endTimeStr)
|
||||||
|
if err != nil {
|
||||||
|
base.Fail(r, "时间格式有误")
|
||||||
|
}
|
||||||
|
duration := endTime.Sub(startTime)
|
||||||
|
if duration.Milliseconds() > 1000*3600*24*92 {
|
||||||
|
base.Fail(r, "时间范围不可超过三个月")
|
||||||
|
}
|
||||||
|
bs := bson.A{}
|
||||||
|
if serverId != 0 {
|
||||||
|
serverMatch := bson.D{{
|
||||||
|
"$match", bson.D{{
|
||||||
|
"region", serverId,
|
||||||
|
}},
|
||||||
|
}}
|
||||||
|
bs = append(bs, serverMatch)
|
||||||
|
}
|
||||||
|
match := bson.D{{
|
||||||
|
"$match", bson.D{{
|
||||||
|
"creattime", bson.D{{"$gte", startTimeStr}, {"$lte", endTimeStr}},
|
||||||
|
}},
|
||||||
|
}}
|
||||||
|
group := bson.D{{
|
||||||
|
"$group", bson.D{
|
||||||
|
{"_id", "$openid"},
|
||||||
|
{"totalMoney", bson.D{{"$sum", "$money"}}},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
sort := bson.D{{
|
||||||
|
"$sort", bson.D{
|
||||||
|
{"totalMoney", -1},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
limit := bson.D{{
|
||||||
|
"$limit", 50,
|
||||||
|
}}
|
||||||
|
bs = append(bs, match, group, sort, limit)
|
||||||
|
allBson := gameinfo.ModelRechargeTotal.FindPipeline(bs)
|
||||||
|
data := g.ListAnyAny{}
|
||||||
|
for allBson.Next(context.TODO()) {
|
||||||
|
var rechargeTotal gameinfo.RechargeTotal
|
||||||
|
err := allBson.Decode(&rechargeTotal)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("%s", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dataMap := gmap.New()
|
||||||
|
dataMap.Set("id", rechargeTotal.Id)
|
||||||
|
dataMap.Set("totalMoney", rechargeTotal.TotalMoney)
|
||||||
|
data = append(data, gconv.Map(dataMap))
|
||||||
|
}
|
||||||
|
base.Succ(r,
|
||||||
|
g.Map{
|
||||||
|
"rows": data,
|
||||||
|
"total": 0,
|
||||||
|
"current": 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package gameinfo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/frame/g"
|
||||||
|
dao "gmanager/library/mongo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RechargeTotal struct {
|
||||||
|
Id string `bson:"_id" json:"_id"`
|
||||||
|
TotalMoney int32 `bson:"totalMoney" json:"money"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Table is the table name of account.
|
||||||
|
TableRechargeTotal = "pay"
|
||||||
|
RechargeTotalTablbeName = g.Config().GetString("db.core")
|
||||||
|
// Model is the model object of account.
|
||||||
|
ModelRechargeTotal = dao.NewMgo(RechargeTotalTablbeName, TableRechargeTotal)
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package gameinfo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/frame/g"
|
||||||
|
dao "gmanager/library/mongo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserRegisterInfo struct {
|
||||||
|
Id string `bson:"_id" json:"id"`
|
||||||
|
OpenId string `bson:"openId" json:"openId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Table is the table name of account.
|
||||||
|
TableRegisterUserInfo = "user_register_info"
|
||||||
|
UserRegisterInfoTablbeName = g.Config().GetString("db.core")
|
||||||
|
// Model is the model object of account.
|
||||||
|
ModelUserRegisterInfo = dao.NewMgo(UserRegisterInfoTablbeName, TableRegisterUserInfo)
|
||||||
|
)
|
||||||
|
|
@ -90,6 +90,15 @@ func (m *Mgo) FindAllBson(filter bson.D) *mongo.Cursor {
|
||||||
return singleResult
|
return singleResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mgo) FindPipeline(filter bson.A) *mongo.Cursor {
|
||||||
|
client := DB.Mongo
|
||||||
|
collection, _ := client.Database(m.database).Collection(m.collection).Clone()
|
||||||
|
//collection.
|
||||||
|
//filter := bson.D{{key, value}}
|
||||||
|
singleResult, _ := collection.Aggregate(context.TODO(), filter)
|
||||||
|
return singleResult
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Mgo) FindAllBson_ServerId(filter bson.D, serverId string) *mongo.Cursor {
|
func (m *Mgo) FindAllBson_ServerId(filter bson.D, serverId string) *mongo.Cursor {
|
||||||
client := DB.Mongo
|
client := DB.Mongo
|
||||||
collection, _ := client.Database(m.database).Collection(m.collection + "_" + serverId).Clone()
|
collection, _ := client.Database(m.database).Collection(m.collection + "_" + serverId).Clone()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue