feat: 添加了订单支付类型余额不足的异常处理和门店统计相关功能的优化
This commit is contained in:
parent
346b92aa67
commit
bded87e5e0
@ -296,6 +296,9 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($params['shipping_type'] == 2) {
|
if ($params['shipping_type'] == 2) {
|
||||||
$_order['status'] = 1;
|
$_order['status'] = 1;
|
||||||
}
|
}
|
||||||
|
if ($_order['pay_type']==PayEnum::BALANCE_PAY && $user!=null&&$user['now_money'] < $_order['pay_price']) {
|
||||||
|
throw new \Exception('余额不足');
|
||||||
|
}
|
||||||
//生成核销码
|
//生成核销码
|
||||||
$generator = new BarcodeGeneratorPNG();
|
$generator = new BarcodeGeneratorPNG();
|
||||||
$barcode = $generator->getBarcode($verify_code, $generator::TYPE_CODE_128);
|
$barcode = $generator->getBarcode($verify_code, $generator::TYPE_CODE_128);
|
||||||
|
@ -5,8 +5,10 @@ namespace app\statistics\controller;
|
|||||||
use app\admin\logic\statistic\TradeStatisticLogic;
|
use app\admin\logic\statistic\TradeStatisticLogic;
|
||||||
use app\common\controller\BaseLikeController;
|
use app\common\controller\BaseLikeController;
|
||||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\model\user_recharge\UserRecharge;
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
use app\statistics\logic\OrderLogic;
|
use app\statistics\logic\OrderLogic;
|
||||||
@ -63,7 +65,8 @@ class IndexController extends BaseLikeController
|
|||||||
/**
|
/**
|
||||||
* 门店统计
|
* 门店统计
|
||||||
*/
|
*/
|
||||||
public function sotre_count(){
|
public function sotre_count()
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
['street_name' => '喻寺镇', 'merchant_count' => 1],
|
['street_name' => '喻寺镇', 'merchant_count' => 1],
|
||||||
['street_name' => '立石镇', 'merchant_count' => 1],
|
['street_name' => '立石镇', 'merchant_count' => 1],
|
||||||
@ -75,7 +78,8 @@ class IndexController extends BaseLikeController
|
|||||||
return $this->success('ok', ['merchatCountList' => $data, 'merchantTotalCount' => count($data)]);
|
return $this->success('ok', ['merchatCountList' => $data, 'merchantTotalCount' => count($data)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function product_count_sotre_count(){
|
public function product_count_sotre_count()
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
['street_name' => '喻寺镇', 'product_count' => 1],
|
['street_name' => '喻寺镇', 'product_count' => 1],
|
||||||
['street_name' => '立石镇', 'product_count' => 1],
|
['street_name' => '立石镇', 'product_count' => 1],
|
||||||
@ -91,7 +95,6 @@ class IndexController extends BaseLikeController
|
|||||||
$productRankingTotal += $item['total_sales'];
|
$productRankingTotal += $item['total_sales'];
|
||||||
}
|
}
|
||||||
return $this->success('ok', ['townProductCountList' => $data, 'productRankingList' => $product_count, 'townProductCount' => $townProductCount, 'productRankingTotal' => $productRankingTotal]);
|
return $this->success('ok', ['townProductCountList' => $data, 'productRankingList' => $product_count, 'townProductCount' => $townProductCount, 'productRankingTotal' => $productRankingTotal]);
|
||||||
|
|
||||||
}
|
}
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
@ -222,4 +225,31 @@ class IndexController extends BaseLikeController
|
|||||||
}
|
}
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function store_order_day()
|
||||||
|
{
|
||||||
|
$arr = SystemStore::where('is_show', 1)->field('id,name street_name')->select()
|
||||||
|
->each(function($item){
|
||||||
|
$res = StoreOrder::where('paid', 1)->where('refund_status', 0)->where('store_id', $item['id'])->whereDay('create_time')->field('count(id) count,sum(pay_price) price')->find();
|
||||||
|
$month = StoreOrder::where('paid', 1)->where('refund_status', 0)->where('store_id', $item['id'])->whereMonth('create_time')->field('count(id) count,sum(pay_price) price')->find();
|
||||||
|
$item['dayOrderAmount']=$res['price']??0;
|
||||||
|
$item['dayOrderCount']=$res['count']??0;
|
||||||
|
$item['monthOrderAmount']=$month['price']??0;
|
||||||
|
$item['monthOrderCount']=$month['count']??0;
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
return $this->success('ok', $arr?->toArray());
|
||||||
|
}
|
||||||
|
public function store_order_day_two()
|
||||||
|
{
|
||||||
|
$arr = SystemStore::where('is_show', 1)->field('id,name street_name')->select()
|
||||||
|
->each(function($item){
|
||||||
|
$today_order_amount = StoreOrder::where('paid', 1)->where('refund_status', 0)->where('store_id', $item['id'])->whereDay('create_time')->sum('pay_price');
|
||||||
|
$yesterday_order_amount = StoreOrder::where('paid', 1)->where('refund_status', 0)->where('store_id', $item['id'])->whereMonth('create_time','yesterday')->sum('pay_price');
|
||||||
|
$item['today_order_amount']=$today_order_amount;
|
||||||
|
$item['yesterday_order_amount']=$yesterday_order_amount;
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
return $this->success('ok', $arr?->toArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user