Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘小敏
loveisland
Commits
c64d3b9c
Commit
c64d3b9c
authored
May 23, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据中心优化
parent
32f0f5e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
30 deletions
+118
-30
Dashboard.php
application/admin/controller/shopro/Dashboard.php
+99
-25
index.html
application/admin/view/shopro/dashboard/index.html
+0
-0
DataStatsCenter.php
application/command/DataStatsCenter.php
+11
-3
addons.js
public/assets/js/addons.js
+8
-2
dashboard.js
public/assets/js/backend/shopro/dashboard.js
+0
-0
No files found.
application/admin/controller/shopro/Dashboard.php
View file @
c64d3b9c
This diff is collapsed.
Click to expand it.
application/admin/view/shopro/dashboard/index.html
View file @
c64d3b9c
This diff is collapsed.
Click to expand it.
application/command/DataStatsCenter.php
View file @
c64d3b9c
...
@@ -195,10 +195,10 @@ class DataStatsCenter extends Command
...
@@ -195,10 +195,10 @@ class DataStatsCenter extends Command
$currentRegisterTotal
=
$this
->
getRegisterCount
(
0
,
$currentRange
[
'end'
]);
$currentRegisterTotal
=
$this
->
getRegisterCount
(
0
,
$currentRange
[
'end'
]);
$previousRegisterTotal
=
$this
->
getRegisterCount
(
0
,
$previousRange
[
'end'
]);
$previousRegisterTotal
=
$this
->
getRegisterCount
(
0
,
$previousRange
[
'end'
]);
// 计算转化率(
订单
数/访客数)
// 计算转化率(
购买用户
数/访客数)
$this
->
customLog
(
'info'
,
'开始计算当前&上一期统计周期转化率'
);
$this
->
customLog
(
'info'
,
'开始计算当前&上一期统计周期转化率'
);
$currentConversion
=
$currentVisitors
>
0
?
round
(
$currentRevenue
[
'
ord
er_count'
]
/
$currentVisitors
*
100
,
2
)
:
0
;
$currentConversion
=
$currentVisitors
>
0
?
round
(
$currentRevenue
[
'
buy
er_count'
]
/
$currentVisitors
*
100
,
2
)
:
0
;
$previousConversion
=
$previousVisitors
>
0
?
round
(
$previousRevenue
[
'
ord
er_count'
]
/
$previousVisitors
*
100
,
2
)
:
0
;
$previousConversion
=
$previousVisitors
>
0
?
round
(
$previousRevenue
[
'
buy
er_count'
]
/
$previousVisitors
*
100
,
2
)
:
0
;
// 构建趋势数据
// 构建趋势数据
$this
->
customLog
(
'info'
,
'开始构建当前统计周期趋势数据'
);
$this
->
customLog
(
'info'
,
'开始构建当前统计周期趋势数据'
);
...
@@ -332,6 +332,13 @@ class DataStatsCenter extends Command
...
@@ -332,6 +332,13 @@ class DataStatsCenter extends Command
->
where
(
'paid_time'
,
'between'
,
[
$startTime
,
$endTime
])
->
where
(
'paid_time'
,
'between'
,
[
$startTime
,
$endTime
])
->
count
();
->
count
();
// 统计购买用户数(去重)
$buyerCount
=
(
int
)
Db
::
name
(
'shopro_order'
)
->
whereIn
(
'status'
,
[
'paid'
,
'completed'
])
->
where
(
'paid_time'
,
'between'
,
[
$startTime
,
$endTime
])
->
where
(
'user_id'
,
'>'
,
0
)
->
count
(
'DISTINCT user_id'
);
// 计算客单价(成交额/订单数)
// 计算客单价(成交额/订单数)
$avgAmount
=
$orderCount
>
0
?
round
(
$totalAmount
/
$orderCount
,
2
)
:
0
;
$avgAmount
=
$orderCount
>
0
?
round
(
$totalAmount
/
$orderCount
,
2
)
:
0
;
...
@@ -355,6 +362,7 @@ class DataStatsCenter extends Command
...
@@ -355,6 +362,7 @@ class DataStatsCenter extends Command
return
[
return
[
'total_amount'
=>
$totalAmount
,
'total_amount'
=>
$totalAmount
,
'order_count'
=>
$orderCount
,
'order_count'
=>
$orderCount
,
'buyer_count'
=>
$buyerCount
,
'avg_amount'
=>
$avgAmount
,
'avg_amount'
=>
$avgAmount
,
'cost_amount'
=>
$costAmount
,
'cost_amount'
=>
$costAmount
,
'refund_amount'
=>
$refundAmount
,
'refund_amount'
=>
$refundAmount
,
...
...
public/assets/js/addons.js
View file @
c64d3b9c
...
@@ -50,6 +50,9 @@ if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.a
...
@@ -50,6 +50,9 @@ if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.a
'ElementPlus'
:
{
'ElementPlus'
:
{
deps
:
[
'css!../addons/shopro/libs/element-plus/index.css'
]
deps
:
[
'css!../addons/shopro/libs/element-plus/index.css'
]
},
},
'ElementPlusIconsVue'
:
{
deps
:
[
'ElementPlusIconsVue3'
]
}
},
},
});
});
require
([
'vue3'
,
'ElementPlusIconsVue3'
],
function
(
Vue3
,
ElementPlusIconsVue3
)
{
require
([
'vue3'
,
'ElementPlusIconsVue3'
],
function
(
Vue3
,
ElementPlusIconsVue3
)
{
...
@@ -75,8 +78,11 @@ if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.a
...
@@ -75,8 +78,11 @@ if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.a
const
app
=
createApp
({})
const
app
=
createApp
({})
app
.
use
(
ElementPlus
)
app
.
use
(
ElementPlus
)
for
(
const
[
key
,
component
]
of
Object
.
entries
(
ElementPlusIconsVue
))
{
app
.
component
(
key
,
component
)
if
(
ElementPlusIconsVue
&&
typeof
ElementPlusIconsVue
===
'object'
)
{
for
(
const
[
key
,
component
]
of
Object
.
entries
(
ElementPlusIconsVue
))
{
app
.
component
(
key
,
component
)
}
}
}
app
.
component
(
'sa-chat'
,
SaChat
)
app
.
component
(
'sa-chat'
,
SaChat
)
...
...
public/assets/js/backend/shopro/dashboard.js
View file @
c64d3b9c
This diff is collapsed.
Click to expand it.
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