Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lzzzzl
/
spiderboard
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ad9db969
authored
Aug 02, 2019
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改
parent
ee1d5b74
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
2 deletions
.idea/workspace.xml
app/Http/Controllers/AccessApiController.php
app/Http/Controllers/AccessController.php
app/Http/function.php
app/Model/SpiderModel.php
config/perm.php
public/js/spider/board.js
public/js/spider/boardquickmodify.js
resources/views/spider/board.blade.php
resources/views/spider/boardquickmodify.blade.php
.idea/workspace.xml
View file @
ad9db969
This diff is collapsed.
Click to expand it.
app/Http/Controllers/AccessApiController.php
View file @
ad9db969
...
...
@@ -126,4 +126,14 @@ class AccessApiController extends Controller
}
/**
* 更新所有面板状态
*/
private
function
ApiUpdateAllBoard
()
{
$data
=
(
new
SpiderModel
())
->
updateAllBoard
();
$this
->
Export
(
$data
);
}
}
app/Http/Controllers/AccessController.php
View file @
ad9db969
...
...
@@ -345,4 +345,16 @@ class AccessController extends Controller
return
view
(
'spiderwindow'
,
$data
);
}
/**
* 列表页快速修改
* @param $request
* @param $data
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
boardQuickModify
(
$request
,
$data
,
$id
)
{
$data
[
'title'
]
=
'快速修改'
;
return
view
(
'spiderwindow'
,
$data
);
}
}
app/Http/function.php
View file @
ad9db969
...
...
@@ -201,3 +201,14 @@ function export_csv($data = [], $header_data = [], $file_name = '')
fclose
(
$fp
);
exit
;
}
function
time2string
(
$second
){
$day
=
floor
(
$second
/
(
3600
*
24
));
$second
=
$second
%
(
3600
*
24
);
$hour
=
floor
(
$second
/
3600
);
$second
=
$second
%
3600
;
$minute
=
floor
(
$second
/
60
);
$second
=
$second
%
60
;
// 不用管怎么实现的,能用就ok
return
$day
.
'天'
.
$hour
.
'小时'
.
$minute
.
'分'
.
$second
.
'秒'
;
}
app/Model/SpiderModel.php
View file @
ad9db969
...
...
@@ -34,7 +34,7 @@ class SpiderModel extends Model
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$data
[
'data'
][
$k
][
'status_name'
]
=
platform_status
(
$v
[
'status'
]);
$data
[
'data'
][
$k
][
'start_time'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'start_time'
]);
$data
[
'data'
][
$k
][
'run_time'
]
.=
'秒'
;
$data
[
'data'
][
$k
][
'run_time'
]
=
time2string
(
$v
[
'run_time'
])
;
}
return
$data
;
...
...
@@ -201,4 +201,24 @@ class SpiderModel extends Model
}
/**
* 更新所有面板状态
* @return array
*/
public
function
updateAllBoard
()
{
$collect
=
Request
::
all
();
$collect
=
TrimX
(
$collect
,
false
,
[
'status'
]);
unset
(
$collect
[
's'
]);
$result
=
DB
::
connection
(
'dashboard'
)
->
table
(
'spider_board'
)
->
where
(
'status'
,
'!='
,
'2'
)
->
update
(
$collect
);
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
}
config/perm.php
View file @
ad9db969
...
...
@@ -6,7 +6,7 @@ return [
'NotAuth'
),
//api不用验证方法
'ApiNotAuth'
=>
array
(
'ApiSpiderList'
,
'ApiUpdateStatus'
,
'ApiConfigContent'
,
'ApiAddConfig'
,
'ApiUpdateNode'
,
'ApiUpdateAllNode'
'ApiNotAuth'
=>
array
(
'ApiSpiderList'
,
'ApiUpdateStatus'
,
'ApiConfigContent'
,
'ApiAddConfig'
,
'ApiUpdateNode'
,
'ApiUpdateAllNode'
,
'ApiUpdateAllBoard'
),
'MenuSign'
=>
'/web/'
,
//菜单去除掉标记,生成菜单时用
...
...
public/js/spider/board.js
View file @
ad9db969
...
...
@@ -141,3 +141,18 @@ $('#add').click(function () {
});
});
});
$
(
'#quick_modify'
).
click
(
function
()
{
layui
.
use
(
'layer'
,
function
()
{
var
layer
=
layui
.
layer
;
layer
.
open
({
type
:
2
,
area
:
[
'250px'
,
'250px'
],
offset
:
'100px'
,
fixed
:
false
,
maxmin
:
true
,
content
:
'/web/boardquickmodify'
,
title
:
'快速修改'
,
});
});
});
public/js/spider/boardquickmodify.js
0 → 100644
View file @
ad9db969
var
status
=
1
;
layui
.
use
([
'table'
,
'form'
,
'laydate'
,
'layer'
],
function
()
{
var
form
=
layui
.
form
;
form
.
on
(
'switch(status)'
,
function
(){
status
=
this
.
checked
?
0
:
1
});
})
$
(
'#submit'
).
click
(
function
()
{
$
.
ajax
({
url
:
'/api/ApiUpdateAllBoard'
,
type
:
'get'
,
dataType
:
'json'
,
data
:
{
'status'
:
status
},
success
:
function
()
{
layer
.
msg
(
'修改成功'
);
window
.
parent
.
location
.
reload
();
parent
.
layer
.
closeAll
();
},
error
:
function
()
{
layer
.
msg
(
'修改失败'
);
}
});
});
resources/views/spider/board.blade.php
View file @
ad9db969
...
...
@@ -4,6 +4,9 @@
<button
class=
"layui-btn layui-btn-fluid"
id=
"add"
lay-submit
lay-filter=
"add"
style=
"width: 216px"
>
添加配置
</button>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn layui-btn-normal"
id=
"quick_modify"
lay-submit
lay-filter=
"quick_modify"
style=
"width: 216px;"
>
一键更改
</button>
</div>
<div
class=
"layui-inline"
>
<input
type=
"hidden"
class=
"layui-input"
>
</div>
<div
class=
"layui-inline"
>
...
...
resources/views/spider/boardquickmodify.blade.php
0 → 100644
View file @
ad9db969
<div
class=
"layui-form"
>
<div
class=
"layui-input-block"
>
<input
type=
"checkbox"
name=
"check"
value=
""
lay-skin=
"switch"
lay-text=
"启动|停止"
lay-filter=
"status"
>
</div>
<br>
<br>
<br>
<div
class=
"layui-input-block"
>
<button
id=
"submit"
class=
"layui-btn"
>
确认
</button>
</div>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment