| @@ -472,6 +472,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | |||||
| Path: "/storelink/getImageList", | Path: "/storelink/getImageList", | ||||
| Handler: storelink.GetLinkImageListHandler(serverCtx), | Handler: storelink.GetLinkImageListHandler(serverCtx), | ||||
| }, | }, | ||||
| { | |||||
| Method: http.MethodDelete, | |||||
| Path: "/storelink/deleteImageList", | |||||
| Handler: storelink.DeleteLinkImageHandler(serverCtx), | |||||
| }, | |||||
| { | |||||
| Method: http.MethodPost, | |||||
| Path: "/storelink/submitLinkTask", | |||||
| Handler: storelink.SubmitLinkTaskHandler(serverCtx), | |||||
| }, | |||||
| { | |||||
| Method: http.MethodGet, | |||||
| Path: "/storelink/getLinkTask", | |||||
| Handler: storelink.GetLinkTaskHandler(serverCtx), | |||||
| }, | |||||
| { | |||||
| Method: http.MethodDelete, | |||||
| Path: "/storelink/deleteLinkTask", | |||||
| Handler: storelink.DeleteLinkTaskHandler(serverCtx), | |||||
| }, | |||||
| }, | }, | ||||
| rest.WithPrefix("/pcm/v1"), | rest.WithPrefix("/pcm/v1"), | ||||
| ) | ) | ||||
| @@ -0,0 +1,28 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.DeleteLinkImageReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteLinkImage(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.DeleteLinkTaskReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteLinkTask(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.GetLinkTaskReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetLinkTask(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/storelink" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.SubmitLinkTaskReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.SubmitLinkTask(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type DeleteLinkImageLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewDeleteLinkImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLinkImageLogic { | |||||
| return &DeleteLinkImageLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *DeleteLinkImageLogic) DeleteLinkImage(req *types.DeleteLinkImageReq) (resp *types.DeleteLinkImageResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type DeleteLinkTaskLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewDeleteLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLinkTaskLogic { | |||||
| return &DeleteLinkTaskLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp *types.DeleteLinkTaskResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type GetLinkTaskLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewGetLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLinkTaskLogic { | |||||
| return &GetLinkTaskLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *GetLinkTaskLogic) GetLinkTask(req *types.GetLinkTaskReq) (resp *types.GetLinkTaskResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package storelink | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type SubmitLinkTaskLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewSubmitLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitLinkTaskLogic { | |||||
| return &SubmitLinkTaskLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *SubmitLinkTaskLogic) SubmitLinkTask(req *types.SubmitLinkTaskReq) (resp *types.SubmitLinkTaskResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -106,6 +106,7 @@ func (s *scheduler) SaveToDb() error { | |||||
| } | } | ||||
| tx := s.dbEngin.Create(structForDb) | tx := s.dbEngin.Create(structForDb) | ||||
| if tx.Error != nil { | if tx.Error != nil { | ||||
| // todo 保存失败数据 | |||||
| logx.Error(tx.Error) | logx.Error(tx.Error) | ||||
| return tx.Error | return tx.Error | ||||
| } | } | ||||
| @@ -2721,9 +2721,20 @@ type Cloud struct { | |||||
| } | } | ||||
| type UploadLinkImageReq struct { | type UploadLinkImageReq struct { | ||||
| PartId int64 `json:"partId"` | |||||
| FilePath string `json:"filePath"` | |||||
| } | } | ||||
| type UploadLinkImageImageResp struct { | |||||
| type UploadLinkImageResp struct { | |||||
| Success bool `json:"success"` | |||||
| Image ImageSl `json:"image"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type ImageSl struct { | |||||
| ImageId string `json:"imageId"` | |||||
| ImageName string `json:"imageName"` | |||||
| ImageStatus string `json:"imageStatus"` | |||||
| } | } | ||||
| type GetLinkImageListReq struct { | type GetLinkImageListReq struct { | ||||
| @@ -2731,5 +2742,66 @@ type GetLinkImageListReq struct { | |||||
| } | } | ||||
| type GetLinkImageListResp struct { | type GetLinkImageListResp struct { | ||||
| ImageIds []int64 `json:"imageIds"` | |||||
| Success bool `json:"success"` | |||||
| Images []ImageSl `json:"images"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type DeleteLinkImageReq struct { | |||||
| PartId int64 `json:"partId"` | |||||
| ImageId string `json:"imageId"` | |||||
| } | |||||
| type DeleteLinkImageResp struct { | |||||
| Success bool `json:"success"` | |||||
| Image ImageSl `json:"image"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type SubmitLinkTaskReq struct { | |||||
| PartId int64 `json:"partId"` | |||||
| ImageId string `json:"imageId"` | |||||
| Cmd string `json:"cmd"` | |||||
| Envs []EnvSl `json:"envs"` | |||||
| } | |||||
| type EnvSl struct { | |||||
| Key string `json:"key"` | |||||
| Val string `json:"value"` | |||||
| } | |||||
| type SubmitLinkTaskResp struct { | |||||
| Success bool `json:"success"` | |||||
| TaskId string `json:"taskId"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type GetLinkTaskReq struct { | |||||
| PartId int64 `json:"partId"` | |||||
| TaskId string `json:"taskId"` | |||||
| } | |||||
| type GetLinkTaskResp struct { | |||||
| Success bool `json:"success"` | |||||
| Task TaskSl `json:"task"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type DeleteLinkTaskReq struct { | |||||
| PartId int64 `json:"partId"` | |||||
| TaskId string `json:"taskId"` | |||||
| } | |||||
| type DeleteLinkTaskResp struct { | |||||
| Success bool `json:"success"` | |||||
| TaskId string `json:"taskId"` | |||||
| ErrorMsg string `json:"errorMsg"` | |||||
| } | |||||
| type TaskSl struct { | |||||
| TaskId string `json:"taskId"` | |||||
| TaskName string `json:"taskName"` | |||||
| TaskStatus string `json:"taskStatus"` | |||||
| StartedAt int64 `json:"startedAt"` | |||||
| CompletedAt int64 `json:"completedAt"` | |||||
| } | } | ||||