13444
This commit is contained in:
parent
7e912f5d86
commit
179ce30a7c
@ -6,6 +6,7 @@ import (
|
|||||||
"case-open-api/api/requests"
|
"case-open-api/api/requests"
|
||||||
"case-open-api/api/responses"
|
"case-open-api/api/responses"
|
||||||
"case-open-api/api/service"
|
"case-open-api/api/service"
|
||||||
|
"case-open-api/config"
|
||||||
"case-open-api/global"
|
"case-open-api/global"
|
||||||
"case-open-api/utils"
|
"case-open-api/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -115,6 +116,20 @@ func (b *Res) GetResCaseList(c *gin.Context) {
|
|||||||
// 处理返回值
|
// 处理返回值
|
||||||
g := dto.GetCaseResListDto(cases)
|
g := dto.GetCaseResListDto(cases)
|
||||||
|
|
||||||
|
// 获取平台数据
|
||||||
|
platformDao := dao.PlatformDao{}
|
||||||
|
platform, err := platformDao.GetPlatformById(platformId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, caseDto := range g {
|
||||||
|
// 加载访问链接
|
||||||
|
link := config.C.DomainName + "/caseIntro" + "?project_id=" + caseDto.ProjectId + "&source=3" + "&platform_key=" + platform.PlatformKey + "&case_id=" + caseDto.SId
|
||||||
|
caseDto.LoadLink(link)
|
||||||
|
}
|
||||||
|
|
||||||
responses.OkWithData(g, c)
|
responses.OkWithData(g, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"case-open-api/api/model"
|
"case-open-api/api/model"
|
||||||
"case-open-api/config"
|
|
||||||
"case-open-api/utils"
|
"case-open-api/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
@ -138,9 +137,6 @@ func GetCaseResListDto(m []*model.Case) []*ResCaseDto {
|
|||||||
StarTime: v.CreatedAt,
|
StarTime: v.CreatedAt,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载访问链接
|
|
||||||
response.LoadLink(v)
|
|
||||||
|
|
||||||
// 将转换后的结构体添加到新切片中
|
// 将转换后的结构体添加到新切片中
|
||||||
responses[i] = response
|
responses[i] = response
|
||||||
}
|
}
|
||||||
@ -174,11 +170,8 @@ func (r *ResProjectDto) LoadIsRecentlyUpdate(m *model.Case) *ResProjectDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoadLink 加载访问链接
|
// LoadLink 加载访问链接
|
||||||
func (r *ResCaseDto) LoadLink(m *model.Case) *ResCaseDto {
|
func (r *ResCaseDto) LoadLink(link string) *ResCaseDto {
|
||||||
if m != nil {
|
r.Url = link
|
||||||
link := config.C.DomainName + "/caseIntro" + "?project_id=" + fmt.Sprintf("%d", m.ProjectId) + "&source=3" + "&platform_key=opf$di!3" + "&case_id=" + fmt.Sprintf("%d", m.CaseId)
|
|
||||||
r.Url = link
|
|
||||||
}
|
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user