MerchantOrderCreateRepository.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\repositories\store\order;
  12. use think\facade\Db;
  13. use think\facade\Cache;
  14. use think\facade\Queue;
  15. use crmeb\jobs\SendSmsJob;
  16. use crmeb\services\PayStatusService;
  17. use crmeb\services\SwooleTaskService;
  18. use think\exception\ValidateException;
  19. use app\common\repositories\system\RecordRepository;
  20. use app\common\repositories\system\merchant\MerchantRepository;
  21. use app\common\repositories\store\coupon\StoreCouponUserRepository;
  22. use app\common\repositories\store\product\{
  23. ProductAttrValueRepository,
  24. ProductRepository
  25. };
  26. use app\common\repositories\user\{
  27. UserAddressRepository,
  28. UserBillRepository,
  29. UserRepository
  30. };
  31. class MerchantOrderCreateRepository extends StoreOrderRepository
  32. {
  33. use MerchantOrderTrait;
  34. const CACHE_KEY = 'order_create_cache';
  35. private function getUserRepository(): UserRepository
  36. {
  37. return app()->make(UserRepository::class);
  38. }
  39. private function getUserAddressRepository(): UserAddressRepository
  40. {
  41. return app()->make(UserAddressRepository::class);
  42. }
  43. private function getStoreCartRepository(): StoreCartRepository
  44. {
  45. return app()->make(StoreCartRepository::class);
  46. }
  47. private function getStoreCouponUserRepository(): StoreCouponUserRepository
  48. {
  49. return app()->make(StoreCouponUserRepository::class);
  50. }
  51. private function getMerchantRepository(): MerchantRepository
  52. {
  53. return app()->make(MerchantRepository::class);
  54. }
  55. private function getProductRepository(): ProductRepository
  56. {
  57. return app()->make(ProductRepository::class);
  58. }
  59. private function getProductAttrValueRepository(): ProductAttrValueRepository
  60. {
  61. return app()->make(ProductAttrValueRepository::class);
  62. }
  63. private function getStoreGroupOrderRepository(): StoreGroupOrderRepository
  64. {
  65. return app()->make(StoreGroupOrderRepository::class);
  66. }
  67. private function getUserBillRepository(): UserBillRepository
  68. {
  69. return app()->make(UserBillRepository::class);
  70. }
  71. private function getStoreOrderStatusRepository(): StoreOrderStatusRepository
  72. {
  73. return app()->make(StoreOrderStatusRepository::class);
  74. }
  75. private function getStoreOrderProductRepository(): StoreOrderProductRepository
  76. {
  77. return app()->make(StoreOrderProductRepository::class);
  78. }
  79. private function getRecordRepository(): RecordRepository
  80. {
  81. return app()->make(RecordRepository::class);
  82. }
  83. public function merchantInfo($merId)
  84. {
  85. $merchant = $this->getMerchantRepository()->get($merId);
  86. if (!$merchant) {
  87. throw new ValidateException('商家不存在');
  88. }
  89. return $merchant;
  90. }
  91. /**
  92. * 检查订单
  93. *
  94. * @return array
  95. */
  96. public function checkOrder(array $params): ?array
  97. {
  98. $result = [];
  99. $uid = $params['uid'];
  100. $key = md5(json_encode($params)) . $uid;
  101. // 校验用户信息
  102. $user = $this->validUser($uid);
  103. $svipStatus = (isset($user) && $user['is_svip'] > 0 && systemConfig('svip_switch_status') == '1');
  104. $userIntegral = $user['integral'] ?? 0;
  105. // 校验地址信息
  106. $address = $this->validAddress($params['address_id'], $uid);
  107. // 校验购物车信息
  108. $cartList = $this->validCartList($user, $params['merId'], $params['cart_ids'], $address);
  109. // 获取优惠券信息
  110. $userCoupons = $this->fetchUserCoupons($uid, $params['merId']);
  111. // 处理运费模板
  112. $cartProductShippingFeeTemplate = $this->template(array_column(array_column($cartList, 'product'), 'temp'));
  113. $result['totalCartNum'] = 0;
  114. $result['totalPaymentPrice'] = 0;
  115. $result['totalOriginalPrice'] = 0;
  116. $result['updatedPriceFlag'] = 0;
  117. $result['discountDetail']['updatedDiscountAmount'] = 0;
  118. $result['discountDetail']['vipDiscountAmount'] = 0;
  119. foreach ($cartList as &$value) {
  120. $cartNum = $value['cart_num'];
  121. $value['productAttr']['org_price'] = $value['productAttr']['price'];
  122. $value['productAttr']['show_svip_price'] = false;
  123. // 原价
  124. $value['totalAmount'] = (float)bcmul($value['productAttr']['price'], $cartNum, 2);
  125. // 改价后金额
  126. $updatedPriceFlag = (isset($value['productAttr']['new_price']) || isset($value['updatedTotalAmount'])) ? 1 : 0;
  127. if($updatedPriceFlag) {
  128. $value['updatedTotalAmount'] = $value['is_batch'] ? (float)$value['updatedTotalAmount'] : (float)bcmul($value['productAttr']['new_price'], $cartNum, 2);
  129. }
  130. // 会员权益后的金额
  131. $value['vipTotalAmount'] = ($svipStatus && !$updatedPriceFlag) ? (float)bcmul($value['productAttr']['svip_price'], $cartNum, 2) : 0;
  132. $value['productAttr']['show_svip_price'] = ($svipStatus && !$updatedPriceFlag) ? true : false;
  133. // 是否使用会员权益
  134. $value['useSvip'] = ($value['vipTotalAmount'] != 0) ? 1 : 0;
  135. // 实付价格:优先取改价后金额,若无改价后金额则取会员权益后的总金额,若无会员权益后的总金额则取原价
  136. $value['paymentPrice'] = ($updatedPriceFlag) ? $value['updatedTotalAmount'] : current(array_filter([$value['updatedTotalAmount'], $value['vipTotalAmount'], $value['totalAmount']]));
  137. // 计算优惠金额
  138. $value['updatedDiscountAmount'] = ($updatedPriceFlag) ? (float)bcsub($value['totalAmount'], $value['updatedTotalAmount'], 2) : 0;
  139. $value['vipDiscountAmount'] = (!$updatedPriceFlag && $value['vipTotalAmount'] != 0) ? (float)bcsub($value['totalAmount'], $value['vipTotalAmount'], 2) : 0;
  140. // 不免运费且为快递配送,则计算该商品的运费。【is_free_shipping : 0 不免运费,1 免运费】【delivery_way : 0 快递,1 自提】
  141. if ($params['is_free_shipping'] == 0 && $params['delivery_way'] == 0) {
  142. $shippingFeeTemplate = $value['product']['temp'] ? $value['product']['temp']->toArray() : null;
  143. // 判断是否符合免运费条件,free为空说明不免费,则计算运费
  144. if ($shippingFeeTemplate && empty($shippingFeeTemplate['free'])) {
  145. $cartProductShippingFeeTemplate[$value['product']['temp_id']]['aggregate'] += $this->productByTempNumber($value);
  146. }
  147. }
  148. $value['productAttr']['price'] = current(array_filter([$value['productAttr']['new_price'], $value['productAttr']['new_batch_price'], $value['productAttr']['svip_price'], $value['productAttr']['price']]));
  149. $result['totalCartNum'] += $cartNum;
  150. // 原价总金额
  151. $result['totalOriginalPrice'] += $value['totalAmount'];
  152. $result['totalPaymentPrice'] += $value['paymentPrice'];
  153. $result['discountDetail']['updatedDiscountAmount'] += $value['updatedDiscountAmount'];
  154. $result['discountDetail']['vipDiscountAmount'] += $value['vipDiscountAmount'];
  155. }
  156. // 判断改价,单商品改价标记为1,整单改价标记为2
  157. $cartUpdatePrice = array_column($cartList, 'is_batch');
  158. if($cartUpdatePrice) {
  159. $result['updatedPriceFlag'] = (in_array(0, $cartUpdatePrice)) ? 1 : 2;
  160. }
  161. $result['totalPrice'] = $result['totalPaymentPrice'];
  162. // 计算优惠券
  163. $result = $this->calculateCoupon($result, $cartList, $userCoupons, $params['merId'], $params['use_coupon'], $user);
  164. // 计算积分
  165. $result = $this->calculateIntegral($result, $cartList, $params['merId'], $params['use_integral'], $userIntegral);
  166. // 计算运费
  167. $result['totalShippingAmount'] = $address ? (float)$this->calculateShippingCost($cartProductShippingFeeTemplate) : 0;
  168. // 总优惠金额
  169. $result['totalDiscountAmount'] = array_sum($result['discountDetail']);
  170. // 支付总金额:实付总金额 + 运费
  171. $result['totalPaymentPrice'] = (float)bcadd($result['totalPaymentPrice'], $result['totalShippingAmount'], 2);
  172. $result['key'] = $key;
  173. $result['carts'] = $cartList;
  174. $result['address'] = $address;
  175. Cache::set(self::CACHE_KEY . $uid . '_' . $key, $result, 600);
  176. return $result;
  177. }
  178. /**
  179. * 创建订单
  180. *
  181. * @param array $params
  182. * @return void
  183. */
  184. public function createOrder(array $params)
  185. {
  186. $uid = $params['uid'];
  187. $cacheKey = self::CACHE_KEY . $uid . '_' . $params['key'];
  188. $orderInfo = Cache::get($cacheKey);
  189. if (!$orderInfo) {
  190. throw new ValidateException('订单操作超时,请刷新页面');
  191. }
  192. // 验证价格
  193. if ($params['old_pay_price'] != $orderInfo['totalPaymentPrice']) {
  194. throw new ValidateException('支付金额异常,参数信息与缓存不一致');
  195. }
  196. if ($orderInfo['totalPaymentPrice'] > 1000000) {
  197. throw new ValidateException('支付金额超出最大限制');
  198. }
  199. // 组装优惠ids, 验证use_coupon
  200. $usedCouponIds = [];
  201. $usedCoupons = isset($orderInfo['usedCoupons']) ? $orderInfo['usedCoupons'] : [];
  202. foreach ($usedCoupons as $value) {
  203. $usedCouponIds = array_unique(array_merge($usedCouponIds, array_column($value, 'id')));
  204. }
  205. // 验证address
  206. $address = $orderInfo['address'];
  207. if(!$address && $params['address_id']) {
  208. $address = $this->validAddress($params['address_id'], $uid);
  209. }
  210. $userAddress = isset($address) ? ($address['province'] . $address['city'] . $address['district'] . $address['street'] . $address['detail']) : '';
  211. // 计算成本金额
  212. $cost = 0;
  213. foreach ($orderInfo['carts'] as $cart) {
  214. $cost += bcmul($cart['productAttr']['cost'], $cart['cart_num']);
  215. }
  216. // 订单数据
  217. $groupOrder = [
  218. 'uid' => $uid,
  219. 'group_order_sn' => ($this->getNewOrderId(StoreOrderRepository::TYPE_SN_ORDER) . '0'),
  220. 'total_postage' => $orderInfo['totalShippingAmount'],
  221. 'total_price' => $orderInfo['totalPrice'],
  222. 'total_num' => $orderInfo['totalCartNum'],
  223. 'real_name' => $address['real_name'] ?? '',
  224. 'user_phone' => $address['phone'] ?? '',
  225. 'user_address' => $userAddress,
  226. 'pay_price' => $orderInfo['totalPaymentPrice'],
  227. 'coupon_price' => $orderInfo['discountDetail']['couponsDiscountAmount'] ?? 0,
  228. 'pay_postage' => $orderInfo['totalShippingAmount'],
  229. 'cost' => $cost,
  230. 'coupon_id' => (isset($orderInfo['usedCoupons']['platform'][0]['id']) ? $orderInfo['usedCoupons']['platform'][0]['id'] : 0),
  231. 'pay_type' => array_search($params['pay_type'], MerchantOrderCreateRepository::PAY_TYPE),
  232. 'integral' => $orderInfo['integral']['usedNum'] ?? 0,
  233. 'integral_price' => $orderInfo['discountDetail']['integralDiscountAmount'] ?? 0,
  234. 'is_behalf' => 1 // 代客下单订单标识
  235. ];
  236. // 子订单数据
  237. $order = [
  238. 'order_sn' => ($this->getNewOrderId(StoreOrderRepository::TYPE_SN_ORDER) . '1'),
  239. 'uid' => $uid,
  240. 'real_name' => $address['real_name'] ?? '',
  241. 'user_phone' => $address['phone'] ?? '',
  242. 'user_address' => $userAddress,
  243. 'cart_id' => implode(',', array_column($orderInfo['carts'], 'cart_id')),
  244. 'total_num' => $orderInfo['totalCartNum'],
  245. 'total_price' => $orderInfo['totalPrice'],
  246. 'total_postage' => $orderInfo['totalShippingAmount'],
  247. 'pay_price' => $orderInfo['totalPaymentPrice'],
  248. 'pay_postage' => $orderInfo['totalShippingAmount'],
  249. 'commission_rate' => $orderInfo['commission_switch'] ? $orderInfo['commission_rate'] : 0,
  250. 'integral' => $orderInfo['integral']['usedNum'] ?? 0,
  251. 'integral_price' => $orderInfo['discountDetail']['integralDiscountAmount'] ?? 0,
  252. 'coupon_id' => implode(',', $usedCouponIds),
  253. 'coupon_price' => $orderInfo['discountDetail']['couponsDiscountAmount'] ?? 0,
  254. 'platform_coupon_price' => array_sum(array_column(isset($orderInfo['usedCoupons']['platform']) ? $orderInfo['usedCoupons']['platform'] : [], 'price')) ?? 0,
  255. 'svip_discount' => $orderInfo['discountDetail']['vipDiscountAmount'] ?? 0,
  256. 'order_type' => $params['delivery_way'] == 4 ? 1 : $params['delivery_way'], // 0:快递 1:自提 4:无需核销(前端融合在一个字段里,在此处拆分开)
  257. 'behalf_no_verify' => $params['delivery_way'] == 4 ? 1: 0, // 代客下单订单是否无需核销
  258. 'is_virtual' => 0,
  259. 'mer_id' => $params['merId'],
  260. 'mark' => $params['mark'],
  261. 'cost' => $cost,
  262. 'pay_type' => array_search($params['pay_type'], MerchantOrderCreateRepository::PAY_TYPE),
  263. 'is_behalf' => 1 // 代客下单订单标识
  264. ];
  265. $carts = $orderInfo['carts'];
  266. $user = $this->validUser($uid);
  267. event('order.create.before', compact('groupOrder', 'order'));
  268. try {
  269. [$group, $storeOrder] = Db::transaction(function () use ($user, $params, $order, $groupOrder, $carts) {
  270. $orderProduct = [];
  271. $productRepository = $this->getProductRepository();
  272. $productAttrValueRepository = $this->getProductAttrValueRepository();
  273. // 1. 减库存,加销量,加使用积分抵扣金额总数 product_attr, attr_value, product
  274. $remainingPrice = $groupOrder['pay_price'];
  275. foreach ($carts as $key => $cart) {
  276. $productAttrValueRepository->descStock($cart['productAttr']['product_id'], $cart['productAttr']['unique'], $cart['cart_num']);
  277. $productRepository->descStock($cart['product']['product_id'], $cart['cart_num']);
  278. if ($cart['integral'] && $cart['integral']['use'] > 0) {
  279. $productRepository->incIntegral($cart['product']['product_id'], $cart['integral']['use'], $cart['integral']['price']);
  280. }
  281. $orderProduct[] = [
  282. 'cart_id' => $cart['cart_id'],
  283. 'uid' => $user->uid ?? 0,
  284. 'product_id' => $cart['product_id'],
  285. 'total_price' => $cart['totalAmount'],
  286. 'product_price' => $cart['paymentPrice'],
  287. 'svip_discount' => $cart['vipTotalAmount'],
  288. 'cost' => $cart['productAttr']['cost'],
  289. 'coupon_price' => $cart['couponsDiscount'],
  290. 'platform_coupon_price' => $cart['platformCouponDiscountAmount'],
  291. 'product_sku' => $cart['productAttr']['unique'],
  292. 'product_num' => $cart['cart_num'],
  293. 'refund_num' => $cart['cart_num'],
  294. 'integral_price' => $cart['integral']['price'] ?? 0,
  295. 'integral' => $cart['integral']['use'] ?? 0,
  296. 'integral_total' => $cart['integral']['price'] ?? 0,
  297. 'product_type' => $cart['product_type'],
  298. 'cart_info' => json_encode($cart),
  299. 'refund_switch' => $cart['product']['refund_switch'],
  300. ];
  301. }
  302. // 2. 修改购物车状态 store_cart
  303. $cartIds = array_column($carts, 'cart_id');
  304. $this->getStoreCartRepository()->updates($cartIds, ['is_pay' => 1]);
  305. // 3. 使用优惠券 user_coupon
  306. if (!empty($order['coupon_id'])) {
  307. $this->getStoreCouponUserRepository()->updates(explode(',', $order['coupon_id']), [
  308. 'use_time' => date('Y-m-d H:i:s'),
  309. 'status' => 1
  310. ]);
  311. }
  312. // 4. 主订单表 group_order
  313. $groupOrder = $this->getStoreGroupOrderRepository()->create($groupOrder);
  314. // 5. 生成账单记录,减积分 user, user_bill
  315. if ($groupOrder['integral'] > 0) {
  316. // 生成用户账单记录
  317. $this->getUserBillRepository()->decBill($user['uid'], 'integral', 'deduction', [
  318. 'link_id' => $groupOrder['group_order_id'],
  319. 'status' => 1,
  320. 'title' => '购买商品',
  321. 'number' => $groupOrder['integral'],
  322. 'mark' => '购买商品使用积分抵扣' . floatval($groupOrder['integral_price']) . '元',
  323. 'balance' => $user->integral
  324. ]);
  325. // 减用户积分
  326. $user->integral = bcsub($user->integral, $groupOrder['integral'], 0);
  327. $user->save();
  328. }
  329. // 6. 子订单表 order
  330. $order['group_order_id'] = $groupOrder->group_order_id;
  331. $storeOrder = $this->dao->create($order);
  332. // 7. 订单操作记录 order_status
  333. $orderStatus[] = [
  334. 'order_id' => $storeOrder->order_id,
  335. 'order_sn' => $storeOrder->order_sn,
  336. 'type' => StoreOrderStatusRepository::TYPE_ORDER,
  337. 'change_message' => '订单生成',
  338. 'change_type' => StoreOrderStatusRepository::ORDER_STATUS_CREATE,
  339. 'uid' => $user->uid ?? 0,
  340. 'nickname' => $user->nickname ?? '游客',
  341. 'user_type' => StoreOrderStatusRepository::U_TYPE_USER,
  342. ];
  343. $this->getStoreOrderStatusRepository()->batchCreateLog($orderStatus);
  344. // 8. 订单商品记录 order_product
  345. foreach ($orderProduct as $key => &$value) {
  346. $value['order_id'] = $storeOrder->order_id;
  347. $value['postage_price'] = $key == 0 ? $groupOrder['total_postage'] : 0;
  348. }
  349. $this->getStoreOrderProductRepository()->insertAll($orderProduct);
  350. // 9. 记录地址使用次数
  351. if ($params['address_id']) {
  352. $this->getRecordRepository()->addRecord(
  353. RecordRepository::TYPE_ADDRESS_RECORD,
  354. [
  355. 'address_id' => $params['address_id'],
  356. 'num' => 1
  357. ]
  358. );
  359. }
  360. event('order.create', compact('groupOrder'));
  361. return [$groupOrder, $storeOrder];
  362. });
  363. } catch (\Exception $e) {
  364. throw new ValidateException($e->getMessage());
  365. };
  366. // 库存不足提醒商家
  367. foreach ($carts as $cart) {
  368. if (($cart['productAttr']['stock'] - $cart['cart_num']) < (int)merchantConfig($params['merId'], 'mer_store_stock')) {
  369. SwooleTaskService::merchant(
  370. 'notice',
  371. [
  372. 'type' => 'min_stock',
  373. 'data' => [
  374. 'title' => '库存不足',
  375. 'message' => $cart['product']['store_name'] . '(' . $cart['productAttr']['sku'] . ')库存不足',
  376. 'id' => $cart['product']['product_id']
  377. ]
  378. ],
  379. $params['merId']
  380. );
  381. }
  382. }
  383. // 通知
  384. Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => $group->group_order_id]);
  385. // 自动打印订单
  386. $this->autoPrinter($storeOrder->order_id, $params['merId'], 2);
  387. Cache::delete($cacheKey);
  388. return $group;
  389. }
  390. /**
  391. * 支付
  392. * alipayQr 支付宝二维码支付
  393. * weixinQr 微信二维码支付
  394. * balance 余额支付
  395. * weixinBarCode 微信扫码枪支付
  396. * alipayBarCode 支付宝扫码枪支付
  397. *
  398. * @return void
  399. */
  400. public function merchantPay(array $params, $user, $groupOrder)
  401. {
  402. $authCode = isset($params['auth_code']) && !empty($params['auth_code']) ? $params['auth_code'] : '';
  403. return $this->pay($params['pay_type'], $user, $groupOrder, '', false, null, $authCode);
  404. }
  405. /**
  406. * 支付配置信息
  407. *
  408. * @param $uid
  409. * @return void
  410. */
  411. public function merchantPayConfig($uid, $merId)
  412. {
  413. $user = app()->make(UserRepository::class)->get($uid);
  414. $config = systemConfig(['pay_wechat_type', 'recharge_switch', 'yue_pay_status', 'pay_weixin_open', 'alipay_open', 'offline_switch', 'auto_close_order_timer', 'balance_func_status']);
  415. $merchant = $this->merchantInfo($merId);
  416. $timer = (int)($config['auto_close_order_timer'] ?: 15);
  417. $data = [
  418. 'is_wechat_v3' => $config['pay_wechat_type'] ? true : false,
  419. 'offline_switch' => $config['offline_switch'] && $merchant['offline_switch'] ? 1 : 0,
  420. 'now_money' => $user['now_money'] ?? 0,
  421. 'pay_weixin_open' => $config['pay_weixin_open'],
  422. 'alipay_open' => $config['alipay_open'],
  423. 'yue_pay_status' => ($config['yue_pay_status'] && $config['balance_func_status'] && $uid) ? 1 : 0,
  424. 'invalid_time' => time() + $timer * 60,
  425. ];
  426. return $data;
  427. }
  428. /**
  429. * 支付状态查询
  430. *
  431. * @param array $params
  432. * @return void
  433. */
  434. public function payStatus(array $params)
  435. {
  436. $groupOrder = $this->getStoreGroupOrderRepository()->status($params['uid'], intval($params['id']));
  437. if (!$groupOrder) {
  438. throw new ValidateException('订单不存在');
  439. }
  440. // 如果是扫码枪支付并且订单支付状态为0,则去微信/支付宝查询支付状态
  441. if (in_array($params['pay_type'], ['weixinBarCode', 'alipayBarCode']) && $groupOrder['paid'] == 0) {
  442. $payStatus = (new PayStatusService($params['pay_type'], $groupOrder->getPayParams()))->query();
  443. // 如果支付成功,则更新订单状态
  444. if (!empty($payStatus)) {
  445. $orders['transaction_id'] = $payStatus['transaction_id'];
  446. $this->paySuccess($groupOrder, 0, $orders);
  447. }
  448. }
  449. // 返回订单信息
  450. return $groupOrder;
  451. }
  452. }