del: 移除网元软件安装接口
This commit is contained in:
@@ -191,44 +191,3 @@ func (s *NeSoftwareController) NewNeVersion(c *gin.Context) {
|
||||
}
|
||||
c.JSON(200, result.Err(nil))
|
||||
}
|
||||
|
||||
// 网元软件包安装
|
||||
//
|
||||
// POST /install
|
||||
func (s *NeSoftwareController) Install(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
Software model.NeSoftware `json:"software" binding:"required"` // 软件包信息
|
||||
Preinput map[string]string `json:"preinput" binding:"required"` // 预先输入参数
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.Software.NeId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在软件包记录
|
||||
neSoftwares := s.neSoftwareService.SelectList(model.NeSoftware{
|
||||
NeType: body.Software.NeType,
|
||||
Name: body.Software.Name,
|
||||
Version: body.Software.Version,
|
||||
})
|
||||
if len(neSoftwares) <= 0 {
|
||||
body.Software.CreateBy = ctx.LoginUserToUserName(c)
|
||||
body.Software.ID = s.neSoftwareService.Insert(body.Software)
|
||||
} else {
|
||||
neSoftware := neSoftwares[0]
|
||||
neSoftware.Path = body.Software.Path
|
||||
neSoftware.Description = body.Software.Description
|
||||
neSoftware.UpdateBy = ctx.LoginUserToUserName(c)
|
||||
s.neSoftwareService.Update(neSoftware)
|
||||
}
|
||||
|
||||
// 进行安装
|
||||
output, err := s.neSoftwareService.InstallToNeHost(body.Software, body.Preinput)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.OkData(output))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user