From 91f39ea2745163d1e224b695e418f4d449f87ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 27 Feb 2023 19:14:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/order/StoreOrderController.php | 15 +++------------ .../services/order/StoreOrderCreateServices.php | 13 ++++++++++++- crmeb/crmeb/utils/Json.php | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/crmeb/app/api/controller/v1/order/StoreOrderController.php b/crmeb/app/api/controller/v1/order/StoreOrderController.php index e6a94e5f4..3116b8d81 100644 --- a/crmeb/app/api/controller/v1/order/StoreOrderController.php +++ b/crmeb/app/api/controller/v1/order/StoreOrderController.php @@ -196,10 +196,7 @@ class StoreOrderController if ($bargainId) { $bargainServices->checkBargainUser((int)$bargainId, $uid); } - //下单前发票验证 - if ($invoice_id) { - $userInvoiceServices->checkInvoice((int)$invoice_id, $uid); - } + if ($pinkId) { $pinkId = (int)$pinkId; /** @var StorePinkServices $pinkServices */ @@ -235,7 +232,7 @@ class StoreOrderController } } $virtual_type = $cartGroup['cartInfo'][0]['productInfo']['virtual_type'] ?? 0; - $order = $createServices->createOrder($uid, $key, $cartGroup, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $virtual_type, $customForm); + $order = $createServices->createOrder($uid, $key, $cartGroup, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $virtual_type, $customForm, $invoice_id); if ($order === false) { if ($seckill_id || $combinationId || $advanceId || $bargainId) { foreach ($cartInfo as $item) { @@ -261,14 +258,8 @@ class StoreOrderController if (!$orderInfo || !isset($orderInfo['paid'])) { return app('json')->fail(410194); } - //创建开票数据 - if ($invoice_id) { - $storeOrderInvoiceServices->makeUp($uid, $orderId, (int)$invoice_id); - } - $info = compact('orderId', 'key'); - - return app('json')->status('success', 410203, $info); + return app('json')->status('success', 410203, compact('orderId', 'key')); // if ($orderId) { // switch ($payType) { diff --git a/crmeb/app/services/order/StoreOrderCreateServices.php b/crmeb/app/services/order/StoreOrderCreateServices.php index a00fc1665..a4fa5919b 100644 --- a/crmeb/app/services/order/StoreOrderCreateServices.php +++ b/crmeb/app/services/order/StoreOrderCreateServices.php @@ -21,6 +21,7 @@ use app\services\product\product\StoreCategoryServices; use app\services\shipping\ShippingTemplatesFreeServices; use app\services\shipping\ShippingTemplatesRegionServices; use app\services\shipping\ShippingTemplatesServices; +use app\services\user\UserInvoiceServices; use app\services\wechat\WechatUserServices; use app\services\BaseServices; use crmeb\exceptions\ApiException; @@ -137,8 +138,13 @@ class StoreOrderCreateServices extends BaseServices * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function createOrder($uid, $key, $cartGroup, $userInfo, $addressId, $payType, $useIntegral = false, $couponId = 0, $mark = '', $combinationId = 0, $pinkId = 0, $seckillId = 0, $bargainId = 0, $shippingType = 1, $real_name = '', $phone = '', $storeId = 0, $news = false, $advanceId = 0, $virtual_type = 0, $customForm = []) + public function createOrder($uid, $key, $cartGroup, $userInfo, $addressId, $payType, $useIntegral = false, $couponId = 0, $mark = '', $combinationId = 0, $pinkId = 0, $seckillId = 0, $bargainId = 0, $shippingType = 1, $real_name = '', $phone = '', $storeId = 0, $news = false, $advanceId = 0, $virtual_type = 0, $customForm = [], $invoice_id = 0) { + //下单前发票验证 + if ($invoice_id) { + app()->make(UserInvoiceServices::class)->checkInvoice((int)$invoice_id, $uid); + } + /** @var StoreOrderComputedServices $computedServices */ $computedServices = app()->make(StoreOrderComputedServices::class); $priceData = $computedServices->computedOrder($uid, $userInfo, $cartGroup, $addressId, $payType, $useIntegral, $couponId, true, $shippingType); @@ -271,6 +277,11 @@ class StoreOrderCreateServices extends BaseServices return $order; }); + //创建开票数据 + if ($invoice_id) { + app()->make(StoreOrderInvoiceServices::class)->makeUp($uid, $order['order_id'], (int)$invoice_id); + } + // 订单创建成功后置事件 event('OrderCreateAfterListener', [$order, compact('cartInfo', 'priceData', 'addressId', 'cartIds', 'news'), $uid, $key, $combinationId, $seckillId, $bargainId]); // 推送订单 diff --git a/crmeb/crmeb/utils/Json.php b/crmeb/crmeb/utils/Json.php index 8c1703070..bef491937 100644 --- a/crmeb/crmeb/utils/Json.php +++ b/crmeb/crmeb/utils/Json.php @@ -68,6 +68,6 @@ class Json $result = $msg; $msg = 'success'; } - return app('json')->success($msg, compact('status', 'result')); + return $this->success($msg, compact('status', 'result')); } } From ffe12525955b2c917a469d71f1961d0acdb945c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 27 Feb 2023 19:18:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/adminapi/controller/v1/user/User.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crmeb/app/adminapi/controller/v1/user/User.php b/crmeb/app/adminapi/controller/v1/user/User.php index 0502aa336..db6501581 100644 --- a/crmeb/app/adminapi/controller/v1/user/User.php +++ b/crmeb/app/adminapi/controller/v1/user/User.php @@ -378,6 +378,12 @@ class User extends AuthController ['spread_open', 1] ]); if (!$id) return app('json')->fail(100100); + if (!$data['real_name']) { + return app('json')->fail(410245); + } + if (!$data['phone']) { + return app('json')->fail(410245); + } if ($data['phone']) { if (!preg_match("/^1[3456789]\d{9}$/", $data['phone'])) return app('json')->fail(400252); } From 337e6d515131e197fb081f3dadb4fe71b182f424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Tue, 28 Feb 2023 09:28:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v1/order/StoreOrderController.php | 83 +------------------ .../order/StoreOrderCreateServices.php | 5 +- 2 files changed, 5 insertions(+), 83 deletions(-) diff --git a/crmeb/app/api/controller/v1/order/StoreOrderController.php b/crmeb/app/api/controller/v1/order/StoreOrderController.php index 3116b8d81..9f61275a2 100644 --- a/crmeb/app/api/controller/v1/order/StoreOrderController.php +++ b/crmeb/app/api/controller/v1/order/StoreOrderController.php @@ -154,8 +154,8 @@ class StoreOrderController * @param StoreOrderInvoiceServices $storeOrderInvoiceServices * @param StoreCombinationServices $combinationServices * @param $key + * @return \think\Response * @throws \Psr\SimpleCache\InvalidArgumentException - * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -260,87 +260,6 @@ class StoreOrderController } return app('json')->status('success', 410203, compact('orderId', 'key')); - -// if ($orderId) { -// switch ($payType) { -// case PayServices::WEIXIN_PAY: -// if ($orderInfo['paid']) return app('json')->fail(410174); -// //支付金额为0 -// if (bcsub((string)$orderInfo['pay_price'], '0', 2) <= 0) { -// //创建订单jspay支付 -// /** @var StoreOrderSuccessServices $success */ -// $success = app()->make(StoreOrderSuccessServices::class); -// $payPriceStatus = $success->zeroYuanPayment($orderInfo, $uid, PayServices::WEIXIN_PAY); -// if ($payPriceStatus)//0元支付成功 -// return app('json')->status('success', 410195, $info); -// else -// return app('json')->status('pay_error'); -// } else { -// /** @var OrderPayServices $payServices */ -// $payServices = app()->make(OrderPayServices::class); -// if ($from == 'app' && $request->isApp()) { -// $from = 'weixin'; -// } -// $info['jsConfig'] = $payServices->orderPay($orderInfo, $from); -// if ($from == 'weixinh5') { -// return app('json')->status('wechat_h5_pay', 410203, $info); -// } else { -// return app('json')->status('wechat_pay', 410203, $info); -// } -// } -// case PayServices::YUE_PAY: -// /** @var YuePayServices $yueServices */ -// $yueServices = app()->make(YuePayServices::class); -// $pay = $yueServices->yueOrderPay($orderInfo, $uid); -// if ($pay['status'] === true) -// return app('json')->status('success', 410197, $info); -// else { -// if (is_array($pay)) -// return app('json')->status($pay['status'], $pay['msg'], $info); -// else -// return app('json')->status('pay_error', $pay); -// } -// case PayServices::ALIAPY_PAY: -// if (!$quitUrl && ($request->isH5() || $request->isWechat())) { -// return app('json')->status('pay_error', 410198, $info); -// } -// [$url, $param] = explode('?', $quitUrl); -// $quitUrl = $url . '?order_id=' . $orderInfo['order_id']; -// //支付金额为0 -// if (bcsub((string)$orderInfo['pay_price'], '0', 2) <= 0) { -// //创建订单jspay支付 -// /** @var StoreOrderSuccessServices $success */ -// $success = app()->make(StoreOrderSuccessServices::class); -// $payPriceStatus = $success->zeroYuanPayment($orderInfo, $uid, PayServices::ALIAPY_PAY); -// if ($payPriceStatus)//0元支付成功 -// return app('json')->status('success', 410199, $info); -// else -// return app('json')->status('pay_error'); -// } else { -// /** @var OrderPayServices $payServices */ -// $payServices = app()->make(OrderPayServices::class); -// $info['jsConfig'] = $payServices->alipayOrder($orderInfo, $quitUrl, $from == 'routine'); -// $payKey = md5($orderInfo['order_id']); -// CacheService::set($payKey, ['order_id' => $orderInfo['order_id'], 'other_pay_type' => false], 300); -// $info['pay_key'] = $payKey; -// return app('json')->status(PayServices::ALIAPY_PAY . '_pay', 410203, $info); -// } -// case PayServices::OFFLINE_PAY: -// case 'pc': -// case 'friend': -// return app('json')->status('success', 410203, $info); -// case PayServices::ALLIN_PAY: -// /** @var OrderPayServices $payServices */ -// $payServices = app()->make(OrderPayServices::class); -// $info['jsConfig'] = $payServices->orderPay($orderInfo, $payType, [ -// 'returl' => sys_config('site_url') . '/pages/index/index', -// ]); -// if ($request->isWechat()) { -// $info['pay_url'] = AllinPay::UNITODER_H5UNIONPAY; -// } -// return app('json')->status(PayServices::ALLIN_PAY . '_pay', 410203, $info); -// } -// } else return app('json')->fail(410200); } /** diff --git a/crmeb/app/services/order/StoreOrderCreateServices.php b/crmeb/app/services/order/StoreOrderCreateServices.php index a4fa5919b..3672e93e9 100644 --- a/crmeb/app/services/order/StoreOrderCreateServices.php +++ b/crmeb/app/services/order/StoreOrderCreateServices.php @@ -132,8 +132,11 @@ class StoreOrderCreateServices extends BaseServices * @param string $phone * @param int $storeId * @param bool $news + * @param int $advanceId + * @param int $virtual_type + * @param array $customForm + * @param int $invoice_id * @return mixed - * @throws \Psr\SimpleCache\InvalidArgumentException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException