ref: 重构网元跟踪任务功能
This commit is contained in:
@@ -80,39 +80,6 @@ func (s *TraceTaskController) Add(c *gin.Context) {
|
||||
c.JSON(200, resp.Ok(nil))
|
||||
}
|
||||
|
||||
// 跟踪任务修改
|
||||
//
|
||||
// PUT /
|
||||
func (s *TraceTaskController) Edit(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
var body model.TraceTask
|
||||
err := c.ShouldBindBodyWithJSON(&body)
|
||||
if err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(40422, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID == 0 {
|
||||
c.JSON(400, resp.CodeMsg(40010, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
taskInfo := s.traceTaskService.FindById(body.ID)
|
||||
if taskInfo.ID != body.ID {
|
||||
// 没有可访问任务信息数据!
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "task.noData")))
|
||||
return
|
||||
}
|
||||
|
||||
body.UpdateBy = reqctx.LoginUserToUserName(c)
|
||||
if err = s.traceTaskService.Update(body); err != nil {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
c.JSON(200, resp.Ok(nil))
|
||||
}
|
||||
|
||||
// 跟踪任务删除
|
||||
//
|
||||
// DELETE /:id
|
||||
|
||||
Reference in New Issue
Block a user