Skip to content

Commit

Permalink
添加主动处理接口。
Browse files Browse the repository at this point in the history
  • Loading branch information
YuleiLan committed Sep 1, 2020
1 parent d4ab989 commit 8d60f67
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apis/process/workOrder.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,3 +585,42 @@ func UrgeWorkOrder(c *gin.Context) {

app.OK(c, "", "")
}

// 主动处理
func ActiveOrder(c *gin.Context) {
var (
workOrderId string
err error
stateValue []struct {
ID string `json:"id"`
Label string `json:"label"`
ProcessMethod string `json:"process_method"`
Processor []int `json:"processor"`
}
stateValueByte []byte
)

workOrderId = c.Param("id")

err = c.ShouldBind(&stateValue)
if err != nil {
app.Error(c, -1, err, "")
return
}

stateValueByte, err = json.Marshal(stateValue)
if err != nil {
app.Error(c, -1, fmt.Errorf("转byte失败,%v", err.Error()), "")
return
}

err = orm.Eloquent.Model(&process.WorkOrderInfo{}).
Where("id = ?", workOrderId).
Update("state", stateValueByte).Error
if err != nil {
app.Error(c, -1, fmt.Errorf("接单失败,%v", err.Error()), "")
return
}

app.OK(c, "", "接单成功,请及时处理")
}
1 change: 1 addition & 0 deletions router/process/workOrder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ func RegisterWorkOrderRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
workOrderRouter.GET("/unity", process.UnityWorkOrder)
workOrderRouter.POST("/inversion", process.InversionWorkOrder)
workOrderRouter.GET("/urge", process.UrgeWorkOrder)
workOrderRouter.PUT("/active-order/:id", process.ActiveOrder)
}
}

0 comments on commit 8d60f67

Please sign in to comment.