Browse Source

fix notshipcount

animeic 2 years ago
parent
commit
53aaa19f9b
3 changed files with 7 additions and 10 deletions
  1. BIN
      3dshow-supplier/__debug_bin
  2. 5 4
      3dshow-supplier/api/order.go
  3. 2 6
      3dshow-supplier/db/repo/repo.go

BIN
3dshow-supplier/__debug_bin


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

@@ -19,8 +19,9 @@ func Order(r *GinRouter) {
 // 订单列表
 func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	page, size, query := UtilQueryPageSize(c)
-	_userId := apictx.User.ID
-	userId, _ := primitive.ObjectIDFromHex(_userId)
+	// _userId := apictx.User.ID
+	// userId, _ := primitive.ObjectIDFromHex(_userId)
+	userId, _ := primitive.ObjectIDFromHex("636c66874fa01c203c478ba9")
 	// 供应商的订单列表
 	query["supplyId"] = userId
 	result, err := repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
@@ -28,7 +29,7 @@ func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		Page:        page,
 		Size:        size,
 		Query:       query,
-		Project:     []string{"createTime", "userId", "supplyId", "products"},
+		Project:     []string{"createTime", "userId", "supplyId", "products", "status"},
 		Sort:        repo.Map{"createTime": -1},
 	})
 
@@ -51,7 +52,7 @@ func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 			orderCount = len(v["products"].(primitive.A))
 			if orderCount > 0 {
 				for _, p := range v["products"].(primitive.A) {
-					if p.(map[string]interface{})["status"] == -1 {
+					if p.(map[string]interface{})["status"].(int32) == -1 {
 						notShipCount++
 					}
 				}

+ 2 - 6
3dshow-supplier/db/repo/repo.go

@@ -18,12 +18,8 @@ type RepoSession struct {
 }
 
 const (
-	CollectionSupply   = "supply"
-	CollectionCollect  = "collect"
-	CollectionProduct  = "product"
-	CollectionAddress  = "address"
-	CollectionOrder    = "order"
-	CollectionShopCart = "shopCart"
+	CollectionProduct = "product"
+	CollectionOrder   = "order"
 )
 
 type Map map[string]interface{}