From 898043fc97d2ab8b793fd317a049b874ed207c6d Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Wed, 10 Dec 2025 20:12:31 +0800
Subject: [PATCH] 商户添加分类
---
admin/app/shop/model/order/OrderProduct.php | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/admin/app/shop/model/order/OrderProduct.php b/admin/app/shop/model/order/OrderProduct.php
index 1bfcfed..a2814c0 100644
--- a/admin/app/shop/model/order/OrderProduct.php
+++ b/admin/app/shop/model/order/OrderProduct.php
@@ -103,4 +103,23 @@
return 0;
}
+ public static function getPurchaseCount($userId, $postData,$product_ids)
+ {
+ $model = new static();
+ //搜索时间段
+ if (!empty($postData['create_time'])) {
+ $sta_time = array_shift($postData['create_time']);
+ $end_time = array_pop($postData['create_time']);
+ $model = $model->whereBetweenTime('order.create_time', $sta_time, date('Y-m-d 23:59:59', strtotime($end_time)));
+ }
+ return $model->alias('o_product')
+ ->join('order', 'order.order_id = o_product.order_id')
+ ->where('order.pay_status', '=', OrderPayStatusEnum::SUCCESS)
+ ->where('order.order_status', '<>', OrderStatusEnum::CANCELLED)
+ ->where('o_product.user_id', '=', $userId)
+ ->where('o_product.product_id', 'in', $product_ids)
+ ->group('o_product.product_id')
+ ->sum("total_num");
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.2