sorry 5 лет назад
Родитель
Сommit
92efacc545
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      biz-hd/admin/services/ShopAdminService.php

+ 5 - 2
biz-hd/admin/services/ShopAdminService.php

@@ -64,11 +64,12 @@ class ShopAdminService extends BaseService
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
+
         $sjId = $shop['merchantId'] ?? 0;
-        $shopAdmin = ShopAdminClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId]);
+        $shopAdmin = ShopAdminClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId], true);
         if (!empty($shopAdmin)) {
             //员工已经删除的补回
-            if (isset($shopAdmin->delStatus) && $shopAdmin->delStatus == 1) {
+            if ($shopAdmin->delStatus == 1) {
                 $shopAdmin->delStatus = 0;
                 $shopAdmin->roleId = $roleId;
                 $shopAdmin->remind = $remind;
@@ -76,6 +77,8 @@ class ShopAdminService extends BaseService
                 $shopAdmin->save();
                 $update = ['name' => $name, 'mobile' => $mobile, 'password' => $password, 'remark' => $remark, 'currentShopId' => $shopId];
                 AdminClass::updateById($adminId, $update);
+                // 员工数+1
+                AdminRoleClass::counters(['num' => 1], ['id' => $roleId]);
 
                 return $shopAdmin->attributes;
             }