25 lines
635 B
Go
25 lines
635 B
Go
package check
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
"github.com/zeromicro/go-zero/rest/pathvar"
|
|
"muyu-apiserver/gateway/internal/logic/inventory/check"
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
)
|
|
|
|
func GetStockCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"])
|
|
l := check.NewGetStockCheckLogic(ctx, svcCtx)
|
|
resp, err := l.GetStockCheck()
|
|
if err != nil {
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
|
} else {
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
}
|
|
}
|
|
}
|