This commit is contained in:
2025-03-19 13:27:22 +08:00
parent 430e66ac00
commit 41256225ff
3 changed files with 12 additions and 4 deletions
+5 -1
View File
@@ -3,6 +3,7 @@
namespace app\controller;
use app\model\Area;
use app\model\Country;
use app\util\Util;
use support\Request;
@@ -41,7 +42,10 @@ class AreaController
public function getCountry (Request $request)
{
$level = Util::getParam($request,'level')?:1;
$list = $this->getRegions(null, $level,false);
$list = Country::get()->toArray();
foreach ($list as &$row) {
$row['name'] = $row['cn_addr'];
}
return Util::success($list);
}
+5 -3
View File
@@ -41,7 +41,8 @@ class UserController
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
//验证密码
if (!password_verify($userPassword, $hashedPassword)) {
// if (!password_verify($userPassword, $hashedPassword)) {
if ($userPassword==$hashedPassword) {
return Util::fail([], trans('password_error'));
}
$userId = $user['id']; // 实际从数据库获取
@@ -132,6 +133,7 @@ class UserController
'sex' => $sex,
'role' => 1,
'password' => $hashedPassword,
'status' => 0,
];
if (Util::isEmpty($id)) {
@@ -145,9 +147,9 @@ class UserController
unset($res['password']);
if ($res) {
return Util::success($res);
return Util::success($res,trans('register_success'));
} else {
return Util::fail($res);
return Util::fail($res, trans('register_fail'));
}
}
+2
View File
@@ -12,5 +12,7 @@ return [
'email_repeat' => '邮箱重复',
'save_success' => '添加成功',
'save_fail' => '添加失败',
'register_success' => '注册成功',
'register_fail' => '注册失败',
];