|
|
@@ -303,24 +303,33 @@ class ShopController extends BaseController
|
|
|
util::success(['list' => $shop]);
|
|
|
}
|
|
|
|
|
|
- //切换门店 ssh 20210908
|
|
|
+ //切换门店 ssh 20220624
|
|
|
public function actionSwitchGhsShop()
|
|
|
{
|
|
|
$shopAdmin = $this->shopAdmin;
|
|
|
$adminId = $shopAdmin->adminId ?? 0;
|
|
|
- if ($adminId != 2) {
|
|
|
- util::fail('没有权限');
|
|
|
- }
|
|
|
+ $admin = $this->admin;
|
|
|
$shopId = Yii::$app->request->get('shopId', 0);
|
|
|
- $admin = \biz\admin\classes\AdminClass::getById($adminId, true);
|
|
|
- if (empty($admin)) {
|
|
|
- util::fail('没有找到这个管理员');
|
|
|
+ $shop = ShopClass::getById($shopId, true);
|
|
|
+ if (empty($shop)) {
|
|
|
+ util::fail('没有找到门店');
|
|
|
+ }
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $staff = ShopAdminClass::getByCondition(['mainId' => $mainId, 'adminId' => $adminId], true);
|
|
|
+ if (empty($staff)) {
|
|
|
+ util::fail('没有权限哦...');
|
|
|
+ }
|
|
|
+ $delStatus = $staff->delStatus ?? 0;
|
|
|
+ if ($delStatus == 1) {
|
|
|
+ util::fail('你不是员工');
|
|
|
}
|
|
|
- $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $shopId, 'adminId' => $adminId], true);
|
|
|
- if (empty($shopAdmin)) {
|
|
|
- util::fail('不是本店员工');
|
|
|
+ $status = $staff->status ?? 0;
|
|
|
+ if ($status == 0) {
|
|
|
+ util::fail('无法登录,请联系店长');
|
|
|
}
|
|
|
- $admin->currentShopId = $shopId;
|
|
|
+ $admin->currentGhsShopId = $shopId;
|
|
|
+ $lsShopId = $shop->lsShopId ?? 0;
|
|
|
+ $admin->currentShopId = $lsShopId;
|
|
|
$admin->save();
|
|
|
util::complete();
|
|
|
}
|