pay.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace common\components;
  3. use biz\recharge\classes\RechargeClass;
  4. use bizHd\order\classes\OrderClass;
  5. use bizHd\purchase\classes\PurchaseClass;
  6. use bizHd\purchase\classes\PurchaseClearClass;
  7. use Yii;
  8. class pay
  9. {
  10. public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach)
  11. {
  12. $connection = Yii::$app->db;
  13. $transaction = $connection->beginTransaction();
  14. try {
  15. //流水类型列表
  16. switch ($capitalType) {
  17. case dict::getDict('capitalType', 'xhRecharge', 'id'):
  18. //零售和供货商充值
  19. RechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  20. break;
  21. case dict::getDict('capitalType', 'xhPurchase', 'id'):
  22. //零售采购订单
  23. PurchaseClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  24. break;
  25. case dict::getDict('capitalType', 'hdPurchaseClear', 'id'):
  26. //零售采购订单结算
  27. PurchaseClearClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  28. break;
  29. case dict::getDict('capitalType', 'xhOrder', 'id'):
  30. //零售订单
  31. OrderClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
  32. break;
  33. default:
  34. }
  35. $transaction->commit();
  36. } catch (Exception $exception) {
  37. $transaction->rollBack();
  38. util::fail("支付回调处理失败 orderSn:{$orderSn} capitalType:{$capitalType}");
  39. }
  40. }
  41. }