zhangqian
2023-08-28 e517b1a99b6edfa24c8cc4e109a6a10488f23b6a
api/v1/test/product.go
@@ -26,17 +26,17 @@
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body test.Product true "创建Product"
// @Param data body request.ProductCreate true "创建Product"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /p/createProduct [post]
func (pApi *ProductApi) CreateProduct(c *gin.Context) {
   var p test.Product
   var p testReq.ProductCreate
   err := c.ShouldBindJSON(&p)
   if err != nil {
      response.FailWithMessage(err.Error(), c)
      return
   }
   if err := pService.CreateProduct(&p); err != nil {
   if err := pService.CreateProduct(p.List); err != nil {
      global.GVA_LOG.Error("创建失败!", zap.Error(err))
      response.FailWithMessage("创建失败", c)
   } else {
@@ -229,14 +229,13 @@
   if err != nil || getProductListResponse.Code != 0 {
      global.GVA_LOG.Error("获取失败!", zap.Error(err))
      response.FailWithMessage("获取失败", c)
      return
   } else {
      response.OkWithDetailed(response.PageResult{
         List:     productList,
         Total:    int64(len(productList)),
         Page:     pageInfo.Page,
         PageSize: pageInfo.PageSize,
      }, "获取成功", c)
   }
   response.OkWithDetailed(response.PageResult{
      List:     productList,
      Total:    int64(len(productList)),
      Page:     pageInfo.Page,
      PageSize: pageInfo.PageSize,
   }, "获取成功", c)
}