|
@@ -28,6 +28,7 @@ use app\services\store\finance\StoreFinanceFlowServices;
|
|
|
use app\services\store\SystemStoreServices;
|
|
use app\services\store\SystemStoreServices;
|
|
|
use app\services\system\config\ConfigServices;
|
|
use app\services\system\config\ConfigServices;
|
|
|
use app\services\system\form\SystemFormServices;
|
|
use app\services\system\form\SystemFormServices;
|
|
|
|
|
+use app\services\user\UserAwardIntegralServices;
|
|
|
use app\services\user\UserInvoiceServices;
|
|
use app\services\user\UserInvoiceServices;
|
|
|
use app\services\user\UserServices;
|
|
use app\services\user\UserServices;
|
|
|
use app\services\product\product\StoreProductReplyServices;
|
|
use app\services\product\product\StoreProductReplyServices;
|
|
@@ -53,23 +54,23 @@ class StoreOrderServices extends BaseServices
|
|
|
{
|
|
{
|
|
|
use ServicesTrait;
|
|
use ServicesTrait;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 订单类型
|
|
|
|
|
- * @var string[]
|
|
|
|
|
- */
|
|
|
|
|
- protected $type = [
|
|
|
|
|
- 0 => '普通',
|
|
|
|
|
- 1 => '秒杀',
|
|
|
|
|
- 2 => '砍价',
|
|
|
|
|
- 3 => '拼团',
|
|
|
|
|
- 4 => '积分',
|
|
|
|
|
- 5 => '套餐',
|
|
|
|
|
- 6 => '预售',
|
|
|
|
|
- 7 => '新人礼',
|
|
|
|
|
- 8 => '抽奖',
|
|
|
|
|
- 9 => '拼单',
|
|
|
|
|
- 10 => '桌码'
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单类型
|
|
|
|
|
+ * @var string[]
|
|
|
|
|
+ */
|
|
|
|
|
+ protected $type = [
|
|
|
|
|
+ 0 => '普通',
|
|
|
|
|
+ 1 => '秒杀',
|
|
|
|
|
+ 2 => '砍价',
|
|
|
|
|
+ 3 => '拼团',
|
|
|
|
|
+ 4 => '积分',
|
|
|
|
|
+ 5 => '套餐',
|
|
|
|
|
+ 6 => '预售',
|
|
|
|
|
+ 7 => '新人礼',
|
|
|
|
|
+ 8 => '抽奖',
|
|
|
|
|
+ 9 => '拼单',
|
|
|
|
|
+ 10 => '桌码'
|
|
|
|
|
+ ];
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 发货类型
|
|
* 发货类型
|
|
@@ -123,18 +124,18 @@ class StoreOrderServices extends BaseServices
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取列表
|
|
|
|
|
- * @param array $where
|
|
|
|
|
- * @param array $field
|
|
|
|
|
- * @param array $with
|
|
|
|
|
- * @param bool $abridge
|
|
|
|
|
- * @param string $order
|
|
|
|
|
- * @return array
|
|
|
|
|
- * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
|
|
- * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取列表
|
|
|
|
|
+ * @param array $where
|
|
|
|
|
+ * @param array $field
|
|
|
|
|
+ * @param array $with
|
|
|
|
|
+ * @param bool $abridge
|
|
|
|
|
+ * @param string $order
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ */
|
|
|
public function getOrderList(array $where, array $field = ['*'], array $with = [], bool $abridge = false, string $order = 'add_time DESC,id DESC')
|
|
public function getOrderList(array $where, array $field = ['*'], array $with = [], bool $abridge = false, string $order = 'add_time DESC,id DESC')
|
|
|
{
|
|
{
|
|
|
[$page, $limit] = $this->getPageValue();
|
|
[$page, $limit] = $this->getPageValue();
|
|
@@ -337,11 +338,11 @@ class StoreOrderServices extends BaseServices
|
|
|
$cart['surplus_num'] = $cartInfo['write_surplus_times'];
|
|
$cart['surplus_num'] = $cartInfo['write_surplus_times'];
|
|
|
$cart['refund_num'] = $cartInfo['refund_num'];
|
|
$cart['refund_num'] = $cartInfo['refund_num'];
|
|
|
$cart['write_times'] = $cartInfo['write_times'];
|
|
$cart['write_times'] = $cartInfo['write_times'];
|
|
|
- $cart['write_surplus_times'] = $cartInfo['write_surplus_times'];
|
|
|
|
|
- $cart['write_start'] = $cartInfo['write_start'];
|
|
|
|
|
- $cart['write_end'] = $cartInfo['write_end'];
|
|
|
|
|
- $cart['write_off'] = max(bcsub((string)$cart['write_times'], (string)$cart['write_surplus_times'], 0), 0);
|
|
|
|
|
- $cart['product_type'] = $cartInfo['product_type'];
|
|
|
|
|
|
|
+ $cart['write_surplus_times'] = $cartInfo['write_surplus_times'];
|
|
|
|
|
+ $cart['write_start'] = $cartInfo['write_start'];
|
|
|
|
|
+ $cart['write_end'] = $cartInfo['write_end'];
|
|
|
|
|
+ $cart['write_off'] = max(bcsub((string)$cart['write_times'], (string)$cart['write_surplus_times'], 0), 0);
|
|
|
|
|
+ $cart['product_type'] = $cartInfo['product_type'];
|
|
|
$cart['supplier_id'] = $cart['store_id'] = 0;
|
|
$cart['supplier_id'] = $cart['store_id'] = 0;
|
|
|
if ($cartInfo['type'] == 1) {
|
|
if ($cartInfo['type'] == 1) {
|
|
|
$cart['store_id'] = $cartInfo['relation_id'] ?? 0;
|
|
$cart['store_id'] = $cartInfo['relation_id'] ?? 0;
|
|
@@ -500,16 +501,16 @@ class StoreOrderServices extends BaseServices
|
|
|
$status['_msg'] = '等待其他人参加拼团';
|
|
$status['_msg'] = '等待其他人参加拼团';
|
|
|
$status['_class'] = 'state-nfh';
|
|
$status['_class'] = 'state-nfh';
|
|
|
} else if (in_array($order['shipping_type'], [1, 3])) {
|
|
} else if (in_array($order['shipping_type'], [1, 3])) {
|
|
|
- $status['_type'] = 1;
|
|
|
|
|
- $status['_title'] = '未发货';
|
|
|
|
|
- $status['_msg'] = '商家未发货,请耐心等待';
|
|
|
|
|
- $status['_class'] = 'state-nfh';
|
|
|
|
|
- } else {
|
|
|
|
|
- $status['_type'] = 5;
|
|
|
|
|
- $status['_title'] = '待核销';
|
|
|
|
|
- $status['_msg'] = '待核销,请到核销点进行核销';
|
|
|
|
|
- $status['_class'] = 'state-nfh';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $status['_type'] = 1;
|
|
|
|
|
+ $status['_title'] = '未发货';
|
|
|
|
|
+ $status['_msg'] = '商家未发货,请耐心等待';
|
|
|
|
|
+ $status['_class'] = 'state-nfh';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $status['_type'] = 5;
|
|
|
|
|
+ $status['_title'] = '待核销';
|
|
|
|
|
+ $status['_msg'] = '待核销,请到核销点进行核销';
|
|
|
|
|
+ $status['_class'] = 'state-nfh';
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
if (in_array($order['shipping_type'], [1, 3])) {
|
|
if (in_array($order['shipping_type'], [1, 3])) {
|
|
|
$status['_type'] = 1;
|
|
$status['_type'] = 1;
|
|
@@ -570,7 +571,7 @@ class StoreOrderServices extends BaseServices
|
|
|
try {
|
|
try {
|
|
|
$order_details_images = sys_data('order_details_images') ?: [];
|
|
$order_details_images = sys_data('order_details_images') ?: [];
|
|
|
$order_details_images = array_combine(array_column($order_details_images, 'order_status'), $order_details_images);
|
|
$order_details_images = array_combine(array_column($order_details_images, 'order_status'), $order_details_images);
|
|
|
- $_type = $order['_status']['_type'] == 5 ? 2 : $order['_status']['_type'];
|
|
|
|
|
|
|
+ $_type = $order['_status']['_type'] == 5 ? 2 : $order['_status']['_type'];
|
|
|
$order['status_pic'] = $order_details_images[$_type]['pic'] ?? '';
|
|
$order['status_pic'] = $order_details_images[$_type]['pic'] ?? '';
|
|
|
} catch (\Throwable $e) {
|
|
} catch (\Throwable $e) {
|
|
|
}
|
|
}
|
|
@@ -649,10 +650,10 @@ class StoreOrderServices extends BaseServices
|
|
|
$color = '#457856';
|
|
$color = '#457856';
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
- case 4://积分
|
|
|
|
|
- $pink_name = $abridge ? '积分' : '[积分订单]';
|
|
|
|
|
- $color = '#12c5e9';
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ case 4://积分
|
|
|
|
|
+ $pink_name = $abridge ? '积分' : '[积分订单]';
|
|
|
|
|
+ $color = '#12c5e9';
|
|
|
|
|
+ break;
|
|
|
case 5://套餐
|
|
case 5://套餐
|
|
|
$pink_name = $abridge ? '优惠' : '[优惠套餐]';
|
|
$pink_name = $abridge ? '优惠' : '[优惠套餐]';
|
|
|
$color = '#12c5e9';
|
|
$color = '#12c5e9';
|
|
@@ -1104,14 +1105,14 @@ HTML;
|
|
|
if ($order['paid']) {
|
|
if ($order['paid']) {
|
|
|
throw new ValidateException('订单已支付');
|
|
throw new ValidateException('订单已支付');
|
|
|
}
|
|
}
|
|
|
- //限制改价金额两位小数
|
|
|
|
|
- $data['pay_price'] = sprintf("%.2f", $data['pay_price']);
|
|
|
|
|
- $pay_price = $order['pay_price'];
|
|
|
|
|
- if ($order['change_price']) {//已经改过一次价
|
|
|
|
|
- $pay_price = bcadd((string)$pay_price, (string)$order['change_price'], 2);
|
|
|
|
|
- }
|
|
|
|
|
- //记录改价优惠金额
|
|
|
|
|
- $data['change_price'] = (float)bcsub((string)$pay_price, (string)($data['pay_price'] ?? 0), 2);
|
|
|
|
|
|
|
+ //限制改价金额两位小数
|
|
|
|
|
+ $data['pay_price'] = sprintf("%.2f", $data['pay_price']);
|
|
|
|
|
+ $pay_price = $order['pay_price'];
|
|
|
|
|
+ if ($order['change_price']) {//已经改过一次价
|
|
|
|
|
+ $pay_price = bcadd((string)$pay_price, (string)$order['change_price'], 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ //记录改价优惠金额
|
|
|
|
|
+ $data['change_price'] = (float)bcsub((string)$pay_price, (string)($data['pay_price'] ?? 0), 2);
|
|
|
|
|
|
|
|
/** @var StoreOrderStatusServices $services */
|
|
/** @var StoreOrderStatusServices $services */
|
|
|
$services = app()->make(StoreOrderStatusServices::class);
|
|
$services = app()->make(StoreOrderStatusServices::class);
|
|
@@ -1512,7 +1513,10 @@ HTML;
|
|
|
'total' => $total_user . '人',
|
|
'total' => $total_user . '人',
|
|
|
'date' => '今日'
|
|
'date' => '今日'
|
|
|
];
|
|
];
|
|
|
- $info = array_values(compact('sales', 'visits', 'order', 'user'));
|
|
|
|
|
|
|
+ $integralService = app()->make(UserAwardIntegralServices::class);
|
|
|
|
|
+ $integral['active'] = $integralService->getIntegralSum(['status' => 0, 'type' => 1]);
|
|
|
|
|
+ $integral['static'] = $integralService->getIntegralSum(['status' => 0, 'type' => 0]);
|
|
|
|
|
+ $info = array_values(compact('sales', 'visits', 'order', 'user', 'integral'));
|
|
|
$info[0]['title'] = '销售额';
|
|
$info[0]['title'] = '销售额';
|
|
|
$info[1]['title'] = '用户访问量';
|
|
$info[1]['title'] = '用户访问量';
|
|
|
$info[2]['title'] = '订单量';
|
|
$info[2]['title'] = '订单量';
|
|
@@ -1524,64 +1528,64 @@ HTML;
|
|
|
return $info;
|
|
return $info;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 打印订单
|
|
|
|
|
- * @param int $id
|
|
|
|
|
- * @param bool $isTable
|
|
|
|
|
- * @return bool
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 打印订单
|
|
|
|
|
+ * @param int $id
|
|
|
|
|
+ * @param bool $isTable
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ */
|
|
|
public function orderPrint(int $id, int $type = -1, int $relation_id = -1, bool $isTable = false)
|
|
public function orderPrint(int $id, int $type = -1, int $relation_id = -1, bool $isTable = false)
|
|
|
{
|
|
{
|
|
|
- $order = $this->dao->get($id);
|
|
|
|
|
- if (!$order) {
|
|
|
|
|
- throw new ValidateException('订单信息不存在!');
|
|
|
|
|
- }
|
|
|
|
|
- $order = $order->toArray();
|
|
|
|
|
- /** @var StoreOrderCartInfoServices $cartServices */
|
|
|
|
|
- $cartServices = app()->make(StoreOrderCartInfoServices::class);
|
|
|
|
|
- $product = $cartServices->getCartInfoPrintProduct((int)$order['id']);
|
|
|
|
|
- if (!$product) {
|
|
|
|
|
- throw new ValidateException('订单商品获取失败,无法打印!');
|
|
|
|
|
- }
|
|
|
|
|
- if ($type == -1 && $relation_id == -1) {//取订单属于那一端
|
|
|
|
|
- $type = $relation_id = 0;
|
|
|
|
|
- if (isset($order['store_id']) && $order['store_id']) {
|
|
|
|
|
- $store_id = (int)$order['store_id'];
|
|
|
|
|
- if ($isTable) {
|
|
|
|
|
- if (isset($order['type']) && $order['type'] == 10) {
|
|
|
|
|
- $print = store_config($store_id, 'store_printing_timing');
|
|
|
|
|
- if(!$print || !is_array($print) || !in_array(2, $print)){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $type = 1;
|
|
|
|
|
- $relation_id = $store_id;
|
|
|
|
|
- } elseif (isset($order['supplier_id']) && $order['supplier_id']) {
|
|
|
|
|
- $supplier_id = (int)$order['supplier_id'];
|
|
|
|
|
- $type = 2;
|
|
|
|
|
- $relation_id = $supplier_id;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /** @var ConfigServices $configServices */
|
|
|
|
|
- $configServices = app()->make(ConfigServices::class);
|
|
|
|
|
- [$switch, $name, $configData] = $configServices->getPrintingConfig($type, $relation_id);
|
|
|
|
|
- if (!$switch) {
|
|
|
|
|
- throw new ValidateException('请先开启小票打印');
|
|
|
|
|
- }
|
|
|
|
|
- foreach ($configData as $value) {
|
|
|
|
|
- if (!$value) {
|
|
|
|
|
- throw new ValidateException('请先配置小票打印开发者');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- $printer = new Printer($name, $configData);
|
|
|
|
|
- $printer->setPrinterContent([
|
|
|
|
|
- 'name' => sys_config('site_name'),
|
|
|
|
|
- 'orderInfo' => is_object($order) ? $order->toArray() : $order,
|
|
|
|
|
- 'product' => $product
|
|
|
|
|
- ])->startPrinter();
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ $order = $this->dao->get($id);
|
|
|
|
|
+ if (!$order) {
|
|
|
|
|
+ throw new ValidateException('订单信息不存在!');
|
|
|
|
|
+ }
|
|
|
|
|
+ $order = $order->toArray();
|
|
|
|
|
+ /** @var StoreOrderCartInfoServices $cartServices */
|
|
|
|
|
+ $cartServices = app()->make(StoreOrderCartInfoServices::class);
|
|
|
|
|
+ $product = $cartServices->getCartInfoPrintProduct((int)$order['id']);
|
|
|
|
|
+ if (!$product) {
|
|
|
|
|
+ throw new ValidateException('订单商品获取失败,无法打印!');
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($type == -1 && $relation_id == -1) {//取订单属于那一端
|
|
|
|
|
+ $type = $relation_id = 0;
|
|
|
|
|
+ if (isset($order['store_id']) && $order['store_id']) {
|
|
|
|
|
+ $store_id = (int)$order['store_id'];
|
|
|
|
|
+ if ($isTable) {
|
|
|
|
|
+ if (isset($order['type']) && $order['type'] == 10) {
|
|
|
|
|
+ $print = store_config($store_id, 'store_printing_timing');
|
|
|
|
|
+ if (!$print || !is_array($print) || !in_array(2, $print)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $type = 1;
|
|
|
|
|
+ $relation_id = $store_id;
|
|
|
|
|
+ } elseif (isset($order['supplier_id']) && $order['supplier_id']) {
|
|
|
|
|
+ $supplier_id = (int)$order['supplier_id'];
|
|
|
|
|
+ $type = 2;
|
|
|
|
|
+ $relation_id = $supplier_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** @var ConfigServices $configServices */
|
|
|
|
|
+ $configServices = app()->make(ConfigServices::class);
|
|
|
|
|
+ [$switch, $name, $configData] = $configServices->getPrintingConfig($type, $relation_id);
|
|
|
|
|
+ if (!$switch) {
|
|
|
|
|
+ throw new ValidateException('请先开启小票打印');
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($configData as $value) {
|
|
|
|
|
+ if (!$value) {
|
|
|
|
|
+ throw new ValidateException('请先配置小票打印开发者');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $printer = new Printer($name, $configData);
|
|
|
|
|
+ $printer->setPrinterContent([
|
|
|
|
|
+ 'name' => sys_config('site_name'),
|
|
|
|
|
+ 'orderInfo' => is_object($order) ? $order->toArray() : $order,
|
|
|
|
|
+ 'product' => $product
|
|
|
|
|
+ ])->startPrinter();
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1666,12 +1670,12 @@ HTML;
|
|
|
// $data['giveCartInfo'] = $giveCartList;
|
|
// $data['giveCartInfo'] = $giveCartList;
|
|
|
$data['custom_form'] = [];
|
|
$data['custom_form'] = [];
|
|
|
if (isset($cartGroup['cartInfo'][0]['productInfo']['system_form_id']) && $cartGroup['cartInfo'][0]['productInfo']['system_form_id']) {
|
|
if (isset($cartGroup['cartInfo'][0]['productInfo']['system_form_id']) && $cartGroup['cartInfo'][0]['productInfo']['system_form_id']) {
|
|
|
- /** @var SystemFormServices $systemFormServices */
|
|
|
|
|
- $systemFormServices = app()->make(SystemFormServices::class);
|
|
|
|
|
- $formInfo = $systemFormServices->value(['id' => $cartGroup['cartInfo'][0]['productInfo']['system_form_id']], 'value');
|
|
|
|
|
- if ($formInfo) {
|
|
|
|
|
- $data['custom_form'] = is_string($formInfo) ? json_decode($formInfo, true) : $formInfo;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /** @var SystemFormServices $systemFormServices */
|
|
|
|
|
+ $systemFormServices = app()->make(SystemFormServices::class);
|
|
|
|
|
+ $formInfo = $systemFormServices->value(['id' => $cartGroup['cartInfo'][0]['productInfo']['system_form_id']], 'value');
|
|
|
|
|
+ if ($formInfo) {
|
|
|
|
|
+ $data['custom_form'] = is_string($formInfo) ? json_decode($formInfo, true) : $formInfo;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$data['give_integral'] = $other['give_integral'];
|
|
$data['give_integral'] = $other['give_integral'];
|
|
|
$data['give_coupon'] = [];
|
|
$data['give_coupon'] = [];
|
|
@@ -2018,9 +2022,9 @@ HTML;
|
|
|
}
|
|
}
|
|
|
$list = $this->dao->search($where)->with($with)->page($page, $limit)->order('id asc')->select()->toArray();
|
|
$list = $this->dao->search($where)->with($with)->page($page, $limit)->order('id asc')->select()->toArray();
|
|
|
if ($list) {
|
|
if ($list) {
|
|
|
- /** @var $userServices */
|
|
|
|
|
- $userServices = app()->make(UserServices::class);
|
|
|
|
|
- $userSex = $userServices->getColumn([['uid', 'IN', array_unique(array_column($list, 'uid'))]], 'uid,sex', 'uid');
|
|
|
|
|
|
|
+ /** @var $userServices */
|
|
|
|
|
+ $userServices = app()->make(UserServices::class);
|
|
|
|
|
+ $userSex = $userServices->getColumn([['uid', 'IN', array_unique(array_column($list, 'uid'))]], 'uid,sex', 'uid');
|
|
|
foreach ($list as &$item) {
|
|
foreach ($list as &$item) {
|
|
|
/** @var StoreOrderCartInfoServices $orderCart */
|
|
/** @var StoreOrderCartInfoServices $orderCart */
|
|
|
$orderCart = app()->make(StoreOrderCartInfoServices::class);
|
|
$orderCart = app()->make(StoreOrderCartInfoServices::class);
|
|
@@ -2033,9 +2037,9 @@ HTML;
|
|
|
}
|
|
}
|
|
|
$item['_info'] = $_info;
|
|
$item['_info'] = $_info;
|
|
|
$item['sex'] = $userSex[$item['uid']]['sex'] ?? '';
|
|
$item['sex'] = $userSex[$item['uid']]['sex'] ?? '';
|
|
|
- [$pink_name, $color] = $this->tidyOrderType($item);
|
|
|
|
|
- $item['pink_name'] = $pink_name;
|
|
|
|
|
- $item['color'] = $color;
|
|
|
|
|
|
|
+ [$pink_name, $color] = $this->tidyOrderType($item);
|
|
|
|
|
+ $item['pink_name'] = $pink_name;
|
|
|
|
|
+ $item['color'] = $color;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return $list;
|
|
return $list;
|
|
@@ -2669,18 +2673,18 @@ HTML;
|
|
|
$store_id = [];
|
|
$store_id = [];
|
|
|
//delivery_type :1、快递,2、到店自提,3、门店配送
|
|
//delivery_type :1、快递,2、到店自提,3、门店配送
|
|
|
foreach ($cartInfo as $item) {
|
|
foreach ($cartInfo as $item) {
|
|
|
- $delivery_type = is_string($item['productInfo']['delivery_type']) ? explode(',', $item['productInfo']['delivery_type']) : $item['productInfo']['delivery_type'];
|
|
|
|
|
- if (in_array(1, $delivery_type)) {//支持平台配送 验证平台该商品
|
|
|
|
|
- $productInfo = $item['productInfo'] ?? [];
|
|
|
|
|
- if ($productInfo && isset($productInfo['type']) && $productInfo['type'] == 1 && isset($productInfo['pid']) && $productInfo['pid']) {
|
|
|
|
|
- /** @var StoreProductServices $productServices */
|
|
|
|
|
- $productServices = app()->make(StoreProductServices::class);
|
|
|
|
|
- $platInfo = $productServices->getCacheProductInfo((int)$productInfo['pid']);
|
|
|
|
|
- if (!$platInfo || $platInfo['stock'] <= 0) {
|
|
|
|
|
- unset($delivery_type[array_search('1', $delivery_type)]);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $delivery_type = is_string($item['productInfo']['delivery_type']) ? explode(',', $item['productInfo']['delivery_type']) : $item['productInfo']['delivery_type'];
|
|
|
|
|
+ if (in_array(1, $delivery_type)) {//支持平台配送 验证平台该商品
|
|
|
|
|
+ $productInfo = $item['productInfo'] ?? [];
|
|
|
|
|
+ if ($productInfo && isset($productInfo['type']) && $productInfo['type'] == 1 && isset($productInfo['pid']) && $productInfo['pid']) {
|
|
|
|
|
+ /** @var StoreProductServices $productServices */
|
|
|
|
|
+ $productServices = app()->make(StoreProductServices::class);
|
|
|
|
|
+ $platInfo = $productServices->getCacheProductInfo((int)$productInfo['pid']);
|
|
|
|
|
+ if (!$platInfo || $platInfo['stock'] <= 0) {
|
|
|
|
|
+ unset($delivery_type[array_search('1', $delivery_type)]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$arr = array_merge($arr, $delivery_type);
|
|
$arr = array_merge($arr, $delivery_type);
|
|
|
if (isset($item['productInfo']['type']) && isset($item['productInfo']['relation_id']) && $item['productInfo']['type'] == 1 && $item['productInfo']['relation_id']) {
|
|
if (isset($item['productInfo']['type']) && isset($item['productInfo']['relation_id']) && $item['productInfo']['type'] == 1 && $item['productInfo']['relation_id']) {
|
|
|
$store_id[] = $item['productInfo']['relation_id'];
|
|
$store_id[] = $item['productInfo']['relation_id'];
|
|
@@ -2713,36 +2717,36 @@ HTML;
|
|
|
return ['type' => $arr];
|
|
return ['type' => $arr];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @param int $pid
|
|
|
|
|
- * @param int $order_id
|
|
|
|
|
- * @return bool
|
|
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
|
|
- */
|
|
|
|
|
- public function checkSubOrderNotSend(int $pid, int $order_id)
|
|
|
|
|
- {
|
|
|
|
|
- $order_count = $this->dao->getSubOrderNotSend($pid, $order_id);
|
|
|
|
|
- if ($order_count > 0) {
|
|
|
|
|
- return false;
|
|
|
|
|
- } else {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * @param int $pid
|
|
|
|
|
- * @param int $order_id
|
|
|
|
|
- * @return bool
|
|
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
|
|
- */
|
|
|
|
|
- public function checkSubOrderNotTake(int $pid, int $order_id)
|
|
|
|
|
- {
|
|
|
|
|
- $order_count = $this->dao->getSubOrderNotTake($pid, $order_id);
|
|
|
|
|
- if ($order_count > 0) {
|
|
|
|
|
- return false;
|
|
|
|
|
- } else {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param int $pid
|
|
|
|
|
+ * @param int $order_id
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function checkSubOrderNotSend(int $pid, int $order_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $order_count = $this->dao->getSubOrderNotSend($pid, $order_id);
|
|
|
|
|
+ if ($order_count > 0) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param int $pid
|
|
|
|
|
+ * @param int $order_id
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function checkSubOrderNotTake(int $pid, int $order_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $order_count = $this->dao->getSubOrderNotTake($pid, $order_id);
|
|
|
|
|
+ if ($order_count > 0) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|