|
|
@@ -5,6 +5,7 @@ namespace biz\shop\classes;
|
|
|
use biz\admin\classes\AdminClass;
|
|
|
use biz\admin\classes\AdminRoleClass;
|
|
|
use bizGhs\ws\services\WsService;
|
|
|
+use bizHd\staff\classes\StaffClass;
|
|
|
use bizHd\user\classes\UserClass;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
@@ -180,31 +181,19 @@ class ShopAdminClass extends BaseClass
|
|
|
{
|
|
|
$id = $relation->id ?? 0;
|
|
|
if ($relation->founder == 2) {
|
|
|
- util::fail("创始人不能删除");
|
|
|
+ util::fail("不能删老板");
|
|
|
}
|
|
|
if ($id == $thisShopAdminId) {
|
|
|
util::fail("不能删自己");
|
|
|
}
|
|
|
ShopAdminClass::valid($relation, $mainId);
|
|
|
$adminId = $relation->adminId ?? 0;
|
|
|
- $currentShopId = $relation->shopId ?? 0;
|
|
|
$admin = AdminClass::getById($adminId, true);
|
|
|
if (empty($admin)) {
|
|
|
util::fail('没有找到员工信息');
|
|
|
}
|
|
|
- $admin->currentGhsShopId = 0;
|
|
|
- $admin->save();
|
|
|
- $relation->delStatus = 1;
|
|
|
- $relation->save();
|
|
|
- //删除员工关系后,再找出这个员工还有没其它门店员工身份补上
|
|
|
- if (!empty($admin) && isset($admin->currentShopId) && $admin->currentShopId == $currentShopId) {
|
|
|
- $has = self::getByCondition(['adminId' => $adminId, 'delStatus' => 0, 'status' => 1], true);
|
|
|
- $hasCurrentShopId = $has->shopId ?? 0;
|
|
|
- $admin->currentGhsShopId = $hasCurrentShopId;
|
|
|
- $admin->save();
|
|
|
- }
|
|
|
- // 员工数-1
|
|
|
- AdminRoleClass::counters(['num' => -1], ['id' => $relation->roleId]);
|
|
|
+ //员工离职,多处使用,关键词 staff_lz
|
|
|
+ StaffClass::executeStaffResignation($admin, $relation);
|
|
|
}
|
|
|
|
|
|
//根据shopId 获取 员工的shopAdminId
|