fix: php8.1 install

This commit is contained in:
Ying
2022-08-20 17:05:05 +08:00
parent 7ceee7533b
commit e4b3594077
2 changed files with 44 additions and 7 deletions

View File

@@ -22,14 +22,10 @@ class AccessCross implements MiddlewareInterface
'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With',
];
$origin = request()->server('HTTP_ORIGIN');
$parseUrl = parse_url($origin);
$domains = array_merge(config('app.cors_domain'), [request()->host(true)]);
if (in_array("*", $domains) || in_array($origin, $domains)
|| (isset($parseUrl['host']) && in_array($parseUrl['host'], $domains))) {
$header['Access-Control-Allow-Origin'] = $request->header('Origin', '*');
}
$domains = array_unique($domains);
// 默认为全部允许跨域
$header['Access-Control-Allow-Origin'] = $request->header('Origin', '*');
$response->withHeaders($header);
return $response;
}

41
app/queue/redis/Push.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
declare (strict_types=1);
// +----------------------------------------------------------------------
// | swiftAdmin 极速开发框架 [基于WebMan开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2030 http://www.swiftadmin.net
// +----------------------------------------------------------------------
// | swiftAdmin.net High Speed Development Framework
// +----------------------------------------------------------------------
// | Author: meystack <coolsec@foxmail.com> Apache 2.0 License
// +----------------------------------------------------------------------
namespace app\queue\redis;
use app\AdminController;
use Webman\Push\Api;
class Push extends AdminController
{
/**
* api推送
* @var null
*/
protected $api = null;
/**
* 构造函数
*/
public function __construct()
{
parent::__construct();
}
/*
* 消息推送首页
* @return mixed
*/
public function index()
{
return response('success');
}
}