Merge pull request 'dev' (#88) from dev into master

Reviewed-on: #88
This commit is contained in:
mkm 2023-12-02 15:11:15 +08:00
commit 16f88f6aa6
3 changed files with 31 additions and 9 deletions

View File

@ -102,6 +102,7 @@ class Order extends BaseController
$response = $client->request('GET', $getUrl); $response = $client->request('GET', $getUrl);
$courierData = json_decode($response->getBody(), true); $courierData = json_decode($response->getBody(), true);
$currOrderList[$k]['courier'] = $courierData['data']['courier_name']; $currOrderList[$k]['courier'] = $courierData['data']['courier_name'];
$currOrderList[$k]['status'] = $this->getStatusDesc($order['status']);
} }
// 待取货订单数 // 待取货订单数
@ -126,16 +127,19 @@ class Order extends BaseController
$type = $this->request->get('type',2); // 1今日 2总计 $type = $this->request->get('type',2); // 1今日 2总计
$townList = Db::name('geo_street')->field('street_code,street_name')->where('area_code', $this->areaCode)->select()->toArray(); // 镇/街道列表 $townList = Db::name('geo_street')->field('street_code,street_name')->where('area_code', $this->areaCode)->select()->toArray(); // 镇/街道列表
foreach ($townList as &$town) { $orderCount = 0;
$townOrderList = [];
foreach ($townList as $town) {
// 查询订单数 // 查询订单数
$orderCountQuery = Db::name('product_order_log')->where('street_code', $town['street_code'])->where('status', 1); $orderCountQuery = Db::name('product_order_log')->where('street_code', $town['street_code'])->where('status', 1);
if ($type == 1) { if ($type == 1) {
$orderCountQuery->whereDay('create_time', 'today'); $orderCountQuery->whereDay('create_time', 'today');
} }
$orderCount = $orderCountQuery->count(); $tempOrderCount = $orderCountQuery->count();
$town['order_count'] = $orderCount; $town['order_count'] = $tempOrderCount;
$orderCount += $tempOrderCount;
$townOrderList[] = $town;
} }
unset($town);
// $orderRankingQuery = Db::name('product_order_log')->alias('op') // $orderRankingQuery = Db::name('product_order_log')->alias('op')
// ->leftJoin('geo_street s','op.street_code = s.street_code') // ->leftJoin('geo_street s','op.street_code = s.street_code')
// ->field('op.street_code,COUNT(op.order_id) AS order_count,s.street_name') // ->field('op.street_code,COUNT(op.order_id) AS order_count,s.street_name')
@ -147,8 +151,27 @@ class Order extends BaseController
// } // }
// $orderRankingList = $orderRankingQuery->group('op.street_code')->order('order_count desc')->select(); // $orderRankingList = $orderRankingQuery->group('op.street_code')->order('order_count desc')->select();
$orderCountArr = array_column($townList, 'order_count'); $orderCountArr = array_column($townOrderList, 'order_count');
array_multisort($orderCountArr, SORT_DESC, $townList); array_multisort($orderCountArr, SORT_DESC, $townOrderList);
return app('json')->success($townList); return app('json')->success(compact('orderCount', 'townOrderList'));
}
private function getStatusDesc($status)
{
// 订单状态0待发货1待收货2待评价3已完成 9: 拼团中 10: 待付尾款 11:尾款超时未付 -1已退款
$desc = [
0 => '待取货',
1 => '待配送',
2 => '待评价',
3 => '已完成',
9 => '拼团中',
10 => '待付尾款',
11 => '尾款超时未付',
-1 => '已退款',
];
if (!isset($desc[$status])) {
return '未知';
}
return $desc[$status];
} }
} }

View File

@ -10,7 +10,6 @@ class ImportProductJob implements JobInterface
{ {
public function fire($job, $data) public function fire($job, $data)
{ {
Log::info('开始导入商品:');
if ($job->attempts() > 1) { if ($job->attempts() > 1) {
$job->delete(); $job->delete();
$this->failed($data); $this->failed($data);

View File

@ -378,7 +378,7 @@ class SpreadsheetExcelService
if($is_limit==true){ if($is_limit==true){
$limit=$sheet->getHighestRow(); $limit=$sheet->getHighestRow();
if($limit>$count){ if($limit>$count){
throw new ValidateException('导入的条数超过限制数量:'.$count); throw new ValidateException('导入的条数超过限制数量:'.$count.',当前表格数量'.$limit);
} }
} }