TestController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\order\classes\OrderClass;
  4. use common\components\util;
  5. use Yii;
  6. class TestController extends BaseController
  7. {
  8. public function actionTestPayAfter()
  9. {
  10. // $get = Yii::$app->request->get();
  11. // $id = $get['order_id'];
  12. // $order = OrderClass::getById($id, true);
  13. // if (empty($order)) {
  14. // util::fail('没有找到订单');
  15. // }
  16. // if ($order->mainId != $this->mainId) {
  17. // util::fail('不是你的订单');
  18. // }
  19. //
  20. // $payWay = 1; // balancePay
  21. // $connection = Yii::$app->db;
  22. // $transaction = $connection->beginTransaction();
  23. // try {
  24. // $actPrice = $order->actPrice;
  25. // $order->debtPrice = $actPrice;
  26. // $order->remainDebtPrice = $actPrice;
  27. // $order->debt = 1;
  28. // $order->save();
  29. // OrderClass::payAfter($order, $payWay);
  30. // $transaction->commit();
  31. // util::complete('付款成功');
  32. // } catch (\Exception $exception) {
  33. // $transaction->rollBack();
  34. // Yii::info("付款失败原因:" . $exception->getMessage());
  35. // util::fail('操作失败');
  36. // }
  37. }
  38. }