Browse Source

微信支付回调

fuyu 5 years ago
parent
commit
f3c8ed652d
1 changed files with 28 additions and 0 deletions
  1. 28 0
      application/inter/controller/Wechat.php

+ 28 - 0
application/inter/controller/Wechat.php

@@ -0,0 +1,28 @@
+<?php
+namespace app\inter\controller;
+
+use think\Controller;
+use think\Db;
+use think\Session;
+use app\common\library\UUIDs;
+use think\Cache;
+use think\Log;
+use app\common\library\Verify;
+use think\File;
+use app\common\library\send_message;
+use app\common\library\Message;
+class Application extends Base {
+    public function  payConfirm() {
+        $param = $_REQUEST['param'];
+        $order_id = $param['order_id'];
+        $remote_order = DB::table('remote_order')->where('id', $order_id)->find();
+        if(!$remote_order) {
+            return json_encode(['status'=>'fail','code'=>'3001','msg'=> "没有找到该订单"]);
+        }
+        if($remote_order !== Application::ORDER_STATUS['CREATE']) {
+            return json_encode(['status'=>'fail','code'=>'3002','msg'=> "订单状态出错"]);
+        }
+        DB::table('remote_order')->where('id', $order_id)->update(["status" => Application::ORDER_STATUS['PAYCOMPLTET']]);
+        return json_encode(['status'=>'ok','code'=>'0000','msg'=> "支付回调成功"]);
+    }
+}