2023-12-02 19:58:12 +08:00

36 lines
1.2 KiB
PHP

<?php
namespace app\controller\api\dataview;
use app\common\repositories\BaseRepository;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class Logistics extends BaseController
{
public function __construct(App $app, BaseRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
$this->areaCode = $this->request->param('areaCode', '');
$this->streetCode = $this->request->param('streetCode', '');
if ($this->areaCode == '' && $this->streetCode == '') {
throw new ValidateException('请选择地区');
}
}
// 三轮车列表 从供销系统获取
public function vehicleList()
{
// 请求供销,供销查区域下的公司,在通过公司查三轮车列表
$client = new \GuzzleHttp\Client();
$getUrl = env('TASK_WORKER_HOST_URL') . '/api/index/vehicleCarList?areaCode='.$this->areaCode.'&streetCode='.$this->streetCode;
$response = $client->request('GET', $getUrl);
$result = json_decode($response->getBody(), true);
$list = $result['data'];
$count = count($list);
return app('json')->success(compact('count', 'list'));
}
}