mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-20 16:08:14 +00:00
fix: 修复我的机器人不回复的情况
This commit is contained in:
parent
92d757662a
commit
19eb05269b
@ -210,7 +210,7 @@ class UserDevice extends AbstractModel
|
|||||||
$row = self::whereHash($hash)->first();
|
$row = self::whereHash($hash)->first();
|
||||||
if ($row) {
|
if ($row) {
|
||||||
// 判断是否过期
|
// 判断是否过期
|
||||||
if (Carbon::parse($row->expired_at)->isPast()) {
|
if ($row->expired_at && Carbon::parse($row->expired_at)->isPast()) {
|
||||||
self::forget($row);
|
self::forget($row);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -237,11 +237,11 @@ class UserDevice extends AbstractModel
|
|||||||
if (empty($token)) {
|
if (empty($token)) {
|
||||||
$token = Doo::userToken();
|
$token = Doo::userToken();
|
||||||
$userid = Doo::userId();
|
$userid = Doo::userId();
|
||||||
$expiredAt = Doo::userExpiredAt() ?: null;
|
$expiredAt = Doo::userExpiredAt();
|
||||||
} else {
|
} else {
|
||||||
$info = Doo::tokenDecode($token);
|
$info = Doo::tokenDecode($token);
|
||||||
$userid = $info['userid'] ?? 0;
|
$userid = $info['userid'] ?? 0;
|
||||||
$expiredAt = $info['expired_at'] ?? null;
|
$expiredAt = $info['expired_at'];
|
||||||
}
|
}
|
||||||
$deviceData = [
|
$deviceData = [
|
||||||
'detail' => Base::array2json(self::getDeviceInfo($_SERVER['HTTP_USER_AGENT'] ?? '')),
|
'detail' => Base::array2json(self::getDeviceInfo($_SERVER['HTTP_USER_AGENT'] ?? '')),
|
||||||
|
|||||||
@ -181,12 +181,12 @@ class Doo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* token过期时间(来自请求的token)
|
* token过期时间(来自请求的token)
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public static function userExpiredAt(): string
|
public static function userExpiredAt(): ?string
|
||||||
{
|
{
|
||||||
$expiredAt = self::string(self::doo()->userExpiredAt());
|
$expiredAt = self::string(self::doo()->userExpiredAt());
|
||||||
return $expiredAt === 'forever' ? '' : $expiredAt;
|
return $expiredAt === 'forever' ? null : $expiredAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,7 +263,9 @@ class Doo
|
|||||||
*/
|
*/
|
||||||
public static function tokenDecode($token): array
|
public static function tokenDecode($token): array
|
||||||
{
|
{
|
||||||
return Base::json2array(self::string(self::doo()->tokenDecode($token)));
|
$array = Base::json2array(self::string(self::doo()->tokenDecode($token)));
|
||||||
|
$array['expired_at'] = $array['expired_at'] === 'forever' ? null : $array['expired_at'];
|
||||||
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user