yingzi 2 years ago
parent
commit
8e6e401f24
1 changed files with 9 additions and 2 deletions
  1. 9 2
      Model/Purchase/MPurchase.Class.php

+ 9 - 2
Model/Purchase/MPurchase.Class.php

@@ -60,6 +60,9 @@ class MPurchase extends MBaseModel
 
     private $cutTable = 200000;
     
+    
+    private $objDShop;
+    
 
     /**
      * MOrder constructor.
@@ -86,6 +89,10 @@ class MPurchase extends MBaseModel
         $this->objDPurchaseGoods->setSearchIndex('purchase_details_search')->setType('purchase_details');
 
         $this->objStock = new Stock($this->onlineEnterpriseId);
+        
+        $this->objDShop = new DShop();
+        $this->objDShop->setTable('qianniao_shop_1');
+        
     }
 
     /**
@@ -779,7 +786,7 @@ class MPurchase extends MBaseModel
         $whereSql .= $where . ' p.auditStatus = ' . StatusCode::$auditStatus['auditPass'] . ' AND p.deleteStatus = ' . StatusCode::$standard . ' AND g.deleteStatus = ' . StatusCode::$standard;
         $sql = 'SELECT p.warehouseId,p.warehouseName,p.id,p.`no`,p.buyerId,p.buyerName,p.supplierId,p.supplierName,p.operatorId,p.operatorName,p.inStatus,s.name as shopName,g.skuId,g.categoryId,g.categoryName,g.basicGoodsId AS materielId,g.goodsName AS materielName,g.goodsCode AS materielCode,SUM(g.buyerNum) AS allNum,SUM(g.subtotalPrice) AS total,(SUM(g.subtotalPrice) / SUM(g.buyerNum)) AS costPrice, SUM(g.otherNum) AS otherNum '
                 . 'FROM ' . $this->objDPurchase->get_Table() . ' p '
-                . 'LEFT JOIN qianniao_shop_1 s ON s.id = p.shopId '
+                . 'LEFT JOIN '.$this->objDShop->get_Table().' s ON s.id = p.shopId '
                 . 'LEFT JOIN ' . $this->objDPurchaseGoods->get_Table() . ' g ON p.id = g.purchaseId '
                 . $whereSql . ' ' . $groupBySql . ' '
                 . 'ORDER BY p.createTime DESC LIMIT ' . $offset . ' , ' . $limit;
@@ -791,7 +798,7 @@ class MPurchase extends MBaseModel
         $selectData = $dbResult;
         unset($dbResult);
         $totalSql = 'SELECT COUNT(id) AS total FROM (SELECT p.id FROM ' . $this->objDPurchase->get_Table() . ' p '
-                . 'LEFT JOIN qianniao_shop_1 s ON s.id = p.shopId '
+                . 'LEFT JOIN '.$this->objDShop->get_Table().' s ON s.id = p.shopId '
                 . 'LEFT JOIN ' . $this->objDPurchaseGoods->get_Table() . ' g ON p.id = g.purchaseId ' . $whereSql . ' ' . $groupBySql . ') AS selectData';
         $dbResult = $this->objDPurchase->query($totalSql);
         if ($dbResult === false) {