写数据一键测试

This commit is contained in:
renzhiyuan 2024-12-04 19:49:39 +08:00
parent e24aabb8f0
commit 1a89850b5f
2 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,6 @@ import (
"cron_admin/app/models/croncmdmodel" "cron_admin/app/models/croncmdmodel"
"cron_admin/app/models/crondbmodel" "cron_admin/app/models/crondbmodel"
"cron_admin/app/models/cronreportchannelmodel" "cron_admin/app/models/cronreportchannelmodel"
"cron_admin/app/models/cronusermodel"
"time" "time"
) )
@ -42,7 +41,7 @@ type CmdListResponse struct {
UpdateTime string `json:"update_time"` UpdateTime string `json:"update_time"`
Status int `json:"status"` Status int `json:"status"`
FailReason string `json:"fail_reason"` FailReason string `json:"fail_reason"`
Users []*cronusermodel.CronUser `json:"users"` Users string `json:"users"`
ReadDb *crondbmodel.CronDb `json:"read_db"` ReadDb *crondbmodel.CronDb `json:"read_db"`
WriteDb *crondbmodel.CronDb `json:"write_db"` WriteDb *crondbmodel.CronDb `json:"write_db"`
ReportChannel *cronreportchannelmodel.CronReportChannel `json:"report_channel"` ReportChannel *cronreportchannelmodel.CronReportChannel `json:"report_channel"`

View File

@ -251,10 +251,12 @@ func ListToRep(list []croncmdmodel.CronCmd) (cmdList []backend.CmdListResponse,
} }
if len(in.UserIds) != 0 { if len(in.UserIds) != 0 {
var users []string
for _, v := range strings.Split(in.UserIds, ",") { for _, v := range strings.Split(in.UserIds, ",") {
intVal, _ := strconv.Atoi(v) intVal, _ := strconv.Atoi(v)
d.Users = append(d.Users, userMap[intVal]) users = append(users, userMap[intVal].Name)
} }
d.Users = strings.Join(users, ",")
} }
return d return d
}).ToSlice(&cmdList) }).ToSlice(&cmdList)