|
|
@@ -38,7 +38,7 @@ class PurchaseClass extends BaseClass
|
|
|
$data['orderSn'] = $orderSn;
|
|
|
$data['prePrice'] = 0.01;
|
|
|
$data['actPrice'] = 0.01;
|
|
|
- $data['sendTimeWant'] = date("Y-m-d").' '.$data['sendTime'];
|
|
|
+ $data['sendTimeWant'] = date("Y-m-d") . ' ' . $data['sendTime'];
|
|
|
unset($data['sendTime']);
|
|
|
$respond = self::add($data);
|
|
|
if (isset($data['product']) == false || empty($data['product'])) {
|
|
|
@@ -51,8 +51,13 @@ class PurchaseClass extends BaseClass
|
|
|
PurchaseItemClass::batchAdd($productList);
|
|
|
|
|
|
//供货商增加订单
|
|
|
-
|
|
|
-
|
|
|
+ $ghsId = $data['ghsId'] ?? 0;
|
|
|
+ if (empty($ghsId)) {
|
|
|
+ util::fail('没有找到供货商');
|
|
|
+ }
|
|
|
+ $ghs = GhsClass::getGhsInfo($ghsId);
|
|
|
+ $ghsSjId = $ghs['ghsSjId'] ?? 0;
|
|
|
+ $ghsShopId = $ghs['ghsShopId'];
|
|
|
$getType = $data['getType'];
|
|
|
$orderData = [
|
|
|
'prePrice' => 0.01,
|
|
|
@@ -61,10 +66,10 @@ class PurchaseClass extends BaseClass
|
|
|
'smallNum' => 3,
|
|
|
'product' => $productList,
|
|
|
'merchantId' => $ghsSjId,
|
|
|
- 'sendType'=>$getType,
|
|
|
+ 'sendType' => $getType,
|
|
|
];
|
|
|
|
|
|
- \bizGhs\order\classes\OrderClass::addOrder($orderData, $shop, true);
|
|
|
+ \bizGhs\order\classes\OrderClass::addOrder($orderData, $ghsShopId, true);
|
|
|
|
|
|
return $respond;
|
|
|
}
|
|
|
@@ -83,7 +88,7 @@ class PurchaseClass extends BaseClass
|
|
|
{
|
|
|
|
|
|
$ghsIds = array_unique(array_filter(array_column($list, 'ghsId')));
|
|
|
- $supplierInfo = GhsClass::getGhsByIds($ghsIds);
|
|
|
+ $ghsInfo = GhsClass::getGhsByIds($ghsIds);
|
|
|
|
|
|
$adminIds = array_unique(array_filter(array_column($list, 'adminId')));
|
|
|
$adminInfo = AdminClass::getAdminByIds($adminIds, null, 'id');
|
|
|
@@ -94,10 +99,10 @@ class PurchaseClass extends BaseClass
|
|
|
$list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
|
|
|
|
|
|
$ghsId = $val['ghsId'] ?? 0;
|
|
|
- $list[$key]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
|
|
|
- $list[$key]['supplierAvatar'] = $supplierInfo[$ghsId]['smallLogoUrl'] ?? '';
|
|
|
- $list[$key]['supplierMobile'] = $supplierInfo[$ghsId]['mobile'] ?? '';
|
|
|
- $list[$key]['supplierAddress'] = $supplierInfo[$ghsId]['address'] ?? '';
|
|
|
+ $list[$key]['supplierName'] = $ghsInfo[$ghsId]['name'] ?? '';
|
|
|
+ $list[$key]['supplierAvatar'] = $ghsInfo[$ghsId]['smallLogoUrl'] ?? '';
|
|
|
+ $list[$key]['supplierMobile'] = $ghsInfo[$ghsId]['mobile'] ?? '';
|
|
|
+ $list[$key]['supplierAddress'] = $ghsInfo[$ghsId]['address'] ?? '';
|
|
|
|
|
|
if ($showButton) {
|
|
|
$list[$key]['buttonList'] = [
|