shish 5 anni fa
parent
commit
90b84ae564

+ 8 - 13
app/ghs/controllers/SupplierController.php

@@ -2,12 +2,14 @@
 
 namespace ghs\controllers;
 
+use bizGhs\merchant\services\SupplierService;
+use common\components\stringUtil;
 use Yii;
 use common\components\util;
 
 class SupplierController extends BaseController
 {
-
+	
 	//供货商列表 shish 2021.1.18
 	public function actionList()
 	{
@@ -15,22 +17,15 @@ class SupplierController extends BaseController
 		$type = isset($get['type']) ? $get['type'] : 0;
 		$name = isset($get['name']) ? $get['name'] : '';
 		$where = ['ghsId' => $this->ghsId];
-		switch ($type) {
-			case 1:
-				//已开店
-				$where['isOpen'] = 1;
-				break;
-			default:
-		}
 		if (!empty($name)) {
-			if (stringUtil::isMobile($name)) {
-				$where['mobile'] = $name;
+			if (stringUtil::isLetter($name)) {
+				$where['py'] = $name;
 			} else {
-				$where['shopName'] = ['like', $name];
+				$where['upName'] = ['like', $name];
 			}
 		}
-		$list = CustomService::getCustomList($where);
+		$list = SupplierService::getSupplierList($where);
 		util::success($list);
 	}
-
+	
 }

+ 39 - 39
biz-ghs/custom/services/CustomService.php

@@ -9,43 +9,43 @@ use Yii;
 
 class CustomService extends BaseService
 {
-
-    public static $baseFile = '\bizGhs\custom\classes\CustomClass';
-
-    public static function getCustomList($where)
-    {
-        $data = CustomClass::getList('*', $where, 'addTime DESC');
-        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
-        if (empty($list)) {
-            return $data;
-        }
-        $data['list'] = CustomClass::groupBaseInfo($list);
-        $data['isOpenNum'] = 10;
-        $data['allNum'] = 80;
-        return $data;
-    }
-
-    //获取客户信息,包括商家头像和店长信息 shish 2021.1.8
-    public static function getCustomInfo($customId)
-    {
-        $custom = CustomClass::getById($customId);
-        if (empty($custom)) {
-            return [];
-        }
-        $list = CustomClass::groupBaseInfo([$custom]);
-        $custom = current($list);
-        $retailShopId = $custom['retailShopId'] ?? 0;
-        $retailShop = \biz\merchant\classes\ShopClass::getById($retailShopId);
-        $super = \biz\merchant\classes\ShopClass::getSuper($retailShopId);
-        $custom['province'] = $retailShop['province'] ?? '';
-        $custom['city'] = $retailShop['city'] ?? '';
-        $custom['address'] = $retailShop['address'] ?? '';
-        $custom['floor'] = $retailShop['floor'] ?? '';
-        $custom['lat'] = $retailShop['lat'] ?? '';
-        $custom['long'] = $retailShop['long'] ?? '';
-        $custom['userName'] = $super['adminName'] ?? '';
-        $custom['mobile'] = $super['mobile'] ?? '';
-        return $custom;
-    }
-
+	
+	public static $baseFile = '\bizGhs\custom\classes\CustomClass';
+	
+	public static function getCustomList($where)
+	{
+		$data = CustomClass::getList('*', $where, 'addTime DESC');
+		$data['isOpenNum'] = 10;
+		$data['allNum'] = 80;
+		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+		if (empty($list)) {
+			return $data;
+		}
+		$data['list'] = CustomClass::groupBaseInfo($list);
+		return $data;
+	}
+	
+	//获取客户信息,包括商家头像和店长信息 shish 2021.1.8
+	public static function getCustomInfo($customId)
+	{
+		$custom = CustomClass::getById($customId);
+		if (empty($custom)) {
+			return [];
+		}
+		$list = CustomClass::groupBaseInfo([$custom]);
+		$custom = current($list);
+		$retailShopId = $custom['retailShopId'] ?? 0;
+		$retailShop = \biz\merchant\classes\ShopClass::getById($retailShopId);
+		$super = \biz\merchant\classes\ShopClass::getSuper($retailShopId);
+		$custom['province'] = $retailShop['province'] ?? '';
+		$custom['city'] = $retailShop['city'] ?? '';
+		$custom['address'] = $retailShop['address'] ?? '';
+		$custom['floor'] = $retailShop['floor'] ?? '';
+		$custom['lat'] = $retailShop['lat'] ?? '';
+		$custom['long'] = $retailShop['long'] ?? '';
+		$custom['userName'] = $super['adminName'] ?? '';
+		$custom['mobile'] = $super['mobile'] ?? '';
+		return $custom;
+	}
+	
 }

+ 8 - 0
biz-ghs/merchant/services/SupplierService.php

@@ -3,6 +3,7 @@
 namespace bizGhs\merchant\services;
 
 use bizGhs\base\services\BaseService;
+use bizGhs\merchant\classes\SupplierClass;
 use Yii;
 
 class SupplierService extends BaseService
@@ -10,4 +11,11 @@ class SupplierService extends BaseService
 	
 	public static $baseFile = '\bizGhs\merchant\classes\SupplierClass';
 	
+	public static function getSupplierList()
+	{
+		$data = SupplierClass::getList('*', $where, 'addTime DESC');
+		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+		return $data;
+	}
+	
 }