Commit c71426b4 c71426b4e8774cb1fd086eb82c803923af9b2d4e by lemon

请求数据

1 parent ebede106
...@@ -56,7 +56,7 @@ class AuthIdentifier ...@@ -56,7 +56,7 @@ class AuthIdentifier
56 //通过身份证查询id 56 //通过身份证查询id
57 $stakeholder_ids = Stakeholder::stakeholderIds($identifier); 57 $stakeholder_ids = Stakeholder::stakeholderIds($identifier);
58 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL); 58 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL);
59 59
60 $request->attributes->add([ 60 $request->attributes->add([
61 'identifier' => $identifier, 61 'identifier' => $identifier,
62 'stakeholder_ids' => $stakeholder_ids, 62 'stakeholder_ids' => $stakeholder_ids,
......
...@@ -5,7 +5,6 @@ namespace App\Services; ...@@ -5,7 +5,6 @@ namespace App\Services;
5 use App\Helper\AesEncrypt; 5 use App\Helper\AesEncrypt;
6 use App\Helper\ErrorCode; 6 use App\Helper\ErrorCode;
7 use App\Helper\Response; 7 use App\Helper\Response;
8 use GuzzleHttp\Client;
9 use Illuminate\Support\Facades\Log; 8 use Illuminate\Support\Facades\Log;
10 9
11 /** 10 /**
...@@ -20,14 +19,11 @@ class IssueService extends Service ...@@ -20,14 +19,11 @@ class IssueService extends Service
20 */ 19 */
21 public function forward() 20 public function forward()
22 { 21 {
23 $client = new Client([ 22 $client = new \GuzzleHttp\Client([
24 'base_uri' => env('resource_url'), 23 'base_uri' => env('resource_url'),
25 'timeout' => 3.0, 24 'timeout' => 3.0,
26 ]); 25 ]);
27 26
28 $method = $this->request->getMethod();
29 $data = [];
30
31 try { 27 try {
32 28
33 $params['data'] = $this->request->all(); 29 $params['data'] = $this->request->all();
...@@ -35,10 +31,13 @@ class IssueService extends Service ...@@ -35,10 +31,13 @@ class IssueService extends Service
35 'user_id' => $this->identifier->user_id, 31 'user_id' => $this->identifier->user_id,
36 'stakeholder_ids' => $this->stakeholder_ids, 32 'stakeholder_ids' => $this->stakeholder_ids,
37 ]; 33 ];
38 34 $data = ['params' => AesEncrypt::encrypt(json_encode($params))];
39 $data['json'] = ['params' => AesEncrypt::encrypt(json_encode($params))]; 35 $response = $client->post('/api/issue/status/album', [
40 $response = $client->request($method, $this->request->getRequestUri(), $data); 36 'json' => $data,
37 ]);
41 $respArr = json_decode($response->getBody()->getContents(), true); 38 $respArr = json_decode($response->getBody()->getContents(), true);
39
40
42 return response()->json($respArr, 200); 41 return response()->json($respArr, 200);
43 } catch (\Throwable $throwable) { 42 } catch (\Throwable $throwable) {
44 return Response::error(ErrorCode::SERVER_ERROR, $throwable->getMessage()); 43 return Response::error(ErrorCode::SERVER_ERROR, $throwable->getMessage());
......
...@@ -55,7 +55,7 @@ Route::group([], function (){ ...@@ -55,7 +55,7 @@ Route::group([], function (){
55 55
56 //发行 56 //发行
57 Route::group(["prefix"=>"issue"], function (){ 57 Route::group(["prefix"=>"issue"], function (){
58 Route::any('{uri}', 'IssueController@index')->where(['uri'=>'[\w_]{1,}']); 58 Route::post('{uri}', 'IssueController@index')->where(['uri'=>'.*+']);
59 }); 59 });
60 60
61 61
......