pay.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 bizHd\purchase\services\PurchaseService;
  8. use Yii;
  9. class pay
  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. default:
  35. }
  36. $transaction->commit();
  37. } catch (Exception $exception) {
  38. $transaction->rollBack();
  39. util::fail("支付回调处理失败 orderSn:{$orderSn} capitalType:{$capitalType}");
  40. }
  41. }
  42. }