diff --git a/modules/sociaty/api_cross_create.go b/modules/sociaty/api_cross_create.go index 264a5b019..ea7433cf1 100644 --- a/modules/sociaty/api_cross_create.go +++ b/modules/sociaty/api_cross_create.go @@ -116,7 +116,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) } //检查钻石 - if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true); errdata != nil { + if errdata = this.module.CheckRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}); errdata != nil { this.module.Warn("资源不足", log.Field{Key: "uid", Value: uid}, log.Field{Key: "res", Value: this.module.globalConf.GuildBuildCos}, @@ -205,14 +205,15 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype188, 1)) // 初始化玩家公会任务 - go func() { - if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil { - this.module.Error("初始化玩家公会任务", - log.Field{Key: "uid", Value: uid}, - log.Field{Key: "err", Value: err.Error()}, - ) - } - }() + if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil { + this.module.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{ Id: sociaty.Id, diff --git a/modules/sociaty/model_sociatytask.go b/modules/sociaty/model_sociatytask.go index b1c3a7bb3..815be10e9 100644 --- a/modules/sociaty/model_sociatytask.go +++ b/modules/sociaty/model_sociatytask.go @@ -37,6 +37,7 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error { taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList() globalConf := this.moduleSociaty.globalConf + var condIds []int32 // 大于4条配置 if len(taskListConf) > int(globalConf.GuildTaskNum) { // 按照权重 @@ -46,16 +47,20 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error { taskList = append(taskList, &pb.SociatyTask{ TaskId: taskListConf[v].TypeId, }) + condIds = append(condIds, taskListConf[v].TypeId) } } else { for _, v := range taskListConf { taskList = append(taskList, &pb.SociatyTask{ TaskId: v.TypeId, }) + condIds = append(condIds, v.TypeId) } } sociatyTask.TaskList = taskList sociatyTask.LastUpdateTime = configure.Now().Unix() + // 激活所有任务 + this.moduleSociaty.ModuleBuried.ActiveCondition(uid, condIds...) return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask) }