Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
4d3cf722
Commit
4d3cf722
authored
Sep 23, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
7297a0dc
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
256 additions
and
267 deletions
+256
-267
app/Admin/Controllers/GoodController.php
+1
-1
app/Admin/Controllers/HomeController.php
+2
-0
app/Admin/Controllers/OrderInfoController.php
+6
-2
app/Admin/Controllers/SystemSettingController.php
+2
-2
app/Admin/Metrics/Examples/Sessions.php
+43
-24
app/Http/Controllers/Api/GoodController.php
+56
-7
app/Http/Controllers/Api/OrderController.php
+44
-28
app/Http/Controllers/Api/StoreController.php
+3
-1
app/Http/Controllers/Api/SystemSettingController.php
+1
-1
app/Http/Controllers/Api/UserController.php
+79
-4
app/Store/Metrics/Examples/Sessions.php
+6
-10
app/Store/Metrics/Examples/StoreOrderChats.php
+0
-184
routes/api.php
+13
-3
No files found.
app/Admin/Controllers/GoodController.php
View file @
4d3cf722
...
@@ -304,7 +304,7 @@ public static function editGoodSkuData($attrsKey, $sku, $gid)
...
@@ -304,7 +304,7 @@ public static function editGoodSkuData($attrsKey, $sku, $gid)
$goodSkuObj
->
goods_id
=
$gid
;
$goodSkuObj
->
goods_id
=
$gid
;
}
}
$goodSkuObj
->
attr_val
=
$attr_val
;
$goodSkuObj
->
attr_val
=
$attr_val
;
$goodSkuObj
->
pic
=
$vv
[
'pic'
]
;
$goodSkuObj
->
pic
=
str_replace
(
env
(
'IMAGE_URL'
),
''
,
$vv
[
'pic'
])
;
$goodSkuObj
->
attr_sn
=
$attr_sn
;
$goodSkuObj
->
attr_sn
=
$attr_sn
;
$goodSkuObj
->
market_price
=
$vv
[
'market_price'
];
$goodSkuObj
->
market_price
=
$vv
[
'market_price'
];
$goodSkuObj
->
cg_price
=
$vv
[
'cg_price'
];
$goodSkuObj
->
cg_price
=
$vv
[
'cg_price'
];
...
...
app/Admin/Controllers/HomeController.php
View file @
4d3cf722
...
@@ -21,6 +21,8 @@ public function index(Content $content)
...
@@ -21,6 +21,8 @@ public function index(Content $content)
$column
->
row
(
function
(
Row
$row
)
{
$column
->
row
(
function
(
Row
$row
)
{
$row
->
column
(
6
,
new
Examples\OrderWaitCount
());
$row
->
column
(
6
,
new
Examples\OrderWaitCount
());
$row
->
column
(
6
,
new
Examples\OrderPickCount
());
$row
->
column
(
6
,
new
Examples\OrderPickCount
());
//$row->column(12, new Examples\StoreOrderChats());
$row
->
column
(
12
,
new
Examples\Sessions
());
$row
->
column
(
12
,
new
Examples\Product
());
$row
->
column
(
12
,
new
Examples\Product
());
});
});
});
});
...
...
app/Admin/Controllers/OrderInfoController.php
View file @
4d3cf722
...
@@ -37,11 +37,15 @@ protected function grid()
...
@@ -37,11 +37,15 @@ protected function grid()
$grid
->
column
(
'goods_amount'
,
'订单总金额'
);
$grid
->
column
(
'goods_amount'
,
'订单总金额'
);
$grid
->
column
(
'merchant.name'
,
'所属商家'
);
$grid
->
column
(
'merchant.name'
,
'所属商家'
);
$grid
->
column
(
'merchant.province_id'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'merchant.province_id'
,
'所在省市'
)
->
display
(
function
(
$val
)
{
if
(
$val
)
{
$proObj
=
City
::
where
(
"city_id"
,
$val
)
->
first
();
$proObj
=
City
::
where
(
"city_id"
,
$val
)
->
first
();
$cityObj
=
City
::
where
(
"city_id"
,
$this
->
merchant
->
city_id
)
->
first
();
$cityObj
=
City
::
where
(
"city_id"
,
$this
->
merchant
->
city_id
)
->
first
();
$proname
=
$proObj
->
name
??
''
;
$proname
=
$proObj
->
name
??
''
;
$cityname
=
$cityObj
->
name
??
''
;
$cityname
=
$cityObj
->
name
??
''
;
return
$proname
.
" "
.
$cityname
;
return
$proname
.
" "
.
$cityname
;
}
else
{
return
''
;
}
});
});
$grid
->
column
(
'store_id'
,
'快递代收点'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'store_id'
,
'快递代收点'
)
->
display
(
function
(
$val
)
{
...
@@ -129,8 +133,8 @@ protected function form()
...
@@ -129,8 +133,8 @@ protected function form()
{
{
return
Form
::
make
(
new
OrderInfo
(),
function
(
Form
$form
)
{
return
Form
::
make
(
new
OrderInfo
(),
function
(
Form
$form
)
{
//$form->display('id');
//$form->display('id');
$form
->
display
(
'order_sn'
);
$form
->
display
(
'order_sn'
,
'订单号'
);
$form
->
text
(
'remark'
,
'备注(后台用)'
);
//
$form->text('remark', '备注(后台用)');
//订单状态 -1:全部 0:待付款 1:待到货 2:待领取 3: 待评价 4:已完成 7:已取消 8:已退款
//订单状态 -1:全部 0:待付款 1:待到货 2:待领取 3: 待评价 4:已完成 7:已取消 8:已退款
$options
=
[
$options
=
[
1
=>
'待到货'
,
1
=>
'待到货'
,
...
...
app/Admin/Controllers/SystemSettingController.php
View file @
4d3cf722
...
@@ -64,8 +64,8 @@ protected function form()
...
@@ -64,8 +64,8 @@ protected function form()
$form
->
image
(
'bj_invite'
,
'邀请页背景图'
)
$form
->
image
(
'bj_invite'
,
'邀请页背景图'
)
->
accept
(
'jpg,jpeg,png'
)
->
accept
(
'jpg,jpeg,png'
)
->
maxSize
(
4096
)
->
maxSize
(
4096
)
->
url
(
'upload/ca
tegory
'
)
->
url
(
'upload/ca
rousel
'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(
750px * 42
0px)'
)
->
help
(
'仅支持jpg、jpeg、png格式图片上传(
690px * 120
0px)'
)
->
autoUpload
();
->
autoUpload
();
$form
->
editor
(
'cp_brief'
,
'公司介绍'
);
$form
->
editor
(
'cp_brief'
,
'公司介绍'
);
$form
->
editor
(
'cashout_brief'
,
'提现须知'
);
$form
->
editor
(
'cashout_brief'
,
'提现须知'
);
...
...
app/Admin/Metrics/Examples/Sessions.php
View file @
4d3cf722
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Widgets\Metrics\Bar
;
use
Dcat\Admin\Widgets\Metrics\Bar
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Dcat\Admin\Widgets\Card
;
class
Sessions
extends
Bar
class
Sessions
extends
Bar
{
{
...
@@ -19,6 +20,8 @@ protected function init()
...
@@ -19,6 +20,8 @@ protected function init()
$dark35
=
$color
->
dark35
();
$dark35
=
$color
->
dark35
();
$dark20
=
$color
->
blue
();
// 卡片内容宽度
// 卡片内容宽度
$this
->
contentWidth
(
5
,
7
);
$this
->
contentWidth
(
5
,
7
);
// 标题
// 标题
...
@@ -32,9 +35,9 @@ protected function init()
...
@@ -32,9 +35,9 @@ protected function init()
]);
]);
// 设置图表颜色
// 设置图表颜色
$this
->
chartColors
([
$this
->
chartColors
([
$dark
35
,
$dark
20
,
$dark
35
,
$dark
20
,
$
color
->
primary
()
,
$
dark20
,
$dark35
,
$dark35
,
$dark35
,
$dark35
,
$dark35
$dark35
...
@@ -53,16 +56,16 @@ public function handle(Request $request)
...
@@ -53,16 +56,16 @@ public function handle(Request $request)
switch
(
$request
->
get
(
'option'
))
{
switch
(
$request
->
get
(
'option'
))
{
case
'7'
:
case
'7'
:
default
:
default
:
// 卡片内容
$this
->
withContent
(
'2.7k'
,
'+5.2%'
);
// 图表数据
// 图表数据
$this
->
withChart
([
$this
->
withChart
([
[
[
'name'
=>
'Sessions'
,
'name'
=>
'Sessions'
,
'data'
=>
[
75
,
125
,
225
,
175
,
125
,
75
,
2
5
],
'data'
=>
[
175
,
125
,
225
,
175
,
125
,
75
,
20
5
],
],
],
]);
]);
// 卡片内容
$this
->
withContent
(
'2.7k'
,
'+5.2%'
);
}
}
}
}
...
@@ -75,9 +78,24 @@ public function handle(Request $request)
...
@@ -75,9 +78,24 @@ public function handle(Request $request)
*/
*/
public
function
withChart
(
array
$data
)
public
function
withChart
(
array
$data
)
{
{
return
$this
->
chart
([
// return $this->chart([
'series'
=>
$data
,
// 'series' => $data,
]);
// ]);
// 模拟数据
$data
=
[
'Jan'
=>
123
,
'Feb'
=>
234
,
'Mar'
=>
156
,
// ...
];
// 创建柱状图
$barChart
=
Bar
::
title
(
'Monthly Sales Report'
)
->
labels
(
array_keys
(
$data
));
$barChart
->
dataset
(
'Sales'
,
'bar'
,
array_values
(
$data
));
// 创建卡片并添加图表
$card
=
Card
::
make
(
'Sales Report'
,
$barChart
);
return
$card
;
}
}
/**
/**
...
@@ -98,20 +116,21 @@ public function withContent($title, $value, $style = 'success')
...
@@ -98,20 +116,21 @@ public function withContent($title, $value, $style = 'success')
$minHeight
=
'183px'
;
$minHeight
=
'183px'
;
return
$this
->
content
(
<<<HTML
// return $this->content(
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
// <<<HTML
<div class="text-left">
// <div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
// <div class="text-left">
<h5 class="font-medium-2" style="margin-top: 10px;">
// <h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
<span class="text-{$style}">{$value} </span>
// <h5 class="font-medium-2" style="margin-top: 10px;">
<span>vs {$label}</span>
// <span class="text-{$style}">{$value} </span>
</h5>
// <span>vs {$label}</span>
</div>
// </h5>
// </div>
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
</div>
// <a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
HTML
// </div>
);
// HTML
// );
}
}
}
}
app/Http/Controllers/Api/GoodController.php
View file @
4d3cf722
...
@@ -8,7 +8,10 @@
...
@@ -8,7 +8,10 @@
use
App\Models\UserCollect
;
use
App\Models\UserCollect
;
use
App\Models\Category
as
CategoryModel
;
use
App\Models\Category
as
CategoryModel
;
use
App\Models\GoodsAttr
as
GoodsAttrModel
;
use
App\Models\GoodsAttr
as
GoodsAttrModel
;
use
App\Models\Kefu
;
use
App\Models\Merchant
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
class
GoodController
extends
BaseController
class
GoodController
extends
BaseController
{
{
...
@@ -73,6 +76,13 @@ public function getList(Request $request)
...
@@ -73,6 +76,13 @@ public function getList(Request $request)
$sort
=
$request
->
sort
??
'desc'
;
$sort
=
$request
->
sort
??
'desc'
;
$page
=
$request
->
page
??
1
;
$page
=
$request
->
page
??
1
;
$limit
=
$request
->
limit
??
10
;
$limit
=
$request
->
limit
??
10
;
$islogin
=
$request
->
islogin
??
0
;
$mer_id
=
0
;
// 获取已认证的用户,如果未认证则返回 null
$userObj
=
optional
(
Auth
::
user
());
if
(
$userObj
)
{
$mer_id
=
$userObj
->
merchant_id
;
}
$data
=
[
$data
=
[
'current_page'
=>
$page
,
'current_page'
=>
$page
,
'total'
=>
0
,
'total'
=>
0
,
...
@@ -115,6 +125,7 @@ public function getList(Request $request)
...
@@ -115,6 +125,7 @@ public function getList(Request $request)
'goods_name'
=>
$item
->
goods_name
,
'goods_name'
=>
$item
->
goods_name
,
'dg_price'
=>
sprintf
(
"%.2f"
,
$cg_price
),
'dg_price'
=>
sprintf
(
"%.2f"
,
$cg_price
),
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
"%.2f"
,
$cg_price
)
:
sprintf
(
"%.2f"
,
$market_price
),
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'cover_img'
=>
(
isset
(
$goodsObj
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$goodsObj
->
cover_img
:
''
),
'cover_img'
=>
(
isset
(
$goodsObj
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$goodsObj
->
cover_img
:
''
),
];
];
...
@@ -131,7 +142,14 @@ public function getIndexGoods(Request $request)
...
@@ -131,7 +142,14 @@ public function getIndexGoods(Request $request)
$sort
=
$request
->
sort
??
'desc'
;
$sort
=
$request
->
sort
??
'desc'
;
$page
=
$request
->
page
??
1
;
$page
=
$request
->
page
??
1
;
$limit
=
$request
->
limit
??
10
;
$limit
=
$request
->
limit
??
10
;
//$islogin = $request->islogin ?? 0;
$mer_id
=
0
;
$data
=
[];
$data
=
[];
// 获取已认证的用户,如果未认证则返回 null
$userObj
=
optional
(
Auth
::
user
());
if
(
$userObj
)
{
$mer_id
=
$userObj
->
merchant_id
;
}
$model
=
GoodModel
::
select
([
'id'
,
'goods_name'
,
'is_hot'
,
'cover_img'
,
'goods_brief'
,
'sku'
,
'tags'
])
$model
=
GoodModel
::
select
([
'id'
,
'goods_name'
,
'is_hot'
,
'cover_img'
,
'goods_brief'
,
'sku'
,
'tags'
])
->
where
([
'is_show'
=>
1
]);
->
where
([
'is_show'
=>
1
]);
...
@@ -173,6 +191,7 @@ public function getIndexGoods(Request $request)
...
@@ -173,6 +191,7 @@ public function getIndexGoods(Request $request)
'is_hot'
=>
$datum
->
is_hot
,
'is_hot'
=>
$datum
->
is_hot
,
'dg_price'
=>
sprintf
(
"%.2f"
,
$dg_price
),
'dg_price'
=>
sprintf
(
"%.2f"
,
$dg_price
),
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
"%.2f"
,
$dg_price
)
:
sprintf
(
"%.2f"
,
$market_price
),
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'cover_img'
=>
(
$datum
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$datum
->
cover_img
:
''
,
'cover_img'
=>
(
$datum
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$datum
->
cover_img
:
''
,
];
];
...
@@ -184,12 +203,25 @@ public function getIndexGoods(Request $request)
...
@@ -184,12 +203,25 @@ public function getIndexGoods(Request $request)
public
function
getDetail
(
Request
$request
)
public
function
getDetail
(
Request
$request
)
{
{
$mer_id
=
$request
->
user
()
?
$request
->
user
()
->
merchant_id
:
0
;
//获取绑定的商户ID
$mer_id
=
0
;
//获取绑定的商户ID
$goods_id
=
$request
->
goods_id
??
null
;
$goods_id
=
$request
->
goods_id
??
null
;
$goods
=
GoodModel
::
find
(
$goods_id
);
$goods
=
GoodModel
::
find
(
$goods_id
);
if
(
!
$goods
)
{
if
(
!
$goods
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
$is_collect
=
0
;
//客服电话
$kefuObj
=
Kefu
::
where
(
'is_type'
,
2
)
->
first
();
$kf_phone
=
$kefuObj
?
$kefuObj
->
contact
:
''
;
// 获取已认证的用户,如果未认证则返回 null
$userObj
=
optional
(
Auth
::
user
());
if
(
$userObj
)
{
$mer_id
=
$userObj
->
merchant_id
;
$merchantObj
=
Merchant
::
find
(
$mer_id
);
$kf_phone
=
$merchantObj
->
phone
;
//收藏
$is_collect
=
UserCollect
::
where
([
'goods_id'
=>
$goods_id
,
'uid'
=>
$userObj
->
id
])
->
wherenull
(
'deleted_at'
)
->
count
();
}
$cover_arr
=
$goods
->
carousel
?
json_decode
(
$goods
->
carousel
)
:
[];
$cover_arr
=
$goods
->
carousel
?
json_decode
(
$goods
->
carousel
)
:
[];
$cover
=
[];
$cover
=
[];
if
(
!
empty
(
$cover_arr
))
{
if
(
!
empty
(
$cover_arr
))
{
...
@@ -220,7 +252,11 @@ public function getDetail(Request $request)
...
@@ -220,7 +252,11 @@ public function getDetail(Request $request)
$stock
=
isset
(
$skuOneData
[
'stock'
])
?
$skuOneData
[
'stock'
]
:
0
;
$stock
=
isset
(
$skuOneData
[
'stock'
])
?
$skuOneData
[
'stock'
]
:
0
;
//标签
//标签
$tags
=
$goods
->
tags
?
json_decode
(
$goods
->
tags
,
true
)
:
[];
$tags
=
$goods
->
tags
?
json_decode
(
$goods
->
tags
,
true
)
:
[];
$skuOne
=
[
'goods_price'
=>
$mer_id
?
$dg_price
:
$market_price
,
'stock'
=>
$stock
,
'pic'
=>
isset
(
$skuOneData
[
'pic'
])
?
$skuOneData
[
'pic'
]
:
''
];
$data
=
[
$data
=
[
'id'
=>
$goods
->
id
,
'id'
=>
$goods
->
id
,
'goods_img'
=>
$cover
,
'goods_img'
=>
$cover
,
...
@@ -229,12 +265,16 @@ public function getDetail(Request $request)
...
@@ -229,12 +265,16 @@ public function getDetail(Request $request)
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'goods_name'
=>
$goods
->
goods_name
,
'goods_name'
=>
$goods
->
goods_name
,
'sale'
=>
$goods
->
sale
??
0
,
'sale'
=>
$goods
->
sale
??
0
,
'sku_items'
=>
$skufield
,
//'sku_items' => $skufield,
'skuOne'
=>
$skuOne
,
'attr'
=>
$attr
,
'attr'
=>
$attr
,
'attr_txt'
=>
trim
(
$attr_txt
,
", "
),
'attr_txt'
=>
trim
(
$attr_txt
,
", "
),
'is_collect'
=>
0
,
'is_collect'
=>
$is_collect
,
'kf_phone'
=>
$kf_phone
,
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'goods_desc'
=>
$goods
->
goods_desc
??
''
'goods_desc'
=>
$goods
->
goods_desc
??
''
,
'intro_desc'
=>
$goods
->
intro_desc
??
''
,
'high_opinion'
=>
$goods
->
high_opinion
??
''
,
];
];
return
$this
->
JsonResponse
(
$data
);
return
$this
->
JsonResponse
(
$data
);
}
}
...
@@ -243,10 +283,17 @@ public function getAttrKey(Request $request)
...
@@ -243,10 +283,17 @@ public function getAttrKey(Request $request)
{
{
$goods_id
=
$request
->
goods_id
??
null
;
$goods_id
=
$request
->
goods_id
??
null
;
$attr_name
=
$request
->
attr_name
??
null
;
//22寸,蓝色,
$attr_name
=
$request
->
attr_name
??
null
;
//22寸,蓝色,
$mer_id
=
0
;
$goods
=
GoodModel
::
find
(
$goods_id
);
$goods
=
GoodModel
::
find
(
$goods_id
);
if
(
!
$goods
)
{
if
(
!
$goods
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
// 获取已认证的用户,如果未认证则返回 null
$userObj
=
optional
(
Auth
::
user
());
if
(
$userObj
)
{
$mer_id
=
$userObj
->
merchant_id
;
}
$attr_sn
=
''
;
$attr_sn
=
''
;
if
(
$attr_name
)
{
if
(
$attr_name
)
{
$attrArr
=
explode
(
","
,
$attr_name
);
$attrArr
=
explode
(
","
,
$attr_name
);
...
@@ -267,9 +314,11 @@ public function getAttrKey(Request $request)
...
@@ -267,9 +314,11 @@ public function getAttrKey(Request $request)
$stock
=
$attrObj
->
stock
?
$attrObj
->
stock
:
0
;
$stock
=
$attrObj
->
stock
?
$attrObj
->
stock
:
0
;
$data
=
[
$data
=
[
'market_price'
=>
sprintf
(
'%.2f'
,
$market_price
),
// 'market_price' => sprintf('%.2f', $market_price),
'dg_price'
=>
sprintf
(
'%.2f'
,
$cg_price
),
// 'dg_price' => sprintf('%.2f', $cg_price),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.2f'
,
$cg_price
)
:
sprintf
(
'%.2f'
,
$market_price
),
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'pic'
=>
$attrObj
->
pic
?
env
(
'IMAGE_URL'
)
.
$attrObj
->
pic
:
''
];
];
return
$this
->
JsonResponse
(
$data
);
return
$this
->
JsonResponse
(
$data
);
}
}
...
...
app/Http/Controllers/Api/OrderController.php
View file @
4d3cf722
...
@@ -62,22 +62,27 @@ public function CreateBuyOrder(Request $request)
...
@@ -62,22 +62,27 @@ public function CreateBuyOrder(Request $request)
$orderObj
=
new
OrderInfoModel
();
$orderObj
=
new
OrderInfoModel
();
$userObj
=
$request
->
user
();
$userObj
=
$request
->
user
();
$user_id
=
$userObj
->
id
;
$user_id
=
$userObj
->
id
;
$merchant_id
=
$userObj
->
merchant_id
;
$merchant_id
=
(
int
)
$userObj
->
merchant_id
;
$goods_id
=
$request
->
goods_id
;
$goods_id
=
$request
->
goods_id
;
$num
=
$request
->
num
??
1
;
$num
=
$request
->
num
??
1
;
$attr_id
=
$request
->
attr_id
??
0
;
$attr_id
=
$request
->
attr_id
??
0
;
$delivery_type
=
$request
->
delivery_type
;
// 收货方式 1:代收点 2:送货上门
$delivery_type
=
$request
->
delivery_type
;
// 收货方式 1:代收点 2:送货上门
$store_id
=
$request
->
store_id
??
0
;
//代收点 门店ID
$store_id
=
$request
->
store_id
??
0
;
//代收点 门店ID
$address_id
=
$request
->
address_id
??
0
;
//地址ID
//----收货地址----
$address
=
$request
->
address
??
''
;
//详情地址
$area
=
$request
->
area
??
''
;
$phone
=
$request
->
phone
??
''
;
$consignee
=
$request
->
consignee
??
''
;
//$address_id = $request->address_id ?? 0; //地址ID
$goodsObj
=
GoodModel
::
find
(
$goods_id
);
$goodsObj
=
GoodModel
::
find
(
$goods_id
);
if
(
!
$goodsObj
)
{
if
(
!
$goodsObj
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
$userAddress
=
''
;
//
$userAddress = '';
if
(
$address_id
)
{
//
if ($address_id) {
$userAddress
=
UserAddress
::
where
(
"id"
,
$address_id
)
->
first
();
//
$userAddress = UserAddress::where("id", $address_id)->first();
}
//
}
$order_sn
=
$this
->
getOrderSn
();
$order_sn
=
$this
->
getOrderSn
();
DB
::
beginTransaction
();
DB
::
beginTransaction
();
...
@@ -114,10 +119,10 @@ public function CreateBuyOrder(Request $request)
...
@@ -114,10 +119,10 @@ public function CreateBuyOrder(Request $request)
//订单信息
//订单信息
$orderObj
->
order_sn
=
$order_sn
;
$orderObj
->
order_sn
=
$order_sn
;
$orderObj
->
user_id
=
$user_id
;
$orderObj
->
user_id
=
$user_id
;
$orderObj
->
a
ddress_id
=
$address_id
;
$orderObj
->
a
rea
=
$area
;
$orderObj
->
address
=
$
userAddress
?
$userAddress
->
address
:
''
;
$orderObj
->
address
=
$
address
;
$orderObj
->
consignee
=
$
userAddress
?
$userAddress
->
consignee
:
''
;
$orderObj
->
consignee
=
$
consignee
;
$orderObj
->
mobile
=
$
userAddress
?
$userAddress
->
phone
:
$userObj
->
phone
;
$orderObj
->
mobile
=
$phone
;
$orderObj
->
goods_amount
=
$total_price
;
$orderObj
->
goods_amount
=
$total_price
;
$orderObj
->
order_amount
=
$total_price
;
$orderObj
->
order_amount
=
$total_price
;
$orderObj
->
goods_sn
=
$goodObj
->
goods_sn
;
$orderObj
->
goods_sn
=
$goodObj
->
goods_sn
;
...
@@ -152,7 +157,11 @@ public function CreateOrder(Request $request)
...
@@ -152,7 +157,11 @@ public function CreateOrder(Request $request)
$catKey
=
$request
->
catKey
??
''
;
//购物车KeyID拼接 5_1,6_2
$catKey
=
$request
->
catKey
??
''
;
//购物车KeyID拼接 5_1,6_2
$delivery_type
=
$request
->
delivery_type
;
// 收货方式 1:代收点 2:送货上门
$delivery_type
=
$request
->
delivery_type
;
// 收货方式 1:代收点 2:送货上门
$store_id
=
$request
->
store_id
??
0
;
//代收点 门店ID
$store_id
=
$request
->
store_id
??
0
;
//代收点 门店ID
$address_id
=
$request
->
address_id
??
0
;
//地址ID
//----收货地址----
$address
=
$request
->
address
??
''
;
//详情地址
$area
=
$request
->
area
??
''
;
$phone
=
$request
->
phone
??
''
;
$consignee
=
$request
->
consignee
??
''
;
if
(
!
$catKey
)
{
if
(
!
$catKey
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
...
@@ -163,12 +172,12 @@ public function CreateOrder(Request $request)
...
@@ -163,12 +172,12 @@ public function CreateOrder(Request $request)
}
}
$userAddress
=
''
;
$userAddress
=
''
;
if
(
$address_id
)
{
//
if ($address_id) {
$userAddress
=
UserAddress
::
where
([
'uid'
=>
$user_id
,
'id'
=>
$address_id
])
->
first
();
//
$userAddress = UserAddress::where(['uid' => $user_id, 'id' => $address_id])->first();
if
(
!
$userAddress
)
{
//
if (!$userAddress) {
return
$this
->
JsonResponse
(
''
,
'请选择收货地址'
,
500
);
//
return $this->JsonResponse('', '请选择收货地址', 500);
}
//
}
}
//
}
$order_sn
=
$this
->
getOrderSn
();
$order_sn
=
$this
->
getOrderSn
();
DB
::
beginTransaction
();
DB
::
beginTransaction
();
try
{
try
{
...
@@ -215,10 +224,10 @@ public function CreateOrder(Request $request)
...
@@ -215,10 +224,10 @@ public function CreateOrder(Request $request)
}
}
$orderObj
->
order_sn
=
$order_sn
;
$orderObj
->
order_sn
=
$order_sn
;
$orderObj
->
user_id
=
$user_id
;
$orderObj
->
user_id
=
$user_id
;
$orderObj
->
address
_id
=
$address_id
;
$orderObj
->
address
=
$address
;
$orderObj
->
a
ddress
=
$userAddress
?
$userAddress
->
address
:
''
;
$orderObj
->
a
rea
=
$area
;
$orderObj
->
consignee
=
$
userAddress
?
$userAddress
->
consignee
:
''
;
$orderObj
->
consignee
=
$
consignee
;
$orderObj
->
mobile
=
$
userAddress
?
$userAddress
->
phone
:
$userObj
->
phone
;
$orderObj
->
mobile
=
$phone
;
$orderObj
->
goods_amount
=
$total_price
;
$orderObj
->
goods_amount
=
$total_price
;
$orderObj
->
order_amount
=
$total_price
;
$orderObj
->
order_amount
=
$total_price
;
//$orderObj->goods_sn = $goodObj->goods_sn;
//$orderObj->goods_sn = $goodObj->goods_sn;
...
@@ -346,6 +355,7 @@ public function orderList(Request $request)
...
@@ -346,6 +355,7 @@ public function orderList(Request $request)
//'is_apply' => $is_apply,
//'is_apply' => $is_apply,
//'service_status' => $item->service_status,
//'service_status' => $item->service_status,
'order_amount'
=>
$item
->
order_amount
,
'order_amount'
=>
$item
->
order_amount
,
'verification_code'
=>
$item
->
verification_code
??
''
,
'created_at'
=>
date
(
"Y-m-d H:i"
,
strtotime
(
$item
->
created_at
)),
'created_at'
=>
date
(
"Y-m-d H:i"
,
strtotime
(
$item
->
created_at
)),
'order_goods'
=>
$order_goods
'order_goods'
=>
$order_goods
];
];
...
@@ -504,13 +514,14 @@ public function OrderInfo(Request $request)
...
@@ -504,13 +514,14 @@ public function OrderInfo(Request $request)
$order_goods
=
$this
->
getOrderGoods
(
$order_id
);
$order_goods
=
$this
->
getOrderGoods
(
$order_id
);
//快递待收点、收货地址
//快递待收点、收货地址
$delivery
=
[];
$delivery
=
[];
if
(
$orderObj
->
address_id
)
{
if
(
$orderObj
->
consignee
)
{
$addressObj
=
UserAddress
::
find
(
$orderObj
->
address_id
);
//$addressObj = UserAddress::find($orderObj->address_id);
$delivery
[
'contacts'
]
=
$addressObj
->
consignee
;
$delivery
[
'contacts'
]
=
$orderObj
->
consignee
;
$delivery
[
'phone'
]
=
$addressObj
->
phone
;
$delivery
[
'phone'
]
=
$orderObj
->
mobile
;
$delivery
[
'area'
]
=
$addressObj
->
area
;
$delivery
[
'address'
]
=
$orderObj
->
address
;
$delivery
[
'lat'
]
=
$addressObj
->
lat
;
$delivery
[
'area'
]
=
$orderObj
->
area
;
$delivery
[
'lng'
]
=
$addressObj
->
lng
;
// $delivery['lat'] = $addressObj->lat;
// $delivery['lng'] = $addressObj->lng;
}
}
if
(
$orderObj
->
store_id
)
{
if
(
$orderObj
->
store_id
)
{
$sObj
=
Store
::
find
(
$orderObj
->
store_id
);
$sObj
=
Store
::
find
(
$orderObj
->
store_id
);
...
@@ -522,6 +533,9 @@ public function OrderInfo(Request $request)
...
@@ -522,6 +533,9 @@ public function OrderInfo(Request $request)
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lat'
]
=
isset
(
$latlngArr
[
1
])
?
$latlngArr
[
1
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
$delivery
[
'lng'
]
=
isset
(
$latlngArr
[
0
])
?
$latlngArr
[
0
]
:
''
;
}
}
//订单状态
$order_status
=
$orderObj
->
order_status
;
$status_txt
=
OrderInfoModel
::
STATUS_OPTIONS
[
$order_status
];
$data
=
[
$data
=
[
'id'
=>
$orderObj
->
id
,
'id'
=>
$orderObj
->
id
,
...
@@ -529,6 +543,8 @@ public function OrderInfo(Request $request)
...
@@ -529,6 +543,8 @@ public function OrderInfo(Request $request)
'user_id'
=>
$orderObj
->
user_id
,
'user_id'
=>
$orderObj
->
user_id
,
'order_amount'
=>
$orderObj
->
order_amount
,
'order_amount'
=>
$orderObj
->
order_amount
,
'mobile'
=>
$orderObj
->
mobile
,
'mobile'
=>
$orderObj
->
mobile
,
'order_status'
=>
$order_status
,
'status_txt'
=>
$status_txt
,
'delivery'
=>
$delivery
,
'delivery'
=>
$delivery
,
'delivery_type'
=>
$orderObj
->
delivery_type
,
'delivery_type'
=>
$orderObj
->
delivery_type
,
'delivery_typename'
=>
(
$orderObj
->
delivery_type
==
1
)
?
'快递代收点'
:
'送货上门'
,
'delivery_typename'
=>
(
$orderObj
->
delivery_type
==
1
)
?
'快递代收点'
:
'送货上门'
,
...
...
app/Http/Controllers/Api/StoreController.php
View file @
4d3cf722
...
@@ -42,6 +42,7 @@ public function checkDistance(Request $request)
...
@@ -42,6 +42,7 @@ public function checkDistance(Request $request)
$lat1
=
$request
->
lat
??
''
;
$lat1
=
$request
->
lat
??
''
;
$lng1
=
$request
->
lng
??
''
;
$lng1
=
$request
->
lng
??
''
;
$flag
=
false
;
$flag
=
false
;
$store_id
=
0
;
if
(
$mid
)
{
if
(
$mid
)
{
$list
=
Store
::
where
([
'merchant_id'
=>
$mid
])
$list
=
Store
::
where
([
'merchant_id'
=>
$mid
])
->
select
([
'id'
,
'title'
,
'lat_lng'
,
'distance'
])
->
get
();
->
select
([
'id'
,
'title'
,
'lat_lng'
,
'distance'
])
->
get
();
...
@@ -52,12 +53,13 @@ public function checkDistance(Request $request)
...
@@ -52,12 +53,13 @@ public function checkDistance(Request $request)
$res
=
(
$lat1
&&
$lat2
)
?
$this
->
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
:
''
;
$res
=
(
$lat1
&&
$lat2
)
?
$this
->
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
:
''
;
if
(
$res
<=
$val
->
distance
)
{
if
(
$res
<=
$val
->
distance
)
{
$flag
=
true
;
$flag
=
true
;
break
;
}
}
}
}
}
else
{
}
else
{
$flag
=
true
;
$flag
=
true
;
}
}
return
$this
->
JsonResponse
([
'flag'
=>
$flag
]);
return
$this
->
JsonResponse
([
'flag'
=>
$flag
,
'delivery_store_id'
=>
$store_id
]);
}
}
function
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
function
haversineDistance
(
$lat1
,
$lng1
,
$lat2
,
$lng2
)
...
...
app/Http/Controllers/Api/SystemSettingController.php
View file @
4d3cf722
...
@@ -40,7 +40,7 @@ public function verificationGrCode(Request $request)
...
@@ -40,7 +40,7 @@ public function verificationGrCode(Request $request)
// 指定保存路径
// 指定保存路径
$folder_name
=
"/qrcode/"
.
date
(
"Ymd"
,
time
());
$folder_name
=
"/qrcode/"
.
date
(
"Ymd"
,
time
());
$filename
=
"verifi_code_"
.
$user_id
.
".png"
;
$filename
=
md5
(
"verifi_code_"
.
$code
.
"_"
.
$user_id
)
.
".png"
;
$savePath
=
public_path
()
.
"/uploads"
.
$folder_name
.
"/"
;
$savePath
=
public_path
()
.
"/uploads"
.
$folder_name
.
"/"
;
if
(
!
file_exists
(
$savePath
))
{
if
(
!
file_exists
(
$savePath
))
{
mkdir
(
$savePath
,
0755
,
true
);
mkdir
(
$savePath
,
0755
,
true
);
...
...
app/Http/Controllers/Api/UserController.php
View file @
4d3cf722
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
namespace
App\Http\Controllers\Api
;
namespace
App\Http\Controllers\Api
;
use
App\Command\Log
;
use
App\Command\Log
;
use
App\Handlers\QqCos
;
use
App\Handlers\FileUploadHandler
;
use
App\Handlers\FileUploadHandler
;
use
App\Models\Carousel
;
use
App\Models\Carousel
;
use
App\Models\GoodSku
;
use
App\Models\GoodSku
;
...
@@ -11,7 +10,7 @@
...
@@ -11,7 +10,7 @@
use
App\Models\Merchant
;
use
App\Models\Merchant
;
use
App\Models\User
;
use
App\Models\User
;
use
App\Models\UserAddress
;
use
App\Models\UserAddress
;
use
App\Models\
UserPermission
;
use
App\Models\
OrderDivideRecord
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -129,8 +128,36 @@ public function reduceShoppingCart(Request $request)
...
@@ -129,8 +128,36 @@ public function reduceShoppingCart(Request $request)
return
$this
->
JsonResponse
(
''
,
'购物车无资源'
,
500
);
return
$this
->
JsonResponse
(
''
,
'购物车无资源'
,
500
);
}
}
if
(
$cartKey
)
{
if
(
$cartKey
)
{
if
(
isset
(
$shoppingCart
[
$cartKey
]))
unset
(
$shoppingCart
[
$cartKey
]);
$ckeys
=
explode
(
','
,
$cartKey
);
foreach
(
$ckeys
as
$kk
=>
$vv
)
{
if
(
isset
(
$shoppingCart
[
$vv
]))
unset
(
$shoppingCart
[
$vv
]);
}
}
}
$user
->
shopping_cart
=
empty
(
$shoppingCart
)
?
null
:
json_encode
(
$shoppingCart
,
JSON_UNESCAPED_UNICODE
);
$user
->
save
();
return
$this
->
JsonResponse
(
''
);
}
//购物车商品数量更新
public
function
numberShoppingCart
(
Request
$request
)
{
$cart_id
=
$request
->
cartKey
??
''
;
$number
=
$request
->
num
??
0
;
$user
=
$request
->
user
();
$shoppingCart
=
$user
->
shopping_cart
?
json_decode
(
$user
->
shopping_cart
,
true
)
:
[];
if
(
empty
(
$shoppingCart
))
{
return
$this
->
JsonResponse
(
''
,
'购物车无资源'
,
201
);
}
foreach
(
$shoppingCart
as
$key
=>
$val
)
{
if
(
isset
(
$shoppingCart
[
$cart_id
]))
{
if
(
$number
)
{
$shoppingCart
[
$cart_id
][
'num'
]
=
$number
;
}
else
{
unset
(
$shoppingCart
[
$cart_id
]);
}
}
}
$user
->
shopping_cart
=
empty
(
$shoppingCart
)
?
null
:
json_encode
(
$shoppingCart
,
JSON_UNESCAPED_UNICODE
);
$user
->
shopping_cart
=
empty
(
$shoppingCart
)
?
null
:
json_encode
(
$shoppingCart
,
JSON_UNESCAPED_UNICODE
);
$user
->
save
();
$user
->
save
();
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
...
@@ -150,6 +177,7 @@ public function info(Request $request)
...
@@ -150,6 +177,7 @@ public function info(Request $request)
'phone_sec'
=>
$user
->
phone
?
substr
(
$user
->
phone
,
0
,
3
)
.
"****"
.
substr
(
$user
->
phone
,
7
)
:
''
,
'phone_sec'
=>
$user
->
phone
?
substr
(
$user
->
phone
,
0
,
3
)
.
"****"
.
substr
(
$user
->
phone
,
7
)
:
''
,
//'status' => $user->status,
//'status' => $user->status,
'merchant_id'
=>
$user
->
merchant_id
,
'merchant_id'
=>
$user
->
merchant_id
,
'buycode'
=>
$user
->
buycode
,
'balance'
=>
$balance
,
'balance'
=>
$balance
,
'total_revenue'
=>
$total_revenue
,
'total_revenue'
=>
$total_revenue
,
'cashout'
=>
$cashout
,
'cashout'
=>
$cashout
,
...
@@ -314,7 +342,7 @@ public function setUserAddress(Request $request)
...
@@ -314,7 +342,7 @@ public function setUserAddress(Request $request)
if
(
!
$model
->
save
())
{
if
(
!
$model
->
save
())
{
return
$this
->
JsonResponse
(
''
,
'设置收货地址失败'
,
201
);
return
$this
->
JsonResponse
(
''
,
'设置收货地址失败'
,
201
);
}
}
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
$model
->
toArray
()
);
}
}
//删除收货地址
//删除收货地址
...
@@ -375,6 +403,53 @@ public function getMyShare(Request $request)
...
@@ -375,6 +403,53 @@ public function getMyShare(Request $request)
return
$this
->
JsonResponse
(
$data
);
return
$this
->
JsonResponse
(
$data
);
}
}
//我的好友
public
function
getMyFriend
(
Request
$request
)
{
$user_id
=
$request
->
user
()
->
id
;
$page
=
$request
->
page
??
1
;
$limit
=
$request
->
limit
??
10
;
$type
=
$request
->
type
??
1
;
//1: 直推 2:间推
$where
=
[];
if
(
$type
==
1
)
{
$where
[
'spuid'
]
=
$user_id
;
}
else
{
$where
[
'second_spuid'
]
=
$user_id
;
}
$sql
=
User
::
where
([
'deleted_at'
=>
null
])
->
where
(
$where
);
$data
=
[
'total'
=>
$sql
->
count
(),
'total_page'
=>
ceil
(
$sql
->
count
()
/
$limit
),
'directAmount'
=>
0
,
'indirectAmount'
=>
0
,
'list'
=>
[]
];
//直推佣金总额 indirect
$directAmount
=
OrderDivideRecord
::
where
([
'sh_type'
=>
1
,
'um_id'
=>
$user_id
])
->
sum
(
'divide_price'
);
$data
[
'directAmount'
]
=
(
float
)
$directAmount
;
//间推佣金总额 indirect
$indirectAmount
=
OrderDivideRecord
::
where
([
'sh_type'
=>
2
,
'um_id'
=>
$user_id
])
->
sum
(
'divide_price'
);
$data
[
'indirectAmount'
]
=
(
float
)
$indirectAmount
;
$listData
=
$sql
->
offset
((
$page
-
1
)
*
$limit
)
->
limit
(
$limit
)
->
orderBy
(
'created_at'
,
'DESC'
)
->
get
();
if
(
$listData
->
toArray
())
{
foreach
(
$listData
as
$item
)
{
//获取会员给我产生的佣金
$uid
=
$item
->
id
;
$divide_price
=
OrderDivideRecord
::
where
([
'sh_type'
=>
$type
,
'um_id'
=>
$user_id
,
'user_id'
=>
$uid
])
->
sum
(
'divide_price'
);
$data
[
'list'
][]
=
[
'name'
=>
$item
->
name
,
'divide_price'
=>
(
float
)
$divide_price
,
'avatar'
=>
(
$item
->
avatar
?
env
(
'IMAGE_URL'
)
.
$item
->
avatar
:
''
),
'addtime'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
$item
->
created_at
))
];
}
}
return
$this
->
JsonResponse
(
$data
);
}
//绑定直购码
//绑定直购码
public
function
bindBuycode
(
Request
$request
)
public
function
bindBuycode
(
Request
$request
)
{
{
...
...
app/Store/Metrics/Examples/Sessions.php
View file @
4d3cf722
...
@@ -39,6 +39,8 @@ protected function init()
...
@@ -39,6 +39,8 @@ protected function init()
$dark35
=
$color
->
dark35
();
$dark35
=
$color
->
dark35
();
$light
=
$color
->
light
();
// 卡片内容宽度
// 卡片内容宽度
...
@@ -64,12 +66,13 @@ protected function init()
...
@@ -64,12 +66,13 @@ protected function init()
// 设置图表颜色
// 设置图表颜色
$this
->
chartColors
([
$this
->
chartColors
([
$color
->
primary
(),
$dark35
,
//
$dark35,
$dark35
,
$dark35
,
$
color
->
primary
()
,
$
dark35
,
$dark35
,
$dark35
,
...
@@ -78,7 +81,6 @@ protected function init()
...
@@ -78,7 +81,6 @@ protected function init()
$dark35
$dark35
]);
]);
}
}
...
@@ -127,13 +129,11 @@ public function handle(Request $request)
...
@@ -127,13 +129,11 @@ public function handle(Request $request)
$this
->
withChart
([
$this
->
withChart
([
[
[
'name'
=>
'收益'
,
'name'
=>
'收益'
,
'data'
=>
array_values
([
51
,
15
,
63
,
88
,
16
,
77
,
51
]),
'data'
=>
array_values
([
51
,
15
,
63
,
88
,
16
,
77
,
51
]),
],
],
]);
]);
}
}
}
}
...
@@ -161,7 +161,6 @@ public function withChart(array $data)
...
@@ -161,7 +161,6 @@ public function withChart(array $data)
'series'
=>
$data
,
'series'
=>
$data
,
]);
]);
}
}
...
@@ -231,8 +230,5 @@ public function withContent($title, $value, $style = 'success')
...
@@ -231,8 +230,5 @@ public function withContent($title, $value, $style = 'success')
HTML
HTML
);
);
}
}
}
}
app/Store/Metrics/Examples/StoreOrderChats.php
deleted
100644 → 0
View file @
7297a0dc
<?php
namespace
App\Store\Metrics\Examples
;
use
App\Models\StoreOrder
;
use
Dcat\Admin\Widgets\Metrics\Line
;
use
Illuminate\Http\Request
;
class
StoreOrderChats
extends
Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected
function
init
()
{
parent
::
init
();
$this
->
title
(
'已完成订单'
);
$this
->
dropdown
([
'7'
=>
'最近7天'
,
'30'
=>
'最近30天'
,
'365'
=>
'最近一年'
,
]);
$this
->
height
(
600
);
$this
->
chartHeight
(
500
);
$this
->
chartOptions
=
[
'colors'
=>
[
'#FF69B4'
],
'chart'
=>
[
'type'
=>
'area'
,
'dropShadow'
=>
[
'enabled'
=>
true
,
'color'
=>
'#000'
,
'top'
=>
18
,
'left'
=>
7
,
'blur'
=>
10
,
'opacity'
=>
0.2
],
'toolbar'
=>
[
'show'
=>
false
],
'zoom'
=>
[
//关闭缩放
'enabled'
=>
false
]
],
'stroke'
=>
[
'show'
=>
true
,
'width'
=>
1
,
'colors'
=>
[
'#77B6EA'
],
'curve'
=>
'smooth'
],
// 'fill' => [
// 'type' => 'gradient',
// 'gradient'=>[
// 'opacityFrom' => 0.6,
// 'opacityTo'=> 0.8
// ]
// ],
'grid'
=>
[
'borderColor'
=>
'#e7e7e7'
,
'row'
=>
[
'opacity'
=>
0.5
],
],
//圆点大小
'markers'
=>
[
'size'
=>
0
],
'dataLabels'
=>
[
'enabled'
=>
false
,
'offsetX'
=>
0
,
'style'
=>
[
'fontSize'
=>
'12px'
,
'colors'
=>
[
'#FFFFFF'
]
]
],
'plotOptions'
=>
[
'line'
=>
[
'horizontal'
=>
true
,
'dataLabels'
=>
[
'position'
=>
'top'
,
],
]
],
'xaxis'
=>
[
'categories'
=>
[],
],
];
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public
function
handle
(
Request
$request
)
{
switch
(
$request
->
get
(
'option'
))
{
case
'365'
:
$data
=
StoreOrder
::
getYearOrder
();
// 卡片内容
$this
->
withContent
(
'总量: '
.
$data
[
'total'
]);
// 图表数据
$this
->
withChart
(
$data
[
'list'
]);
break
;
case
'30'
:
$data
=
StoreOrder
::
getNumDayOrder
(
30
);
// 卡片内容
$this
->
withContent
(
'总量: '
.
$data
[
'total'
]);
// 图表数据
$this
->
withChart
(
$data
[
'list'
]);
break
;
case
'7'
:
default
:
$data
=
StoreOrder
::
getNumDayOrder
(
7
);
// 卡片内容
$this
->
withContent
(
'总量: '
.
$data
[
'total'
]);
// 图表数据
$this
->
withChart
(
$data
[
'list'
]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public
function
withChart
(
array
$data
)
{
$days
=
[];
$order_data
=
[
];
foreach
(
$data
as
$k
=>
$v
){
$days
[]
=
$k
;
$order_data
[]
=
$v
;
}
return
$this
->
chart
([
'series'
=>
[
[
'name'
=>
'完成订单'
,
'data'
=>
$order_data
],
],
'xaxis'
=>
[
'categories'
=>
$days
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public
function
withContent
(
$content
)
{
return
$this
->
content
(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
routes/api.php
View file @
4d3cf722
...
@@ -50,10 +50,10 @@
...
@@ -50,10 +50,10 @@
// Route::get('get-third-list', 'CategoryController@getThirdList'); //三级分类列表
// Route::get('get-third-list', 'CategoryController@getThirdList'); //三级分类列表
Route
::
get
(
'recommend-good'
,
'GoodController@getIndexGoods'
);
//首页商品列表
Route
::
get
(
'goods-list'
,
'GoodController@getList'
);
//分类商品列表
Route
::
get
(
'goods-list'
,
'GoodController@getList'
);
//分类商品列表
Route
::
get
(
'recommend-good'
,
'GoodController@getIndexGoods'
);
//首页商品列表
Route
::
post
(
'get-ajax-attr'
,
'GoodController@getAttrKey'
);
//商品规格查询
Route
::
post
(
'get-ajax-attr'
,
'GoodController@getAttrKey'
);
//商品规格查询
Route
::
get
(
'get-kefu-list'
,
'KefuController@getList'
);
//客服列表
Route
::
get
(
'get-kefu-list'
,
'KefuController@getList'
);
//客服列表
...
@@ -84,6 +84,14 @@
...
@@ -84,6 +84,14 @@
Route
::
get
(
'home'
,
'UserController@home'
);
//首页数据
Route
::
get
(
'home'
,
'UserController@home'
);
//首页数据
Route
::
get
(
'recommend-good-auth'
,
'GoodController@getIndexGoods'
);
//首页商品列表
Route
::
get
(
'goods-list-auth'
,
'GoodController@getList'
);
//分类商品列表
Route
::
get
(
'get-good-detail-auth'
,
'GoodController@getDetail'
);
//商品详情
Route
::
post
(
'get-ajax-attr-auth'
,
'GoodController@getAttrKey'
);
//商品规格查询
Route
::
post
(
'upload'
,
'UserController@uploadFile'
);
//统一上传接口
Route
::
post
(
'upload'
,
'UserController@uploadFile'
);
//统一上传接口
Route
::
get
(
'qrCode'
,
'SystemSettingController@qrCode'
);
//生成二维码
Route
::
get
(
'qrCode'
,
'SystemSettingController@qrCode'
);
//生成二维码
...
@@ -94,7 +102,7 @@
...
@@ -94,7 +102,7 @@
Route
::
get
(
'user-share'
,
'UserController@share'
);
//用户二维码分享
Route
::
get
(
'user-share'
,
'UserController@share'
);
//用户二维码分享
Route
::
get
(
'my-
share'
,
'UserController@getMyShare'
);
//我的邀请
Route
::
get
(
'my-
friend'
,
'UserController@getMyFriend'
);
//我的好友
Route
::
post
(
'bind-buycode'
,
'UserController@bindBuycode'
);
//绑定直购码
Route
::
post
(
'bind-buycode'
,
'UserController@bindBuycode'
);
//绑定直购码
...
@@ -104,6 +112,8 @@
...
@@ -104,6 +112,8 @@
Route
::
post
(
'reduce-shopping-cart'
,
'UserController@reduceShoppingCart'
);
//删减购物车
Route
::
post
(
'reduce-shopping-cart'
,
'UserController@reduceShoppingCart'
);
//删减购物车
Route
::
post
(
'number-shopping-cart'
,
'UserController@numberShoppingCart'
);
//购物车商品加减
Route
::
post
(
'express-collection'
,
'StoreController@getDeliveryList'
);
//快递代收点
Route
::
post
(
'express-collection'
,
'StoreController@getDeliveryList'
);
//快递代收点
Route
::
post
(
'check-distance'
,
'StoreController@checkDistance'
);
//送货上门-距离判断
Route
::
post
(
'check-distance'
,
'StoreController@checkDistance'
);
//送货上门-距离判断
...
...
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