|
...
|
...
|
@@ -3,8 +3,12 @@ |
|
|
|
namespace App\Http\Controllers\Aside\Com;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Enums\Common\Common;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Http\Logic\Aside\Manage\MenuLogic;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class IndexController
|
|
...
|
...
|
@@ -33,4 +37,38 @@ class IndexController extends BaseController |
|
|
|
$this->response('success',Code::SUCCESS,$menus);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :修改密码
|
|
|
|
* @name :editPassword
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/11 9:10
|
|
|
|
*/
|
|
|
|
public function editPassword(){
|
|
|
|
$this->request->validate([
|
|
|
|
'oldPassword'=>'required',
|
|
|
|
'password' => 'required',
|
|
|
|
'confirm'=>'required',
|
|
|
|
], [
|
|
|
|
'oldPassword.required' => '请输入原密码',
|
|
|
|
'password.required' => '请输入新密码',
|
|
|
|
'confirm.required' => '请再次输入新密码密码',
|
|
|
|
]);
|
|
|
|
//查询员密码是否正确
|
|
|
|
$managerModel = new Manage();
|
|
|
|
$info = $managerModel->read(['id'=>$this->manage['id']]);
|
|
|
|
if(!Hash::check($this->param['password'], $info['password'])){
|
|
|
|
$this->response('原密码错误',Code::USER_REGISTER_ERROE);
|
|
|
|
}
|
|
|
|
if($this->param['password'] != $this->param['confirm']){
|
|
|
|
$this->response('两次密码不一致');
|
|
|
|
}
|
|
|
|
$rs = $managerModel->edit(['password'=>Hash::make($this->param['password'])],['id'=>$this->manage['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('系统错误',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
Cache::pull(Common::MANAGE_TOKEN . $info['token']);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|