animeic 2 lat temu
rodzic
commit
2165367f87
2 zmienionych plików z 4 dodań i 8 usunięć
  1. 3 3
      3dshow-supplier/api/order.go
  2. 1 5
      3dshow-supplier/api/product.go

+ 3 - 3
3dshow-supplier/api/order.go

@@ -48,10 +48,10 @@ func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 			v["customer"] = customerUser
 			v["customer"] = customerUser
 
 
 			// 统计下单数和未发货数
 			// 统计下单数和未发货数
-			orderCount = len(v["products"].([]*model.OrderProduct))
+			orderCount = len(v["products"].(primitive.A))
 			if orderCount > 0 {
 			if orderCount > 0 {
-				for _, p := range v["products"].([]*model.OrderProduct) {
-					if p.Status == -1 {
+				for _, p := range v["products"].(primitive.A) {
+					if p.(map[string]interface{})["status"] == -1 {
 						notShipCount++
 						notShipCount++
 					}
 					}
 				}
 				}

+ 1 - 5
3dshow-supplier/api/product.go

@@ -162,12 +162,8 @@ func ProductDelete(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if !found || err != nil {
 	if !found || err != nil {
 		return nil, errors.New("该商品不存在")
 		return nil, errors.New("该商品不存在")
 	}
 	}
-
-	_userId := apictx.User.ID
-	userId, _ := primitive.ObjectIDFromHex(_userId)
-
 	// 不是自己的商品
 	// 不是自己的商品
-	if product.SupplyId != userId {
+	if product.SupplyId.Hex() != apictx.User.ID {
 		return nil, errors.New("非法操作")
 		return nil, errors.New("非法操作")
 	}
 	}