feat: 网站列表增加运行环境字段 (#562)

This commit is contained in:
zhengkunwang223
2023-04-10 08:24:26 +00:00
committed by GitHub
parent cc51eaef3f
commit 1bba2664b6
4 changed files with 23 additions and 9 deletions
+1
View File
@@ -10,6 +10,7 @@ type WebsiteDTO struct {
AccessLogPath string `json:"accessLogPath"`
SitePath string `json:"sitePath"`
AppName string `json:"appName"`
RuntimeName string `json:"runtimeName"`
}
type WebsitePreInstallCheck struct {
+15 -4
View File
@@ -78,17 +78,28 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
return 0, nil, err
}
for _, web := range websites {
var appName string
if web.Type == constant.Deployment {
var (
appName string
runtimeName string
)
switch web.Type {
case constant.Deployment:
appInstall, err := appInstallRepo.GetFirst(commonRepo.WithByID(web.AppInstallID))
if err != nil {
return 0, nil, err
}
appName = appInstall.Name
case constant.Runtime:
runtime, err := runtimeRepo.GetFirst(commonRepo.WithByID(web.RuntimeID))
if err != nil {
return 0, nil, err
}
runtimeName = runtime.Name
}
websiteDTOs = append(websiteDTOs, response.WebsiteDTO{
Website: web,
AppName: appName,
Website: web,
AppName: appName,
RuntimeName: runtimeName,
})
}
return total, websiteDTOs, nil