Selaa lähdekoodia

员工修改密码

林琦海 5 vuotta sitten
vanhempi
commit
b49ca6ec80
1 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. 10 1
      app-ghs/controllers/ShopAdminController.php

+ 10 - 1
app-ghs/controllers/ShopAdminController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use biz\admin\classes\AdminClass;
 use bizHd\wx\classes\WxOpenClass;
 use bizGhs\shop\classes\ShopAdminClass;
 use bizGhs\admin\services\AdminRoleService;
@@ -118,6 +119,14 @@ class ShopAdminController extends BaseController
         $relation->status = $status;
         $relation->save();
         ShopAdminClass::valid($relation, $this->shopId);
+        //若有传密码,则修改密码
+        $password = $post['password']??'';
+        if(!empty($password)){
+            $adminId = $relation->adminId;
+            $password = password_hash($password, PASSWORD_BCRYPT);
+            AdminClass::updateById($adminId,['password'=>$password]);
+        }
+
         util::complete('修改成功');
     }
 
@@ -134,4 +143,4 @@ class ShopAdminController extends BaseController
         util::complete();
     }
 
-}
+}