diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 74b540bbf..9db3b14ad 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -321,16 +321,15 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) { } stime := time.Now() // this.gateway.Debugf("----------3 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) - // ctx, _ := context.WithTimeout(context.Background(), time.Second*5) - ctx := context.Background() + ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + // ctx := context.Background() if len(serviceTag) == 0 { // this.gateway.Debugf("----------4 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) if err = this.gateway.Service().RpcCall(ctx, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil { this.gateway.Error("[UserResponse]", log.Field{Key: "uid", Value: this.uId}, log.Field{Key: "serviceTag", Value: serviceTag}, - log.Field{Key: "servicePath", Value: servicePath}, - log.Field{Key: "servicePath", Value: servicePath}, + log.Field{Key: "servicePath", Value: servicePath}, log.Field{Key: "req", Value: fmt.Sprintf("%s:%s %v", req.MainType, req.SubType, req.Message.String())}, log.Field{Key: "err", Value: err.Error()}, ) diff --git a/modules/worldtask/api_mine.go b/modules/worldtask/api_mine.go index 487060f3d..1565de738 100644 --- a/modules/worldtask/api_mine.go +++ b/modules/worldtask/api_mine.go @@ -45,33 +45,37 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( // 日常 if now-myWorldtask.DaliyRefreshTime >= 3600*24 { dailyIds := this.module.randomTask(user.Lv, dailyDes, myWorldtask) - for _, v := range dailyIds { - gwtd, err := this.module.configure.getWorldtaskById(v) - if err != nil || gwtd == nil { - continue - } - myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ - TaskId: v, - TaskType: gwtd.Des, + if len(dailyIds) > 0 { + for _, v := range dailyIds { + gwtd, err := this.module.configure.getWorldtaskById(v) + if err != nil || gwtd == nil { + continue + } + myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ + TaskId: v, + TaskType: gwtd.Des, + } } + update["daliyRefreshTime"] = configure.Now().Unix() } - update["daliyRefreshTime"] = configure.Now().Unix() } //周常 if now-myWorldtask.WeekRefreshTime >= 3600*24*7 { weekIds := this.module.randomTask(user.Lv, weekDes, myWorldtask) - for _, v := range weekIds { - gwtd, err := this.module.configure.getWorldtaskById(v) - if err != nil || gwtd == nil { - continue - } - myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ - TaskId: v, - TaskType: gwtd.Des, + if len(weekIds) > 0 { + for _, v := range weekIds { + gwtd, err := this.module.configure.getWorldtaskById(v) + if err != nil || gwtd == nil { + continue + } + myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{ + TaskId: v, + TaskType: gwtd.Des, + } } + update["weekRefreshTime"] = configure.Now().Unix() } - update["weekRefreshTime"] = configure.Now().Unix() } update["currentTask"] = myWorldtask.CurrentTask