OrderOfflineServices.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\pay;
  12. use app\services\BaseServices;
  13. use app\services\order\StoreOrderServices;
  14. use app\services\order\StoreOrderSuccessServices;
  15. use think\exception\ValidateException;
  16. /**
  17. * 线下支付
  18. * Class OrderOfflineServices
  19. * @package app\services\pay
  20. */
  21. class OrderOfflineServices extends BaseServices
  22. {
  23. /**
  24. * 线下支付
  25. * @param int $id
  26. * @return mixed
  27. */
  28. public function orderOffline(int $id)
  29. {
  30. /** @var StoreOrderServices $orderSerives */
  31. $orderSerives = app()->make(StoreOrderServices::class);
  32. $orderInfo = $orderSerives->get($id);
  33. if (!$orderInfo) {
  34. throw new ValidateException('订单不存在');
  35. }
  36. if ($orderInfo->paid) {
  37. throw new ValidateException('订单已支付');
  38. }
  39. /** @var StoreOrderSuccessServices $storeOrderSuccessServices */
  40. $storeOrderSuccessServices = app()->make(StoreOrderSuccessServices::class);
  41. $storeOrderSuccessServices->paySuccess($orderInfo->toArray(), PayServices::OFFLINE_PAY);
  42. return true;
  43. }
  44. }