dever пре 3 година
родитељ
комит
39dbec545c
2 измењених фајлова са 11 додато и 6 уклоњено
  1. 5 2
      lib/Api.php
  2. 6 4
      lib/Parse.php

+ 5 - 2
lib/Api.php

@@ -26,7 +26,7 @@ class Api
 
 	public function test_api($id)
 	{
-		//Dever::setInput('test', 1);
+		Dever::setInput('test', 1);
 		$this->run($id);
 		return 'reload';
 	}
@@ -72,7 +72,10 @@ class Api
 		                # 等会儿再执行
 		                sleep(60);
 		            }
-		            Dever::daemon('lib/api.run?id=' . $id, 'spider');
+		            $num = Dever::process('lib/api.run?id=' . $id, true);
+		            if ($num <= 0) {
+		                Dever::daemon('lib/api.run?id=' . $id, 'spider');
+		            }
 				}
 			}
 			return true;

+ 6 - 4
lib/Parse.php

@@ -113,15 +113,15 @@ class Parse
 				}
 			}
 
+			if ($v['collect_filter_link'] == 1) {
+				$value = $this->filter($value);
+			}
+
 			if ($v['local'] == 1) {
 				$this->res = $v['res_key'];
 				$value = $this->local($value, $v['type']);
 			}
 
-			if ($v['collect_filter_link'] == 1) {
-				$value = $this->filter($value);
-			}
-
 			if ($value) {
 				$result[$v['key']] = $value;
 				if (Dever::input('test') == 1) {
@@ -175,6 +175,7 @@ class Parse
 
 	private function filter($content)
 	{
+		echo 1;die;
 		$rule = '<(a).+href="(.*?)"(.*?)>(.*?)<\/a>';
 		$content = preg_replace_callback('/' . $rule . '/i', array($this, 'filter_replace'), $content);
 		return $content;
@@ -182,6 +183,7 @@ class Parse
 
 	private function filter_replace($result)
 	{
+		print_r($result);die;
 		if (isset($result[4]) && $result[4]) {
 			return $result[4];
 		}