shish 5 ani în urmă
părinte
comite
880deacf6b

+ 1 - 1
app-ghs/controllers/OrderController.php

@@ -115,7 +115,7 @@ class OrderController extends BaseController
             //判断花材有效性
             ProductClass::valid($productList, $this->shopId);
             $post['product'] = $productList;
-            $return = OrderClass::addOrder($post, $this->shop);
+            $return = OrderClass::addOrder($post, $this->shopId);
             $transaction->commit();
             util::success($return);
         } catch (\Exception $e) {

+ 3 - 3
app-ghs/controllers/PurchaseOrderController.php

@@ -36,9 +36,9 @@ class PurchaseOrderController extends BaseController
         if(empty($ghsId)){
             util::fail("请选择供应商");
         }
-        $supplierInfo = GhsClass::getGhsInfo($ghsId);
-        GhsClass::valid($supplierInfo,$this->sjId);
-        $post['supplierInfo']= json_encode($supplierInfo);
+        $ghsInfo = GhsClass::getGhsInfo($ghsId);
+        GhsClass::valid($ghsInfo,$this->sjId);
+        $post['ghsInfo']= json_encode($ghsInfo);
 
         //判断花材里的信息
         foreach ($ghsItemInfo as $v){

+ 2 - 3
biz-ghs/order/classes/OrderClass.php

@@ -76,7 +76,7 @@ class OrderClass extends BaseClass
     const CLEAR_HAS_GATHERING = 2;
 
     //添加订单 ssh 2019.12.5
-    public static function addOrder($data, $currentShop, $customOrder = false)
+    public static function addOrder($data, $currentShopId, $customOrder = false)
     {
         $sjId = $data['merchantId'] ?? 0;
         $month = date("Ym");
@@ -110,8 +110,7 @@ class OrderClass extends BaseClass
         $data['weight'] = $weight;
 
         //门店总订单数+1
-        $shopId = $currentShop['id'] ?? 0;
-        $shop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $shopId])->one();
+        $shop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $currentShopId])->one();
         if (empty($shop)) {
             util::fail('没有找到门店');
         }

+ 5 - 5
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -170,7 +170,7 @@ class PurchaseOrderClass extends BaseClass
             'shopId'=>$shopId,
         ];
         $orderData = self::getByCondition($where);
-        $orderData['supplierInfo'] = json_decode($orderData['supplierInfo']);
+        $orderData['ghsInfo'] = json_decode($orderData['ghsInfo']);
         if(!$orderData) {
             util::fail('订单不存在');
         }
@@ -194,10 +194,10 @@ class PurchaseOrderClass extends BaseClass
 
 		//供货商信息
         $ghsId = $orderData['ghsId'] ?? 0;
-        $supplierInfo = GhsClass::getGhsInfo($ghsId);
-        $orderData['supplierName'] = $supplierInfo['name'] ?? '';
-        $orderData['supplierMobile'] = $supplierInfo['mobile'] ?? '';
-	    $orderData['supplierAddress'] = $supplierInfo['address'] ?? '';
+        $ghsInfo = GhsClass::getGhsInfo($ghsId);
+        $orderData['supplierName'] = $ghsInfo['name'] ?? '';
+        $orderData['supplierMobile'] = $ghsInfo['mobile'] ?? '';
+	    $orderData['supplierAddress'] = $ghsInfo['address'] ?? '';
 
         $orderData['itemInfo'] = $itemData;
         $orderData['statusName'] = self::getStatusName($orderData['status']);

+ 5 - 5
biz-ghs/order/traits/OrderTrait.php

@@ -55,14 +55,14 @@ trait OrderTrait
 			return $list;
 		}
 		$ghsIds = array_unique(array_filter(array_column($list, 'ghsId')));
-		$supplierInfo = GhsClass::getGhsByIds($ghsIds);
+		$ghsInfo = GhsClass::getGhsByIds($ghsIds);
 
 		foreach ($list as $k => $val) {
 			$ghsId = $val['ghsId'] ?? 0;
-			$list[$k]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
-			$list[$k]['supplierAvatar'] = $supplierInfo[$ghsId]['smallLogoUrl'] ?? '';
-			$list[$k]['supplierMobile'] = $supplierInfo[$ghsId]['mobile'] ?? '';
-			$list[$k]['supplierAddress'] = $supplierInfo[$ghsId]['address'] ?? '';
+			$list[$k]['supplierName'] = $ghsInfo[$ghsId]['name'] ?? '';
+			$list[$k]['supplierAvatar'] = $ghsInfo[$ghsId]['smallLogoUrl'] ?? '';
+			$list[$k]['supplierMobile'] = $ghsInfo[$ghsId]['mobile'] ?? '';
+			$list[$k]['supplierAddress'] = $ghsInfo[$ghsId]['address'] ?? '';
 		}
 		return $list;
 	}

+ 15 - 10
biz-hd/purchase/classes/PurchaseClass.php

@@ -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'] = [

+ 3 - 3
biz-hd/purchase/services/PurchaseService.php

@@ -30,15 +30,15 @@ class PurchaseService extends BaseService
         }
 
         $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);
 
         foreach ($list as $key => $val) {
             $ghsId = $val['ghsId'];
-            $list[$key]['supplierName'] = $supplierInfo[$ghsId]['name'] ?? '';
-            $list[$key]['supplierAvatar'] = $supplierInfo[$ghsId]['logoUrl'] ?? imgUtil::getPrefix() . '/hhb_small.png';
+            $list[$key]['supplierName'] = $ghsInfo[$ghsId]['name'] ?? '';
+            $list[$key]['supplierAvatar'] = $ghsInfo[$ghsId]['logoUrl'] ?? imgUtil::getPrefix() . '/hhb_small.png';
             $adminId = $val['adminId'] ?? 0;
             $list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
             $list[$key]['status'] = rand(1, 4);