feat: 新增机器与项目关联及相关资源列表查询以项目关联成员为准

This commit is contained in:
meilin.huang
2021-12-11 11:19:47 +08:00
parent fb0fc274b4
commit 358b34c7f4
14 changed files with 128 additions and 48 deletions

View File

@@ -23,7 +23,18 @@ type Machine struct {
}
func (m *Machine) Machines(rc *ctx.ReqCtx) {
res := m.MachineApp.GetMachineList(new(entity.Machine), ginx.GetPageParam(rc.GinCtx), new([]*vo.MachineVO))
condition := new(entity.Machine)
// 使用创建者id模拟账号成员id
condition.CreatorId = rc.LoginAccount.Id
condition.Ip = rc.GinCtx.Query("ip")
condition.ProjectId = uint64(ginx.QueryInt(rc.GinCtx, "projectId", 0))
res := m.MachineApp.GetMachineList(condition, ginx.GetPageParam(rc.GinCtx), new([]*vo.MachineVO))
if res.Total == 0 {
rc.ResData = res
return
}
list := res.List.(*[]*vo.MachineVO)
for _, mv := range *list {
mv.HasCli = machine.HasCli(*mv.Id)