From 76b998a6c9b759138354cd2ed5b11edc8a1f6fcb Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Fri, 30 Aug 2024 09:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/User.php | 6 ++++++ app/api/logic/UserLogic.php | 11 ++++++++++- app/common.php | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 8fd13e5c..62ce50e2 100755 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -324,4 +324,10 @@ class User extends Api return JsonServer::success('', $result); } + // 校验支付密码 + public function checkPayPassword() + { + $post = $this->request->post(); + $reult = UserLogic::checkPayPassword($post, $this->user_id); + } } \ No newline at end of file diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 213f05d4..e9682060 100755 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -622,7 +622,7 @@ class UserLogic extends Logic throw new \Exception('账号不存在'); } //更新密码 - $pay_password = create_password($post['pay_password'], $account['salt']);//生成密码 + $pay_password = create_pay_password($post['pay_password'], $account['salt']);//生成密码 if ($account['pay_password'] == $pay_password) { throw new \Exception('密码未改动'); } @@ -639,4 +639,13 @@ class UserLogic extends Logic return false; } } + + public static function checkPayPassword($post, $user_id) + { + $user = User::where(['id' => $user_id, 'del' => 0])->find(); + $password = create_pay_password($post['pay_password'], $user['salt']); + if($password != $user['password']) { + return '密码错误'; + } + } } diff --git a/app/common.php b/app/common.php index 13243604..4fcb652e 100755 --- a/app/common.php +++ b/app/common.php @@ -225,6 +225,20 @@ function create_password($plaintext, $salt) return md5($plaintext . $salt); } +/** + * User: 意象信息科技 lr + * Desc:生成支付密码密文 + * @param $plaintext string 明文 + * @param $salt string 密码盐 + * @return string + */ +function create_pay_password($plaintext, $salt) +{ + $salt = md5('y' . $salt . 'x'); + $salt .= '2024_pay_pwd'; + return md5($plaintext . $salt); +} + /** * User: 意象信息科技 mjf * Desc: 用时间生成订单编号