diff --git a/Server/application/common/controller/PasswordLoginController.php b/Server/application/common/controller/PasswordLoginController.php index 6f3d62cd..f4d12cf0 100644 --- a/Server/application/common/controller/PasswordLoginController.php +++ b/Server/application/common/controller/PasswordLoginController.php @@ -6,6 +6,7 @@ use app\common\model\User as UserModel; use app\common\util\JwtUtil; use Exception; use library\ResponseHelper; +use think\Db; use think\Validate; /** @@ -111,12 +112,15 @@ class PasswordLoginController extends BaseController { // 获取用户信息 $member = $this->getUser($account, $password, $typeId); + $deviceTotal = Db::name('device')->where(['companyId' => $member['companyId'],'deleteTime' => 0])->count(); + + // 生成JWT令牌 - $token = JwtUtil::createToken($member, 86400); - $token_expired = time() + 86400; + $token = JwtUtil::createToken($member, 86400 * 30); + $token_expired = time() + 86400 * 30; - return compact('member', 'token', 'token_expired'); + return compact('member', 'token', 'token_expired','deviceTotal'); } /**