dever 3 years ago
parent
commit
d1b67f6e0e
3 changed files with 36 additions and 2 deletions
  1. 25 1
      database/data.php
  2. 1 1
      lib/Api.php
  3. 10 0
      src/Data.php

+ 25 - 1
database/data.php

@@ -7,6 +7,13 @@ $option = array
 	2 => '删除',
 );
 
+$use = array
+(
+	1 => '未使用',
+	2 => '已使用',
+);
+
+
 $pid = Dever::input('search_option_pid');
 return array
 (
@@ -82,6 +89,18 @@ return array
 			//'list'		=> true,
 		),
 
+		'use'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '使用状态',
+			'default' 	=> '1',
+			'desc' 		=> '使用状态',
+			'match' 	=> 'is_numeric',
+			'option' 	=> $use,
+			'update'	=> 'radio',
+			'list'		=> true,
+		),
+
 		'state'		=> array
 		(
 			'type' 		=> 'tinyint-1',
@@ -117,6 +136,9 @@ return array
             //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
             //'导出EXCEL' => array('location', 'spider/data.excel?id=' . $pid),
             '导出SQL' => array('location', 'spider/data.sql?id=' . $pid . '&time=' . time()),
+            
+            '重置使用状态' => array('oper', 'spider/data.use?id=' . $pid),
+
             '清空数据' => array('oper', 'spider/data.drop?id=' . $pid),
         ),
 	),
@@ -144,11 +166,13 @@ return array
 			# 匹配的正则或函数 选填项
 			'option' => array
 			(
-				'config_id' => 'yes',
+				'pid' => 'yes',
+				'use' => 'yes',
 				'state' => 1,
 			),
 			'type' => 'all',
 			'order' => array('id', 'asc'),
+			'limit' => '0,12',
 		),
 
 		'getOne' => array

+ 1 - 1
lib/Api.php

@@ -205,7 +205,7 @@ class Api
 	private function parse($url, $project, $rule, $param, $col, $set, $push)
 	{
 		$test = Dever::input('test');
-		if ($test) {
+		if ($test == 1) {
 			$parse = new Parse($url, $project, $rule, $param, $col, $set, $push);
 			return $parse->get();
 		}

+ 10 - 0
src/Data.php

@@ -53,6 +53,16 @@ class Data
 		return 'reload';
 	}
 
+    # 清空数据
+    public function use()
+    {
+        $where['option_pid'] = Dever::input('id');
+        $where['set_use'] = 1;
+        Dever::db('spider/data')->updates($where);
+
+        return 'reload';
+    }
+
 	# 导出excel
     public function excel()
     {