generated from root/miduo_server
黑名单封禁时间
parent
4672866814
commit
952ed777eb
|
|
@ -965,6 +965,7 @@ func (action *Action) DelWhiteList(r *ghttp.Request) {
|
||||||
|
|
||||||
//黑名单列表
|
//黑名单列表
|
||||||
func (action *Action) BlackList(r *ghttp.Request) {
|
func (action *Action) BlackList(r *ghttp.Request) {
|
||||||
|
var timeLayoutStr = "2006-01-02 15:04:05"
|
||||||
form := base.NewForm(r.GetMap())
|
form := base.NewForm(r.GetMap())
|
||||||
bs := bson.D{}
|
bs := bson.D{}
|
||||||
if form.Params != nil {
|
if form.Params != nil {
|
||||||
|
|
@ -992,6 +993,11 @@ func (action *Action) BlackList(r *ghttp.Request) {
|
||||||
}
|
}
|
||||||
dayMap.Set("id", blackList.Id)
|
dayMap.Set("id", blackList.Id)
|
||||||
dayMap.Set("openId", blackList.OpenId)
|
dayMap.Set("openId", blackList.OpenId)
|
||||||
|
if blackList.UnblockTime > 0 {
|
||||||
|
dayMap.Set("unblockTime", time.Unix(blackList.UnblockTime, 0).Format(timeLayoutStr))
|
||||||
|
} else {
|
||||||
|
dayMap.Set("unblockTime", "永久封禁")
|
||||||
|
}
|
||||||
data = append(g.ListAnyAny{gconv.Map(dayMap)}, data...)
|
data = append(g.ListAnyAny{gconv.Map(dayMap)}, data...)
|
||||||
}
|
}
|
||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
|
|
@ -1008,6 +1014,7 @@ func (action *Action) BlackList(r *ghttp.Request) {
|
||||||
func (action *Action) SaveBlackList(r *ghttp.Request) {
|
func (action *Action) SaveBlackList(r *ghttp.Request) {
|
||||||
id := r.Form.Get("id")
|
id := r.Form.Get("id")
|
||||||
openid := r.Form.Get("openId")
|
openid := r.Form.Get("openId")
|
||||||
|
blockTime := gconv.Int64(r.Form.Get("time"))
|
||||||
obj_id := primitive.NewObjectID()
|
obj_id := primitive.NewObjectID()
|
||||||
if id != "" {
|
if id != "" {
|
||||||
obj_id, _ = primitive.ObjectIDFromHex(id)
|
obj_id, _ = primitive.ObjectIDFromHex(id)
|
||||||
|
|
@ -1015,6 +1022,11 @@ func (action *Action) SaveBlackList(r *ghttp.Request) {
|
||||||
blackList := new(gameinfo.BlackList)
|
blackList := new(gameinfo.BlackList)
|
||||||
blackList.Id = obj_id
|
blackList.Id = obj_id
|
||||||
blackList.OpenId = openid
|
blackList.OpenId = openid
|
||||||
|
if blockTime > 0 {
|
||||||
|
blackList.UnblockTime = time.Now().Unix() + blockTime*60
|
||||||
|
} else {
|
||||||
|
blackList.UnblockTime = -1
|
||||||
|
}
|
||||||
res := gameinfo.ModelBlackList.AddBlackList(id, openid, blackList)
|
res := gameinfo.ModelBlackList.AddBlackList(id, openid, blackList)
|
||||||
if res > 0 {
|
if res > 0 {
|
||||||
base.Succ(r, g.Map{"code": 0, "result": "操作成功"})
|
base.Succ(r, g.Map{"code": 0, "result": "操作成功"})
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlackList struct {
|
type BlackList struct {
|
||||||
Id primitive.ObjectID `bson:"_id" json:"id"`
|
Id primitive.ObjectID `bson:"_id" json:"id"`
|
||||||
OpenId string `bson:"openId" json:"openId"`
|
OpenId string `bson:"openId" json:"openId"`
|
||||||
|
UnblockTime int64 `bson:"unblockTime" json:"unblockTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue