39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use Symfony\Component\HttpClient\HttpClient;
|
|
use think\facade\Log;
|
|
|
|
class RemoteController extends BaseApiController
|
|
{
|
|
|
|
public array $notNeedLogin = ['index'];
|
|
public function index()
|
|
{
|
|
$parmas = [
|
|
"brigade_id" => "3",
|
|
"city_code" => "510500",
|
|
"district_code" => "510502",
|
|
"street_code" => "510502106",
|
|
"village_code" => "510502106201",
|
|
"start_date" => "2023-08-12",
|
|
"end_date" => "2023-08-12"
|
|
];
|
|
try {
|
|
$res = HttpClient::create()->request('GET', 'https://crmeb-test.shop.lihaink.cn/api/order/statistics', [
|
|
'query' => $parmas,
|
|
]);
|
|
$arr = json_decode($res->getContent(), true);
|
|
if ($arr['status'] == 200) {
|
|
$data['total_price'] = $arr['data']['total_price'];
|
|
} else {
|
|
$data['total_price'] = 0;
|
|
Log::error('获取订单金额失败:' . $arr . '参数:' . json_encode($parmas));
|
|
}
|
|
} catch (\Exception $e) {
|
|
halt($e->getMessage());
|
|
}
|
|
}
|
|
}
|