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: 用时间生成订单编号