合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !3236
正在显示
1 个修改的文件
包含
16 行增加
和
12 行删除
| @@ -61,19 +61,23 @@ class Ticket5UploadDataController extends BaseController | @@ -61,19 +61,23 @@ class Ticket5UploadDataController extends BaseController | ||
| 61 | $this->response('未知请求',Code::SYSTEM_ERROR); | 61 | $this->response('未知请求',Code::SYSTEM_ERROR); |
| 62 | } | 62 | } |
| 63 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | 63 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; |
| 64 | - $data = http_get($url); | ||
| 65 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND); | ||
| 66 | - if($data && $data['status'] == 200){ | ||
| 67 | - $resultData = $data['data']; | ||
| 68 | - $saveData = [ | ||
| 69 | - 'project_id' => $projectInfo['post_id'], | ||
| 70 | - 'domain' => $projectInfo['website'], | ||
| 71 | - 'text'=>json_encode($data['data']), | ||
| 72 | - 'type' => $this->param['type'], | ||
| 73 | - ]; | ||
| 74 | - $project5CateModel->addReturnId($saveData); | ||
| 75 | - $this->response('success', Code::SUCCESS,$resultData); | 64 | + $response = Http::withHeaders([])->asForm()->get($url); |
| 65 | + if ($response->successful()) { | ||
| 66 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 67 | + if ($result && $result['status'] == 200) { | ||
| 68 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($result, true) . PHP_EOL, FILE_APPEND); | ||
| 69 | + $resultData = $result['data']; | ||
| 70 | + $saveData = [ | ||
| 71 | + 'project_id' => $projectInfo['post_id'], | ||
| 72 | + 'domain' => $projectInfo['website'], | ||
| 73 | + 'text'=>json_encode($result['data']), | ||
| 74 | + 'type' => $this->param['type'], | ||
| 75 | + ]; | ||
| 76 | + $project5CateModel->addReturnId($saveData); | ||
| 77 | + $this->response('success', Code::SUCCESS,$resultData); | ||
| 78 | + } | ||
| 76 | } | 79 | } |
| 80 | + | ||
| 77 | $this->response('success',Code::SUCCESS,$url); | 81 | $this->response('success',Code::SUCCESS,$url); |
| 78 | } | 82 | } |
| 79 | 83 |
-
请 注册 或 登录 后发表评论