添加:在线买单 - 管理后台相关接口
This commit is contained in:
parent
5f770b8232
commit
d4de8c70e2
|
|
@ -2436,4 +2436,54 @@ class StoreOrderRepository extends BaseRepository
|
||||||
if (!$order) return null;
|
if (!$order) return null;
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 在线买单 - 统计
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/12 16:54
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getOnlineOrderStat():array{
|
||||||
|
$model = $this->dao->getSearch([])->where('activity_type',30);
|
||||||
|
return [
|
||||||
|
'total_pay_price' => $model->sum('pay_price'),// 总买单金额
|
||||||
|
'total_people_num' => $model->count('uid'),// 参与人数
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 在线买单 - 记录列表获取
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/12 17:01
|
||||||
|
* @param array $params
|
||||||
|
* @param int $page
|
||||||
|
* @param int $limit
|
||||||
|
* @return array
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function getOnlineOrderList(array $params,int $page,int $limit):array{
|
||||||
|
$query = $this->dao->getSearch([])
|
||||||
|
->when((int)$params['uid'] > 0,function($query) use ($params){
|
||||||
|
$query->where('uid', (int)$params['uid']);
|
||||||
|
})
|
||||||
|
->when((int)$params['mer_id'] > 0,function($query) use ($params){
|
||||||
|
$query->where('mer_id', (int)$params['mer_id']);
|
||||||
|
})
|
||||||
|
->with([
|
||||||
|
'user' => function($query){
|
||||||
|
$query->field('uid,nickname,avatar')->bind(['nickname','avatar']);
|
||||||
|
},
|
||||||
|
'merchant' => function($query){
|
||||||
|
$query->field('mer_id,mer_name,mer_avatar')->bind(['mer_name','mer_avatar']);
|
||||||
|
},
|
||||||
|
])
|
||||||
|
->where('activity_type',30)
|
||||||
|
->order('create_time DESC,order_id DESC');
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->page($page,$limit)->select();
|
||||||
|
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,4 +208,38 @@ class Order extends BaseController
|
||||||
$data = $this->repository->childrenList($id, 0);
|
$data = $this->repository->childrenList($id, 0);
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common: 在线买单 - 统计信息
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/12 16:58
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function onlineTitle(){
|
||||||
|
$statInfo = $this->repository->getOnlineOrderStat();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
['className' => 'el-icon-coin','count' => $statInfo['total_pay_price'],'field' => '元','name' => '总金额'],
|
||||||
|
['className' => 'el-icon-coin','count' => $statInfo['total_people_num'],'field' => '元','name' => '买单次数'],
|
||||||
|
];
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common: 在线买单 - 信息列表
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/01/12 17:01
|
||||||
|
* @return mixed
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function onlineList(){
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
$params = $this->request->params(['uid','mer_id']);
|
||||||
|
|
||||||
|
$data = $this->repository->getOnlineOrderList((array)$params,(int)$page,(int)$limit);
|
||||||
|
|
||||||
|
return app('json')->success($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ Route::group(function () {
|
||||||
'_path' => '/promoter/orderList',
|
'_path' => '/promoter/orderList',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
])->append(['is_spread' => 1]);
|
])->append(['is_spread' => 1]);
|
||||||
|
|
||||||
Route::group('order', function () {
|
Route::group('order', function () {
|
||||||
Route::get('lst', 'Order/getAllList')->name('systemOrderLst')->option([
|
Route::get('lst', 'Order/getAllList')->name('systemOrderLst')->option([
|
||||||
'_alias' => '列表',
|
'_alias' => '列表',
|
||||||
|
|
@ -81,7 +80,6 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Route::group('order', function () {
|
Route::group('order', function () {
|
||||||
|
|
||||||
Route::get('take_title', 'Order/takeTitle')->name('systemOrderTakeStat')->option([
|
Route::get('take_title', 'Order/takeTitle')->name('systemOrderTakeStat')->option([
|
||||||
|
|
@ -97,7 +95,6 @@ Route::group(function () {
|
||||||
'_path' => '/order/cancellation',
|
'_path' => '/order/cancellation',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Route::group('order', function () {
|
Route::group('order', function () {
|
||||||
Route::get('refund/lst', 'RefundOrder/getAllList')->name('systemRefundOrderLst')->option([
|
Route::get('refund/lst', 'RefundOrder/getAllList')->name('systemRefundOrderLst')->option([
|
||||||
'_alias' => '列表',
|
'_alias' => '列表',
|
||||||
|
|
@ -123,7 +120,18 @@ Route::group(function () {
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
// 在线买单相关
|
||||||
|
Route::group('order', function () {
|
||||||
|
Route::get('online_title', 'Order/onlineTitle')->name('systemOrderOnlineTitle')->option([
|
||||||
|
'_alias' => '在线买单统计',
|
||||||
|
]);
|
||||||
|
Route::get('online_list', 'Order/onlineList')->name('systemOrderOnlineList')->option([
|
||||||
|
'_alias' => '在线买单列表',
|
||||||
|
]);
|
||||||
|
})->prefix('admin.order.')->option([
|
||||||
|
'_path' => '/order/onlinePay',
|
||||||
|
'_auth' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
})->middleware(AllowOriginMiddleware::class)
|
})->middleware(AllowOriginMiddleware::class)
|
||||||
->middleware(AdminTokenMiddleware::class, true)
|
->middleware(AdminTokenMiddleware::class, true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue