Browse Source

fix: 回调服务处理

super-yimizi 1 month ago
parent
commit
8b28278816

+ 6 - 0
application/api/controller/Index.php

@@ -5,6 +5,7 @@ namespace app\api\controller;
 use app\common\controller\Api;
 use app\common\controller\Api;
 use app\common\model\Feedback;
 use app\common\model\Feedback;
 use app\api\validate\Feedback as FeedbackValidate;
 use app\api\validate\Feedback as FeedbackValidate;
+use app\common\Service\Pay\PayOperService;
 /**
 /**
  * 首页接口
  * 首页接口
  */
  */
@@ -19,6 +20,11 @@ class Index extends Api
      */
      */
     public function index()
     public function index()
     {
     {
+        // $result =  PayOperService::settle('20250628031925000000028802', '0.05','czdcd');
+        // echo "<pre>";
+        // print_r($result);
+        // echo "</pre>";
+        // exit;
         $this->success(__('User Center'));
         $this->success(__('User Center'));
     }
     }
 
 

+ 2 - 3
application/common/Service/Pay/PayOperService.php

@@ -96,11 +96,10 @@ class PayOperService
      */
      */
     public static function settle($orderSn, $payamount, $transactionid = '')
     public static function settle($orderSn, $payamount, $transactionid = '')
     {
     {
-        $order = OrderService::getDetailByOrderSn($orderSn);
+        $order = OrderService::getDetailByOrderSn($orderSn);       
         if (!$order->canPayHandle()) {
         if (!$order->canPayHandle()) {
             return false;
             return false;
         }
         }
-
         if ($payamount != $order->amount) {
         if ($payamount != $order->amount) {
             \think\Log::write("支付失败,订单支付金额不一致[{$orderSn}][{$payamount}][{$order->amount}]");
             \think\Log::write("支付失败,订单支付金额不一致[{$orderSn}][{$payamount}][{$order->amount}]");
             return false;
             return false;
@@ -109,7 +108,7 @@ class PayOperService
         // 启动事务
         // 启动事务
         Db::startTrans();
         Db::startTrans();
         try {
         try {
-            $order->status = OrderEnum::STATUS_PAY;
+            $order->order_status = OrderEnum::STATUS_PAY;
             // $order->transaction_id = $transactionid;
             // $order->transaction_id = $transactionid;
             $order->pay_amount = $payamount;
             $order->pay_amount = $payamount;
             $order->pay_time = time();
             $order->pay_time = time();