|
|
@@ -483,30 +483,34 @@ class AuthController extends PublicController
|
|
|
if (empty($password)) {
|
|
|
util::fail('请输入密码');
|
|
|
}
|
|
|
- $admin = AdminService::getByCondition(['mobile' => $mobile, 'style' => AdminClass::STYLE_GHS]);
|
|
|
- if (password_verify($password, $admin['password']) == false) {
|
|
|
+ $admin = AdminService::getByCondition(['mobile' => $mobile], true);
|
|
|
+ if (password_verify($password, $admin->password) == false) {
|
|
|
util::fail('密码错误');
|
|
|
}
|
|
|
- $openShop = $admin['openGhsShop'] ?? 1;
|
|
|
- $currentShopId = $admin['currentGhsShopId'] ?? 0;
|
|
|
+ $openShop = $admin->openGhsShop ?? 1;
|
|
|
+ $currentShopId = $admin->currentGhsShopId ?? 0;
|
|
|
if (empty($currentShopId)) {
|
|
|
if ($openShop == 2) {
|
|
|
util::fail('审核中');
|
|
|
}
|
|
|
util::fail('请先注册');
|
|
|
}
|
|
|
- $adminId = $admin['id'];
|
|
|
- $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'delStatus' => 0], true);
|
|
|
+ $currentShop = \bizGhs\shop\classes\ShopClass::getById($currentShopId, true);
|
|
|
+ if (empty($currentShop)) {
|
|
|
+ util::fail('没有找到门店');
|
|
|
+ }
|
|
|
+ $mainId = $currentShop->mainId ?? 0;
|
|
|
+ $adminId = $admin->id;
|
|
|
+ $shopAdmin = ShopAdminService::getByCondition(['mainId' => $mainId, 'adminId' => $adminId], true);
|
|
|
if (empty($shopAdmin)) {
|
|
|
- util::fail('出错了');
|
|
|
+ util::fail('您没有权限');
|
|
|
+ }
|
|
|
+ if ($shopAdmin->delStatus == 0) {
|
|
|
+ util::fail('您没有权限哦');
|
|
|
}
|
|
|
if ($shopAdmin->status == 0) {
|
|
|
util::fail("您的账号已冻结");
|
|
|
}
|
|
|
- $shopId = $shopAdmin->shopId ?? 0;
|
|
|
- if (empty($shopId)) {
|
|
|
- util::fail('您不是管理员');
|
|
|
- }
|
|
|
$token = jwt::getNewToken($adminId);
|
|
|
$shopAdminId = $shopAdmin->id ?? 0;
|
|
|
//是否有切换门店的权限
|