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
ee1d5b74
authored
Jul 31, 2019
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
体验更改
parent
c34a5b04
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
30 deletions
.idea/workspace.xml
app/Http/Controllers/AccessApiController.php
app/Model/SpiderModel.php
public/js/spider/board.js
public/js/spider/boardconfig.js
resources/views/spider/board.blade.php
resources/views/spider/boardconfig.blade.php
.idea/workspace.xml
View file @
ee1d5b74
This diff is collapsed.
Click to expand it.
app/Http/Controllers/AccessApiController.php
View file @
ee1d5b74
...
...
@@ -59,8 +59,9 @@ class AccessApiController extends Controller
$limit
=
$request
[
'limit'
];
$p
=
$request
[
'p'
];
$task_code
=
!
empty
(
$request
[
'task_code'
])
?
$request
[
'task_code'
]
:
''
;
$data
=
(
new
SpiderModel
())
->
spiderList
(
$limit
,
$p
);
$data
=
(
new
SpiderModel
())
->
spiderList
(
$limit
,
$p
,
$task_code
);
$this
->
ExportLayui
(
0
,
'成功'
,
$data
[
'data'
],
$data
[
'total'
]);
}
...
...
app/Model/SpiderModel.php
View file @
ee1d5b74
...
...
@@ -20,12 +20,16 @@ class SpiderModel extends Model
* @param $p
* @return mixed
*/
public
function
spiderList
(
$limit
,
$p
)
{
public
function
spiderList
(
$limit
,
$p
,
$task_code
)
{
$limit
=
!
empty
(
$limit
)
?
$limit
:
''
;
$p
=
!
empty
(
$p
)
?
$p
:
1
;
$data
=
$this
->
where
(
'status'
,
'!='
,
2
)
->
paginate
(
$limit
,[
'*'
],
'p'
,
$p
)
->
toArray
();
$map
=
[];
if
(
!
empty
(
$task_code
))
$map
[]
=
[
'task_code'
,
'='
,
$task_code
];
$data
=
$this
->
where
(
'status'
,
'!='
,
2
)
->
where
(
$map
)
->
paginate
(
$limit
,[
'*'
],
'p'
,
$p
)
->
toArray
();
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$data
[
'data'
][
$k
][
'status_name'
]
=
platform_status
(
$v
[
'status'
]);
...
...
public/js/spider/board.js
View file @
ee1d5b74
...
...
@@ -6,28 +6,50 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
table
.
render
({
elem
:
'#table'
,
loading
:
true
,
cellMinWidth
:
1
5
0
,
cellMinWidth
:
1
0
0
,
page
:
true
,
limit
:
50
,
url
:
'/api/ApiSpiderList/'
,
request
:{
pageName
:
'p'
,
limitName
:
'limit'
},
cols
:
[[
{
field
:
'status'
,
title
:
'状态'
,
width
:
85
,
templet
:
'#switchTpl'
,
unresize
:
true
},
{
field
:
'
platform'
,
title
:
'平台名称'
},
{
field
:
'
task_code'
,
title
:
'任务码'
},
{
field
:
'
concurrency'
,
title
:
'并发数'
},
{
field
:
'queue'
,
title
:
'队列'
},
{
field
:
'
unique_code'
,
title
:
'唯一码'
},
{
field
:
'
start_time'
,
title
:
'开始时间'
,
width
:
200
},
{
field
:
'
run_time'
,
title
:
'运行时间'
,
width
:
200
},
{
field
:
'
task_type'
,
title
:
'任务类型'
},
{
field
:
'r
emain_task'
,
title
:
'剩余任务数'
},
{
field
:
'
remain_wrong_task'
,
title
:
'剩余异常任务数'
},
{
field
:
'
wrong_radio'
,
title
:
'错误率'
},
{
field
:
'
task_code'
,
title
:
'任务码'
,
sort
:
true
},
{
field
:
'
concurrency'
,
title
:
'并发数'
,
sort
:
true
},
{
field
:
'
platform'
,
title
:
'平台名称'
,
sort
:
true
},
{
field
:
'queue'
,
title
:
'队列'
,
width
:
250
,
sort
:
true
},
{
field
:
'
remain_task'
,
title
:
'剩余任务数'
,
width
:
140
,
sort
:
true
},
{
field
:
'
remain_wrong_task'
,
title
:
'剩余异常任务数'
,
width
:
140
,
sort
:
true
},
{
field
:
'
wrong_radio'
,
title
:
'错误率'
,
sort
:
true
},
{
field
:
'
start_time'
,
title
:
'开始时间'
,
width
:
200
,
sort
:
true
},
{
field
:
'r
un_time'
,
title
:
'运行时间'
,
width
:
200
,
sort
:
true
},
{
field
:
'
task_type'
,
title
:
'任务类型'
,
sort
:
true
},
{
field
:
'
unique_code'
,
title
:
'唯一码'
,
width
:
250
,
sort
:
true
},
{
fixed
:
'right'
,
title
:
''
,
align
:
'center'
,
toolbar
:
'#modify'
,
width
:
200
},
]],
id
:
'idTest'
});
var
$
=
layui
.
$
,
active
=
{
reload
:
function
(){
//执行重载
table
.
reload
(
'idTest'
,
{
page
:
{
curr
:
1
//重新从第 1 页开始
}
,
where
:
{
task_code
:
$
(
'#task_code'
).
val
(),
}
})
},
};
$
(
'.load'
).
on
(
'click'
,
function
(){
var
type
=
$
(
this
).
data
(
'type'
);
active
[
type
]
?
active
[
type
].
call
(
this
)
:
''
;
});
form
.
on
(
'switch(status)'
,
function
(){
var
data
=
{
id
:
$
(
this
).
attr
(
'data-id'
),
...
...
public/js/spider/boardconfig.js
View file @
ee1d5b74
...
...
@@ -18,10 +18,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
var
data
=
{
id
:
$
(
'#id'
).
val
(),
platform
:
$
(
"#platform"
).
val
(),
task_code
:
$
(
"#task_code"
).
val
(),
concurrency
:
$
(
"#concurrency"
).
val
(),
queue
:
$
(
"#queue"
).
val
(),
start_time
:
$
(
"#start_time"
).
val
(),
task_type
:
$
(
"#task_type"
).
val
(),
}
$
.
ajax
({
...
...
resources/views/spider/board.blade.php
View file @
ee1d5b74
<div
class=
"layui-form"
>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn layui-btn-fluid"
id=
"add"
lay-submit
lay-filter=
"add"
style=
"width: 216px"
>
添加配置
</button>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn layui-btn-fluid"
id=
"add"
lay-submit
lay-filter=
"add"
style=
"width: 216px"
>
添加配置
</button>
</div>
<div
class=
"layui-inline"
>
<input
type=
"hidden"
class=
"layui-input"
>
</div>
<div
class=
"layui-inline"
>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
id=
"task_code"
placeholder=
"请输入任务码"
autocomplete=
"off"
class=
"layui-input"
value=
"{{$_GET['name'] or ''}}"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"btn btn btn-outline btn-primary load"
id=
"search"
lay-submit
lay-filter=
"*"
data-type=
"reload"
>
搜索
</button>
</div>
</div>
<table
class=
"layui-table"
id=
"table"
lay-filter=
"demo"
>
</table>
...
...
resources/views/spider/boardconfig.blade.php
View file @
ee1d5b74
...
...
@@ -8,12 +8,6 @@
<input
type=
"text"
name=
"platform"
id=
"platform"
value=
"{{$detail['platform'] or ''}}"
lay-verify=
"required"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
任务码
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"task_code"
id=
"task_code"
value=
"{{$detail['task_code'] or ''}}"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
并发数
</label>
<div
class=
"layui-input-block"
>
...
...
@@ -27,12 +21,6 @@
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
><span
class=
"layui-badge-dot"
></span>
开始时间
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"start_time"
id=
"start_time"
autocomplete=
"off"
class=
"layui-input"
value=
"{{$detail['start_time'] or ''}}"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
任务类型
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"task_type"
id=
"task_type"
value=
"{{$detail['task_type'] or ''}}"
autocomplete=
"off"
class=
"layui-input"
>
...
...
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