dever 6 年之前
父节点
当前提交
d7bc80a30a
共有 1 个文件被更改,包括 17 次插入13 次删除
  1. 17 13
      main/lib/Core.php

+ 17 - 13
main/lib/Core.php

@@ -17,7 +17,7 @@ class Core
 		if ($state == false) {
 			$result = Dever::daemon(self::url($send), 'main');
 		} else {
-			$result = $this->call_api($send);
+			$result = $this->callAction($send);
 		}
 
 		return $result;
@@ -30,15 +30,8 @@ class Core
 		return $url;
 	}
 
-	public function call_api($send = array())
+	private function callAction($send)
 	{
-		$state = false;
-		if ($send) {
-			$state = true;
-		} else {
-			$send = json_decode(base64_decode(Dever::input('param')), true);
-		}
-		
 		if (isset($send['i']) && $send['i'] > 0) {
 			$wechat = new Wechat($send['i'], $send['a']);
 			$param = array();
@@ -53,11 +46,22 @@ class Core
 			if ($send['e']) {
 				Dever::load($send['a'] . '/' . $send['e'], $send['i'], $result, $send['p']);
 			}
-			if ($state == false) {
-				print_r($result);
-				die;
-			}
+
+			return $result;
 		}
+		return array();
+	}
+
+	public function call_api()
+	{
+		$send = json_decode(base64_decode(Dever::input('param')), true);
+		
+		$result = $this->callAction($send);
+		if (isset($result)) {
+			print_r($result);
+			die;
+		}
+		
 		return;
 	}
 }