API接口-优化/创建保存jwt

This commit is contained in:
2026-03-30 15:19:22 +08:00
parent 2d561f81b5
commit c2ce8085c2
5 changed files with 69 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ use app\common\model\MallPlayxDailyPush;
use app\common\model\MallPlayxSession;
use app\common\model\MallPlayxOrder;
use app\common\model\MallPlayxUserAsset;
use app\common\library\PlayxInboundJwt;
use support\think\Db;
use Webman\Http\Request;
use support\Response;
@@ -156,6 +157,14 @@ class Playx extends Api
return $response;
}
$partnerJwtSecret = strval(config('playx.partner_jwt_secret', ''));
if ($partnerJwtSecret !== '') {
$authHeader = strval($request->header('authorization', ''));
if (!PlayxInboundJwt::verifyBearer($authHeader, $partnerJwtSecret)) {
return $this->error(__('Invalid or missing JWT'), null, 0, ['statusCode' => 401]);
}
}
$body = $request->post();
if (empty($body)) {
$raw = $request->rawBody();