diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php
index 8b545d5..a260cc2 100644
--- a/app/Controller/Payment/AccountController.php
+++ b/app/Controller/Payment/AccountController.php
@@ -93,6 +93,20 @@ class AccountController extends AbstractController
return $this->success(['token' => $token]);
}
+ public function updatePassword(RequestInterface $request)
+ {
+ $userInfo = $this->checkUser($request);
+ $oldPassword = $request->input('oldPassword');
+ $password = $request->input('password');
+ $account = Account::where('id', $userInfo['userId'])->first();
+ if (md5($oldPassword . $account->salt) != $account->password) {
+ throw new BusinessException('旧密码错误');
+ }
+ $account->password = md5($password . $account->salt);
+ $account->save();
+ return $this->success();
+ }
+
public function openAccount(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
diff --git a/config/routes.php b/config/routes.php
index ea3b739..98b530d 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -48,6 +48,7 @@ Router::addGroup('/account',function () {
Router::post('/transfer-pay', [AccountController::class, 'transferPay']);
Router::post('/user-info', [AccountController::class, 'getUserInfo']);
Router::get('/company-register', [AccountController::class, 'companyRegister']);
+ Router::post('/update-password', [AccountController::class, 'updatePassword']);
}, []);
Router::addGroup('/notify',function () {
diff --git a/public/account.html b/public/account.html
index 7d6a7d8..4409b34 100644
--- a/public/account.html
+++ b/public/account.html
@@ -16,6 +16,7 @@
{{username}} 退出登录
+ 修改
@@ -77,6 +78,25 @@
确 定
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+