正在显示
1 个修改的文件
包含
11 行增加
和
4 行删除
| @@ -13,6 +13,7 @@ use App\Enums\Common\Code; | @@ -13,6 +13,7 @@ use App\Enums\Common\Code; | ||
| 13 | use App\Http\Controllers\Api\BaseController; | 13 | use App\Http\Controllers\Api\BaseController; |
| 14 | use App\Models\Ticket\Project5Cate; | 14 | use App\Models\Ticket\Project5Cate; |
| 15 | use App\Models\WorkOrder\TicketProject; | 15 | use App\Models\WorkOrder\TicketProject; |
| 16 | +use Illuminate\Support\Facades\Http; | ||
| 16 | 17 | ||
| 17 | class Project5CateController extends BaseController | 18 | class Project5CateController extends BaseController |
| 18 | { | 19 | { |
| @@ -100,10 +101,16 @@ class Project5CateController extends BaseController | @@ -100,10 +101,16 @@ class Project5CateController extends BaseController | ||
| 100 | if(empty($action)){ | 101 | if(empty($action)){ |
| 101 | $this->response('未知请求',Code::SYSTEM_ERROR); | 102 | $this->response('未知请求',Code::SYSTEM_ERROR); |
| 102 | } | 103 | } |
| 103 | - $data = http_post($url,json_encode(['name'=>$this->param['name'],'parent'=>$this->param['parent']],true)); | ||
| 104 | - if($data && $data['status'] == 200){ | ||
| 105 | - $this->response('success'); | 104 | + $response = Http::withHeaders([])->asForm()->post($url, [ |
| 105 | + 'name' => '测试分类', | ||
| 106 | + 'parent' => 0 | ||
| 107 | + ]); | ||
| 108 | + if ($response->successful()) { | ||
| 109 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 110 | + if($result && $result['status'] == 200){ | ||
| 111 | + $this->response('success'); | ||
| 112 | + } | ||
| 106 | } | 113 | } |
| 107 | - $this->response('请求失败',Code::SYSTEM_ERROR,$data); | 114 | + $this->response('请求失败',Code::SYSTEM_ERROR); |
| 108 | } | 115 | } |
| 109 | } | 116 | } |
-
请 注册 或 登录 后发表评论