فهرست منبع

添加删除员工,员工数量+/-1

sorry 5 سال پیش
والد
کامیت
248d432b23
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 7 1
      biz-ghs/shop/services/ShopAdminService.php
  2. 3 0
      biz/shop/classes/ShopAdminClass.php

+ 7 - 1
biz-ghs/shop/services/ShopAdminService.php

@@ -77,6 +77,8 @@ class ShopAdminService extends BaseService
 
                 $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;
             }
@@ -105,7 +107,11 @@ class ShopAdminService extends BaseService
             'name' => $name,
         ];
         ShopAdminClass::delBindAdminData($shopId, $recommendAdminId);
-        return ShopAdminClass::add($addData);
+        $result = ShopAdminClass::add($addData);
+        // 员工数+1
+        AdminRoleClass::counters(['num' => 1], ['id' => $roleId]);
+
+        return $result;
     }
 
     //获取管理员 ssh 2020.4.21

+ 3 - 0
biz/shop/classes/ShopAdminClass.php

@@ -206,6 +206,9 @@ class ShopAdminClass extends BaseClass
             }
             $admin->save();
         }
+
+        // 员工数-1
+        AdminRoleClass::counters(['num' => -1], ['id' => $relation->roleId]);
     }
 
 }