上传礼包过期处理
This commit is contained in:
parent
f3c14c4eb7
commit
bc803d2203
@ -3,6 +3,9 @@ package pushgiftbag
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
@ -15,6 +18,8 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.PushGiftbagInf
|
||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.PushGiftbagInfoReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
info *pb.DBPushGiftbag
|
||||
conf *cfg.GamePushGiftData
|
||||
bugs []*pb.DBPushGiftbagItem
|
||||
err error
|
||||
)
|
||||
if errdata = this.InfoCheck(session, req); errdata != nil {
|
||||
@ -29,7 +34,21 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PushGiftbagInfoReq)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
bugs = make([]*pb.DBPushGiftbagItem, 0)
|
||||
for _, v := range info.Item {
|
||||
if conf, err = this.module.configure.getGamePushGiftbyid(v.Id); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if !configure.Now().After(time.Unix(v.Stime, 0).Add(time.Duration(conf.Time) * time.Second)) {
|
||||
bugs = append(bugs, v)
|
||||
}
|
||||
}
|
||||
info.Item = bugs
|
||||
session.SendMsg(string(this.module.GetType()), "info", &pb.PushGiftbagInfoResp{Item: info.Item})
|
||||
return
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package pushgiftbag
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -33,3 +34,20 @@ func (this *configureComp) getGamePushGift() (conf []*cfg.GamePushGiftData, err
|
||||
conf = v.(*cfg.GamePushGift).GetDataList()
|
||||
return
|
||||
}
|
||||
|
||||
//获取礼包代码
|
||||
func (this *configureComp) getGamePushGiftbyid(id int32) (conf *cfg.GamePushGiftData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_pushgift); err != nil {
|
||||
return
|
||||
}
|
||||
if conf, ok = v.(*cfg.GamePushGift).GetDataMap()[id]; ok {
|
||||
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pushgift, id)
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -88,6 +88,9 @@ func (this *PushGiftbag) Delivery(session comm.IUserSession, pid string) (errdat
|
||||
info.Item = append(info.Item[0:i], info.Item[i+1:]...)
|
||||
}
|
||||
}
|
||||
this.model.Change(session.GetUserId(), map[string]interface{}{
|
||||
"item": info.Item,
|
||||
})
|
||||
session.SendMsg(string(this.GetType()), "chanage", &pb.PushGiftbagChanagePush{Item: info.Item})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user