From 4b64fe947e1bd64bbd181c677762731dea6885a4 Mon Sep 17 00:00:00 2001 From: lihan <3398341942@qq.com> Date: Thu, 8 Nov 2018 10:34:30 +0800 Subject: [PATCH] 赠送积分和角色管理 --- app/friendship/controller/FriendController.php | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/app/friendship/controller/FriendController.php b/app/friendship/controller/FriendController.php index 14ae592..4e9642a 100644 --- a/app/friendship/controller/FriendController.php +++ b/app/friendship/controller/FriendController.php @@ -170,18 +170,55 @@ class FriendController extends HomeBaseController } //密码管理验证码页面 - public function passwordManager() { + public function passwordManager() + { return $this->fetch(':password_manager'); } //输入密码 - public function enterPassword() { + public function enterPassword() + { return $this->fetch(':enter_password'); } //确认密码 - public function surePassword() { + public function surePassword() + { return $this->fetch(':sure_password'); } + public function pwd() + { + $request = request(); + if ($request->isAjax()) { + $integral_pwd = $request->param('integral_pwd'); + $step = $request->param('step'); + if ($step == 'enter') { + session('user.pwd', $integral_pwd); + if (session('user.pwd')) { + $this->success('', url('friendship/Friend/surePassword'), true); + } + } elseif ($step == 'sure') { + if ($integral_pwd == session('user.pwd')) { + $data = [ + 'id' => session('user.id'), + 'integral_pwd' => md5($integral_pwd) + ]; + if (Db::name('user')->update($data)) { + session('user.pwd', null); + $this->success('修改成功', url('user/center/myBalance'), true); + }else { + session('user.pwd', null); + $this->success('您未作出任何修改', url('user/center/myBalance'), true); + } + } else { + $this->success('密码不一致', '', false); + } + } else { + $this->success('未知错误', '', false); + } + + } + } + } \ No newline at end of file -- libgit2 0.24.0