diff --git a/app/controller/AreaController.php b/app/controller/AreaController.php index ee6addd..68eeb95 100644 --- a/app/controller/AreaController.php +++ b/app/controller/AreaController.php @@ -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); } diff --git a/app/controller/UserController.php b/app/controller/UserController.php index 87bdccb..bbbc5e7 100644 --- a/app/controller/UserController.php +++ b/app/controller/UserController.php @@ -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')); } } diff --git a/resource/translations/zh_CN/messages.php b/resource/translations/zh_CN/messages.php index e6890f0..8350cef 100644 --- a/resource/translations/zh_CN/messages.php +++ b/resource/translations/zh_CN/messages.php @@ -12,5 +12,7 @@ return [ 'email_repeat' => '邮箱重复', 'save_success' => '添加成功', 'save_fail' => '添加失败', + 'register_success' => '注册成功', + 'register_fail' => '注册失败', ]; \ No newline at end of file