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.

schedulecreatetaskhandler.go 1.1 kB

11 months ago
11 months ago
12345678910111213141516171819202122232425262728293031323334353637
  1. package schedule
  2. import (
  3. "github.com/zeromicro/go-zero/rest/httpx"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/schedule"
  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. )
  11. func ScheduleCreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  12. return func(w http.ResponseWriter, r *http.Request) {
  13. var req types.CreateTaskReq
  14. if err := httpx.Parse(r, &req); err != nil {
  15. result.ParamErrorResult(r, w, err)
  16. return
  17. }
  18. // 获取ip信息
  19. ip := utils.GetClientIP(r)
  20. req.UserIp = ip
  21. // 获取token信息
  22. token := r.Header.Get("Authorization")
  23. req.Token = token
  24. jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
  25. if err != nil {
  26. result.ParamErrorResult(r, w, err)
  27. return
  28. }
  29. req.UserId = jccUserInfo.Id
  30. l := schedule.NewScheduleCreateTaskLogic(r.Context(), svcCtx)
  31. resp, err := l.ScheduleCreateTask(&req)
  32. result.HttpResult(r, w, resp, err)
  33. }
  34. }

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.