46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package expedition
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.ExpeditionInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// 获取工会boos战信息
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.ExpeditionInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
member *pb.DBGuildMember
|
|
info *pb.DBExpedition
|
|
err error
|
|
)
|
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
lock, _ := this.module.modelExpedition.userlock(req.Guildid)
|
|
err = lock.Lock()
|
|
if err != nil {
|
|
this.module.Error("公会战分布式锁 err!", log.Field{Key: "Guildid", Value: req.Guildid}, log.Field{Key: "err", Value: err.Error()})
|
|
return
|
|
}
|
|
defer lock.Unlock()
|
|
if info, err = this.module.modelExpedition.getInfo(req.Guildid); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if !utils.IsSameWeek(member.Refreshtime) {
|
|
this.module.modelExpedition.refreshBoos(info)
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.ExpeditionInfoResp{Info: info})
|
|
return
|
|
}
|