修改用户TOKEN处理

This commit is contained in:
邹景立 2021-06-17 11:18:05 +08:00
parent ace10b8917
commit 95236e9b9f
4 changed files with 21 additions and 9 deletions

View File

@ -82,10 +82,10 @@ class UserTokenService extends Service
public function token(int $uuid, string $type): array public function token(int $uuid, string $type): array
{ {
// 清理无效认证数据 // 清理无效认证数据
$map0 = [['token', '<>', 'token']]; $time = time();
$map1 = [['time', '<', $time = time()]]; $map1 = [['token', '<>', 'token'], ['time', '<', $time]];
$map2 = [['type', '=', $type], ['uid', '=', $uuid]]; $map2 = [['token', '<>', 'token'], ['type', '=', $type], ['uid', '=', $uuid]];
$this->app->db->name('DataUserToken')->where($map0)->whereOr([$map1, $map2])->delete(); $this->app->db->name('DataUserToken')->whereOr([$map1, $map2])->delete();
// 创建新的认证数据 // 创建新的认证数据
do $map = ['type' => $type, 'token' => md5(uniqid() . rand(100, 999))]; do $map = ['type' => $type, 'token' => md5(uniqid() . rand(100, 999))];
while ($this->app->db->name('DataUserToken')->where($map)->count() > 0); while ($this->app->db->name('DataUserToken')->where($map)->count() > 0);

View File

@ -249,7 +249,13 @@ class InstalledVersions
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) { if (null === self::$installed) {
self::$installed = include __DIR__ . '/installed.php'; // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
} }
return self::$installed; return self::$installed;
@ -316,7 +322,13 @@ class InstalledVersions
} }
if (null === self::$installed) { if (null === self::$installed) {
self::$installed = require __DIR__ . '/installed.php'; // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
} }
$installed[] = self::$installed; $installed[] = self::$installed;

View File

@ -5,7 +5,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '612077be96278a23df4f517da2088fc3147574e0', 'reference' => 'ace10b89177358237d3c4e0e06749cac94208523',
'name' => 'zoujingli/thinkadmin', 'name' => 'zoujingli/thinkadmin',
'dev' => false, 'dev' => false,
), ),
@ -153,7 +153,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '612077be96278a23df4f517da2088fc3147574e0', 'reference' => 'ace10b89177358237d3c4e0e06749cac94208523',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'zoujingli/wechat-developer' => array( 'zoujingli/wechat-developer' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2021-06-09 11:20:22 // This file is automatically generated at:2021-06-17 11:17:58
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',