|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
+use biz\admin\classes\AdminClass;
|
|
|
use bizHd\admin\classes\ShopAdminClass;
|
|
|
use bizGhs\shop\services\ShopAdminService;
|
|
|
use bizGhs\admin\services\AdminService;
|
|
|
@@ -154,19 +155,17 @@ class AuthController extends PublicController
|
|
|
if (empty($password)) {
|
|
|
util::fail('请输入密码');
|
|
|
}
|
|
|
- $admin = AdminService::getByCondition(['mobile' => $mobile]);
|
|
|
+ $admin = AdminService::getByCondition(['mobile' => $mobile, 'style' => AdminClass::STYLE_GHS]);
|
|
|
if (password_verify($password, $admin['password']) == false) {
|
|
|
util::fail('密码错误');
|
|
|
}
|
|
|
$adminId = $admin['id'];
|
|
|
- $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
|
|
|
+ $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'delStatus' => 0]);
|
|
|
$merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
|
|
|
- $shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
|
|
|
+ $shopId = $shopAdmin['shopId'] ?? 0;
|
|
|
if (empty($shopId)) {
|
|
|
util::fail('您不是管理员');
|
|
|
}
|
|
|
- //管理员关联门店
|
|
|
- Yii::$app->redis->executeCommand('SET', ['LOGIN_ADMIN_SHOP' . $adminId, $shopId]);
|
|
|
//获取token
|
|
|
$token = jwt::getNewToken($adminId);
|
|
|
util::success(['token' => $token, 'account' => $merchantId, 'shopId' => $shopId]);
|