|
|
@@ -6,6 +6,8 @@ use biz\auth\services\AuthService;
|
|
|
use biz\base\services\BaseService;
|
|
|
use biz\merchant\classes\MerchantClass;
|
|
|
use biz\saas\services\SetAuthService;
|
|
|
+use biz\saas\services\SetMealService;
|
|
|
+use common\components\business;
|
|
|
use Yii;
|
|
|
|
|
|
class MerchantService extends BaseService
|
|
|
@@ -71,7 +73,7 @@ class MerchantService extends BaseService
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
- //取平台下的商家
|
|
|
+ //取平台下的商家 shish 2019.12.20
|
|
|
public static function getSaasMerchant($where)
|
|
|
{
|
|
|
$data = MerchantClass::getList('*', $where, 'addTime DESC');
|
|
|
@@ -79,15 +81,28 @@ class MerchantService extends BaseService
|
|
|
if (empty($list)) {
|
|
|
return $data;
|
|
|
}
|
|
|
+
|
|
|
+ //管理员
|
|
|
$adminIdList = array_column($list, 'adminId');
|
|
|
- $admin = AdminService::getByIds($adminIdList, null, 'id');
|
|
|
- $merchantIdList = array_column($list, 'merchantId');
|
|
|
- $asset = MerchantAssetService::getByIds($merchantIdList, null, 'merchantId');
|
|
|
+ $admin = AdminService::getAdminByIds($adminIdList, null, 'id');
|
|
|
+ //商家资产
|
|
|
+ $merchantIdList = array_column($list, 'id');
|
|
|
+ $asset = MerchantAssetService::getAssetByMerchantIds($merchantIdList);
|
|
|
+ //套餐
|
|
|
+ $setIdList = array_column($list, 'setId');
|
|
|
+ $set = SetMealService::getSetByIds($setIdList);
|
|
|
+
|
|
|
foreach ($list as $key => $val) {
|
|
|
- die;
|
|
|
+ $adminId = $val['adminId'];
|
|
|
+ $merchantId = $val['id'];
|
|
|
+ $setId = $val['setId'];
|
|
|
+ $val['adminName'] = isset($admin[$adminId]['adminName']) ? $admin[$adminId]['adminName'] : '';
|
|
|
+ $val['merchantAsset'] = isset($asset[$merchantId]) ? $asset[$merchantId] : [];
|
|
|
+ $val['setMealName'] = isset($set[$setId]) ? $set[$setId]['name'] : '';
|
|
|
+ $list[$key] = business::formatMerchantLogo($val);
|
|
|
}
|
|
|
$data['list'] = $list;
|
|
|
return $data;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|