123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Http\Middleware;
- use Closure;
- use App\Exceptions\ApiException;
- class BindExportToken
- {
- use CheckTokenTrait;
- /**
- * @param $request
- * @param Closure $next
- * @return mixed
- * @throws ApiException
- */
- public function handle($request, Closure $next)
- {
- // 接口中的token(如有则绑定token到全局)
- $all = $request->all();
- $token = getProp($all, 'd_token');
- $channelId = getProp($all, 'd_channel_id');
- if ($token && $channelId) {
- $this->checkTokenTrait($token, $channelId);
- }
- return $next($request);
- }
- }
|