Skip to content

Commit 30d4f87

Browse files
committed
fix(control): 参数校验问题
1 parent 0816e0e commit 30d4f87

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

laravel/app/Http/Controllers/Bus/IndexController.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,19 @@ public function busLine(Request $request)
130130
if (!empty($post['lineID'])) {
131131
$data = NewBusRepository::getInstent()->getLineStatus($post['lineID']);
132132
} elseif (!empty($post) && !empty($post['href']) && !empty($post['LineGuid']) && !empty($post['LineInfo'])) {
133-
// 'href' => string 'APTSLine.aspx?cid=175ecd8d-c39d-4116-83ff-109b946d7cb4' (length=54) 'LineGuid' => string '9d090af5-c5c6-4db8-b34e-2e8af4f63216' (length=36) 'LineInfo' => string '1(公交一路新村)' (length=21)
134-
$parseUrl = parse_url($post['href']);
135-
parse_str($parseUrl['query'], $params);
133+
// ['href' => 'APTSLine.aspx?cid=175ecd8d-c39d-4116-83ff-109b946d7cb4', 'LineGuid' => '9d090af5-c5c6-4db8-b34e-2e8af4f63216', 'LineInfo' => '1(公交一路新村)']
134+
if (isset($post['cid'])) {
135+
$aspUrl = $post['href'] ?? 'APTSLine.aspx';
136+
} else {
137+
$parseUrl = parse_url($post['href']);
138+
$query = $parseUrl['query'] ?? '';
139+
parse_str($query, $params);
140+
$post['cid'] = $params['cid'];
141+
$aspUrl = $parseUrl['path'] ?? 'APTSLine.aspx';
142+
}
136143
unset($post['href']);
137-
$post['cid'] = $params['cid'];
138-
$data = BusRepository::getInstent()->getLine($parseUrl['path'], $post);
144+
145+
$data = BusRepository::getInstent()->getLine($aspUrl, $post);
139146
}
140147

141148
return $this->out(200, $data);

0 commit comments

Comments
 (0)