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.

commitgeneraltaskhandler.go 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package cloud
  2. import (
  3. "github.com/zeromicro/go-zero/rest/httpx"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/cloud"
  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/models"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  10. "k8s.io/apimachinery/pkg/util/json"
  11. "net/http"
  12. )
  13. func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14. return func(w http.ResponseWriter, r *http.Request) {
  15. var req types.GeneralTaskReq
  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.UserIp = ip
  23. // 获取token信息
  24. token := r.Header.Get("Authorization")
  25. req.Token = token
  26. // 获取用户信息
  27. userStr := r.Header.Get("User")
  28. user := &models.JccUserInfo{}
  29. json.Unmarshal([]byte(userStr), user)
  30. req.UserId = user.Id
  31. l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx)
  32. err := l.CommitGeneralTask(&req)
  33. result.HttpResult(r, w, nil, err)
  34. }
  35. }

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.