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
7b38f176
authored
Aug 05, 2019
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增
parent
ad9db969
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
191 deletions
.idea/workspace.xml
app/Http/Controllers/AccessController.php
app/Model/DataManageModel.php
app/Model/SpiderModel.php
public/js/spider/addboard.js
resources/views/spider/addboard.blade.php
.idea/workspace.xml
View file @
7b38f176
This diff is collapsed.
Click to expand it.
app/Http/Controllers/AccessController.php
View file @
7b38f176
...
@@ -303,6 +303,7 @@ class AccessController extends Controller
...
@@ -303,6 +303,7 @@ class AccessController extends Controller
*/
*/
public
function
addBoard
(
$request
,
$data
,
$id
)
{
public
function
addBoard
(
$request
,
$data
,
$id
)
{
$data
[
'title'
]
=
'添加'
;
$data
[
'title'
]
=
'添加'
;
$data
[
'time'
]
=
date
(
"Y-m-d H:i:s"
);
return
view
(
'spiderwindow'
,
$data
);
return
view
(
'spiderwindow'
,
$data
);
}
}
...
...
app/Model/DataManageModel.php
deleted
100644 → 0
View file @
ad9db969
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Config
;
use
DB
;
use
RedisDB
;
class
DataManageModel
extends
Model
{
protected
$connection
=
'dashboard'
;
protected
$table
=
'data_manage'
;
public
$timestamps
=
false
;
/**
* 数据列表
* @param $limit
* @param $p
* @return mixed
*/
public
function
dataList
(
$limit
,
$p
)
{
$limit
=
!
empty
(
$limit
)
?
$limit
:
''
;
$p
=
!
empty
(
$p
)
?
$p
:
1
;
$data
=
$this
->
paginate
(
$limit
,[
'*'
],
'p'
,
$p
)
->
toArray
();
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$data
[
'data'
][
$k
][
'platform_type'
]
=
platform_type
(
$v
[
'platform_type'
]);
$data
[
'data'
][
$k
][
'status_name'
]
=
platform_status
(
$v
[
'status'
]);
$data
[
'data'
][
$k
][
'frequency'
]
=
timestamp_to_hour
(
$v
[
'frequency'
]);
$data
[
'data'
][
$k
][
'start_time'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'start_time'
]);
$data
[
'data'
][
$k
][
'end_time'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'end_time'
]);
}
return
$data
;
}
public
function
dataSingle
(
$id
)
{
$arr
=
[];
$data
=
$this
->
where
(
'id'
,
'='
,
$id
)
->
get
();
foreach
(
$data
as
$k
=>
$v
)
{
$arr
[
'platform_name'
]
=
$v
[
'platform_name'
];
$arr
[
'platform_cn_name'
]
=
$v
[
'platform_cn_name'
];
$arr
[
'key'
]
=
$v
[
'key'
];
$arr
[
'frequency'
]
=
$v
[
'frequency'
];
$arr
[
'start_time'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'start_time'
]);
$arr
[
'end_time'
]
=
date
(
"Y-m-d H:i:s"
,
$v
[
'end_time'
]);
$arr
[
'condition'
]
=
$v
[
'condition'
];
$arr
[
'condition_desc'
]
=
$v
[
'condition_desc'
];
$arr
[
'canal'
]
=
$v
[
'canal'
];
$arr
[
'hk_delivery_time'
]
=
$v
[
'hk_delivery_time'
];
$arr
[
'cn_delivery_time'
]
=
$v
[
'cn_delivery_time'
];
$arr
[
'rmb_ratio'
]
=
$v
[
'rmb_ratio'
];
$arr
[
'usd_ratio'
]
=
$v
[
'usd_ratio'
];
$arr
[
'file_addr'
]
=
$v
[
'file_addr'
];
$arr
[
'file_name'
]
=
$v
[
'file_name'
];
$arr
[
'id'
]
=
$v
[
'id'
];
}
return
$arr
;
}
public
function
updateOnOff
()
{
$collect
=
Request
::
all
();
$map
[
'id'
]
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
''
;
$collect
=
TrimX
(
$collect
,
false
,
[
'on_off'
]);
$result
=
$this
->
where
(
$map
)
->
update
(
$collect
);
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
public
function
updateManualPush
()
{
$collect
=
Request
::
all
();
$map
[
'id'
]
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
''
;
$collect
=
TrimX
(
$collect
,
false
,
[
'manual_push'
]);
$result
=
$this
->
where
(
$map
)
->
update
(
$collect
);
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
public
function
updateContent
()
{
$collect
=
Request
::
all
();
$map
[
'id'
]
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
''
;
$collect
[
'start_time'
]
=
strtotime
(
$collect
[
'start_time'
]);
$collect
[
'end_time'
]
=
strtotime
(
$collect
[
'end_time'
]);
$collect
=
TrimX
(
$collect
,
false
,
[
'platform_name'
,
'platform_cn_name'
,
'key'
,
'frequency'
,
'start_time'
,
'end_time'
,
'condition'
,
'condition_desc'
,
'canal'
,
'hk_delivery_time'
,
'cn_delivery_time'
,
'rmb_ratio'
,
'usd_ratio'
]);
unset
(
$collect
[
's'
]);
$result
=
$this
->
where
(
$map
)
->
update
(
$collect
);
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
public
function
insertContent
()
{
$collect
=
Request
::
all
();
$collect
[
'start_time'
]
=
strtotime
(
$collect
[
'start_time'
]);
$collect
[
'status'
]
=
1
;
unset
(
$collect
[
's'
]);
return
$this
->
insert
(
$collect
);
}
public
function
updateExcelContent
()
{
$collect
=
Request
::
all
();
$id
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
0
;
$collect
=
TrimX
(
$collect
,
false
,
[
'file_addr'
,
'file_name'
]);
unset
(
$collect
[
's'
]);
$result
=
DB
::
connection
(
'dashboard'
)
->
table
(
'data_manage_file'
)
->
insert
(
array
(
'manage_id'
=>
$id
,
'file_addr'
=>
$collect
[
'file_addr'
],
'file_name'
=>
$collect
[
'file_name'
]));
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
public
function
fileList
()
{
$collect
=
Request
::
all
();
$id
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
0
;
$result
=
DB
::
connection
(
'dashboard'
)
->
table
(
'data_manage_file'
)
->
where
(
'manage_id'
,
'='
,
$id
)
->
get
();
return
[
'data'
=>
$result
,
'total'
=>
sizeof
(
$result
)];
}
public
function
deleteFile
()
{
$collect
=
Request
::
all
();
$id
=
!
empty
(
$collect
[
'id'
])
?
$collect
[
'id'
]
:
0
;
$result
=
DB
::
connection
(
'dashboard'
)
->
table
(
'data_manage_file'
)
->
where
(
'id'
,
'='
,
$id
)
->
delete
();
if
(
$result
)
{
return
[
0
,
'成功'
];
}
else
{
return
[
1
,
'失败'
];
}
}
}
app/Model/SpiderModel.php
View file @
7b38f176
...
@@ -29,7 +29,10 @@ class SpiderModel extends Model
...
@@ -29,7 +29,10 @@ class SpiderModel extends Model
if
(
!
empty
(
$task_code
))
if
(
!
empty
(
$task_code
))
$map
[]
=
[
'task_code'
,
'='
,
$task_code
];
$map
[]
=
[
'task_code'
,
'='
,
$task_code
];
$data
=
$this
->
where
(
'status'
,
'!='
,
2
)
->
where
(
$map
)
->
paginate
(
$limit
,[
'*'
],
'p'
,
$p
)
->
toArray
();
$map
[]
=
[
'status'
,
'!='
,
2
];
$map
[]
=
[
'status'
,
'!='
,
3
];
$data
=
$this
->
where
(
$map
)
->
paginate
(
$limit
,[
'*'
],
'p'
,
$p
)
->
toArray
();
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$data
[
'data'
][
$k
][
'status_name'
]
=
platform_status
(
$v
[
'status'
]);
$data
[
'data'
][
$k
][
'status_name'
]
=
platform_status
(
$v
[
'status'
]);
...
@@ -67,7 +70,6 @@ class SpiderModel extends Model
...
@@ -67,7 +70,6 @@ class SpiderModel extends Model
$collect
=
Request
::
all
();
$collect
=
Request
::
all
();
$collect
[
'start_time'
]
=
strtotime
(
$collect
[
'start_time'
]);
$collect
[
'start_time'
]
=
strtotime
(
$collect
[
'start_time'
]);
$collect
[
'status'
]
=
0
;
unset
(
$collect
[
's'
]);
unset
(
$collect
[
's'
]);
return
$this
->
insert
(
$collect
);
return
$this
->
insert
(
$collect
);
...
...
public/js/spider/addboard.js
View file @
7b38f176
var
on_off
=
1
;
layui
.
use
([
'table'
,
'form'
,
'laydate'
,
'layer'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'laydate'
,
'layer'
],
function
()
{
var
laydate
=
layui
.
laydate
;
var
laydate
=
layui
.
laydate
;
...
@@ -10,19 +8,16 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
...
@@ -10,19 +8,16 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
type
:
'datetime'
type
:
'datetime'
});
});
form
.
on
(
'switch(on_off)'
,
function
(){
on_off
=
this
.
checked
?
1
:
2
;
});
form
.
on
(
'submit(submit)'
,
function
(){
form
.
on
(
'submit(submit)'
,
function
(){
var
data
=
{
var
data
=
{
on_off
:
on_off
,
status
:
3
,
platform
:
$
(
"#platform"
).
val
(),
platform
:
$
(
"#platform"
).
val
(),
task_code
:
$
(
"#task_code"
).
val
(),
task_code
:
$
(
"#task_code"
).
val
(),
concurrency
:
$
(
"#concurrency"
).
val
(),
concurrency
:
$
(
"#concurrency"
).
val
(),
queue
:
$
(
"#queue"
).
val
(),
queue
:
$
(
"#queue"
).
val
(),
start_time
:
$
(
"#start_time"
).
val
(),
start_time
:
$
(
"#start_time"
).
val
(),
task_type
:
$
(
"#task_type"
).
val
(),
task_type
:
$
(
"#task_type"
).
val
(),
unique_code
:
Math
.
round
(
new
Date
()
/
1000
)
+
$
(
"#task_code"
).
val
()
+
$
(
"#concurrency"
).
val
(),
}
}
$
.
ajax
({
$
.
ajax
({
url
:
'/api/ApiAddConfig'
,
url
:
'/api/ApiAddConfig'
,
...
...
resources/views/spider/addboard.blade.php
View file @
7b38f176
<form
action=
""
method=
"post"
class=
"layui-form"
style=
"margin:30px 50px 20px 0"
>
<form
action=
""
method=
"post"
class=
"layui-form"
style=
"margin:30px 50px 20px 0"
>
<div
class=
"layui-form-item"
>
{{--
<div
class=
"layui-form-item"
>
--}}
<label
class=
"layui-form-label"
>
状态
</label>
{{--
<label
class=
"layui-form-label"
>
状态
</label>
--}}
<div
class=
"layui-input-block"
>
{{--
<div
class=
"layui-input-block"
>
--}}
<input
type=
"checkbox"
name=
"check"
value=
""
lay-skin=
"switch"
lay-text=
"启动|停止"
lay-filter=
"on_off"
checked
>
{{--
<input
type=
"checkbox"
name=
"check"
value=
""
lay-skin=
"switch"
lay-text=
"启动|停止"
lay-filter=
"on_off"
checked
>
--}}
</div>
{{--
</div>
--}}
</div>
{{--
</div>
--}}
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"layui-badge-dot"
></span>
平台名称
</label>
<label
class=
"layui-form-label"
><span
class=
"layui-badge-dot"
></span>
平台名称
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
...
@@ -13,27 +13,27 @@
...
@@ -13,27 +13,27 @@
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
任务码
</label>
<label
class=
"layui-form-label"
>
<span
class=
"layui-badge-dot"
></span>
任务码
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<input
type=
"text"
id=
"task_code"
style=
"width: 250px"
class=
"layui-input"
>
<input
type=
"text"
id=
"task_code"
lay-verify=
"required"
style=
"width: 250px"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
并发数
</label>
<label
class=
"layui-form-label"
>
<span
class=
"layui-badge-dot"
></span>
并发数
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<input
type=
"number"
name=
"concurrency"
id=
"concurrency"
style=
"width: 250px"
class=
"layui-input"
>
<input
type=
"number"
name=
"concurrency"
lay-verify=
"required"
id=
"concurrency"
style=
"width: 250px"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
队列
</label>
<label
class=
"layui-form-label"
>
<span
class=
"layui-badge-dot"
></span>
队列
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"queue"
id=
"queue"
style=
"width: 250px"
class=
"layui-input"
>
<input
type=
"text"
name=
"queue"
id=
"queue"
lay-verify=
"required"
style=
"width: 250px"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
><span
class=
"layui-badge-dot"
></span>
开始时间
</label>
<label
class=
"layui-form-label"
><span
class=
"layui-badge-dot"
></span>
开始时间
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"start_time"
id=
"start_time"
style=
"width: 250px"
lay-verify=
"required"
class=
"layui-input"
>
<input
type=
"text"
name=
"start_time"
value=
"{{$time}}"
id=
"start_time"
style=
"width: 250px"
lay-verify=
"required"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<div
class=
"layui-form-item layui-form-text"
>
...
...
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