From c2ae7d892e72dd03071a1bf9d76af99021481446 Mon Sep 17 00:00:00 2001 From: weigang Date: Thu, 13 Aug 2020 10:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/NotifyController.php | 4 ++++ app/Controller/PaymentController.php | 10 ++++++++-- app/Service/OrderService.php | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Controller/NotifyController.php b/app/Controller/NotifyController.php index 4794fce..7845876 100644 --- a/app/Controller/NotifyController.php +++ b/app/Controller/NotifyController.php @@ -40,6 +40,10 @@ class NotifyController extends BaseController // return true; } + + // 修改订单、子订单状态 + + // 更新销量、商品库存,新增月销数据 }); $response->send(); diff --git a/app/Controller/PaymentController.php b/app/Controller/PaymentController.php index ff5159e..e0c850c 100644 --- a/app/Controller/PaymentController.php +++ b/app/Controller/PaymentController.php @@ -39,6 +39,9 @@ class PaymentController extends BaseController 'openid' => $data['openid'], ]); + $result['sign_type'] = 'MD5'; + $result['timestamp'] = time(); + return $this->success($result); } @@ -57,18 +60,21 @@ class PaymentController extends BaseController ->first(); if (empty($orderMain)) { - return $this->result(ErrorCode::PAY_FAILURE, ['order_id' => $data['order_id']],'订单不存在或已失效'); + return $this->result(ErrorCode::PAY_FAILURE, $data,'订单不存在或已失效'); } $result = $app->order->unify([ 'body' => '懒族生活 - 当面支付', 'out_trade_no' => $orderMain->global_order_id, - 'total_fee' => bcmul(floatval($orderMain->money), 100), + 'total_fee' => bcmul(floatval($orderMain->money), 100, 0), 'notify_url' => config('site_host') . '/v1/notify/wxminiOffline', 'trade_type' => 'JSAPI', 'openid' => $data['openid'], ]); + $result['sign_type'] = 'MD5'; + $result['timestamp'] = time(); + return $this->success($result); } diff --git a/app/Service/OrderService.php b/app/Service/OrderService.php index 321c1f7..de1c925 100644 --- a/app/Service/OrderService.php +++ b/app/Service/OrderService.php @@ -83,8 +83,7 @@ class OrderService implements OrderServiceInterface // 统计订单中所有店铺当日订单数,做店铺订单序号 $countsArr = Order::query() - ->selectRaw('COUNT(*) AS count') - ->select('id') + ->selectRaw('id, COUNT(*) AS count') ->whereIn('store_id', explode(',', $dataMain['store_ids'])) ->where(['type' => OrderMain::ORDER_TYPE_ONLINE]) ->whereBetween('time', [date('Y-m-d 00:00:00'), date('Y-m-d 23:59:59')]) @@ -93,6 +92,7 @@ class OrderService implements OrderServiceInterface $storeOrderCounts = []; foreach ($countsArr as $key => &$row) { + var_dump('row', $row); $storeOrderCounts[$row['id']] = $row['count']; }