Compare commits

..

2 Commits

Author SHA1 Message Date
renzhiyuan 7efbeb06fa Merge remote-tracking branch 'origin/main' into main 2024-11-28 11:21:07 +08:00
renzhiyuan 0035e6fdac 任务模块 2024-11-28 11:20:57 +08:00
4 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import (
"cron_admin/app/constants/errorcode" "cron_admin/app/constants/errorcode"
"cron_admin/app/http/controllers" "cron_admin/app/http/controllers"
"cron_admin/app/http/entities/backend" "cron_admin/app/http/entities/backend"
"cron_admin/app/models/cronusermodel" "cron_admin/app/models/croncmdmodel"
cmd_services "cron_admin/app/services/cmd_service" cmd_services "cron_admin/app/services/cmd_service"
"github.com/ahmetb/go-linq/v3" "github.com/ahmetb/go-linq/v3"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -16,12 +16,16 @@ func CmdList(c *gin.Context) {
if err != nil { if err != nil {
controllers.HandRes(c, nil, errorcode.NotFound) controllers.HandRes(c, nil, errorcode.NotFound)
} else { } else {
ulist := make([]backend.UserListResponse, 0) var (
linq.From(list).SelectT(func(in cronusermodel.CronUser) (d backend.UserListResponse) { cmdList = make([]backend.CmdListResponse, 0)
//userIdList []int
)
linq.From(list).SelectT(func(in croncmdmodel.CronCmd) (d backend.CmdListResponse) {
d.ResponseFromDb(in) d.ResponseFromDb(in)
return d return d
}).ToSlice(&ulist) }).ToSlice(&cmdList)
controllers.HandRes(c, gin.H{"data": ulist, "count": count}, err) controllers.HandRes(c, gin.H{"data": cmdList, "count": count}, err)
} }
} }

View File

@ -18,7 +18,7 @@ type CmdInfoRequest struct {
} }
type CmdListResponse struct { type CmdListResponse struct {
CmdId string `json:"cmd_id"` CmdId int `json:"cmd_id"`
CmdName string `json:"cmd_name"` CmdName string `json:"cmd_name"`
UserIds string `json:"user_ids"` UserIds string `json:"user_ids"`
EntryId int `json:"entry_id"` EntryId int `json:"entry_id"`

View File

@ -13,7 +13,7 @@ var (
// 实体 // 实体
type CronCmd struct { type CronCmd struct {
CmdId string `xorm:"'cmd_id' UNSIGNED INT"` CmdId int `xorm:"'cmd_id' UNSIGNED INT"`
CmdName string `xorm:"'cmd_name' varchar(20)"` CmdName string `xorm:"'cmd_name' varchar(20)"`
UserIds string `xorm:"'user_ids' varchar(50)"` UserIds string `xorm:"'user_ids' varchar(50)"`
EntryId int `xorm:"'entry_id' int(10)"` EntryId int `xorm:"'entry_id' int(10)"`