修复代码
This commit is contained in:
parent
abaf242108
commit
019455923d
@ -293,7 +293,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
|
||||
if len(tasks) > 0 {
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype95, 1))
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
})
|
||||
}
|
||||
return
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
@ -36,27 +35,27 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
|
||||
var taskList []*pb.SociatyTask
|
||||
|
||||
taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList()
|
||||
globalConf := this.moduleSociaty.globalConf
|
||||
// globalConf := this.moduleSociaty.globalConf
|
||||
var condIds []int32
|
||||
// 大于4条配置
|
||||
if len(taskListConf) > int(globalConf.GuildTaskNum) {
|
||||
// 按照权重
|
||||
//随机4条任务
|
||||
randInts := utils.RandomNumbers(0, len(taskListConf)-1, int(globalConf.GuildTaskNum))
|
||||
for _, v := range randInts {
|
||||
taskList = append(taskList, &pb.SociatyTask{
|
||||
TaskId: taskListConf[v].TypeId,
|
||||
})
|
||||
condIds = append(condIds, taskListConf[v].TypeId)
|
||||
}
|
||||
} else {
|
||||
// if len(taskListConf) > int(globalConf.GuildTaskNum) {
|
||||
// // 按照权重
|
||||
// //随机4条任务
|
||||
// randInts := utils.RandomNumbers(0, len(taskListConf)-1, int(globalConf.GuildTaskNum))
|
||||
// for _, v := range randInts {
|
||||
// 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()
|
||||
// 激活所有任务
|
||||
|
@ -323,48 +323,49 @@ type TaskParams struct {
|
||||
}
|
||||
|
||||
// 任务条件达成通知
|
||||
// 废弃 不需要主动推送任务变化 前端主动刷新页面即可
|
||||
func (this *Sociaty) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) {
|
||||
log.Debug("公会任务通知",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "condIds", Value: conds})
|
||||
// log.Debug("公会任务通知",
|
||||
// log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
// log.Field{Key: "condIds", Value: conds})
|
||||
|
||||
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||
if sociaty == nil {
|
||||
return
|
||||
}
|
||||
// sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||
// if sociaty == nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
sociatyId := sociaty.Id
|
||||
// sociatyId := sociaty.Id
|
||||
|
||||
dt := &pb.DBSociatyTask{}
|
||||
err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
comm.Service_Worker, string(comm.Rpc_ModuleSociatyGetTask),
|
||||
&pb.RPCGeneralReqA2{Param1: sociatyId, Param2: session.GetUserId()}, dt)
|
||||
// dt := &pb.DBSociatyTask{}
|
||||
// err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
// comm.Service_Worker, string(comm.Rpc_ModuleSociatyGetTask),
|
||||
// &pb.RPCGeneralReqA2{Param1: sociatyId, Param2: session.GetUserId()}, dt)
|
||||
|
||||
var flag bool
|
||||
for _, v := range dt.TaskList {
|
||||
for _, cond := range conds {
|
||||
if v.TaskId == cond.Conid && cond.State == pb.BuriedItemFinishState_buried_finish {
|
||||
v.Status = 1
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if !flag {
|
||||
return
|
||||
}
|
||||
// var flag bool
|
||||
// for _, v := range dt.TaskList {
|
||||
// for _, cond := range conds {
|
||||
// if v.TaskId == cond.Conid && cond.State == pb.BuriedItemFinishState_buried_finish {
|
||||
// v.Status = 1
|
||||
// flag = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if !flag {
|
||||
// return
|
||||
// }
|
||||
|
||||
update := map[string]interface{}{
|
||||
"taskList": dt.TaskList,
|
||||
"lastUpdateTime": configure.Now().Unix(),
|
||||
}
|
||||
// update := map[string]interface{}{
|
||||
// "taskList": dt.TaskList,
|
||||
// "lastUpdateTime": configure.Now().Unix(),
|
||||
// }
|
||||
|
||||
err = this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
comm.Service_Worker, string(comm.Rpc_ModuleSociatyTask),
|
||||
&TaskParams{SociatyId: sociatyId, Uid: session.GetUserId(), Data: update}, &pb.EmptyResp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
// err = this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
// comm.Service_Worker, string(comm.Rpc_ModuleSociatyTask),
|
||||
// &TaskParams{SociatyId: sociatyId, Uid: session.GetUserId(), Data: update}, &pb.EmptyResp{})
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
}
|
||||
|
||||
func (this *Sociaty) RpcUpdateUserTask(ctx context.Context, p *TaskParams, reply *pb.EmptyResp) error {
|
||||
|
@ -102,12 +102,12 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser, err error) {
|
||||
this.module.Errorln(err)
|
||||
} else {
|
||||
if err = model.Get(uid, user); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
this.module.Errorf("uid:%s err:%v", uid, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err = this.Get(uid, user); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
this.module.Errorf("uid:%s err:%v", uid, err)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user