日周常任务

This commit is contained in:
wh_zcy 2023-04-04 14:41:07 +08:00
parent 14b784d324
commit 24c248323f
2 changed files with 25 additions and 22 deletions

View File

@ -321,8 +321,8 @@ 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 {
@ -330,7 +330,6 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
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: "req", Value: fmt.Sprintf("%s:%s %v", req.MainType, req.SubType, req.Message.String())},
log.Field{Key: "err", Value: err.Error()},
)

View File

@ -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