添加校验支付密码功能

This commit is contained in:
wangxiaowei 2024-08-30 09:21:03 +08:00
parent 7c73a8c4b7
commit 76b998a6c9
3 changed files with 30 additions and 1 deletions

@ -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);
}
}

@ -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 '密码错误';
}
}
}

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