mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-25 02:40:16 +08:00
modified 完善接口路由刷新
This commit is contained in:
parent
ebf0e878c1
commit
9668106808
@ -12,7 +12,7 @@ use app\model\AdminApp;
|
|||||||
use app\model\AdminFields;
|
use app\model\AdminFields;
|
||||||
use app\model\AdminList;
|
use app\model\AdminList;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Tools;
|
use think\facade\Env;
|
||||||
|
|
||||||
class InterfaceList extends Base {
|
class InterfaceList extends Base {
|
||||||
/**
|
/**
|
||||||
@ -176,14 +176,15 @@ class InterfaceList extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function refresh() {
|
public function refresh() {
|
||||||
$apiRoutePath = ROOT_PATH . 'application/apiRoute.php';
|
$rootPath = Env::get('root_path');
|
||||||
$tplPath = ROOT_PATH . 'data/apiRoute.tpl';
|
$apiRoutePath = $rootPath . 'route/apiRoute.php';
|
||||||
|
$tplPath = $rootPath . 'application/install/apiRoute.tpl';
|
||||||
$methodArr = ['*', 'POST', 'GET'];
|
$methodArr = ['*', 'POST', 'GET'];
|
||||||
|
|
||||||
$tplStr = file_get_contents($tplPath);
|
$tplStr = file_get_contents($tplPath);
|
||||||
$listInfo = AdminList::all(['status' => 1]);
|
$listInfo = AdminList::all(['status' => 1]);
|
||||||
foreach ($listInfo as $value) {
|
foreach ($listInfo as $value) {
|
||||||
$tplStr .= 'Route::rule(\'api/' . addslashes($value->hash) . '\',\'api/' . addslashes($value->apiClass) . '\', \'' . $methodArr[$value->method] . '\', [\'after_behavior\' => $afterBehavior]);';
|
$tplStr .= 'Route::rule(\'api/' . addslashes($value->hash) . '\',\'api/' . addslashes($value->api_class) . '\', \'' . $methodArr[$value->method] . '\', [\'after_behavior\' => $afterBehavior]);';
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($apiRoutePath, $tplStr);
|
file_put_contents($apiRoutePath, $tplStr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user