payUtil.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace common\components;
  3. use biz\recharge\classes\RechargeClass;
  4. use biz\renew\classes\RenewClass;
  5. use bizHd\order\classes\OrderClass;
  6. use bizHd\purchase\classes\PurchaseClearClass;
  7. use bizHd\purchase\services\PurchaseService;
  8. use bizHd\px\classes\PxApplyClass;
  9. use bizHd\px\services\PxApplyService;
  10. use Yii;
  11. class payUtil
  12. {
  13. public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach)
  14. {
  15. $connection = Yii::$app->db;
  16. $transaction = $connection->beginTransaction();
  17. try {
  18. //流水类型列表
  19. switch ($capitalType) {
  20. case dict::getDict('capitalType', 'xhRecharge', 'id'):
  21. //零售和供货商充值
  22. RechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  23. break;
  24. case dict::getDict('capitalType', 'xhPurchase', 'id'):
  25. //零售采购订单
  26. PurchaseService::thirdPay($payWay, $orderSn, $totalFee, $attach);
  27. break;
  28. case dict::getDict('capitalType', 'hdPurchaseClear', 'id'):
  29. //零售采购订单结清欠款
  30. PurchaseClearClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  31. break;
  32. case dict::getDict('capitalType', 'xhOrder', 'id'):
  33. //零售订单
  34. OrderClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  35. break;
  36. case dict::getDict('capitalType', 'xhRenew', 'id'):
  37. //零售和供货商续费订单
  38. RenewClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  39. break;
  40. case dict::getDict('capitalType', 'pxApply', 'id'):
  41. //培训报名
  42. PxApplyService::thirdPay($payWay, $orderSn, $totalFee, $attach);
  43. break;
  44. default:
  45. }
  46. $transaction->commit();
  47. } catch (Exception $exception) {
  48. $transaction->rollBack();
  49. util::fail("支付回调处理失败 orderSn:{$orderSn} capitalType:{$capitalType}");
  50. }
  51. }
  52. }