Skip to content

Commit b621ed0

Browse files
committed
优化 刷新接口路由
1 parent 6935215 commit b621ed0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

application/admin/controller/InterfaceList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ public function refresh() {
183183

184184
$tplOriginStr = file_get_contents($tplPath);
185185
$listInfo = AdminList::all(['status' => 1]);
186-
$tplStr = '';
186+
$tplStr = [];
187187
foreach ($listInfo as $value) {
188-
$tplStr .= 'Route::rule(\'' . addslashes($value->hash) . '\',\'api/' . addslashes($value->api_class) . '\', \'' . $methodArr[$value->method] . '\')->middleware([\'ApiAuth\', \'ApiPermission\', \'RequestFilter\', \'ApiLog\']);';
188+
array_push($tplStr, 'Route::rule(\'' . addslashes($value->hash) . '\',\'api/' . addslashes($value->api_class) . '\', \'' . $methodArr[$value->method] . '\')->middleware([\'ApiAuth\', \'ApiPermission\', \'RequestFilter\', \'ApiLog\']);');
189189
}
190-
$tplOriginStr = str_replace(['{$API_RULE}'], [$tplStr], $tplOriginStr);
190+
$tplOriginStr = str_replace(['{$API_RULE}'], [implode($tplStr, "\n ")], $tplOriginStr);
191191

192192
file_put_contents($apiRoutePath, $tplOriginStr);
193193

0 commit comments

Comments
 (0)