|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
|
|
|
|
use App\Exceptions\InquiryFilterException;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Visit\SyncSubmitTask;
|
|
|
|
use App\Services\CosService;
|
|
|
|
use Illuminate\Http\Request;
|
|
...
|
...
|
@@ -18,6 +19,7 @@ class SelfSiteController extends BaseController |
|
|
|
*/
|
|
|
|
public function selfSiteApi(Request $request)
|
|
|
|
{
|
|
|
|
$token = $request->header('token');//token
|
|
|
|
$data = $request->input('data');//访问数据
|
|
|
|
$domain = $request->input('domain');//访问域名
|
|
|
|
$ip = $request->input('ip');//访问ip
|
|
...
|
...
|
@@ -27,6 +29,10 @@ class SelfSiteController extends BaseController |
|
|
|
$traffic = $request->input('traffic', SyncSubmitTask::TRAFFIC_DEFAULT);//是否引流
|
|
|
|
$files = $request->input('files', []);//文件
|
|
|
|
|
|
|
|
if (empty($token)) {
|
|
|
|
return $this->error('token无效', 401);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($data) || empty($domain)) {
|
|
|
|
return $this->error('参数错误');
|
|
|
|
}
|
|
...
|
...
|
@@ -35,6 +41,17 @@ class SelfSiteController extends BaseController |
|
|
|
return $this->error('类型错误');
|
|
|
|
}
|
|
|
|
|
|
|
|
//判断token是否有效
|
|
|
|
$project_model = new Project();
|
|
|
|
$project_info = $project_model->read(['site_token' => $token]);
|
|
|
|
if (!$project_info) {
|
|
|
|
return $this->error('token无效', 401);
|
|
|
|
}
|
|
|
|
if (($project_info['domainInfo']['domain'] ?? '') != $domain) {
|
|
|
|
return $this->error('token无效', 401);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($files)) {
|
|
|
|
try {
|
|
|
|
foreach ($files as $key => $file) {
|
...
|
...
|
|