|
|
@@ -28,9 +28,8 @@ class BaseController extends PublicController
|
|
|
|
|
|
public function beforeAction($action)
|
|
|
{
|
|
|
- //定义平台类型 1花店 2供应商 3商城
|
|
|
Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'mall');
|
|
|
-
|
|
|
+ $this->isWx = util::isWx();
|
|
|
$shopId = Yii::$app->request->get('account', 0);
|
|
|
$this->shopId = $shopId;
|
|
|
if (!empty($shopId)) {
|
|
|
@@ -45,42 +44,22 @@ class BaseController extends PublicController
|
|
|
$this->sjId = $sjId;
|
|
|
$sj = SjClass::getById($this->sjId, true);
|
|
|
if (empty($sj)) {
|
|
|
- util::fail('没有找到商家信息');
|
|
|
+ util::fail('没有商家信息');
|
|
|
}
|
|
|
$this->sj = $sj;
|
|
|
+ $this->sjExtend = MerchantExtendService::getBySjId($this->sjId);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (httpUtil::isMiniProgram()) {
|
|
|
$userId = jwt::getLoginId();
|
|
|
- if (empty($userId)) {
|
|
|
- util::notLogin('您还没有登陆');
|
|
|
- }
|
|
|
- $this->userId = $userId;
|
|
|
- $user = UserClass::getById($userId, true);
|
|
|
- if (empty($user)) {
|
|
|
- util::fail('没有找到客户信息');
|
|
|
- }
|
|
|
- $this->user = $user;
|
|
|
- $this->isWx = util::isWx();
|
|
|
- if (!empty($shop)) {
|
|
|
- $this->sjExtend = MerchantExtendService::getBySjId($this->sjId);
|
|
|
- $userInfo = isset($user->attributes) ? $user->attributes : [];
|
|
|
- $custom = CustomClass::replaceCustom($this->sjId, $userInfo, $shopId);
|
|
|
- if (!empty($custom)) {
|
|
|
- $this->custom = $custom;
|
|
|
- $customId = $custom['id'] ?? 0;
|
|
|
- $this->customId = $customId;
|
|
|
- } else {
|
|
|
- if (in_array($action->id, $this->guestAccess) == false) {
|
|
|
- util::fail('没有找到客户信息哦');
|
|
|
- }
|
|
|
+ if (!empty($userId)) {
|
|
|
+ $this->userId = $userId;
|
|
|
+ $user = UserClass::getById($userId, true);
|
|
|
+ if (!empty($user)) {
|
|
|
+ $this->user = $user;
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- //非登陆情况的请求,支付宝扫码付款需要用到
|
|
|
}
|
|
|
-
|
|
|
return parent::beforeAction($action);
|
|
|
}
|
|
|
|