56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package guildgve
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) SetFireCheck(session comm.IUserSession, req *pb.GuildGveSetFireReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// 获取工会设置集火
|
|
func (this *apiComp) SetFire(session comm.IUserSession, req *pb.GuildGveSetFireReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DBGuildGve
|
|
err error
|
|
)
|
|
if errdata = this.SetFireCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
lock, _ := this.module.modelGuildGve.userlock(req.Guildid)
|
|
err = lock.Lock()
|
|
if err != nil {
|
|
this.module.Error("公会战分布式锁 err!", log.Field{Key: "Unionid", Value: req.Guildid}, log.Field{Key: "err", Value: err.Error()})
|
|
return
|
|
}
|
|
defer lock.Unlock()
|
|
|
|
if info, err = this.module.modelGuildGve.getGuildGve(req.Guildid); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
info.Notice = req.Notice
|
|
info.Fire = req.Boosid
|
|
|
|
if err = this.module.modelGuildGve.updateGuildGve(info); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
go this.module.modelGuildGve.infochangepush(req.Guildid, info)
|
|
session.SendMsg(string(this.module.GetType()), "setfire", &pb.GuildGveSetFireResp{})
|
|
return
|
|
}
|