From 1862b11c0dd58415bd01adfb2467fc496f17c1d2 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Wed, 29 Oct 2025 10:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/PasswordLoginController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Server/application/common/controller/PasswordLoginController.php b/Server/application/common/controller/PasswordLoginController.php index 534a978a..232e4e68 100644 --- a/Server/application/common/controller/PasswordLoginController.php +++ b/Server/application/common/controller/PasswordLoginController.php @@ -106,7 +106,7 @@ class PasswordLoginController extends BaseController * @return array * @throws \Exception */ - protected function doLogin(string $account, string $password, int $typeId): array + protected function doLogin(string $account, string $password, int $typeId, string $deviceId): array { // 获取用户信息 $member = $this->getUser($account, $password, $typeId); @@ -116,10 +116,10 @@ class PasswordLoginController extends BaseController if ($typeId == 2 && !empty($deviceId)){ $deviceUser = Db::name('device_user')->where(['companyId' => $member['companyId'],'userId' => $member['id'],'deleteTime' => 0])->find(); if (!empty($deviceUser)){ - $s2_device = Db::table('s2_device')->where(['companyId' => $member['companyId'],'deleteTime' => 0,'id' => $deviceUser])->find(); - if (!empty($s2_device) && empty($s2_device['deviceImei'])){ - Db::table('s2_device')->where(['id' => $s2_device['id']])->update(['deviceImei' => $deviceId,'updateTime' => time()]); - Db::name('device')->where(['id' => $s2_device['id']])->update(['deviceImei' => $deviceId,'updateTime' => time()]); + $device = Db::name('device')->where(['companyId' => $member['companyId'],'deleteTime' => 0,'id' => $deviceUser['deviceId']])->find(); + if (!empty($device) && empty($device['deviceImei'])){ + Db::table('s2_device')->where(['id' => $device['id']])->update(['deviceImei' => $deviceId,'updateTime' => time()]); + Db::name('device')->where(['id' => $device['id']])->update(['deviceImei' => $deviceId,'updateTime' => time()]); } } } @@ -140,10 +140,12 @@ class PasswordLoginController extends BaseController { $params = $this->request->only(['account', 'password', 'typeId','deviceId']); try { + $deviceId = isset($params['deviceId']) ? $params['deviceId'] : ''; $userData = $this->dataValidate($params)->doLogin( $params['account'], $params['password'], $params['typeId'], + $deviceId );