Toggle navigation
This project
Loading...
Sign in
najixian
/
xt_dc_admin
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Download as
Email Patches
Plain Diff
Browse Files
Commit
2a44d1e9a32acce30970ae83a1194d4c618abbbc
Authored by
teemitop
2020-04-01 12:07:18 +0800
1 parent
946741db
build: skipped
首页基本数据展示
Changes
2
Builds
0
Inline
Side-by-side
Showing
2 changed files
with
318 additions
and
82 deletions
application/admin/controller/Index.php
application/admin/view/index/main.html
application/admin/controller/Index.php
View file @
2a44d1e
...
...
@@ -57,13 +57,54 @@ class Index extends Common
}
return
$date
;
}
public
function
main
(){
if
(
Request
::
isAjax
())
{
//构建地图分布
private
function
address_map
(){
$arr
=
array
(
array
(
"name"
=>
"北京"
,
"value"
=>
0
),
array
(
"name"
=>
"天津"
,
"value"
=>
0
),
array
(
"name"
=>
"上海"
,
"value"
=>
0
),
array
(
"name"
=>
"重庆"
,
"value"
=>
0
),
array
(
"name"
=>
"河北"
,
"value"
=>
0
),
array
(
"name"
=>
"河南"
,
"value"
=>
0
),
array
(
"name"
=>
"云南"
,
"value"
=>
0
),
array
(
"name"
=>
"辽宁"
,
"value"
=>
0
),
array
(
"name"
=>
"黑龙江"
,
"value"
=>
0
),
array
(
"name"
=>
"湖南"
,
"value"
=>
0
),
array
(
"name"
=>
"安徽"
,
"value"
=>
0
),
array
(
"name"
=>
"山东"
,
"value"
=>
0
),
array
(
"name"
=>
"新疆"
,
"value"
=>
0
),
array
(
"name"
=>
"江苏"
,
"value"
=>
0
),
array
(
"name"
=>
"浙江"
,
"value"
=>
0
),
array
(
"name"
=>
"江西"
,
"value"
=>
0
),
array
(
"name"
=>
"湖北"
,
"value"
=>
0
),
array
(
"name"
=>
"广西"
,
"value"
=>
0
),
array
(
"name"
=>
"甘肃"
,
"value"
=>
0
),
array
(
"name"
=>
"山西"
,
"value"
=>
0
),
array
(
"name"
=>
"内蒙古"
,
"value"
=>
0
),
array
(
"name"
=>
"陕西"
,
"value"
=>
0
),
array
(
"name"
=>
"吉林"
,
"value"
=>
0
),
array
(
"name"
=>
"福建"
,
"value"
=>
0
),
array
(
"name"
=>
"贵州"
,
"value"
=>
0
),
array
(
"name"
=>
"广东"
,
"value"
=>
0
),
array
(
"name"
=>
"青海"
,
"value"
=>
0
),
array
(
"name"
=>
"西藏"
,
"value"
=>
0
),
array
(
"name"
=>
"四川"
,
"value"
=>
0
),
array
(
"name"
=>
"宁夏"
,
"value"
=>
0
),
array
(
"name"
=>
"海南"
,
"value"
=>
0
),
array
(
"name"
=>
"台湾"
,
"value"
=>
0
),
array
(
"name"
=>
"香港"
,
"value"
=>
0
),
array
(
"name"
=>
"澳门"
,
"value"
=>
0
)
);
return
$arr
;
}
//主页
public
function
main
()
{
if
(
Request
::
isAjax
())
{
$arr
=
cache
(
'time_total'
);
if
(
!
$arr
){
if
(
$arr
){
$arr
=
array
();
$time
=
$this
->
GetDate
();
foreach
(
$time
as
$key
=>
$value
)
{
...
...
@@ -107,6 +148,65 @@ class Index extends Common
$arr
[
'unline_sum'
]
=
array_sum
(
$arr
[
'unline'
]);
//最近7天内部订单
$arr
[
'cancel_sum'
]
=
array_sum
(
$arr
[
'cancel'
]);
//最近7天取消的
$arr
[
'refuse_sum'
]
=
array_sum
(
$arr
[
'refuse'
]);
//最近7天拒单的
//获取全国商家分布图(合作与推广的商家)
$seller_total
=
Db
::
query
(
"SELECT
province as `name`,
count( province ) AS `value`
FROM
`xt-member-two-LINE`.xt_dc_dz_address AS a
LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type_rel AS r ON a.sid = r.sid
WHERE
province != ''
AND r.type_id IN ( 1, 2 )
GROUP BY
province "
);
$arr
[
'seller_total'
]
=
$this
->
address_map
();
foreach
(
$seller_total
as
$key
=>
$value
)
{
foreach
(
$arr
[
'seller_total'
]
as
$k
=>
$v
)
{
if
(
strstr
(
$value
[
'name'
],
$v
[
'name'
])
!==
false
){
$arr
[
'seller_total'
][
$k
][
'value'
]
=
$value
[
'value'
];
}
}
}
array_multisort
(
array_column
(
$arr
[
'seller_total'
],
'value'
),
SORT_DESC
,
$arr
[
'seller_total'
]);
//按照商家数量排序
//获取首页基础数据
$user_total
=
Db
::
query
(
"SELECT
count(*) AS total
FROM
`xt-member-two-LINE`.xt_dc_dz_wechat
WHERE
openid IS NOT NULL
AND openid != ''"
);
$res_total
=
Db
::
query
(
"SELECT
count(*) AS total
FROM
`xt-member-two-LINE`.xt_dc_reserve AS r
LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type_rel AS rel ON r.sid = rel.sid
WHERE
rel.type_id =1"
);
$price_total
=
Db
::
query
(
" SELECT
SUM(f.price) as total
FROM
`xt-member-two-LINE`.xt_dc_sms_flowing AS f
LEFT JOIN `xt-member-two-LINE`.xt_seller AS s ON f.sellerid = s.id
WHERE
f.paystatus = 1 and f.channel is null"
);
$seller_dv_total
=
Db
::
query
(
" SELECT
count(
DISTINCT ( d.sid )) AS total
FROM
`xt-member-two-LINE`.xt_dc_dz_seller_app_dv AS d
LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type_rel AS r ON d.sid = r.sid
WHERE
r.type_id = 1"
);
$arr
[
'user_total'
]
=
$user_total
?
$user_total
[
0
][
'total'
]
:
0
;
$arr
[
'res_total'
]
=
$res_total
?
$res_total
[
0
][
'total'
]
:
0
;
$arr
[
'sms_price_total'
]
=
$price_total
?
$price_total
[
0
][
'total'
]
:
'0.00'
;
$arr
[
'seller_dv_total'
]
=
$seller_dv_total
?
$seller_dv_total
[
0
][
'total'
]
:
0
;
cache
(
'time_total'
,
$arr
,
3600
);
//将数据集加入缓存
}
...
...
@@ -114,6 +214,7 @@ class Index extends Common
}
$version
=
Db
::
query
(
'SELECT VERSION() AS ver'
);
$config
=
[
'url'
=>
$_SERVER
[
'HTTP_HOST'
],
'document_root'
=>
$_SERVER
[
'DOCUMENT_ROOT'
],
...
...
@@ -129,6 +230,7 @@ class Index extends Common
$this
->
assign
(
'config'
,
$config
);
return
$this
->
fetch
();
}
public
function
welcome
(){
$config
=
"Welcome"
;
$this
->
assign
(
'config'
,
$config
);
...
...
application/admin/view/index/main.html
View file @
2a44d1e
{include file="common/head"/}
<div
class=
"admin-main layui-anim layui-anim-upbit"
>
<div
class=
"table-responsive"
>
<table
class=
"layui-table"
lay-even
lay-skin=
"line"
>
<colgroup>
<col
width=
"40%"
>
<col>
</colgroup>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
预订数据概览
</legend>
</fieldset>
<!--<div class="layui-col-sm6 layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">
访问量
<span class="layui-badge layui-bg-blue layuiadmin-badge">周</span>
</div>
<div class="layui-card-body layuiadmin-card-list">
<p class="layuiadmin-big-font">9,999,666</p>
<p>
总计访问量
<span class="layuiadmin-span-color">88万 <i class="layui-inline layui-icon layui-icon-flag"></i></span>
</p>
</div>
</div>
</div>-->
<link
rel=
"stylesheet"
href=
"https://www.layui.com/admin/std/dist/layuiadmin/style/admin.css"
media=
"all"
>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts-stat/dist/ecStat.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/extension/dataTool.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/map/js/china.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/map/js/world.js"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=2.0&ak=1iGjZaNqCgMp0vtQ8xB2ilbAcX9zTugj&__ec_v__=20190126"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/extension/bmap.min.js"
></script>
<div
class=
"layui-fluid"
>
<div
class=
"layui-row layui-col-space15"
>
<div
class=
"layui-col-sm6 layui-col-md3"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
用户量
<span
class=
"layui-badge layui-bg-blue layuiadmin-badge"
>
至今
</span>
</div>
<div
class=
"layui-card-body layuiadmin-card-list"
>
<p
class=
"layuiadmin-big-font"
id=
"user_total"
></p>
</div>
</div>
</div>
<div
class=
"layui-col-sm6 layui-col-md3"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
订单量
<span
class=
"layui-badge layui-bg-cyan layuiadmin-badge"
>
至今
</span>
</div>
<div
class=
"layui-card-body layuiadmin-card-list"
>
<p
class=
"layuiadmin-big-font"
id=
"res_total"
></p>
</div>
</div>
</div>
<div
class=
"layui-col-sm6 layui-col-md3"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
短信收入
<span
class=
"layui-badge layui-bg-green layuiadmin-badge"
>
至今
</span>
</div>
<div
class=
"layui-card-body layuiadmin-card-list"
>
<p
class=
"layuiadmin-big-font"
id=
"sms_price_total"
></p>
</div>
</div>
</div>
<div
class=
"layui-col-sm6 layui-col-md3"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
商家使用过设备
<span
class=
"layui-badge layui-bg-orange layuiadmin-badge"
>
至今
</span>
</div>
<div
class=
"layui-card-body layuiadmin-card-list"
>
<p
class=
"layuiadmin-big-font"
id=
"seller_dv_total"
></p>
</div>
</div>
</div>
</div>
</div>
<div
id=
"container"
style=
"width: 60%;height:400px;float:left;"
></div>
<div
id=
"container1"
style=
"width: 500px;height:400px;margin-left:65%"
></div>
<div
class=
"layui-col-sm12"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
商家全国分布(合作与推广的商家,且在商家管理中进行地理位置转换的)
</div>
<div
class=
"layui-card-body"
>
<div
class=
"layui-row layui-col-space15"
>
<div
class=
"layui-col-sm8"
>
<table
class=
"layui-table layuiadmin-page-table"
lay-skin=
"line"
>
<thead>
<tr>
<th>
排名
</th>
<th>
地区
</th>
<th>
人数
</th>
</tr>
</thead>
<tbody
id=
"seller_total"
>
</tbody>
</table>
</div>
<div
class=
"layui-col-sm4"
>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts-stat/dist/ecStat.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/extension/dataTool.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/map/js/china.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/map/js/world.js"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=2.0&ak=1iGjZaNqCgMp0vtQ8xB2ilbAcX9zTugj&__ec_v__=20190126"
></script>
<script
type=
"text/javascript"
src=
"https://cdn.jsdelivr.net/npm/echarts/dist/extension/bmap.min.js"
></script>
<fieldset
class=
"layui-elem-field layui-field-title"
>
<legend>
系统信息
</legend>
</fieldset>
<thead>
</thead>
<tbody>
<tr>
<td>
网站域名
</td>
<td>
{$config.url}
</td>
</tr>
<tr>
<td>
网站目录
</td>
<td>
{$config.document_root}
</td>
</tr>
<tr>
<td>
服务器操作系统
</td>
<td>
{$config.server_os}
</td>
</tr>
<tr>
<td>
服务器端口
</td>
<td>
{$config.server_port}
</td>
</tr>
<tr>
<td>
服务器IP
</td>
<td>
{$config.server_ip}
</td>
</tr>
<tr>
<td>
MySQL数据库版本
</td>
<td>
{$config.mysql_version}
</td>
</tr>
<tr>
<td>
运行PHP版本
</td>
<td>
{$config.php_version}
</td>
</tr>
<div
class=
"layui-carousel layadmin-carousel layadmin-dataview"
data-anim=
"fade"
lay-filter=
"LAY-index-pagethree"
lay-anim=
"fade"
style=
"width: 100%; height: 280px;"
id=
"seller_main"
>
</div>
<tr>
<td>
最大上传限制
</td>
<td>
{$config.max_upload_size}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<br>
<div
class=
"layui-col-sm12"
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
>
数据概览
</div>
<div
class=
"layui-col-sm8"
>
<div
class=
"layui-carousel layadmin-carousel layadmin-dataview"
id=
"container"
></div>
</div>
<div
class=
"layui-col-sm4"
>
<div
class=
"layui-carousel layadmin-carousel layadmin-dataview"
id=
"container1"
></div>
</div>
</div>
</div>
<div
class=
"layui-col-sm12"
>
<div
class=
"layui-card-body layui-text"
>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"100"
>
<col>
</colgroup>
<tbody>
<tr>
<td
width=
"100"
>
服务器操作系统
</td>
<td>
{$config.server_os}
</td>
</tr>
<tr>
<td>
PHP版本
</td>
<td>
{$config.php_version}
</td>
</tr>
<tr>
<td>
基于框架
</td>
<td>
ThinkPHP5.1 + LayUi
</td>
</tr>
<tr>
<td>
MySQL版本
</td>
<td>
{$config.mysql_version}
</td>
</tr>
<tr>
<td
width=
"100"
>
最大上传限制
</td>
<td
style=
"padding-bottom: 0;"
>
{$config.max_upload_size}
</td>
</tr>
<tr>
<td
width=
"120"
>
首页数据缓存说明
</td>
<td
style=
"padding-bottom: 0;color:red;"
>
首页数据缓存时间均为 1小时。
</td>
</tr>
</tbody>
</table>
</div>
</div>
{include file="common/foot"/}
<script
type=
"text/javascript"
>
function
randomData
()
{
return
Math
.
round
(
Math
.
random
()
*
500
);
}
layui
.
use
([
'table'
,
'layer'
],
function
(){
var
table
=
layui
.
table
;
var
layer
=
layui
.
layer
;
var
$
=
layui
.
jquery
;
...
...
@@ -96,11 +165,73 @@ layui.use(['table', 'layer'], function(){
datType
:
"json"
,
success
:
function
(
data
){
layer
.
close
(
loading
);
var
dom
=
document
.
getElementById
(
"container"
);
var
dom1
=
document
.
getElementById
(
"container1"
);
var
myChart
=
echarts
.
init
(
dom
,
'light'
);
var
myChart1
=
echarts
.
init
(
dom1
,
'light'
);
//赋值:
$
(
'#user_total'
).
html
(
data
.
data
.
user_total
+
' 位'
);
$
(
'#res_total'
).
html
(
data
.
data
.
res_total
+
' 单'
);
$
(
'#sms_price_total'
).
html
(
data
.
data
.
sms_price_total
+
' 元'
);
$
(
'#seller_dv_total'
).
html
(
data
.
data
.
seller_dv_total
+
' 家'
);
var
myChart2
=
echarts
.
init
(
document
.
getElementById
(
'seller_main'
));
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
"container"
),
'light'
);
var
myChart1
=
echarts
.
init
(
document
.
getElementById
(
"container1"
),
'light'
);
var
app
=
{};
var
html
=
''
;
var
index
=
1
;
//表格替换
$
.
each
(
data
.
data
.
seller_total
.
slice
(
0
,
7
),
function
(
index
,
item
){
html
+=
'<tr><td>'
+
(
index
+
1
)
+
'</td><td>'
+
item
.
name
+
'</td><td>'
+
item
.
value
+
'</td></tr>'
;
})
$
(
'#seller_total'
).
html
(
html
);
//商家分布数据
var
mydata
=
data
.
data
.
seller_total
;
var
optionMap
=
{
backgroundColor
:
'#FFFFFF'
,
title
:
{
text
:
'一键订商家全国分布图'
,
subtext
:
''
,
x
:
'center'
},
toolbox
:
{
feature
:
{
saveAsImage
:
{}
}
},
tooltip
:
{
trigger
:
'item'
},
//左侧小导航图标
visualMap
:
{
show
:
true
,
x
:
'left'
,
y
:
'center'
,
splitList
:
[
{
start
:
800
,
end
:
10000
},{
start
:
400
,
end
:
800
},
{
start
:
300
,
end
:
400
},{
start
:
200
,
end
:
300
},
{
start
:
100
,
end
:
200
},{
start
:
0
,
end
:
100
},
],
color
:
[
'#f70202'
,
'#9feaa5'
,
'#85daef'
,
'#74e2ca'
,
'#e6ac53'
,
'#bef8f8'
]
},
//配置属性
series
:
[{
name
:
'数据'
,
type
:
'map'
,
mapType
:
'china'
,
roam
:
true
,
label
:
{
normal
:
{
show
:
true
//省份名称
},
emphasis
:
{
show
:
false
}
},
data
:
mydata
//数据
}]
};
option
=
null
;
option
=
{
title
:
{
...
...
@@ -240,6 +371,9 @@ layui.use(['table', 'layer'], function(){
}
]
};
if
(
optionMap
&&
typeof
optionMap
===
"object"
)
{
myChart2
.
setOption
(
optionMap
,
true
);
}
if
(
option1
&&
typeof
option1
===
"object"
)
{
myChart1
.
setOption
(
option1
,
true
);
}
...
...
Please
register
or
login
to post a comment