作者 tangxvhui

Merge branch 'test' into dev-tangxvhui

... ... @@ -60,6 +60,8 @@ spec:
value: "debug"
- name: LOG_FILE
value: "true"
- name: ENV_MOD
value: "prd"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
... ...
... ... @@ -60,6 +60,8 @@ spec:
value: "debug"
- name: LOG_FILE
value: "true"
- name: ENV_MOD
value: "test"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
... ...
package main
import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
"time"
"github.com/beego/beego/v2/server/web"
... ... @@ -27,7 +28,13 @@ func startNodeTask() {
go func() {
nodeTaskService := serviceTask.NewNodeTaskService()
for {
timer := time.NewTimer(time.Second * 60)
var duration time.Duration
if constant.Env == "prd" {
duration = time.Minute * 5
} else {
duration = time.Minute * 1
}
timer := time.NewTimer(duration)
<-timer.C
if err := nodeTaskService.SendEvaluationNode(); err != nil {
log.Logger.Error(err.Error())
... ...
... ... @@ -176,7 +176,8 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
}
now := time.Now().Local()
nowO := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
year, month, day := now.Date()
nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
for i := range tasks {
task := tasks[i]
... ... @@ -191,7 +192,7 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
endLocal := task.TimeEnd.Local()
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(now) {
if startLocal.Before(nowO) {
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
task.NextSentAt = &nextTime
} else {
... ... @@ -460,7 +461,8 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
}
now := time.Now().Local()
nowO := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
year, month, day := now.Date()
nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
for i := range project.Template.LinkNodes {
node := project.Template.LinkNodes[i]
... ... @@ -486,7 +488,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
endLocal := task.TimeEnd.Local()
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(now) {
if startLocal.Before(nowO) {
nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
task.NextSentAt = &nextTime
} else {
... ...
... ... @@ -11,8 +11,15 @@ var AdminJwtExpiresIn = int64(3600 * 24 * 7)
var AdminJWTSecretKey = "sg-storage"
// Env 判断当前环境变量
var Env = "dev"
func init() {
if os.Getenv("LOG_LEVEL") != "" {
LOG_LEVEL = os.Getenv("LOG_LEVEL")
}
if os.Getenv("ENV_MOD") != "" {
Env = os.Getenv("ENV_MOD")
}
}
... ...
... ... @@ -63,8 +63,8 @@ func (repo *StaffAssessRepository) Save(d *domain.StaffAssess) (*domain.StaffAss
Status: string(d.Status),
BeginTime: d.BeginTime,
EndTime: d.EndTime,
CreatedAt: d.EndTime,
UpdatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
tx := repo.transactionContext.PgTx
... ...
... ... @@ -34,8 +34,8 @@ func (repo *StaffAssessTaskRepository) TransformToDomain(d *models.StaffAssessTa
EndTime: d.EndTime,
StepList: d.StepList,
ExecutorId: d.ExecutorId,
CreatedAt: d.EndTime,
UpdatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
}
... ... @@ -53,8 +53,8 @@ func (repo *StaffAssessTaskRepository) Save(d *domain.StaffAssessTask) (*domain.
StepList: d.StepList,
BeginTime: d.BeginTime,
EndTime: d.EndTime,
CreatedAt: d.EndTime,
UpdatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
tx := repo.transactionContext.PgTx
... ...