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.3 kB

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

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.