animeic 2 жил өмнө
parent
commit
ae20d0f36f

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

@@ -73,6 +73,7 @@ func OrderAddBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 }
 
+// TODO 待移除 与前端确定
 func OrderAdd(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	var form model.Order
 	err := c.ShouldBindJSON(&form)
@@ -102,10 +103,8 @@ func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	// supplier
 	page, size, query := UtilQueryPageSize(c)
 	_userId := apictx.User.ID
-	userId, err := primitive.ObjectIDFromHex(_userId)
-	if err != nil {
-		return nil, errors.New("非法用户")
-	}
+	userId, _ := primitive.ObjectIDFromHex(_userId)
+
 	// if apictx.User.Role == "customer"{
 	query["userId"] = userId
 	// }

+ 0 - 46
3dshow/api/shopCart.go

@@ -105,52 +105,6 @@ func ShopCartDeleteBatch(c *gin.Context, apictx *ApiSession) (interface{}, error
 	return true, nil
 }
 
-// 供应链分组列表 算法版 map过滤supplyId 乱序
-// func shopCartList(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
-// 	var shopCarts []*model.ShopCart
-// 	userId, _ := primitive.ObjectIDFromHex(apictx.User.ID)
-// 	option := &repo.PageSearchOptions{
-// 		CollectName: repo.CollectionShopCart,
-// 		Query:       repo.Map{"userId": userId},
-// 	}
-
-// 	repo.RepoDocsSearch(apictx.CreateRepoCtx(), option, &shopCarts)
-
-// 	supplyArr := map[primitive.ObjectID]struct{}{}
-// 	supplyList := make([]map[string]interface{}, 0)
-
-// 	if len(shopCarts) > 0 {
-// 		// 找出供应id 去重
-// 		for _, v := range shopCarts {
-// 			supplyArr[v.SupplyId] = struct{}{}
-// 		}
-// 		// supplyId分组列表
-// 		for k := range supplyArr {
-// 			// 查询产品信息
-// 			supply := model.Supply{}
-// 			// 供应商信息
-// 			repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-// 				CollectName: repo.CollectionSupply,
-// 				Query:       repo.Map{"_id": k},
-// 				Project:     []string{"name", "avatar", "contact"},
-// 			}, &supply)
-// 			products := make([]*model.ShopCart, 0)
-// 			for _, v := range shopCarts {
-// 				if k == v.SupplyId {
-// 					products = append(products, v)
-
-// 				}
-// 			}
-// 			supplyList = append(supplyList, map[string]interface{}{
-// 				"supply":   supply,
-// 				"products": products,
-// 			})
-// 		}
-// 	}
-
-// 	return supplyList, nil
-// }
-
 // 供应链分组列表 数据库分组
 func shopCartGroupList(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
 	userId, _ := primitive.ObjectIDFromHex(apictx.User.ID)