From 1a89850b5ffa418192eaa7541a72cebc42f484e8 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Wed, 4 Dec 2024 19:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E6=95=B0=E6=8D=AE=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/entities/backend/cmd.go | 3 +-- app/services/cmd_service/cmd_service.go | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/http/entities/backend/cmd.go b/app/http/entities/backend/cmd.go index 08097b6..f6bca20 100644 --- a/app/http/entities/backend/cmd.go +++ b/app/http/entities/backend/cmd.go @@ -4,7 +4,6 @@ import ( "cron_admin/app/models/croncmdmodel" "cron_admin/app/models/crondbmodel" "cron_admin/app/models/cronreportchannelmodel" - "cron_admin/app/models/cronusermodel" "time" ) @@ -42,7 +41,7 @@ type CmdListResponse struct { UpdateTime string `json:"update_time"` Status int `json:"status"` FailReason string `json:"fail_reason"` - Users []*cronusermodel.CronUser `json:"users"` + Users string `json:"users"` ReadDb *crondbmodel.CronDb `json:"read_db"` WriteDb *crondbmodel.CronDb `json:"write_db"` ReportChannel *cronreportchannelmodel.CronReportChannel `json:"report_channel"` diff --git a/app/services/cmd_service/cmd_service.go b/app/services/cmd_service/cmd_service.go index b34e74a..f7f4f6b 100644 --- a/app/services/cmd_service/cmd_service.go +++ b/app/services/cmd_service/cmd_service.go @@ -251,10 +251,12 @@ func ListToRep(list []croncmdmodel.CronCmd) (cmdList []backend.CmdListResponse, } if len(in.UserIds) != 0 { + var users []string for _, v := range strings.Split(in.UserIds, ",") { intVal, _ := strconv.Atoi(v) - d.Users = append(d.Users, userMap[intVal]) + users = append(users, userMap[intVal].Name) } + d.Users = strings.Join(users, ",") } return d }).ToSlice(&cmdList)