You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

commithpctaskhandler.go 1.2 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package hpc
  2. import (
  3. "github.com/zeromicro/go-zero/rest/httpx"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/hpc"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  9. "net/http"
  10. "strconv"
  11. )
  12. func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13. return func(w http.ResponseWriter, r *http.Request) {
  14. var req types.CommitHpcTaskReq
  15. if err := httpx.Parse(r, &req); err != nil {
  16. result.ParamErrorResult(r, w, err)
  17. return
  18. }
  19. // 获取ip信息
  20. ip := utils.GetClientIP(r)
  21. req.Parameters["UserIp"] = ip
  22. // 获取token信息
  23. token := r.Header.Get("Authorization")
  24. req.Parameters["Token"] = token
  25. // 获取用户信息
  26. jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
  27. if err != nil {
  28. result.ParamErrorResult(r, w, err)
  29. return
  30. }
  31. req.Parameters["UserId"] = strconv.FormatInt(jccUserInfo.Id, 10)
  32. l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx)
  33. resp, err := l.CommitHpcTask(&req)
  34. result.HttpResult(r, w, resp, err)
  35. }
  36. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.