payUtil.php 1.9 KB

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