Commit c71426b4 c71426b4e8774cb1fd086eb82c803923af9b2d4e by lemon

请求数据

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