Browse Source

fix: 解决计划任务时区显示不一致的问题 (#5230)

Refs  #5211
pull/5237/head
ssongliu 6 months ago committed by GitHub
parent
commit
bf7a4f3254
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      backend/app/dto/cronjob.go
  2. 1
      backend/app/service/cornjob.go
  3. 3
      cmd/server/docs/docs.go
  4. 3
      cmd/server/docs/swagger.json
  5. 2
      cmd/server/docs/swagger.yaml
  6. 3
      frontend/src/api/interface/cronjob.ts
  7. 2
      frontend/src/views/cronjob/record/index.vue

16
backend/app/dto/cronjob.go

@ -98,12 +98,12 @@ type SearchRecord struct {
} }
type Record struct { type Record struct {
ID uint `json:"id"` ID uint `json:"id"`
StartTime time.Time `json:"startTime"` StartTime string `json:"startTime"`
Records string `json:"records"` Records string `json:"records"`
Status string `json:"status"` Status string `json:"status"`
Message string `json:"message"` Message string `json:"message"`
TargetPath string `json:"targetPath"` TargetPath string `json:"targetPath"`
Interval int `json:"interval"` Interval int `json:"interval"`
File string `json:"file"` File string `json:"file"`
} }

1
backend/app/service/cornjob.go

@ -71,6 +71,7 @@ func (u *CronjobService) SearchRecords(search dto.SearchRecord) (int64, interfac
if err := copier.Copy(&item, &record); err != nil { if err := copier.Copy(&item, &record); err != nil {
return 0, nil, errors.WithMessage(constant.ErrStructTransform, err.Error()) return 0, nil, errors.WithMessage(constant.ErrStructTransform, err.Error())
} }
item.StartTime = record.StartTime.Format("2006-01-02 15:04:05")
dtoCronjobs = append(dtoCronjobs, item) dtoCronjobs = append(dtoCronjobs, item)
} }
return total, dtoCronjobs, err return total, dtoCronjobs, err

3
cmd/server/docs/docs.go

@ -19488,6 +19488,9 @@ const docTemplate = `{
"pageSize": { "pageSize": {
"type": "integer" "type": "integer"
}, },
"sync": {
"type": "boolean"
},
"tags": { "tags": {
"type": "array", "type": "array",
"items": { "items": {

3
cmd/server/docs/swagger.json

@ -19481,6 +19481,9 @@
"pageSize": { "pageSize": {
"type": "integer" "type": "integer"
}, },
"sync": {
"type": "boolean"
},
"tags": { "tags": {
"type": "array", "type": "array",
"items": { "items": {

2
cmd/server/docs/swagger.yaml

@ -3323,6 +3323,8 @@ definitions:
type: integer type: integer
pageSize: pageSize:
type: integer type: integer
sync:
type: boolean
tags: tags:
items: items:
type: string type: string

3
frontend/src/api/interface/cronjob.ts

@ -90,8 +90,7 @@ export namespace Cronjob {
export interface Record { export interface Record {
id: number; id: number;
file: string; file: string;
startTime: Date; startTime: string;
endTime: Date;
records: string; records: string;
status: string; status: string;
message: string; message: string;

2
frontend/src/views/cronjob/record/index.vue

@ -108,7 +108,7 @@
{{ $t('commons.status.failed') }} {{ $t('commons.status.failed') }}
</el-tag> </el-tag>
<span> <span>
{{ dateFormat(0, 0, row.startTime) }} {{ row.startTime }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>

Loading…
Cancel
Save