...
|
...
|
@@ -19,7 +19,7 @@ class Car extends Backend |
|
|
* @var \app\admin\model\Car
|
|
|
*/
|
|
|
protected $model = null;
|
|
|
|
|
|
protected $selectpageFields = "id,license_plate,seat,driver_id,name";
|
|
|
public function _initialize()
|
|
|
{
|
|
|
parent::_initialize();
|
...
|
...
|
@@ -74,6 +74,58 @@ class Car extends Backend |
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查看
|
|
|
*/
|
|
|
public function select_driver()
|
|
|
{
|
|
|
//当前是否为关联查询
|
|
|
$this->relationSearch = true;
|
|
|
//设置过滤方法
|
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
|
if ($this->request->isAjax()) {
|
|
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
if ($this->request->request('keyField')) {
|
|
|
$res=$this->model
|
|
|
->alias("a")
|
|
|
->join("driver b","a.driver_id=b.id")
|
|
|
->field("b.id,name,license_plate")
|
|
|
->select();
|
|
|
$count=$this->model
|
|
|
->alias("a")
|
|
|
->join("driver b","a.driver_id=b.id")
|
|
|
->count();
|
|
|
foreach ($res as $k=>$v){
|
|
|
$res[$k]['pid']=0;
|
|
|
}
|
|
|
$data=['list'=>$res,'total'=>$count];
|
|
|
return $data;
|
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
$list = $this->model
|
|
|
->with(['route','seat','driver'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
|
|
|
|
foreach ($list as $row) {
|
|
|
$row->visible(['id','car_model','license_plate','seat','colour','driving_license','driver_license','reservation_time','start_time','create_time','status','carmodel_id']);
|
|
|
$row->visible(['route']);
|
|
|
$row->getRelation('route')->visible(['name']);
|
|
|
$row->visible(['seat']);
|
|
|
$row->getRelation('seat')->visible(['name']);
|
|
|
$row->visible(['driver']);
|
|
|
$row->getRelation('driver')->visible(['name']);
|
|
|
}
|
|
|
|
|
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
|
|
return json($result);
|
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
...
|
...
|
@@ -230,7 +282,7 @@ class Car extends Backend |
|
|
}
|
|
|
|
|
|
function createMiniProgramQRCode($accessToken, $path, $width = 430) {
|
|
|
$path = 'pages/module/intercityOrder?url='.$path; // 小程序内的页面路径
|
|
|
$path = 'pages/module/intercityOrder?'.$path; // 小程序内的页面路径
|
|
|
$url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}";
|
|
|
$data = json_encode([
|
|
|
'path' => $path,
|
...
|
...
|
|