chuan 2 months ago
parent
commit
3cfd972f2b
  1. 7
      app/admin/route/app.php
  2. 8
      app/utility/RequestChatServer.php

7
app/admin/route/app.php

@ -653,10 +653,11 @@ Route::group('/', function () {
->middleware('admin_auth');
Route::post('/admin/log', 'Admin/log')->allowCrossDomain($header)->middleware('admin_auth');
//Route::post('/admin/log', 'Admin/log')->allowCrossDomain($header)->middleware('admin_auth');
//登陆
Route::post('/login/login', 'Login/login')->allowCrossDomain($header);
// 缓存股票数据
Route::get('/cacheIdnStock', 'Index/cacheIdnStock');
Route::get('/cacheUsStock', 'Index/cacheUsStock');
@ -670,8 +671,6 @@ Route::get('/cacheFurStock', 'Index/cacheFurStock');
Route::get('/cacheEurStock', 'Index/cacheEurStock');
Route::get('/cacheBrlStock', 'Index/cacheBrlStock');
Route::get('/cacheJpStock', 'Index/cacheJpStock');
Route::get('/cacheForex', 'Index/cacheForex');
Route::get('/cacheIndexInrStock', 'Index/cacheIndexInrStock'); //印度股指缓存
Route::get('/cacheInOption', 'Index/cacheInOption');
@ -681,7 +680,7 @@ Route::get('/invite_code', 'Admin/inviteCode');
Route::get('/cache_redis', 'Index/cacheRedis');
Route::get('/test_send', 'Index/sendToGo');
Route::get('/sign_stock', 'Index/signStock');
Route::get('/sign_stock', 'Index/signStock'); // crontab任务:执行IPO中签
Route::post('/add_stock', 'Index/autoAddStock');
Route::get('/deal_stock', 'Index/dealStock');

8
app/utility/RequestChatServer.php

@ -15,7 +15,7 @@ class RequestChatServer extends BaseHomeService
if (!in_array($method, ['POST','PUT'])) {
return $this->toData('500', '请求方法不在支持列表中');
}
Log::info("请求URL==".$url." 请求Param==".json_encode($data));
Log::info("Guzzle请求: URL==".$url." 请求Param==".json_encode($data));
$resBody = [];
$client = new Client();
if ($method == 'PUT') {
@ -28,16 +28,16 @@ class RequestChatServer extends BaseHomeService
]);
}
$statusCode = $response->getStatusCode();
Log::error("请求聊天服返回:code==".$statusCode." body==". $response->getBody());
Log::error("Guzzle请求响应:code==".$statusCode." body==". $response->getBody());
if ($statusCode == 200) {
$resBody = json_decode($response->getBody(), true); // 转换为数组
}
return $resBody;
} catch (GuzzleException $e) {
Log::error("请求聊天服务异常 - guzzle: " . $e->getMessage());
Log::error("Guzzle请求异常 - guzzle: " . $e->getMessage());
return $this->toData('500', $e->getMessage());
} catch (\Exception $exception) {
Log::error("请求聊天服务异常 - exception: " . $exception->getMessage());
Log::error("Guzzle请求异常 - exception: " . $exception->getMessage());
return $this->toData('500', $exception->getMessage());
}
}

Loading…
Cancel
Save