|
|
@@ -7,7 +7,10 @@ use biz\shop\services\ShopAdminService;
|
|
|
use bizHd\admin\classes\AdminClass;
|
|
|
use bizHd\admin\classes\ShopAdminClass;
|
|
|
use bizHd\admin\services\AdminService;
|
|
|
+use bizHd\staff\classes\StaffClass;
|
|
|
+use bizHd\staff\services\StaffService;
|
|
|
use bizHd\wx\services\WxOpenService;
|
|
|
+use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\noticeUtil;
|
|
|
use common\components\util;
|
|
|
@@ -39,6 +42,51 @@ class AdminController extends BaseController
|
|
|
util::complete();
|
|
|
}
|
|
|
|
|
|
+ //我已离职(从某门店离职)
|
|
|
+ public function actionDelStaff()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $adminId = intval($post['adminId']);
|
|
|
+ $staffId = intval($post['staffId']);
|
|
|
+ if (empty($adminId) || empty($staffId)) {
|
|
|
+ util::fail('参数错误');
|
|
|
+ }
|
|
|
+ if($this->admin->id != $adminId) {
|
|
|
+ util::fail('错误请求');
|
|
|
+ }
|
|
|
+
|
|
|
+ $admin = AdminClass::getById($adminId, true);
|
|
|
+ if (empty($admin)) {
|
|
|
+ util::fail('管理员信息不存在');
|
|
|
+ }
|
|
|
+ $staff = StaffClass::getById($staffId, true);
|
|
|
+ if (empty($staff)) {
|
|
|
+ util::fail('员工信息不存在');
|
|
|
+ }
|
|
|
+ if($staff->founder == 2) {
|
|
|
+ util::fail('店主不执行离职操作');
|
|
|
+ }
|
|
|
+ if($staff->delStatus == 1) {
|
|
|
+ util::fail('帐号已删除');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用事务保证数据一致性
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 执行离职操作
|
|
|
+ $staffServ = new StaffService();
|
|
|
+ $staffServ->executeStaffResignation($admin, $staff);
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('离职完成');
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::error("员工离职失败:" . $exception->getMessage());
|
|
|
+ util::fail('离职操作失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//个人信息 ssh 20230505
|
|
|
public function actionInfo()
|
|
|
{
|