update 镇级最新物流配送详情接口
This commit is contained in:
parent
bf435ed9ca
commit
0c0b6c622b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\controller\api\dataview;
|
namespace app\controller\api\dataview;
|
||||||
|
|
||||||
|
use app\common\model\Company;
|
||||||
use app\common\repositories\BaseRepository;
|
use app\common\repositories\BaseRepository;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
use think\App;
|
use think\App;
|
||||||
@ -25,12 +26,30 @@ class Logistics extends BaseController
|
|||||||
// 三轮车列表 从供销系统获取
|
// 三轮车列表 从供销系统获取
|
||||||
public function vehicleList()
|
public function vehicleList()
|
||||||
{
|
{
|
||||||
// 请求供销,供销查区域下的公司,在通过公司查三轮车列表
|
// 镇区域码为空,查区县的公司
|
||||||
$client = new \GuzzleHttp\Client();
|
if (empty($this->streetCode)) {
|
||||||
$getUrl = env('TASK_WORKER_HOST_URL') . '/api/index/vehicleCarList?areaCode='.$this->areaCode.'&streetCode='.$this->streetCode;
|
$companyList = Db::connect('work_task')->name('company')->where('area', $this->areaCode)->select()->toArray();
|
||||||
$response = $client->request('GET', $getUrl);
|
} else {
|
||||||
$result = json_decode($response->getBody(), true);
|
$companyList = Db::connect('work_task')->name('company')->where('street', $this->streetCode)->select()->toArray();
|
||||||
$list = $result['data'];
|
}
|
||||||
|
$companyIds = array_column($companyList, 'id');
|
||||||
|
// 查镇车辆列表
|
||||||
|
$list = Db::connect('work_task')->name('vehicle_rent')
|
||||||
|
->field('company_id, car_id as id, car_license as license')
|
||||||
|
->append(['area_code','street_code'])
|
||||||
|
->whereIn('company_id', $companyIds)
|
||||||
|
->where('status','in','0,1,2')
|
||||||
|
->withAttr('area_code', function ($value, $data){
|
||||||
|
$company = Db::connect('work_task')->name('company')->where('id', $data['company_id'])->find();
|
||||||
|
return $company['area'];
|
||||||
|
})
|
||||||
|
->withAttr('street_code', function ($value, $data){
|
||||||
|
$company = Db::connect('work_task')->name('company')->where('id', $data['company_id'])->find();
|
||||||
|
return $company['street'];
|
||||||
|
})
|
||||||
|
->group('company_id')
|
||||||
|
->select()->toArray();
|
||||||
|
|
||||||
$count = count($list);
|
$count = count($list);
|
||||||
return app('json')->success(compact('count', 'list'));
|
return app('json')->success(compact('count', 'list'));
|
||||||
}
|
}
|
||||||
@ -50,6 +69,9 @@ class Logistics extends BaseController
|
|||||||
->where('og.street_code', $this->streetCode)
|
->where('og.street_code', $this->streetCode)
|
||||||
->order('o.order_id', 'desc')
|
->order('o.order_id', 'desc')
|
||||||
->find();
|
->find();
|
||||||
|
if (empty($detail)) {
|
||||||
|
return app('json')->success([]);
|
||||||
|
}
|
||||||
// 拼接商户的详细地址 area_id street_id village_id
|
// 拼接商户的详细地址 area_id street_id village_id
|
||||||
$area = Db::name('geo_area')->where('area_code', $detail['area_id'])->find();
|
$area = Db::name('geo_area')->where('area_code', $detail['area_id'])->find();
|
||||||
$city = Db::name('geo_city')->where('city_code', $area['city_code'])->find();
|
$city = Db::name('geo_city')->where('city_code', $area['city_code'])->find();
|
||||||
|
@ -90,6 +90,47 @@ return [
|
|||||||
// 数据库表前缀
|
// 数据库表前缀
|
||||||
'prefix' => env('database2.prefix', ''),
|
'prefix' => env('database2.prefix', ''),
|
||||||
|
|
||||||
|
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||||
|
'deploy' => 0,
|
||||||
|
// 数据库读写是否分离 主从式有效
|
||||||
|
'rw_separate' => false,
|
||||||
|
// 读写分离后 主服务器数量
|
||||||
|
'master_num' => 1,
|
||||||
|
// 指定从服务器序号
|
||||||
|
'slave_no' => '',
|
||||||
|
// 是否严格检查字段是否存在
|
||||||
|
'fields_strict' => true,
|
||||||
|
// 是否需要断线重连
|
||||||
|
'break_reconnect' => true,
|
||||||
|
// 监听SQL
|
||||||
|
'trigger_sql' => env('app_debug', true),
|
||||||
|
// 开启字段缓存
|
||||||
|
'fields_cache' => false,
|
||||||
|
// 字段缓存路径
|
||||||
|
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||||
|
],
|
||||||
|
// 供销系统
|
||||||
|
'work_task' => [
|
||||||
|
// 数据库类型
|
||||||
|
'type' => env('database3.type', 'mysql'),
|
||||||
|
// 服务器地址
|
||||||
|
'hostname' => env('database3.hostname', '127.0.0.1'),
|
||||||
|
// 数据库名
|
||||||
|
'database' => env('database3.database', ''),
|
||||||
|
// 用户名
|
||||||
|
'username' => env('database3.username', 'root'),
|
||||||
|
// 密码
|
||||||
|
'password' => env('database3.password', ''),
|
||||||
|
// 端口
|
||||||
|
'hostport' => env('database3.hostport', '3306'),
|
||||||
|
// 数据库连接参数
|
||||||
|
'params' => [],
|
||||||
|
// 数据库编码默认采用utf8
|
||||||
|
// 'charset' => env('database.charset', 'utf8'),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
// 数据库表前缀
|
||||||
|
'prefix' => env('database3.prefix', ''),
|
||||||
|
|
||||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||||
'deploy' => 0,
|
'deploy' => 0,
|
||||||
// 数据库读写是否分离 主从式有效
|
// 数据库读写是否分离 主从式有效
|
||||||
|
Loading…
x
Reference in New Issue
Block a user