作者 tangxvhui

添加路由

... ... @@ -898,6 +898,22 @@ func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.T
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "xx"+err.Error())
}
taskIgnoreRepo := factory.CreateTaskIgnoreRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, taskIgnoreList, err := taskIgnoreRepo.Find(map[string]interface{}{
"taskId": param.TaskId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "xx"+err.Error())
}
for _, v := range taskIgnoreList {
err = taskIgnoreRepo.Remove(v.Id)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
... ... @@ -215,3 +215,36 @@ func (c *TaskController) SaveTaskLevel() {
err = srv.SaveTaskLevel(paramReq)
c.Response(nil, err)
}
// 取消关注的任务列表
func (c *TaskController) ListTaskIgnore() {
srv := service.NewTaskService()
paramReq := &command.SearchTaskCommand{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
result, err := srv.ListTaskIgnore(paramReq)
c.Response(result, err)
}
// 从取消关注的任务列表中移除
func (c *TaskController) CancelIgnore() {
srv := service.NewTaskService()
paramReq := &command.CancelIgnoreCommand{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
_, err = srv.CancleTaskIgnore(paramReq)
c.Response(nil, err)
}
... ...
... ... @@ -29,6 +29,8 @@ func init() {
web.NSCtrlPost("/list/select", (*controllers.TaskController).SelectCondition),
web.NSCtrlPost("/task_record/list", (*controllers.TaskController).ListTaskRecord),
web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo),
web.NSCtrlPost("/ignore/list", (*controllers.TaskController).ListTaskIgnore),
web.NSCtrlPost("/ignore/cancle", (*controllers.TaskController).CancelIgnore),
)
web.AddNamespace(taskFontNS)
t := web.NewNamespace("/test/task",
... ...