mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
commit
1134aedf45
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\model\AdminList;
|
use app\model\AdminList;
|
||||||
use app\model\AdminGroup;
|
use app\model\AdminGroup;
|
||||||
@ -16,6 +15,7 @@ use app\util\Strs;
|
|||||||
use app\util\Tools;
|
use app\util\Tools;
|
||||||
|
|
||||||
class App extends Base {
|
class App extends Base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用列表
|
* 获取应用列表
|
||||||
* @return array
|
* @return array
|
||||||
@ -23,7 +23,6 @@ class App extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$keywords = $this->request->get('keywords', '');
|
$keywords = $this->request->get('keywords', '');
|
||||||
@ -44,7 +43,7 @@ class App extends Base {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = $obj->order('app_add_time DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->order('app_add_time', 'DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -105,7 +104,7 @@ class App extends Base {
|
|||||||
'app_group' => $postData['app_group'],
|
'app_group' => $postData['app_group'],
|
||||||
'app_add_time' => time(),
|
'app_add_time' => time(),
|
||||||
'app_api' => '',
|
'app_api' => '',
|
||||||
'app_api_show' => '',
|
'app_api_show' => ''
|
||||||
];
|
];
|
||||||
if (isset($postData['app_api']) && $postData['app_api']) {
|
if (isset($postData['app_api']) && $postData['app_api']) {
|
||||||
$appApi = [];
|
$appApi = [];
|
||||||
@ -118,9 +117,9 @@ class App extends Base {
|
|||||||
$res = AdminApp::create($data);
|
$res = AdminApp::create($data);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,13 +131,12 @@ class App extends Base {
|
|||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$status = $this->request->get('status');
|
$status = $this->request->get('status');
|
||||||
$res = AdminApp::update([
|
$res = AdminApp::update([
|
||||||
|
'id' => $id,
|
||||||
'app_status' => $status
|
'app_status' => $status
|
||||||
], [
|
|
||||||
'id' => $id
|
|
||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
$appInfo = AdminApp::get($id);
|
$appInfo = AdminApp::get($id);
|
||||||
cache('AccessToken:' . $appInfo['app_secret'], null);
|
cache('AccessToken:' . $appInfo['app_secret'], null);
|
||||||
if($oldWiki = cache('WikiLogin:' . $id)) {
|
if($oldWiki = cache('WikiLogin:' . $id)) {
|
||||||
@ -147,7 +145,6 @@ class App extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑应用
|
* 编辑应用
|
||||||
@ -157,12 +154,12 @@ class App extends Base {
|
|||||||
public function edit() {
|
public function edit() {
|
||||||
$postData = $this->request->post();
|
$postData = $this->request->post();
|
||||||
$data = [
|
$data = [
|
||||||
|
'app_secret' => $postData['app_secret'],
|
||||||
'app_name' => $postData['app_name'],
|
'app_name' => $postData['app_name'],
|
||||||
'app_info' => $postData['app_info'],
|
'app_info' => $postData['app_info'],
|
||||||
'app_group' => $postData['app_group'],
|
'app_group' => $postData['app_group'],
|
||||||
'app_secret' => $postData['app_secret'],
|
|
||||||
'app_api' => '',
|
'app_api' => '',
|
||||||
'app_api_show' => '',
|
'app_api_show' => ''
|
||||||
];
|
];
|
||||||
if (isset($postData['app_api']) && $postData['app_api']) {
|
if (isset($postData['app_api']) && $postData['app_api']) {
|
||||||
$appApi = [];
|
$appApi = [];
|
||||||
@ -175,7 +172,7 @@ class App extends Base {
|
|||||||
$res = AdminApp::update($data, ['id' => $postData['id']]);
|
$res = AdminApp::update($data, ['id' => $postData['id']]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
$appInfo = AdminApp::get($postData['id']);
|
$appInfo = AdminApp::get($postData['id']);
|
||||||
cache('AccessToken:' . $appInfo['app_secret'], null);
|
cache('AccessToken:' . $appInfo['app_secret'], null);
|
||||||
if($oldWiki = cache('WikiLogin:' . $postData['id'])) {
|
if($oldWiki = cache('WikiLogin:' . $postData['id'])) {
|
||||||
@ -183,7 +180,7 @@ class App extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,13 +7,12 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\model\AdminAppGroup;
|
use app\model\AdminAppGroup;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Tools;
|
|
||||||
|
|
||||||
class AppGroup extends Base {
|
class AppGroup extends Base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用组列表
|
* 获取应用组列表
|
||||||
* @return array
|
* @return array
|
||||||
@ -75,15 +74,14 @@ class AppGroup extends Base {
|
|||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$status = $this->request->get('status');
|
$status = $this->request->get('status');
|
||||||
$res = AdminAppGroup::update([
|
$res = AdminAppGroup::update([
|
||||||
|
'id' => $id,
|
||||||
'status' => $status
|
'status' => $status
|
||||||
], [
|
|
||||||
'id' => $id
|
|
||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,9 +94,9 @@ class AppGroup extends Base {
|
|||||||
$res = AdminAppGroup::create($postData);
|
$res = AdminAppGroup::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,9 +109,9 @@ class AppGroup extends Base {
|
|||||||
$res = AdminAppGroup::update($postData);
|
$res = AdminAppGroup::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminAuthGroup;
|
use app\model\AdminAuthGroup;
|
||||||
use app\model\AdminAuthGroupAccess;
|
use app\model\AdminAuthGroupAccess;
|
||||||
use app\model\AdminAuthRule;
|
use app\model\AdminAuthRule;
|
||||||
@ -24,7 +23,6 @@ class Auth extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$keywords = $this->request->get('keywords', '');
|
$keywords = $this->request->get('keywords', '');
|
||||||
@ -38,7 +36,7 @@ class Auth extends Base {
|
|||||||
$obj = $obj->whereLike('name', "%{$keywords}%");
|
$obj = $obj->whereLike('name', "%{$keywords}%");
|
||||||
}
|
}
|
||||||
|
|
||||||
$listObj = $obj->order('id DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->order('id', 'DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -76,7 +74,7 @@ class Auth extends Base {
|
|||||||
public function getRuleList() {
|
public function getRuleList() {
|
||||||
$groupId = $this->request->get('group_id', 0);
|
$groupId = $this->request->get('group_id', 0);
|
||||||
|
|
||||||
$list = (new AdminMenu)->where([])->order('sort', 'ASC')->select();
|
$list = (new AdminMenu)->order('sort', 'ASC')->select();
|
||||||
$list = Tools::buildArrFromObj($list);
|
$list = Tools::buildArrFromObj($list);
|
||||||
$list = Tools::listToTree($list);
|
$list = Tools::listToTree($list);
|
||||||
|
|
||||||
@ -110,7 +108,7 @@ class Auth extends Base {
|
|||||||
$res = AdminAuthGroup::create($postData);
|
$res = AdminAuthGroup::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
if ($rules) {
|
if ($rules) {
|
||||||
$insertData = [];
|
$insertData = [];
|
||||||
foreach ($rules as $value) {
|
foreach ($rules as $value) {
|
||||||
@ -126,7 +124,6 @@ class Auth extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限组状态编辑
|
* 权限组状态编辑
|
||||||
@ -142,9 +139,9 @@ class Auth extends Base {
|
|||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,9 +162,9 @@ class Auth extends Base {
|
|||||||
$res = AdminAuthGroup::update($postData);
|
$res = AdminAuthGroup::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,9 +224,9 @@ class Auth extends Base {
|
|||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,5 +288,4 @@ class Auth extends Base {
|
|||||||
(new AdminAuthRule())->whereIn('url', $urlArr)->where('group_id', $postData['id'])->delete();
|
(new AdminAuthRule())->whereIn('url', $urlArr)->where('group_id', $postData['id'])->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,5 +74,4 @@ class Base extends Controller {
|
|||||||
$this->debug[] = $data;
|
$this->debug[] = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminFields;
|
use app\model\AdminFields;
|
||||||
use app\model\AdminList;
|
use app\model\AdminList;
|
||||||
use app\util\DataType;
|
use app\util\DataType;
|
||||||
@ -15,6 +14,7 @@ use app\util\ReturnCode;
|
|||||||
use app\util\Tools;
|
use app\util\Tools;
|
||||||
|
|
||||||
class Fields extends Base {
|
class Fields extends Base {
|
||||||
|
|
||||||
private $dataType = array(
|
private $dataType = array(
|
||||||
DataType::TYPE_INTEGER => 'Integer',
|
DataType::TYPE_INTEGER => 'Integer',
|
||||||
DataType::TYPE_STRING => 'String',
|
DataType::TYPE_STRING => 'String',
|
||||||
@ -42,7 +42,9 @@ class Fields extends Base {
|
|||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$hash = $this->request->get('hash', '');
|
$hash = $this->request->get('hash', '');
|
||||||
|
|
||||||
if (!empty($hash)) {
|
if (empty($hash)) {
|
||||||
|
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
||||||
|
}
|
||||||
$listObj = (new AdminFields())->where(['hash' => $hash, 'type' => 0])
|
$listObj = (new AdminFields())->where(['hash' => $hash, 'type' => 0])
|
||||||
->paginate($limit, false, ['page' => $start])->toArray();
|
->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
@ -54,9 +56,6 @@ class Fields extends Base {
|
|||||||
'dataType' => $this->dataType,
|
'dataType' => $this->dataType,
|
||||||
'apiInfo' => $apiInfo
|
'apiInfo' => $apiInfo
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +69,9 @@ class Fields extends Base {
|
|||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$hash = $this->request->get('hash', '');
|
$hash = $this->request->get('hash', '');
|
||||||
|
|
||||||
if (!empty($hash)) {
|
if (empty($hash)) {
|
||||||
|
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
||||||
|
}
|
||||||
$listObj = (new AdminFields())->where(['hash' => $hash, 'type' => 1])
|
$listObj = (new AdminFields())->where(['hash' => $hash, 'type' => 1])
|
||||||
->paginate($limit, false, ['page' => $start])->toArray();
|
->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
@ -82,9 +83,6 @@ class Fields extends Base {
|
|||||||
'dataType' => $this->dataType,
|
'dataType' => $this->dataType,
|
||||||
'apiInfo' => $apiInfo
|
'apiInfo' => $apiInfo
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,9 +103,9 @@ class Fields extends Base {
|
|||||||
|
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,9 +126,9 @@ class Fields extends Base {
|
|||||||
|
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,14 +7,13 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\model\AdminGroup;
|
use app\model\AdminGroup;
|
||||||
use app\model\AdminList;
|
use app\model\AdminList;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Tools;
|
|
||||||
|
|
||||||
class InterfaceGroup extends Base {
|
class InterfaceGroup extends Base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取接口组列表
|
* 获取接口组列表
|
||||||
* @return array
|
* @return array
|
||||||
@ -42,7 +41,7 @@ class InterfaceGroup extends Base {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = $obj->order('create_time desc')->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->order('create_time', 'desc')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -74,15 +73,14 @@ class InterfaceGroup extends Base {
|
|||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$status = $this->request->get('status');
|
$status = $this->request->get('status');
|
||||||
$res = AdminGroup::update([
|
$res = AdminGroup::update([
|
||||||
'status' => $status
|
'id' => $id,
|
||||||
], [
|
'status' => $status,
|
||||||
'id' => $id
|
|
||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,9 +93,9 @@ class InterfaceGroup extends Base {
|
|||||||
$res = AdminGroup::create($postData);
|
$res = AdminGroup::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,9 +108,9 @@ class InterfaceGroup extends Base {
|
|||||||
$res = AdminGroup::update($postData);
|
$res = AdminGroup::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\model\AdminFields;
|
use app\model\AdminFields;
|
||||||
use app\model\AdminList;
|
use app\model\AdminList;
|
||||||
@ -15,6 +14,7 @@ use app\util\ReturnCode;
|
|||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
|
|
||||||
class InterfaceList extends Base {
|
class InterfaceList extends Base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取接口列表
|
* 获取接口列表
|
||||||
* @return array
|
* @return array
|
||||||
@ -22,7 +22,6 @@ class InterfaceList extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$keywords = $this->request->get('keywords', '');
|
$keywords = $this->request->get('keywords', '');
|
||||||
@ -79,9 +78,9 @@ class InterfaceList extends Base {
|
|||||||
$res = AdminList::create($postData);
|
$res = AdminList::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,12 +98,11 @@ class InterfaceList extends Base {
|
|||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
cache('ApiInfo:' . $hash, null);
|
cache('ApiInfo:' . $hash, null);
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑接口
|
* 编辑接口
|
||||||
@ -120,12 +118,11 @@ class InterfaceList extends Base {
|
|||||||
$res = AdminList::update($postData);
|
$res = AdminList::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
cache('ApiInfo:' . $postData['hash'], null);
|
cache('ApiInfo:' . $postData['hash'], null);
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除接口
|
* 删除接口
|
||||||
|
@ -7,13 +7,8 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminAuthGroupAccess;
|
|
||||||
use app\model\AdminUser;
|
|
||||||
use app\model\AdminUserAction;
|
use app\model\AdminUserAction;
|
||||||
use app\model\AdminUserData;
|
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Tools;
|
|
||||||
|
|
||||||
class Log extends Base {
|
class Log extends Base {
|
||||||
|
|
||||||
@ -24,7 +19,6 @@ class Log extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$type = $this->request->get('type', '');
|
$type = $this->request->get('type', '');
|
||||||
@ -44,7 +38,7 @@ class Log extends Base {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = $obj->order('add_time DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->order('add_time', 'DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -65,7 +59,5 @@ class Log extends Base {
|
|||||||
AdminUserAction::destroy($id);
|
AdminUserAction::destroy($id);
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminAuthGroupAccess;
|
use app\model\AdminAuthGroupAccess;
|
||||||
use app\model\AdminAuthRule;
|
use app\model\AdminAuthRule;
|
||||||
use app\model\AdminMenu;
|
use app\model\AdminMenu;
|
||||||
@ -121,5 +120,4 @@ class Login extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminMenu;
|
use app\model\AdminMenu;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Tools;
|
use app\util\Tools;
|
||||||
@ -21,7 +20,7 @@ class Menu extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$list = (new AdminMenu)->where([])->order('sort', 'ASC')->select();
|
$list = (new AdminMenu)->order('sort', 'ASC')->select();
|
||||||
$list = Tools::buildArrFromObj($list);
|
$list = Tools::buildArrFromObj($list);
|
||||||
$list = Tools::formatTree(Tools::listToTree($list));
|
$list = Tools::formatTree(Tools::listToTree($list));
|
||||||
|
|
||||||
@ -62,9 +61,9 @@ class Menu extends Base {
|
|||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,9 +79,9 @@ class Menu extends Base {
|
|||||||
$res = AdminMenu::update($postData);
|
$res = AdminMenu::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
|
||||||
return $this->buildSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,11 +97,9 @@ class Menu extends Base {
|
|||||||
$childNum = AdminMenu::where(['fid' => $id])->count();
|
$childNum = AdminMenu::where(['fid' => $id])->count();
|
||||||
if ($childNum) {
|
if ($childNum) {
|
||||||
return $this->buildFailed(ReturnCode::INVALID, '当前菜单存在子菜单,不可以被删除!');
|
return $this->buildFailed(ReturnCode::INVALID, '当前菜单存在子菜单,不可以被删除!');
|
||||||
} else {
|
}
|
||||||
AdminMenu::destroy($id);
|
AdminMenu::destroy($id);
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
|
|
||||||
class Miss extends Base {
|
class Miss extends Base {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
if ($this->request->isOptions()) {
|
if ($this->request->isOptions()) {
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminAuthGroupAccess;
|
use app\model\AdminAuthGroupAccess;
|
||||||
use app\model\AdminUser;
|
use app\model\AdminUser;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
@ -297,7 +296,6 @@ class ThirdLogin extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
private function doLogin($openid, $userDetail) {
|
private function doLogin($openid, $userDetail) {
|
||||||
|
|
||||||
$userInfo = AdminUser::get(['openid' => $openid]);
|
$userInfo = AdminUser::get(['openid' => $openid]);
|
||||||
if (empty($userInfo)) {
|
if (empty($userInfo)) {
|
||||||
$userInfo = AdminUser::create([
|
$userInfo = AdminUser::create([
|
||||||
@ -345,5 +343,4 @@ class ThirdLogin extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess($userInfo, '登录成功');
|
return $this->buildSuccess($userInfo, '登录成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminAuthGroupAccess;
|
use app\model\AdminAuthGroupAccess;
|
||||||
use app\model\AdminUser;
|
use app\model\AdminUser;
|
||||||
use app\model\AdminUserData;
|
use app\model\AdminUserData;
|
||||||
@ -24,7 +23,6 @@ class User extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
|
|
||||||
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
||||||
$start = $this->request->get('page', 1);
|
$start = $this->request->get('page', 1);
|
||||||
$type = $this->request->get('type', '', 'intval');
|
$type = $this->request->get('type', '', 'intval');
|
||||||
@ -46,7 +44,7 @@ class User extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$listObj = $obj->order('create_time DESC')
|
$listObj = $obj->order('create_time', 'DESC')
|
||||||
->paginate($limit, false, ['page' => $start])->each(function($item, $key){
|
->paginate($limit, false, ['page' => $start])->each(function($item, $key){
|
||||||
$item->userData;
|
$item->userData;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
@ -96,7 +94,7 @@ class User extends Base {
|
|||||||
$res = AdminUser::create($postData);
|
$res = AdminUser::create($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
AdminAuthGroupAccess::create([
|
AdminAuthGroupAccess::create([
|
||||||
'uid' => $res->id,
|
'uid' => $res->id,
|
||||||
'group_id' => $groups
|
'group_id' => $groups
|
||||||
@ -104,7 +102,6 @@ class User extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前组的全部用户
|
* 获取当前组的全部用户
|
||||||
@ -161,14 +158,13 @@ class User extends Base {
|
|||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
if($oldAdmin = cache('Login:' . $id)) {
|
if($oldAdmin = cache('Login:' . $id)) {
|
||||||
cache('Login:' . $oldAdmin, null);
|
cache('Login:' . $oldAdmin, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑用户
|
* 编辑用户
|
||||||
@ -191,7 +187,7 @@ class User extends Base {
|
|||||||
$res = AdminUser::update($postData);
|
$res = AdminUser::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
$has = AdminAuthGroupAccess::get(['uid' => $postData['id']]);
|
$has = AdminAuthGroupAccess::get(['uid' => $postData['id']]);
|
||||||
if ($has) {
|
if ($has) {
|
||||||
AdminAuthGroupAccess::update([
|
AdminAuthGroupAccess::update([
|
||||||
@ -211,7 +207,6 @@ class User extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改自己的信息
|
* 修改自己的信息
|
||||||
@ -240,7 +235,7 @@ class User extends Base {
|
|||||||
$res = AdminUser::update($postData);
|
$res = AdminUser::update($postData);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
|
||||||
} else {
|
}
|
||||||
$userData = AdminUserData::get(['uid' => $postData['id']]);
|
$userData = AdminUserData::get(['uid' => $postData['id']]);
|
||||||
$userData->head_img = $headImg;
|
$userData->head_img = $headImg;
|
||||||
$userData->save();
|
$userData->save();
|
||||||
@ -250,7 +245,6 @@ class User extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
@ -274,7 +268,5 @@ class User extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildSuccess();
|
return $this->buildSuccess();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
|
|
||||||
@ -51,5 +50,4 @@ class Base extends Controller {
|
|||||||
$this->debug[] = $data;
|
$this->debug[] = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use app\util\Strs;
|
use app\util\Strs;
|
||||||
@ -85,5 +84,4 @@ class BuildToken extends Base {
|
|||||||
|
|
||||||
return md5($preStr);
|
return md5($preStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
|
||||||
use think\facade\App;
|
use think\facade\App;
|
||||||
|
|
||||||
class Index extends Base {
|
class Index extends Base {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$this->debug([
|
$this->debug([
|
||||||
'TpVersion' => App::version()
|
'TpVersion' => App::version()
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\util\StrRandom;
|
use app\util\StrRandom;
|
||||||
use think\facade\App;
|
use think\facade\App;
|
||||||
|
|
||||||
class Miss extends Base {
|
class Miss extends Base {
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$this->debug([
|
$this->debug([
|
||||||
'TpVersion' => App::version(),
|
'TpVersion' => App::version(),
|
||||||
|
@ -20,7 +20,7 @@ class Install extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* php think apiadmin:install --db mysql://root:123456@127.0.0.1:3306/apiadmin#utf8
|
* php think apiadmin:install --db mysql://root:123456@127.0.0.1:3306/apiadmin#utf8mb4
|
||||||
* @param Input $input
|
* @param Input $input
|
||||||
* @param Output $output
|
* @param Output $output
|
||||||
* @return int|void|null
|
* @return int|void|null
|
||||||
|
@ -40,5 +40,4 @@ class AdminLog {
|
|||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ class AdminPermission {
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,5 +92,4 @@ class AdminPermission {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace app\http\middleware;
|
|||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
class AdminResponse {
|
class AdminResponse {
|
||||||
|
|
||||||
public function handle($request, \Closure $next) {
|
public function handle($request, \Closure $next) {
|
||||||
return $next($request)->header(Config::get('apiadmin.CROSS_DOMAIN'));
|
return $next($request)->header(Config::get('apiadmin.CROSS_DOMAIN'));
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace app\http\middleware;
|
|||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
class ApiResponse {
|
class ApiResponse {
|
||||||
|
|
||||||
public function handle($request, \Closure $next) {
|
public function handle($request, \Closure $next) {
|
||||||
return $next($request)->header(Config::get('apiadmin.CROSS_DOMAIN'));
|
return $next($request)->header(Config::get('apiadmin.CROSS_DOMAIN'));
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ use app\util\ReturnCode;
|
|||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Validate;
|
use think\facade\Validate;
|
||||||
|
|
||||||
|
|
||||||
class RequestFilter {
|
class RequestFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
application/install/.gitignore
vendored
Normal file
2
application/install/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
!.gitignore
|
||||||
|
lock.ini
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminApp extends Base {
|
class AdminApp extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminAppGroup extends Base {
|
class AdminAppGroup extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,9 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminAuthGroup extends Base {
|
class AdminAuthGroup extends Base {
|
||||||
|
|
||||||
public function rules() {
|
public function rules() {
|
||||||
return $this->hasMany('AdminAuthRule', 'group_id', 'id');
|
return $this->hasMany('AdminAuthRule', 'group_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminAuthGroupAccess extends Base {
|
class AdminAuthGroupAccess extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminAuthRule extends Base {
|
class AdminAuthRule extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminGroup extends Base {
|
class AdminGroup extends Base {
|
||||||
|
|
||||||
protected $autoWriteTimestamp = true;
|
protected $autoWriteTimestamp = true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminMenu extends Base {
|
class AdminMenu extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminUser extends Base {
|
class AdminUser extends Base {
|
||||||
|
|
||||||
protected $autoWriteTimestamp = true;
|
protected $autoWriteTimestamp = true;
|
||||||
|
|
||||||
public function userData() {
|
public function userData() {
|
||||||
return $this->hasOne('AdminUserData', 'uid', 'id');
|
return $this->hasOne('AdminUserData', 'uid', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminUserAction extends Base {
|
class AdminUserAction extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
class AdminUserData extends Base {
|
class AdminUserData extends Base {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
class Base extends Model {
|
class Base extends Model {
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
|
|
||||||
class ApiLogTool {
|
class ApiLogTool {
|
||||||
@ -95,6 +94,4 @@ class ApiLogTool {
|
|||||||
@fwrite($handle, date('Y-m-d H:i:s') . "\t" . $log . "\r\n");
|
@fwrite($handle, date('Y-m-d H:i:s') . "\t" . $log . "\r\n");
|
||||||
@fclose($handle);
|
@fclose($handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
class BuildName {
|
class BuildName {
|
||||||
|
|
||||||
private $arrXing, $numbXing;
|
private $arrXing, $numbXing;
|
||||||
private $arrMing, $numbMing;
|
private $arrMing, $numbMing;
|
||||||
|
|
||||||
@ -66,7 +66,6 @@ class BuildName {
|
|||||||
$this->numbMing = count($this->arrMing);
|
$this->numbMing = count($this->arrMing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取姓
|
// 获取姓
|
||||||
private function getXing() {
|
private function getXing() {
|
||||||
// mt_rand() 比rand()方法快四倍,而且生成的随机数比rand()生成的伪随机数无规律。
|
// mt_rand() 比rand()方法快四倍,而且生成的随机数比rand()生成的伪随机数无规律。
|
||||||
@ -79,7 +78,6 @@ class BuildName {
|
|||||||
return $this->arrMing[mt_rand(0, $this->numbMing - 1)];
|
return $this->arrMing[mt_rand(0, $this->numbMing - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取名字
|
// 获取名字
|
||||||
public function getName($type = 2) {
|
public function getName($type = 2) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
class DataType {
|
class DataType {
|
||||||
|
|
||||||
const TYPE_INTEGER = 1;
|
const TYPE_INTEGER = 1;
|
||||||
@ -20,5 +19,4 @@ class DataType {
|
|||||||
const TYPE_ENUM = 7;
|
const TYPE_ENUM = 7;
|
||||||
const TYPE_MOBILE = 8;
|
const TYPE_MOBILE = 8;
|
||||||
const TYPE_OBJECT = 9;
|
const TYPE_OBJECT = 9;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
class MockConf {
|
class MockConf {
|
||||||
|
|
||||||
public function mockToApiAdmin() {
|
public function mockToApiAdmin() {
|
||||||
@ -17,5 +16,4 @@ class MockConf {
|
|||||||
public function apiAdminToMock() {
|
public function apiAdminToMock() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,8 @@ class ReturnCode {
|
|||||||
const UNKNOWN = -998;
|
const UNKNOWN = -998;
|
||||||
const EXCEPTION = -999;
|
const EXCEPTION = -999;
|
||||||
|
|
||||||
static public function getConstants() {
|
public static function getConstants() {
|
||||||
$oClass = new \ReflectionClass(__CLASS__);
|
$oClass = new \ReflectionClass(__CLASS__);
|
||||||
return $oClass->getConstants();
|
return $oClass->getConstants();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
class StrRandom {
|
class StrRandom {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,5 +181,4 @@ class StrRandom {
|
|||||||
|
|
||||||
return $prefixArr[0] . '0000' . self::randomDate('Ymd') . Strs::randString(3, 1) . $suffixArr[0];
|
return $prefixArr[0] . '0000' . self::randomDate('Ymd') . Strs::randString(3, 1) . $suffixArr[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
class Strs {
|
class Strs {
|
||||||
@ -17,7 +18,7 @@ class Strs {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function uuid() {
|
public static function uuid() {
|
||||||
$charId = md5(uniqid(mt_rand(), true));
|
$charId = md5(uniqid(mt_rand(), true));
|
||||||
$hyphen = chr(45);
|
$hyphen = chr(45);
|
||||||
$uuid = chr(123)
|
$uuid = chr(123)
|
||||||
@ -35,7 +36,7 @@ class Strs {
|
|||||||
* 生成Guid主键
|
* 生成Guid主键
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
static public function keyGen() {
|
public static function keyGen() {
|
||||||
return str_replace('-', '', substr(self::uuid(), 1, -1));
|
return str_replace('-', '', substr(self::uuid(), 1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ class Strs {
|
|||||||
* @param string $string 字符串
|
* @param string $string 字符串
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
static public function isUtf8($string) {
|
public static function isUtf8($string) {
|
||||||
$len = strlen($string);
|
$len = strlen($string);
|
||||||
for ($i = 0; $i < $len; $i++) {
|
for ($i = 0; $i < $len; $i++) {
|
||||||
$c = ord($string[$i]);
|
$c = ord($string[$i]);
|
||||||
@ -79,7 +80,7 @@ class Strs {
|
|||||||
* @param bool $suffix 截断显示字符
|
* @param bool $suffix 截断显示字符
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function mSubStr($str, $start = 0, $length, $charset = "utf-8", $suffix = true) {
|
public static function mSubStr($str, $start = 0, $length, $charset = "utf-8", $suffix = true) {
|
||||||
if (function_exists("mb_substr"))
|
if (function_exists("mb_substr"))
|
||||||
$slice = mb_substr($str, $start, $length, $charset);
|
$slice = mb_substr($str, $start, $length, $charset);
|
||||||
elseif (function_exists('iconv_substr')) {
|
elseif (function_exists('iconv_substr')) {
|
||||||
@ -105,7 +106,7 @@ class Strs {
|
|||||||
* @param string $addChars 额外字符
|
* @param string $addChars 额外字符
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function randString($len = 6, $type = '', $addChars = '') {
|
public static function randString($len = 6, $type = '', $addChars = '') {
|
||||||
$str = '';
|
$str = '';
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -152,7 +153,7 @@ class Strs {
|
|||||||
* 0 字母 1 数字 其它 混合
|
* 0 字母 1 数字 其它 混合
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function buildCountRand($number, $length = 4, $mode = 1) {
|
public static function buildCountRand($number, $length = 4, $mode = 1) {
|
||||||
if ($mode == 1 && $length < strlen($number)) {
|
if ($mode == 1 && $length < strlen($number)) {
|
||||||
//不足以生成一定数量的不重复数字
|
//不足以生成一定数量的不重复数字
|
||||||
return false;
|
return false;
|
||||||
@ -182,7 +183,7 @@ class Strs {
|
|||||||
* @param integer $number 生成数量
|
* @param integer $number 生成数量
|
||||||
* @return string | array
|
* @return string | array
|
||||||
*/
|
*/
|
||||||
static public function buildFormatRand($format, $number = 1) {
|
public static function buildFormatRand($format, $number = 1) {
|
||||||
$str = array();
|
$str = array();
|
||||||
$length = strlen($format);
|
$length = strlen($format);
|
||||||
for ($j = 0; $j < $number; $j++) {
|
for ($j = 0; $j < $number; $j++) {
|
||||||
@ -216,12 +217,12 @@ class Strs {
|
|||||||
* @param integer $max 最大值
|
* @param integer $max 最大值
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function randNumber($min, $max) {
|
public static function randNumber($min, $max) {
|
||||||
return sprintf("%0" . strlen($max) . "d", mt_rand($min, $max));
|
return sprintf("%0" . strlen($max) . "d", mt_rand($min, $max));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动转换字符集 支持数组转换
|
// 自动转换字符集 支持数组转换
|
||||||
static public function autoCharset($string, $from = 'gbk', $to = 'utf-8') {
|
public static function autoCharset($string, $from = 'gbk', $to = 'utf-8') {
|
||||||
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
|
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
|
||||||
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
|
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
|
||||||
if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) {
|
if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\util;
|
namespace app\util;
|
||||||
|
|
||||||
|
|
||||||
class Tools {
|
class Tools {
|
||||||
|
|
||||||
public static function getDate($timestamp) {
|
public static function getDate($timestamp) {
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
namespace app\wiki\controller;
|
namespace app\wiki\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\model\AdminApp;
|
use app\model\AdminApp;
|
||||||
use app\model\AdminFields;
|
use app\model\AdminFields;
|
||||||
use app\model\AdminGroup;
|
use app\model\AdminGroup;
|
||||||
@ -179,5 +178,4 @@ class Api extends Base {
|
|||||||
|
|
||||||
return $this->buildSuccess([], '登出成功');
|
return $this->buildSuccess([], '登出成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace app\wiki\controller;
|
namespace app\wiki\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\util\ReturnCode;
|
use app\util\ReturnCode;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
|
|
||||||
@ -39,5 +38,4 @@ class Base extends Controller {
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
|
|
||||||
Route::group('admin', function() {
|
Route::group('admin', function() {
|
||||||
Route::rule(
|
Route::rule(
|
||||||
'Login/index', 'admin/Login/index', 'post'
|
'Login/index', 'admin/Login/index', 'post'
|
||||||
@ -290,4 +289,3 @@ Route::group('admin', function() {
|
|||||||
//MISS路由定义
|
//MISS路由定义
|
||||||
Route::miss('admin/Miss/index');
|
Route::miss('admin/Miss/index');
|
||||||
})->middleware('AdminResponse');
|
})->middleware('AdminResponse');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user