|
|
@@ -2,11 +2,40 @@
|
|
|
|
|
|
namespace hd\controllers;
|
|
|
|
|
|
-use bizHd\wx\services\WxOpenService;
|
|
|
-use common\components\miniUtil;
|
|
|
+use bizHd\order\classes\OrderClass;
|
|
|
+use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
class TestController extends BaseController
|
|
|
{
|
|
|
+ public function actionTestPayAfter()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['order_id'];
|
|
|
+ $order = OrderClass::getById($id, true);
|
|
|
+ if (empty($order)) {
|
|
|
+ util::fail('没有找到订单');
|
|
|
+ }
|
|
|
+ if ($order->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单');
|
|
|
+ }
|
|
|
|
|
|
+ $payWay = 1; // balancePay
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $actPrice = $order->actPrice;
|
|
|
+ $order->debtPrice = $actPrice;
|
|
|
+ $order->remainDebtPrice = $actPrice;
|
|
|
+ $order->debt = 1;
|
|
|
+ $order->save();
|
|
|
+ OrderClass::payAfter($order, $payWay);
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('付款成功');
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::info("付款失败原因:" . $exception->getMessage());
|
|
|
+ util::fail('操作失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|