|
@@ -0,0 +1,28 @@
|
|
|
+package handler
|
|
|
+
|
|
|
+import (
|
|
|
+ "net/http"
|
|
|
+
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/logic"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
|
|
|
+ "github.com/zeromicro/go-zero/rest/httpx"
|
|
|
+)
|
|
|
+
|
|
|
+func MaterialSaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
|
+ return func(w http.ResponseWriter, r *http.Request) {
|
|
|
+ var req types.MaterialSaveReq
|
|
|
+ if err := httpx.Parse(r, &req); err != nil {
|
|
|
+ httpx.Error(w, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ l := logic.NewMaterialSaveLogic(r.Context(), svcCtx)
|
|
|
+ resp, err := l.MaterialSave(&req)
|
|
|
+ if err != nil {
|
|
|
+ httpx.Error(w, err)
|
|
|
+ } else {
|
|
|
+ httpx.OkJson(w, resp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|