فهرست منبع

修改员工信息

shish 3 سال پیش
والد
کامیت
d1ff0766d6
1فایلهای تغییر یافته به همراه3 افزوده شده و 33 حذف شده
  1. 3 33
      app-ghs/controllers/ShopAdminController.php

+ 3 - 33
app-ghs/controllers/ShopAdminController.php

@@ -201,19 +201,10 @@ class ShopAdminController extends BaseController
     {
         $post = Yii::$app->request->post();
         $id = $post['id'] ?? 0;
-
-        $shop = $this->shop;
-        $join = $shop->join ?? 0;
-        $default = $shop->default ?? 0;
-        if ($join == 0 && $default == 0) {
-            util::fail('请在默认门店操作');
-        }
-
         $shopAdmin = $this->shopAdmin;
         if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
             util::fail('没有权限');
         }
-
         if (empty($id)) {
             util::fail('请选择员工');
         }
@@ -221,43 +212,22 @@ class ShopAdminController extends BaseController
         if (empty($relation)) {
             util::fail('没有找到员工');
         }
-        ShopAdminClass::valid($relation, $this->mainId);
-        unset($post['id']);
+        if ($relation->mainId != $this->mainId) {
+            util::fail('不能修改');
+        }
         $roleId = $post['roleId'] ?? 0;
         $remind = $post['remind'] ?? 0;
         $status = $post['status'] ?? 1;
         $super = $post['super'] ?? 0;
-
         $founder = $relation->founder ?? 1;
         if ($founder == 2 && $super == 0) {
             util::fail('不能关闭超管权限');
         }
-
-        $adminId = $relation->adminId;
-
         $relation->roleId = $roleId;
         $relation->remind = $remind;
         $relation->status = $status;
         $relation->super = $super;
-        if (isset($post['name']) && !empty($post['name'])) {
-            $name = $post['name'];
-            $relation->name = $name;
-            AdminClass::updateById($adminId, ['name' => $name]);
-            ShopAdminClass::updateByCondition(['adminId' => $adminId], ['name' => $name]);
-        }
         $relation->save();
-
-        //若有传密码,则修改密码
-        $password = $post['password'] ?? '';
-        if (!empty($password)) {
-
-            if (ctype_alnum($password)) {
-                util::fail('密码必须是字母、数字和符号的组合');
-            }
-            $password = password_hash($password, PASSWORD_BCRYPT);
-            AdminClass::updateById($adminId, ['password' => $password]);
-        }
-
         util::complete('修改成功');
     }