切换导航条
此项目
正在载入...
登录
何书鹏
/
salarycalculator
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
4 years ago
提交
46bd26318675314ca7447cae16635af152744ce9
1 个父辈
4493a69b
新增API基类Token验证
优化后台选项卡判断
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
21 行增加
和
4 行删除
application/admin/command/Crud/stubs/html/heading-html.stub
application/common/controller/Api.php
application/common/controller/Backend.php
application/common/controller/Frontend.php
application/admin/command/Crud/stubs/html/heading-html.stub
查看文件 @
46bd263
...
...
@@ -2,9 +2,9 @@
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="{%field%}">
<li class="{:
input('get.{%field%}') ? '' : 'active
'}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
<li class="{:
$Think.get.{%field%} === null ? 'active' : '
'}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="{%fieldName%}List" item="vo"}
<li class="{:
input('get.{%field%}') ==
$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
<li class="{:
$Think.get.{%field%} === (string)
$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
...
...
application/common/controller/Api.php
查看文件 @
46bd263
...
...
@@ -12,6 +12,7 @@ use think\Loader;
use
think\Request
;
use
think\Response
;
use
think\Route
;
use
think\Validate
;
/**
* API控制器基类
...
...
@@ -304,4 +305,20 @@ class Api
return
true
;
}
/**
* 刷新Token
*/
protected
function
token
()
{
$token
=
$this
->
request
->
param
(
'__token__'
);
//验证Token
if
(
!
Validate
::
make
()
->
check
([
'__token__'
=>
$token
],
[
'__token__'
=>
'require|token'
]))
{
$this
->
error
(
__
(
'Token verification error'
),
[
'__token__'
=>
$this
->
request
->
token
()]);
}
//刷新Token
$this
->
request
->
token
();
}
}
...
...
application/common/controller/Backend.php
查看文件 @
46bd263
...
...
@@ -531,7 +531,7 @@ class Backend extends Controller
*/
protected
function
token
()
{
$token
=
$this
->
request
->
p
ost
(
'__token__'
);
$token
=
$this
->
request
->
p
aram
(
'__token__'
);
//验证Token
if
(
!
Validate
::
make
()
->
check
([
'__token__'
=>
$token
],
[
'__token__'
=>
'require|token'
]))
{
...
...
application/common/controller/Frontend.php
查看文件 @
46bd263
...
...
@@ -142,7 +142,7 @@ class Frontend extends Controller
*/
protected
function
token
()
{
$token
=
$this
->
request
->
p
ost
(
'__token__'
);
$token
=
$this
->
request
->
p
aram
(
'__token__'
);
//验证Token
if
(
!
Validate
::
make
()
->
check
([
'__token__'
=>
$token
],
[
'__token__'
=>
'require|token'
]))
{
...
...
请
注册
或
登录
后发表评论