dever 6 年之前
父节点
当前提交
27bc742b98
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30 0
      vip/src/Api.php

+ 30 - 0
vip/src/Api.php

@@ -0,0 +1,30 @@
+<?php namespace Vip\Src;
+
+use Dever;
+
+# 未登录
+class Api
+{
+    # 检测是否支付成功
+    public function checkOrder()
+    {
+        $buy_id = Dever::input('buy_id');
+        $order_id = Dever::input('order_id');
+
+        if ($order_id) {
+            $info = Dever::db('vip/order')->one($order_id);
+            if ($info) {
+                if ($info['status'] == 2) {
+                    # 已支付
+                    $url = $this->url('success', array('buy_id' => $buy_id, 'order_id' => $order_id), 'vip');
+                    Dever::location($url);
+                    return;
+                }
+            }
+        }
+        # 未支付
+        $url = $this->url('pay', array('buy_id' => $buy_id, 'open' => 2), 'vip');
+        Dever::location($url);
+
+    }
+}