Compare commits

..

No commits in common. "f6692be36874d7a0bbbb1f55531dd6daef32eec0" and "d98d6faf95d31c60b660971cc72f2c3d2597a4e8" have entirely different histories.

2 changed files with 9 additions and 15 deletions

View File

@ -116,7 +116,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
} }
//检查钻石 //检查钻石
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}); errdata != nil { if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true); errdata != nil {
this.module.Warn("资源不足", this.module.Warn("资源不足",
log.Field{Key: "uid", Value: uid}, log.Field{Key: "uid", Value: uid},
log.Field{Key: "res", Value: this.module.globalConf.GuildBuildCos}, log.Field{Key: "res", Value: this.module.globalConf.GuildBuildCos},
@ -205,15 +205,14 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype188, 1)) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype188, 1))
// 初始化玩家公会任务 // 初始化玩家公会任务
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil { go func() {
this.module.Error("初始化玩家公会任务", if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
log.Field{Key: "uid", Value: uid}, this.module.Error("初始化玩家公会任务",
log.Field{Key: "err", Value: err.Error()}, log.Field{Key: "uid", Value: uid},
) log.Field{Key: "err", Value: err.Error()},
} )
}
//扣除钻石 }()
this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true)
session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{ session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{
Id: sociaty.Id, Id: sociaty.Id,

View File

@ -37,7 +37,6 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList() taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList()
globalConf := this.moduleSociaty.globalConf globalConf := this.moduleSociaty.globalConf
var condIds []int32
// 大于4条配置 // 大于4条配置
if len(taskListConf) > int(globalConf.GuildTaskNum) { if len(taskListConf) > int(globalConf.GuildTaskNum) {
// 按照权重 // 按照权重
@ -47,20 +46,16 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
taskList = append(taskList, &pb.SociatyTask{ taskList = append(taskList, &pb.SociatyTask{
TaskId: taskListConf[v].TypeId, TaskId: taskListConf[v].TypeId,
}) })
condIds = append(condIds, taskListConf[v].TypeId)
} }
} else { } else {
for _, v := range taskListConf { for _, v := range taskListConf {
taskList = append(taskList, &pb.SociatyTask{ taskList = append(taskList, &pb.SociatyTask{
TaskId: v.TypeId, TaskId: v.TypeId,
}) })
condIds = append(condIds, v.TypeId)
} }
} }
sociatyTask.TaskList = taskList sociatyTask.TaskList = taskList
sociatyTask.LastUpdateTime = configure.Now().Unix() sociatyTask.LastUpdateTime = configure.Now().Unix()
// 激活所有任务
this.moduleSociaty.ModuleBuried.ActiveCondition(uid, condIds...)
return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask) return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask)
} }