|
@@ -19,7 +19,7 @@ class Car extends Backend |
|
@@ -19,7 +19,7 @@ class Car extends Backend |
19
|
* @var \app\admin\model\Car
|
19
|
* @var \app\admin\model\Car
|
20
|
*/
|
20
|
*/
|
21
|
protected $model = null;
|
21
|
protected $model = null;
|
22
|
-
|
22
|
+ protected $selectpageFields = "id,license_plate,seat,driver_id,name";
|
23
|
public function _initialize()
|
23
|
public function _initialize()
|
24
|
{
|
24
|
{
|
25
|
parent::_initialize();
|
25
|
parent::_initialize();
|
|
@@ -74,6 +74,58 @@ class Car extends Backend |
|
@@ -74,6 +74,58 @@ class Car extends Backend |
74
|
}
|
74
|
}
|
75
|
return $this->view->fetch();
|
75
|
return $this->view->fetch();
|
76
|
}
|
76
|
}
|
|
|
77
|
+
|
|
|
78
|
+ /**
|
|
|
79
|
+ * 查看
|
|
|
80
|
+ */
|
|
|
81
|
+ public function select_driver()
|
|
|
82
|
+ {
|
|
|
83
|
+ //当前是否为关联查询
|
|
|
84
|
+ $this->relationSearch = true;
|
|
|
85
|
+ //设置过滤方法
|
|
|
86
|
+ $this->request->filter(['strip_tags', 'trim']);
|
|
|
87
|
+ if ($this->request->isAjax()) {
|
|
|
88
|
+ //如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
89
|
+ if ($this->request->request('keyField')) {
|
|
|
90
|
+ $res=$this->model
|
|
|
91
|
+ ->alias("a")
|
|
|
92
|
+ ->join("driver b","a.driver_id=b.id")
|
|
|
93
|
+ ->field("b.id,name,license_plate")
|
|
|
94
|
+ ->select();
|
|
|
95
|
+ $count=$this->model
|
|
|
96
|
+ ->alias("a")
|
|
|
97
|
+ ->join("driver b","a.driver_id=b.id")
|
|
|
98
|
+ ->count();
|
|
|
99
|
+ foreach ($res as $k=>$v){
|
|
|
100
|
+ $res[$k]['pid']=0;
|
|
|
101
|
+ }
|
|
|
102
|
+ $data=['list'=>$res,'total'=>$count];
|
|
|
103
|
+ return $data;
|
|
|
104
|
+ }
|
|
|
105
|
+ list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
106
|
+
|
|
|
107
|
+ $list = $this->model
|
|
|
108
|
+ ->with(['route','seat','driver'])
|
|
|
109
|
+ ->where($where)
|
|
|
110
|
+ ->order($sort, $order)
|
|
|
111
|
+ ->paginate($limit);
|
|
|
112
|
+
|
|
|
113
|
+ foreach ($list as $row) {
|
|
|
114
|
+ $row->visible(['id','car_model','license_plate','seat','colour','driving_license','driver_license','reservation_time','start_time','create_time','status','carmodel_id']);
|
|
|
115
|
+ $row->visible(['route']);
|
|
|
116
|
+ $row->getRelation('route')->visible(['name']);
|
|
|
117
|
+ $row->visible(['seat']);
|
|
|
118
|
+ $row->getRelation('seat')->visible(['name']);
|
|
|
119
|
+ $row->visible(['driver']);
|
|
|
120
|
+ $row->getRelation('driver')->visible(['name']);
|
|
|
121
|
+ }
|
|
|
122
|
+
|
|
|
123
|
+ $result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
124
|
+
|
|
|
125
|
+ return json($result);
|
|
|
126
|
+ }
|
|
|
127
|
+ return $this->view->fetch();
|
|
|
128
|
+ }
|
77
|
/**
|
129
|
/**
|
78
|
* 添加
|
130
|
* 添加
|
79
|
*
|
131
|
*
|
|
@@ -230,7 +282,7 @@ class Car extends Backend |
|
@@ -230,7 +282,7 @@ class Car extends Backend |
230
|
}
|
282
|
}
|
231
|
|
283
|
|
232
|
function createMiniProgramQRCode($accessToken, $path, $width = 430) {
|
284
|
function createMiniProgramQRCode($accessToken, $path, $width = 430) {
|
233
|
- $path = 'pages/module/intercityOrder?url='.$path; // 小程序内的页面路径
|
285
|
+ $path = 'pages/module/intercityOrder?'.$path; // 小程序内的页面路径
|
234
|
$url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}";
|
286
|
$url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}";
|
235
|
$data = json_encode([
|
287
|
$data = json_encode([
|
236
|
'path' => $path,
|
288
|
'path' => $path,
|