切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
0ed834e52ae6a3ec7a74312ab1c686cb06040bc1
2 个父辈
f4abd808
c5049b51
Merge branch 'test' into dev-tangxvhui
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
31 行增加
和
11 行删除
deploy/k8s/prd/performance-back.yaml
deploy/k8s/test/performance-back.yaml
main.go
pkg/application/evaluation_project/project_service.go
pkg/constant/common.go
pkg/infrastructure/repository/pg_staff_assess_repository.go
pkg/infrastructure/repository/pg_staff_assess_task_repository.go
deploy/k8s/prd/performance-back.yaml
查看文件 @
0ed834e
...
...
@@ -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
...
...
deploy/k8s/test/performance-back.yaml
查看文件 @
0ed834e
...
...
@@ -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
...
...
main.go
查看文件 @
0ed834e
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
())
...
...
pkg/application/evaluation_project/project_service.go
查看文件 @
0ed834e
...
...
@@ -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
(
now
O
)
{
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
(
now
O
)
{
nextTime
:=
utils
.
NextTime
(
nowO
,
startLocal
,
node
.
KpiCycle
)
task
.
NextSentAt
=
&
nextTime
}
else
{
...
...
pkg/constant/common.go
查看文件 @
0ed834e
...
...
@@ -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"
)
}
}
...
...
pkg/infrastructure/repository/pg_staff_assess_repository.go
查看文件 @
0ed834e
...
...
@@ -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
...
...
pkg/infrastructure/repository/pg_staff_assess_task_repository.go
查看文件 @
0ed834e
...
...
@@ -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
...
...
请
注册
或
登录
后发表评论