Merge remote-tracking branch 'origin/main'

This commit is contained in:
陈俊宏 2024-11-28 11:38:51 +08:00
commit 39967329b3
2 changed files with 9 additions and 5 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)
} }
} }