From 0035e6fdac195442db1a6c62ed0679b1a7c38c12 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Thu, 28 Nov 2024 11:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/backend/cmd_controller.go | 14 +++++++++----- app/http/entities/backend/cmd.go | 2 +- app/models/croncmdmodel/cron_cmd.go | 2 +- .../{user_service.go => cmd_service.go} | 0 4 files changed, 11 insertions(+), 7 deletions(-) rename app/services/cmd_service/{user_service.go => cmd_service.go} (100%) diff --git a/app/http/controllers/backend/cmd_controller.go b/app/http/controllers/backend/cmd_controller.go index 2a9cb8c..de227d5 100644 --- a/app/http/controllers/backend/cmd_controller.go +++ b/app/http/controllers/backend/cmd_controller.go @@ -4,7 +4,7 @@ import ( "cron_admin/app/constants/errorcode" "cron_admin/app/http/controllers" "cron_admin/app/http/entities/backend" - "cron_admin/app/models/cronusermodel" + "cron_admin/app/models/croncmdmodel" cmd_services "cron_admin/app/services/cmd_service" "github.com/ahmetb/go-linq/v3" "github.com/gin-gonic/gin" @@ -16,12 +16,16 @@ func CmdList(c *gin.Context) { if err != nil { controllers.HandRes(c, nil, errorcode.NotFound) } else { - ulist := make([]backend.UserListResponse, 0) - linq.From(list).SelectT(func(in cronusermodel.CronUser) (d backend.UserListResponse) { + var ( + cmdList = make([]backend.CmdListResponse, 0) + //userIdList []int + ) + + linq.From(list).SelectT(func(in croncmdmodel.CronCmd) (d backend.CmdListResponse) { d.ResponseFromDb(in) return d - }).ToSlice(&ulist) - controllers.HandRes(c, gin.H{"data": ulist, "count": count}, err) + }).ToSlice(&cmdList) + controllers.HandRes(c, gin.H{"data": cmdList, "count": count}, err) } } diff --git a/app/http/entities/backend/cmd.go b/app/http/entities/backend/cmd.go index 8d47c05..e943dad 100644 --- a/app/http/entities/backend/cmd.go +++ b/app/http/entities/backend/cmd.go @@ -18,7 +18,7 @@ type CmdInfoRequest struct { } type CmdListResponse struct { - CmdId string `json:"cmd_id"` + CmdId int `json:"cmd_id"` CmdName string `json:"cmd_name"` UserIds string `json:"user_ids"` EntryId int `json:"entry_id"` diff --git a/app/models/croncmdmodel/cron_cmd.go b/app/models/croncmdmodel/cron_cmd.go index ec9140b..3b9cf50 100644 --- a/app/models/croncmdmodel/cron_cmd.go +++ b/app/models/croncmdmodel/cron_cmd.go @@ -13,7 +13,7 @@ var ( // 实体 type CronCmd struct { - CmdId string `xorm:"'cmd_id' UNSIGNED INT"` + CmdId int `xorm:"'cmd_id' UNSIGNED INT"` CmdName string `xorm:"'cmd_name' varchar(20)"` UserIds string `xorm:"'user_ids' varchar(50)"` EntryId int `xorm:"'entry_id' int(10)"` diff --git a/app/services/cmd_service/user_service.go b/app/services/cmd_service/cmd_service.go similarity index 100% rename from app/services/cmd_service/user_service.go rename to app/services/cmd_service/cmd_service.go