This commit is contained in:
2025-08-13 20:28:23 +08:00
parent 537426593a
commit 7f48675193
9 changed files with 92 additions and 29 deletions

View File

@@ -54,6 +54,7 @@ class BaseController
$this->error('Token expiration', [], 409);
}
};
if ($needLogin) {
$this->error('Token expiration', [], 409);
}
@@ -144,7 +145,7 @@ class BaseController
{
$data['code'] = $code;
$data['message'] = $msg;
$data['time'] = $this->request->server('REQUEST_TIME');
$data['time'] = time();
if(isset($data['data']['records'])) {
$data['data']['records'] = apiconvertToCamelCase($data['data']['records']);
}
@@ -159,12 +160,7 @@ class BaseController
}
$result = $data;
$type = $type ?: $this->responseType;
$response = new Response();
$response->header('Content-Type', $type);
$response->withBody($result);
return $response;
throw new MyBusinessException(json_encode($result));
}

View File

@@ -2,9 +2,9 @@
namespace app\common\library;
use app\api\model\TbUser;
use app\czg\app\model\TbUser;
use app\api\model\TbUserBlacklist;
use app\api\model\UserInfo;
use app\czg\app\model\UserInfo;
use app\common\model\Common;
use app\common\model\SysUser;
use app\utils\JwtUtils;
@@ -160,6 +160,7 @@ class Auth
$where = $sale = ['user_id' => $userId];
$user_id_db_name = DatabaseRoute::getConnection('tb_user', $sale);
$this->model = Db::connect($user_id_db_name)->name('tb_user')->where($where)->find();
if (!$this->model) {
$this->setError('Account not exist');
return false;
@@ -355,13 +356,10 @@ class Auth
// 验证密码
if(TbUser::CheckPassword($this->model['password'], $password)) {
// 实名认证信息
$userInfo = new UserInfo();
$where = ['user_id' => $this->model['user_id']];
$userInfo->setConnection($userInfo::findbefore($userInfo, $where));
$userInfo = $userInfo->where($where)->find();
if($userInfo && $userInfo->cert_no) {
$userInfo = DatabaseRoute::getDb('user_info', $this->model['user_id'])->find();
if($userInfo && $userInfo['cert_no']) {
// 继续查黑名单表
$userBlack = TbUserBlacklist::where(['id_card_no' => $userInfo->cert_no])->find();
$userBlack = \app\czg\app\model\TbUserBlacklist::where(['id_card_no' => $userInfo['cert_no']])->find();
if($userBlack) {
$this->setError('系统正在维护中,请稍后再试!');
return false;

View File

@@ -5,7 +5,7 @@ use app\common\library\DatabaseRoute;
use think\db\BaseQuery;
use think\facade\Db;
use think\facade\Log;
use think\Model;
use support\think\Model;
use think\db\Query;
class BaseModel extends Model