load->model('market/Market_sys_admin_model', 'mdSysAdmin'); } /** * Notes:修改密码 * Created on: 2022/9/16 11:11 * Created by: dengbw */ public function index_put() { $oldPassword = $this->input_param('oldPassword'); $password = $this->input_param('password'); $password2 = $this->input_param('password2'); if (!$oldPassword) { $this->return_json('请输入旧密码'); } if (!$password) { $this->return_json('请输入新密码'); } if (!$password2) { $this->return_json('请再次输入新密码'); } if (mb_strlen($password) < 4) { $this->return_json('请输入至少4个字符的新密码'); } if ($password != $password2) { $this->return_json('两次输入密码不一致'); } if (!password_verify($oldPassword, $_SESSION['password'])) { $this->return_json('旧密码错误'); } $upDate['password'] = password_hash($password, PASSWORD_BCRYPT); $this->mdSysAdmin->update($upDate, ['userId' => $_SESSION['userId']]); $this->return_response(); } }