dever vor 6 Jahren
Ursprung
Commit
73f1b57680
2 geänderte Dateien mit 24 neuen und 8 gelöschten Zeilen
  1. 20 8
      service/src/Base.php
  2. 4 0
      vip/src/Buy.php

+ 20 - 8
service/src/Base.php

@@ -24,13 +24,20 @@ class Base
         $this->seller = $this->getConfig('seller', 1);
 
         $this->signature = Dever::input('signature');
-
-        $this->user = Dever::load('passport/user')->data();
-        # 用户信息
-        if (!$this->user && $this->signature) {
-            $uid = Dever::load('passport/applet')->check();
-
-            $this->user = Dever::db('passport/user')->one($uid);
+        $this->source_type = Dever::input('source_type');
+
+        if ($this->source_type) {
+            $this->user = array();
+            $this->user['id'] = -1;
+            $this->user['username'] = '未登录用户';
+            $this->user['mobile'] = '';
+        } else {
+            $this->user = Dever::load('passport/user')->data();
+            # 用户信息
+            if (!$this->user && $this->signature) {
+                $uid = Dever::load('passport/applet')->check();
+                $this->user = Dever::db('passport/user')->one($uid);
+            }
         }
     }
 
@@ -92,7 +99,12 @@ class Base
         $send['type'] = $this->type;
         $send['seller'] = $this->seller;
         $param['p'] = Dever::encode(Dever::json_encode($send), $this->key);
-        $param['signature'] = $this->signature;
+        if ($this->signature) {
+            $param['signature'] = $this->signature;
+        }
+        if ($this->source_type) {
+            $param['source_type'] = $this->source_type;
+        }
     	$param = http_build_query($param);
     	$url = Dever::url($uri . '?' . $param, $project);
 

+ 4 - 0
vip/src/Buy.php

@@ -157,6 +157,10 @@ class Buy extends Base
             $param['h5'] = 1;
         }
 
+        if ($this->source_type) {
+            //$param['refer'] = $this->source_type;
+        }
+
         return Dever::load('pay/api.page', $param);
     }
 }