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
6fb17b90
authored
Mar 12, 2020
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增过期sku
parent
f14fd450
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
402 additions
and
1 deletions
app/Http/Controllers/AccessApiController.php
app/Http/Controllers/AccessController.php
app/Model/SpiderModel.php
config/perm.php
public/js/spider/expiredsku.js
resources/views/spider/expiredsku.blade.php
app/Http/Controllers/AccessApiController.php
View file @
6fb17b90
...
@@ -169,4 +169,14 @@ class AccessApiController extends Controller
...
@@ -169,4 +169,14 @@ class AccessApiController extends Controller
}
}
private
function
ApiExpireSku
(
$request
)
{
$start_time
=
empty
(
$request
[
'start_time'
])
?
strtotime
(
"-1 day"
)
:
strtotime
(
$request
[
'start_time'
]);
$end_time
=
empty
(
$request
[
'end_time'
])
?
strtotime
(
"0 day"
)
:
strtotime
(
$request
[
'end_time'
]);
$data
=
(
new
SpiderModel
())
->
expiredSku
(
$start_time
,
$end_time
);
$this
->
ExportLayui
(
0
,
'成功'
,
$data
,
sizeof
(
$data
));
}
}
}
app/Http/Controllers/AccessController.php
View file @
6fb17b90
...
@@ -382,4 +382,16 @@ class AccessController extends Controller
...
@@ -382,4 +382,16 @@ class AccessController extends Controller
return
view
(
'spider_card'
,
$data
);
return
view
(
'spider_card'
,
$data
);
}
}
/**
* 过期SKU
* @param $request
* @param $data
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
expiredSku
(
$request
,
$data
,
$id
)
{
$data
[
'title'
]
=
'过期SKU'
;
return
view
(
'spider_card'
,
$data
);
}
}
}
app/Model/SpiderModel.php
View file @
6fb17b90
...
@@ -312,6 +312,26 @@ class SpiderModel extends Model
...
@@ -312,6 +312,26 @@ class SpiderModel extends Model
}
}
public
function
expiredSku
(
$start_time
,
$end_time
)
{
$map
=
[];
$map
[]
=
[
'time_stamp'
,
'<='
,
$end_time
];
$map
[]
=
[
'time_stamp'
,
'>='
,
$start_time
];
$data
=
DB
::
connection
(
'dashboard'
)
->
table
(
'spider_expired_rate'
)
->
where
(
$map
)
->
get
();
$arr
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$time
=
date
(
"Y-m-d H:i:s"
,
$v
[
'time_stamp'
]);
if
(
!
array_key_exists
(
$time
,
$arr
))
$arr
[
$time
]
=
[];
array_push
(
$arr
[
$time
],
[
$v
[
'platform'
]
=>
$v
[
'expired_rate'
]]);
}
return
$arr
;
}
/**
/**
* 补充人员数据
* 补充人员数据
*/
*/
...
...
config/perm.php
View file @
6fb17b90
...
@@ -6,7 +6,8 @@ return [
...
@@ -6,7 +6,8 @@ return [
'NotAuth'
'NotAuth'
),
),
//api不用验证方法
//api不用验证方法
'ApiNotAuth'
=>
array
(
'ApiSpiderList'
,
'ApiUpdateStatus'
,
'ApiConfigContent'
,
'ApiAddConfig'
,
'ApiUpdateNode'
,
'ApiUpdateAllNode'
,
'ApiUpdateAllBoard'
,
'ApiLogsList'
,
'ApiEffectSku'
'ApiNotAuth'
=>
array
(
'ApiSpiderList'
,
'ApiUpdateStatus'
,
'ApiConfigContent'
,
'ApiAddConfig'
,
'ApiUpdateNode'
,
'ApiUpdateAllNode'
,
'ApiUpdateAllBoard'
,
'ApiLogsList'
,
'ApiEffectSku'
,
'ApiExpireSku'
),
),
'MenuSign'
=>
'/web/'
,
//菜单去除掉标记,生成菜单时用
'MenuSign'
=>
'/web/'
,
//菜单去除掉标记,生成菜单时用
...
...
public/js/spider/expiredsku.js
0 → 100644
View file @
6fb17b90
layui
.
use
([
'table'
,
'form'
,
'laydate'
,
'layer'
],
function
()
{
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
//日期范围
laydate
.
render
({
elem
:
'#start_time'
,
type
:
'date'
,
format
:
'yyyy-MM-dd'
});
laydate
.
render
({
elem
:
'#end_time'
,
type
:
'date'
,
format
:
'yyyy-MM-dd'
});
});
$
(
'#search'
).
click
(
function
()
{
var
start_time
=
$
(
'#start_time'
).
val
();
var
end_time
=
$
(
'#end_time'
).
val
();
if
(
start_time
!=
''
&&
end_time
!=
''
)
{
ExpireSku
(
start_time
,
end_time
);
}
else
{
layer
.
msg
(
'请选择时间'
);
}
})
ExpireSku
(
''
,
''
);
function
ExpireSku
(
start_time
,
end_time
)
{
$
.
ajax
({
url
:
'/api/ApiExpireSku'
,
type
:
'get'
,
dataType
:
'json'
,
data
:
{
'start_time'
:
start_time
,
'end_time'
:
end_time
},
success
:
function
(
data
)
{
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'page'
));
var
time
=
[];
var
alliedelec
=
[];
var
arrow
=
[];
var
avnet
=
[];
var
digikey
=
[];
var
powell
=
[];
var
microchip
=
[];
var
aipco
=
[];
var
mouser
=
[];
var
element14
=
[];
var
chip1stop
=
[];
var
future
=
[];
var
js_data
=
data
[
'data'
];
for
(
var
key
in
js_data
)
{
time
.
push
(
key
);
sup_data
=
js_data
[
key
]
for
(
var
i
in
sup_data
)
{
alliedelec
.
push
(
sup_data
[
i
][
'alliedelec'
]);
arrow
.
push
(
sup_data
[
i
][
'arrow'
]);
avnet
.
push
(
sup_data
[
i
][
'avnet'
]);
digikey
.
push
(
sup_data
[
i
][
'digikey'
]);
powell
.
push
(
sup_data
[
i
][
'powell'
]);
microchip
.
push
(
sup_data
[
i
][
'microchip'
]);
aipco
.
push
(
sup_data
[
i
][
'aipco'
]);
mouser
.
push
(
sup_data
[
i
][
'mouser'
]);
element14
.
push
(
sup_data
[
i
][
'element14'
]);
chip1stop
.
push
(
sup_data
[
i
][
'chip1stop'
]);
future
.
push
(
sup_data
[
i
][
'future'
]);
}
}
var
option
=
{
title
:
{
text
:
''
,
left
:
'50%'
,
top
:
'1%'
,
textAlign
:
'center'
},
tooltip
:
{
trigger
:
'axis'
},
toolbox
:
{
feature
:
{
saveAsImage
:
{
show
:
true
}
}
},
legend
:
{
data
:[
'alliedelec'
,
'arrow'
,
'avnet'
,
'digikey'
,
'powell'
,
'microchip'
,
'aipco'
,
'mouser'
,
'element14'
,
'chip1stop'
,
'future'
]
},
grid
:
{
containLabel
:
true
},
xAxis
:
[{
type
:
'category'
,
axisTick
:
{
alignWithLabel
:
true
},
data
:
time
}],
yAxis
:
[{
}],
series
:
[
{
name
:
'alliedelec'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
alliedelec
},
{
name
:
'arrow'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
arrow
},
{
name
:
'avnet'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
avnet
},
{
name
:
'digikey'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
digikey
},
{
name
:
'powell'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
powell
},
{
name
:
'microchip'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
microchip
},
{
name
:
'aipco'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
aipco
},
{
name
:
'mouser'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
mouser
},
{
name
:
'element14'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
element14
},
{
name
:
'chip1stop'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
chip1stop
},
{
name
:
'future'
,
type
:
'line'
,
label
:
{
normal
:
{
show
:
true
,
position
:
'top'
,
}
},
lineStyle
:
{
normal
:
{
width
:
3
,
shadowColor
:
'rgba(0,0,0,0.4)'
,
shadowBlur
:
10
,
shadowOffsetY
:
10
}
},
data
:
future
},
]
};
myChart
.
setOption
(
option
,
true
);
},
error
:
function
()
{
}
});
}
resources/views/spider/expiredsku.blade.php
0 → 100644
View file @
6fb17b90
<div
style=
"padding: 20px; background-color: #F2F2F2;"
>
<div
class=
"layui-row layui-col-space10"
>
<div
class=
"layui-col-md12"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<div
class=
"layui-input-inline"
>
<label
class=
"layui-form-label"
>
时间筛选:
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"start_time"
id=
"start_time"
autocomplete=
"off"
class=
"layui-input"
value=
"{{$_GET['start_time'] or ''}}"
>
</div>
-
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"end_time"
id=
"end_time"
autocomplete=
"off"
class=
"layui-input"
value=
"{{$_GET['end_time'] or ''}}"
>
</div>
<div
class=
"layui-inline"
>
<button
class=
"btn btn btn-outline btn-primary load"
lay-submit
lay-filter=
"*"
data-type=
"reload"
id=
"search"
>
搜索
</button>
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-col-md12"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<div
class=
"layui-col-md12"
>
<span
style=
"font-size:20px;font-weight:bold"
>
数据概览
</span>
<span
class=
"layui-badge-dot layui-bg-orange"
></span>
</div>
<div
id=
"page"
style=
"width: auto;height: 600px"
></div>
</div>
</div>
</div>
</div>
<script
src=
"/js/echarts.min.js"
></script>
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