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
c34a5b04
authored
Jul 29, 2019
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
init
parent
16217c69
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
17 deletions
.idea/workspace.xml
app/Http/Controllers/AccessApiController.php
app/Model/SpiderModel.php
config/perm.php
public/js/spider/board.js
resources/views/spider/board.blade.php
.idea/workspace.xml
View file @
c34a5b04
This diff is collapsed.
Click to expand it.
app/Http/Controllers/AccessApiController.php
View file @
c34a5b04
...
...
@@ -68,9 +68,9 @@ class AccessApiController extends Controller
/**
* 更新开始结束状态
*/
private
function
ApiUpdate
OnOff
()
{
private
function
ApiUpdate
Status
()
{
$data
=
(
new
SpiderModel
())
->
update
OnOff
();
$data
=
(
new
SpiderModel
())
->
update
Status
();
$this
->
Export
(
$data
);
}
...
...
app/Model/SpiderModel.php
View file @
c34a5b04
...
...
@@ -30,7 +30,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'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'run_time'
])
;
$data
[
'data'
][
$k
][
'run_time'
]
.=
'秒'
;
}
return
$data
;
...
...
@@ -41,11 +41,11 @@ class SpiderModel extends Model
* 更新状态
* @return array
*/
public
function
update
OnOff
()
{
public
function
update
Status
()
{
$collect
=
Request
::
all
();
$map
[
'id'
]
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
''
;
$collect
=
TrimX
(
$collect
,
false
,
[
'
on_off
'
]);
$collect
=
TrimX
(
$collect
,
false
,
[
'
status
'
]);
$result
=
$this
->
where
(
$map
)
->
update
(
$collect
);
if
(
$result
)
{
return
[
0
,
'成功'
];
...
...
config/perm.php
View file @
c34a5b04
...
...
@@ -6,7 +6,7 @@ return [
'NotAuth'
),
//api不用验证方法
'ApiNotAuth'
=>
array
(
'Api
AddConfig'
,
'ApiConfigContent'
,
'ApiUpdateManualPush'
,
'ApiUpdateOnOff'
,
'ApiManageList'
,
'ApiUpdateExcel'
,
'ApiFileList'
,
'ApiDeleteFil
e'
'ApiNotAuth'
=>
array
(
'Api
SpiderList'
,
'ApiUpdateStatus'
,
'ApiConfigContent'
,
'ApiAddConfig'
,
'ApiUpdateNode'
,
'ApiUpdateAllNod
e'
),
'MenuSign'
=>
'/web/'
,
//菜单去除掉标记,生成菜单时用
...
...
public/js/spider/board.js
View file @
c34a5b04
...
...
@@ -11,11 +11,10 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
url
:
'/api/ApiSpiderList/'
,
request
:{
pageName
:
'p'
,
limitName
:
'limit'
},
cols
:
[[
{
field
:
'
on_off
'
,
title
:
'状态'
,
width
:
85
,
templet
:
'#switchTpl'
,
unresize
:
true
},
{
field
:
'
status
'
,
title
:
'状态'
,
width
:
85
,
templet
:
'#switchTpl'
,
unresize
:
true
},
{
field
:
'platform'
,
title
:
'平台名称'
},
{
field
:
'task_code'
,
title
:
'任务码'
},
{
field
:
'concurrency'
,
title
:
'并发数'
},
{
field
:
'status'
,
title
:
'任务状态'
,
templet
:
'#status'
},
{
field
:
'queue'
,
title
:
'队列'
},
{
field
:
'unique_code'
,
title
:
'唯一码'
},
{
field
:
'start_time'
,
title
:
'开始时间'
,
width
:
200
},
...
...
@@ -29,13 +28,13 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
id
:
'idTest'
});
form
.
on
(
'switch(
on_off
)'
,
function
(){
form
.
on
(
'switch(
status
)'
,
function
(){
var
data
=
{
id
:
$
(
this
).
attr
(
'data-id'
),
on_off
:
this
.
checked
?
1
:
2
}
status
:
this
.
checked
?
0
:
1
}
;
$
.
ajax
({
url
:
'/api/ApiUpdate
OnOff
'
,
url
:
'/api/ApiUpdate
Status
'
,
type
:
'get'
,
dataType
:
'json'
,
data
:
data
,
...
...
resources/views/spider/board.blade.php
View file @
c34a5b04
...
...
@@ -7,7 +7,7 @@
</div>
<script
type=
"text/html"
id=
"switchTpl"
>
<
input
type
=
"checkbox"
name
=
"check"
value
=
""
lay
-
skin
=
"switch"
lay
-
text
=
"启动|停止"
lay
-
filter
=
"
on_off"
data
-
id
=
"@{{d.id}}"
@{{
d
.
on_off
==
1
?
'checked'
:
''
}}
>
<
input
type
=
"checkbox"
name
=
"check"
value
=
""
lay
-
skin
=
"switch"
lay
-
text
=
"启动|停止"
lay
-
filter
=
"
status"
data
-
id
=
"@{{d.id}}"
@{{
d
.
status
==
0
?
'checked'
:
''
}}
>
</script>
<script
type=
"text/html"
id=
"status"
>
...
...
@@ -16,10 +16,7 @@
<
/a
>
</script>
<script
type=
"text/html"
id=
"manual_push"
>
<
input
type
=
"checkbox"
name
=
"check"
lay
-
skin
=
"switch"
lay
-
text
=
"ON|OFF"
lay
-
filter
=
"manual_push"
data
-
id
=
"@{{d.id}}"
@{{
d
.
manual_push
==
1
?
'checked'
:
''
}}
>
</script>
<script
type=
"text/html"
id=
"modify"
>
<
a
class
=
"btn btn-xs btn-outline btn-primary"
lay
-
event
=
"detail"
>
编辑
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-primary"
lay
-
event
=
"stop"
>
停止任务
<
/a
>
</script>
\ 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