oa.go 990 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package gn
  2. import (
  3. "eta_gn/eta_bridge/controller/resp"
  4. "eta_gn/eta_bridge/global"
  5. gnRequest "eta_gn/eta_bridge/models/request/gn"
  6. "eta_gn/eta_bridge/services/gn"
  7. "github.com/gin-gonic/gin"
  8. "github.com/go-playground/validator/v10"
  9. )
  10. func (gc *GuoNengController) OA(c *gin.Context) {
  11. var req gnRequest.PostOAReq
  12. if e := c.Bind(&req); e != nil {
  13. err, ok := e.(validator.ValidationErrors)
  14. if !ok {
  15. resp.FailData("参数解析失败", "Err:"+e.Error(), c)
  16. return
  17. }
  18. resp.FailData("参数解析失败", err.Translate(global.Trans), c)
  19. return
  20. }
  21. oaReq := gn.OASendDbReq{
  22. AppPersonId: req.AppPersonId,
  23. AppPersonName: req.AppPersonName,
  24. AppTaskUrl: req.AppTaskUrl,
  25. TaskName: req.TaskName,
  26. StatusName: req.StatusName,
  27. Status: req.Status,
  28. AppTaskId: req.AppTaskId,
  29. }
  30. oaResp, err := gn.OASendDb(oaReq)
  31. if err != nil {
  32. resp.FailData("请求失败", err.Error(), c)
  33. return
  34. }
  35. resp.OkData("请求成功", oaResp.Data.TaskId, c)
  36. }