shish 5 лет назад
Родитель
Сommit
70ece6a74f
3 измененных файлов с 63 добавлено и 23 удалено
  1. 22 19
      app/ghs/controllers/SupplierController.php
  2. 37 3
      biz-ghs/merchant/classes/SupplierClass.php
  3. 4 1
      sql.sql

+ 22 - 19
app/ghs/controllers/SupplierController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use bizGhs\merchant\classes\SupplierClass;
 use bizGhs\merchant\services\SupplierService;
 use common\components\stringUtil;
 use Yii;
@@ -9,23 +10,25 @@ use common\components\util;
 
 class SupplierController extends BaseController
 {
-	
-	//供货商列表 shish 2021.1.18
-	public function actionList()
-	{
-		$get = Yii::$app->request->get();
-		$type = isset($get['type']) ? $get['type'] : 0;
-		$name = isset($get['name']) ? $get['name'] : '';
-		$where = ['ghsId' => $this->ghsId];
-		if (!empty($name)) {
-			if (stringUtil::isLetter($name)) {
-				$where['py'] = $name;
-			} else {
-				$where['upName'] = ['like', $name];
-			}
-		}
-		$list = SupplierService::getSupplierList($where);
-		util::success($list);
-	}
-	
+
+    //供货商列表 shish 2021.1.18
+    public function actionList()
+    {
+
+        $r = SupplierClass::getSupplierByIds([1]);dd($r);
+
+        $get = Yii::$app->request->get();
+        $name = isset($get['name']) ? $get['name'] : '';
+        $where = ['ghsId' => $this->ghsId];
+        if (!empty($name)) {
+            if (stringUtil::isLetter($name)) {
+                $where['py'] = ['like', $name];
+            } else {
+                $where['upName'] = ['like', $name];
+            }
+        }
+        $list = SupplierService::getSupplierList($where);
+        util::success($list);
+    }
+
 }

+ 37 - 3
biz-ghs/merchant/classes/SupplierClass.php

@@ -2,12 +2,46 @@
 
 namespace bizGhs\merchant\classes;
 
+use common\components\business;
 use Yii;
 use bizGhs\base\classes\BaseClass;
 
 class SupplierClass extends BaseClass
 {
-	
-	public static $baseFile = '\bizGhs\merchant\models\Supplier';
-	
+
+    public static $baseFile = '\bizGhs\merchant\models\Supplier';
+
+    //根据xhSupplier的id数组 取供货商信息 shish 2021.1.18
+    public static function getSupplierByIds($ids)
+    {
+        $list = self::getByIds($ids, null, 'id');
+        if (empty($list)) {
+            return [];
+        }
+        $list = self::groupBaseInfo($list);
+        return $list;
+    }
+
+    public static function groupBaseInfo($list)
+    {
+        foreach ($list as $key => $val) {
+            //头像大图
+            $list[$key]['logoUrl'] = Yii::$app->params['imgHost'] . '/hhb_small.png';
+            //头像小图,列表页使用
+            $list[$key]['smallLogoUrl'] = Yii::$app->params['imgHost'] . '/hhb_small.png';
+        }
+        return $list;
+    }
+
+    //根据xhSupplier的id取供货商信息 shish 2021.1.18
+    public static function getInfo($id)
+    {
+        return [
+            'upName' => '茗星花卉',
+            'upShopName' => '呈贡店',
+            'mobile' => '15280215347',
+            'address' => '昆明市呈贡区鲜花大道与花都路交叉路口往西南约150米',
+        ];
+    }
+
 }

+ 4 - 1
sql.sql

@@ -629,4 +629,7 @@ merchantId INT NOT NULL DEFAULT 0 COMMENT '商家id',
 ALTER TABLE `xhSupplier` ADD upName VARCHAR(30) NOT NULL DEFAULT '' COMMENT '上游供应商名称' AFTER `upId`,ADD debtAmount DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '欠款金额' AFTER `upName`,
 ADD expendAmount DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额' AFTER `debtAmount`,ADD expendNum INT NOT NULL DEFAULT 0 COMMENT '消费次数' AFTER `expendAmount`;
 ALTER TABLE `xhSupplier` ADD py VARCHAR(20) NOT NULL DEFAULT '' COMMENT '' AFTER `upName`;
-ALTER TABLE `xhItem` CHANGE `pyName` `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '花材名称的拼音首字母';
+ALTER TABLE `xhItem` CHANGE `pyName` `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '花材名称的拼音首字母';
+ALTER TABLE `xhGhsOrderItem` ADD orderSn CHAR(40) NOT NULL DEFAULT '' COMMENT '订单编号' AFTER `orderId`;
+ALTER TABLE xhSupplier MODIFY `py` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '名称拼音首字母';
+ALTER TABLE xhSupplier ADD upShopId INT NOT NULL DEFAULT 0 COMMENT '上游供货商门店id' AFTER `py`;