payUtil.php 2.1 KB

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