feat(plugin): add user.subscribe.response hook

This commit is contained in:
xboard
2025-09-17 00:02:59 +08:00
parent 58a374bde9
commit 8ae3de511b
2 changed files with 2 additions and 8 deletions
@@ -12,6 +12,7 @@ use App\Models\Ticket;
use App\Models\User; use App\Models\User;
use App\Services\Auth\LoginService; use App\Services\Auth\LoginService;
use App\Services\AuthService; use App\Services\AuthService;
use App\Services\Plugin\HookManager;
use App\Services\UserService; use App\Services\UserService;
use App\Utils\CacheKey; use App\Utils\CacheKey;
use App\Utils\Helper; use App\Utils\Helper;
@@ -156,6 +157,7 @@ class UserController extends Controller
$user['subscribe_url'] = Helper::getSubscribeUrl($user['token']); $user['subscribe_url'] = Helper::getSubscribeUrl($user['token']);
$userService = new UserService(); $userService = new UserService();
$user['reset_day'] = $userService->getResetDay($user); $user['reset_day'] = $userService->getResetDay($user);
$user = HookManager::filter('user.subscribe.response', $user);
return $this->success($user); return $this->success($user);
} }
-8
View File
@@ -137,14 +137,6 @@ class User extends Authenticatable
return $this->hasMany(TrafficResetLog::class, 'user_id', 'id'); return $this->hasMany(TrafficResetLog::class, 'user_id', 'id');
} }
/**
* 获取订阅链接属性
*/
public function getSubscribeUrlAttribute(): string
{
return Helper::getSubscribeUrl($this->token);
}
/** /**
* 检查用户是否处于活跃状态 * 检查用户是否处于活跃状态
*/ */