mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
added 新增列表翻译类数据解析方式
This commit is contained in:
parent
f32ec2b869
commit
4391ca5910
@ -18,15 +18,19 @@ class ApiManager extends Base {
|
||||
'header' => [
|
||||
[
|
||||
'field' => 'name',
|
||||
'info' => '应用名称'
|
||||
'info' => '接口名称'
|
||||
],
|
||||
[
|
||||
'field' => 'info',
|
||||
'info' => '应用描述'
|
||||
'field' => 'version',
|
||||
'info' => '接口版本'
|
||||
],
|
||||
[
|
||||
'field' => 'map',
|
||||
'info' => '接口映射'
|
||||
],
|
||||
[
|
||||
'field' => 'type',
|
||||
'info' => '参与方式'
|
||||
'info' => '接口标识'
|
||||
],
|
||||
[
|
||||
'field' => 'status',
|
||||
|
@ -38,6 +38,11 @@ class Base extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义初始化函数
|
||||
*/
|
||||
public function _myInitialize(){}
|
||||
|
||||
/**
|
||||
* 空方法默认的页面
|
||||
*/
|
||||
|
@ -11,6 +11,20 @@ namespace app\admin\controller;
|
||||
use app\admin\model\Keys;
|
||||
|
||||
class KeyManager extends Base {
|
||||
|
||||
private $apps;
|
||||
private $filters;
|
||||
|
||||
public function _myInitialize() {
|
||||
$this->apps = cache(CacheType::APP_LIST_KEY);
|
||||
if( !$this->apps ){
|
||||
$this->error('请先配置应用!', url('AppManager/index'));
|
||||
}else{
|
||||
$this->apps = [0 => '不关联'] + $this->apps;
|
||||
}
|
||||
$this->filters = [-1 => '不限制'] + cache(CacheType::FILTER_LIST_KEY);
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$data = Keys::all();
|
||||
$table = [
|
||||
@ -101,13 +115,12 @@ class KeyManager extends Base {
|
||||
]
|
||||
],
|
||||
'filterId' => [
|
||||
'module' => 'label',
|
||||
'rule' => [
|
||||
-1 => [
|
||||
'info' => '无限制',
|
||||
'class' => 'label label-warning'
|
||||
]
|
||||
]
|
||||
'module' => 'listValue',
|
||||
'rule' => $this->filters
|
||||
],
|
||||
'appId' => [
|
||||
'module' => 'listValue',
|
||||
'rule' => $this->apps
|
||||
]
|
||||
],
|
||||
'data' => $data
|
||||
@ -126,12 +139,6 @@ class KeyManager extends Base {
|
||||
$this->success('操作成功!', url('KeyManager/index'));
|
||||
}
|
||||
}else{
|
||||
$apps = cache(CacheType::APP_LIST_KEY);
|
||||
if( !$apps ){
|
||||
$this->error('请先配置应用!', url('AppManager/index'));
|
||||
}
|
||||
$filters = cache(CacheType::FILTER_LIST_KEY);
|
||||
$filters[-1] = '不限制';
|
||||
$sk = \StrOrg::randString(64);
|
||||
$ak = \StrOrg::keyGen();
|
||||
$form = [
|
||||
@ -172,7 +179,7 @@ class KeyManager extends Base {
|
||||
'attr' => [
|
||||
'name' => 'appId',
|
||||
'value' => '',
|
||||
'options' => $apps
|
||||
'options' => $this->apps
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -182,7 +189,7 @@ class KeyManager extends Base {
|
||||
'attr' => [
|
||||
'name' => 'filterId',
|
||||
'value' => '',
|
||||
'options' => $filters
|
||||
'options' => $this->filters
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -219,12 +226,6 @@ class KeyManager extends Base {
|
||||
$keysModel->allowField(true)->update($data);
|
||||
$this->success('操作成功!', url('KeyManager/index'));
|
||||
}else{
|
||||
$apps = cache(CacheType::APP_LIST_KEY);
|
||||
if( !$apps ){
|
||||
$this->error('请先配置应用!', url('AppManager/index'));
|
||||
}
|
||||
$filters = cache(CacheType::FILTER_LIST_KEY);
|
||||
$filters[-1] = '不限制';
|
||||
$detail = Keys::get($this->request->get($this->primaryKey))->toArray();
|
||||
$form = [
|
||||
'formTitle' => $this->menuInfo['name'],
|
||||
@ -274,7 +275,7 @@ class KeyManager extends Base {
|
||||
'attr' => [
|
||||
'name' => 'appId',
|
||||
'value' => $detail['appId'],
|
||||
'options' => $apps
|
||||
'options' => $this->apps
|
||||
]
|
||||
],
|
||||
[
|
||||
@ -284,7 +285,7 @@ class KeyManager extends Base {
|
||||
'attr' => [
|
||||
'name' => 'filterId',
|
||||
'value' => $detail['filterId'],
|
||||
'options' => $filters
|
||||
'options' => $this->filters
|
||||
]
|
||||
],
|
||||
[
|
||||
|
@ -117,6 +117,15 @@
|
||||
dataListHtml += '<td><input class="auth" type="checkbox" url="'+ rule.rule['url'] +'" name="'+fieldName+'" ></td>';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'listValue':
|
||||
if( rule.rule[dataValue[fieldName]] ){
|
||||
styleList = rule.rule[dataValue[fieldName]];
|
||||
dataListHtml += '<td>'+ styleList +'</td>';
|
||||
}else{
|
||||
dataListHtml += '<td style="color:red;">' + dataValue[fieldName] + '</td>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
dataListHtml += '<td>' + dataValue[fieldName] + '</td>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user