|
1 | 1 | package v1 |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "net/http" |
5 | | - |
6 | 4 | "github.com/gin-gonic/gin" |
7 | | - |
8 | | - "github.com/CocaineCong/gin-mall/pkg/utils/ctl" |
9 | | - "github.com/CocaineCong/gin-mall/pkg/utils/log" |
10 | | - "github.com/CocaineCong/gin-mall/service" |
11 | | - "github.com/CocaineCong/gin-mall/types" |
12 | 5 | ) |
13 | 6 |
|
14 | 7 | func ImportSkillProductHandler() gin.HandlerFunc { |
15 | 8 | return func(ctx *gin.Context) { |
16 | | - var req types.SkillProductImportReq |
17 | | - if err := ctx.ShouldBind(&req); err != nil { |
18 | | - // 参数校验 |
19 | | - log.LogrusObj.Infoln(err) |
20 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
21 | | - return |
22 | | - } |
23 | | - |
24 | | - file, _, _ := ctx.Request.FormFile("file") |
25 | | - l := service.GetSkillProductSrv() |
26 | | - resp, err := l.Import(ctx.Request.Context(), file) |
27 | | - if err != nil { |
28 | | - log.LogrusObj.Infoln(err) |
29 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
30 | | - return |
31 | | - } |
32 | | - ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
| 9 | + // var req types.SkillProductImportReq |
| 10 | + // if err := ctx.ShouldBind(&req); err != nil { |
| 11 | + // // 参数校验 |
| 12 | + // log.LogrusObj.Infoln(err) |
| 13 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 14 | + // return |
| 15 | + // } |
| 16 | + // |
| 17 | + // file, _, _ := ctx.Request.FormFile("file") |
| 18 | + // l := service.GetSkillProductSrv() |
| 19 | + // resp, err := l.Import(ctx.Request.Context(), file) |
| 20 | + // if err != nil { |
| 21 | + // log.LogrusObj.Infoln(err) |
| 22 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 23 | + // return |
| 24 | + // } |
| 25 | + // ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
33 | 26 | } |
34 | 27 | } |
35 | 28 |
|
36 | 29 | func InitSkillProductHandler() gin.HandlerFunc { |
37 | 30 | return func(ctx *gin.Context) { |
38 | | - var req types.SkillProductImportReq |
39 | | - if err := ctx.ShouldBind(&req); err != nil { |
40 | | - // 参数校验 |
41 | | - log.LogrusObj.Infoln(err) |
42 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
43 | | - return |
44 | | - } |
45 | | - |
46 | | - l := service.GetSkillProductSrv() |
47 | | - resp, err := l.InitSkillGoods(ctx.Request.Context()) |
48 | | - if err != nil { |
49 | | - log.LogrusObj.Infoln(err) |
50 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
51 | | - return |
52 | | - } |
53 | | - ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
| 31 | + // var req types.SkillProductImportReq |
| 32 | + // if err := ctx.ShouldBind(&req); err != nil { |
| 33 | + // // 参数校验 |
| 34 | + // log.LogrusObj.Infoln(err) |
| 35 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 36 | + // return |
| 37 | + // } |
| 38 | + // |
| 39 | + // l := service.GetSkillProductSrv() |
| 40 | + // resp, err := l.InitSkillGoods(ctx.Request.Context()) |
| 41 | + // if err != nil { |
| 42 | + // log.LogrusObj.Infoln(err) |
| 43 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 44 | + // return |
| 45 | + // } |
| 46 | + // ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
54 | 47 | } |
55 | 48 | } |
56 | 49 |
|
57 | 50 | func SkillProductHandler() gin.HandlerFunc { |
58 | 51 | return func(ctx *gin.Context) { |
59 | | - var req types.SkillProductServiceReq |
60 | | - if err := ctx.ShouldBind(&req); err != nil { |
61 | | - // 参数校验 |
62 | | - log.LogrusObj.Infoln(err) |
63 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
64 | | - return |
65 | | - } |
66 | | - |
67 | | - l := service.GetSkillProductSrv() |
68 | | - resp, err := l.SkillProduct(ctx.Request.Context(), &req) |
69 | | - if err != nil { |
70 | | - log.LogrusObj.Infoln(err) |
71 | | - ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
72 | | - return |
73 | | - } |
74 | | - ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
| 52 | + // var req types.SkillProductServiceReq |
| 53 | + // if err := ctx.ShouldBind(&req); err != nil { |
| 54 | + // // 参数校验 |
| 55 | + // log.LogrusObj.Infoln(err) |
| 56 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 57 | + // return |
| 58 | + // } |
| 59 | + // |
| 60 | + // l := service.GetSkillProductSrv() |
| 61 | + // resp, err := l.SkillProduct(ctx.Request.Context(), &req) |
| 62 | + // if err != nil { |
| 63 | + // log.LogrusObj.Infoln(err) |
| 64 | + // ctx.JSON(http.StatusOK, ErrorResponse(ctx, err)) |
| 65 | + // return |
| 66 | + // } |
| 67 | + // ctx.JSON(http.StatusOK, ctl.RespSuccess(ctx, resp)) |
75 | 68 | } |
76 | 69 | } |
0 commit comments