| 
					
				 | 
			
			
				@@ -37,18 +37,26 @@ class Spider 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $project_id = Dever::input('project_id', 1);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $info_id = Dever::input('info_id', 1);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $info = Dever::db('spider/project')->find($project_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $info = Dever::db('collection/info')->find($info_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Dever::alert('错误的配置');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $project = Dever::db('spider/project')->find($project_id);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$project) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Dever::alert('错误的配置');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['use'] = 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['limit'] = '0,15';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $data = Dever::db('spider/data')->getAll($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $name = $info['config'] ? $info['config'] : $info['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $name = $project['config'] ? $project['config'] : $project['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $year = date('Y');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $type = 11;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if ($info['config']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            parse_str($info['config'], $config);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($project['config']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            parse_str($project['config'], $config);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (isset($config['name'])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $name = $config['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -60,14 +68,23 @@ class Spider 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $update = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $update['pic_bg'] = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         foreach ($data as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $value = Dever::json_decode($v['value']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (isset($value['name']) && isset($value['pic'])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Dever::load('collection/lib/create.up', $info_id, $v['id'], $name, $value['name'], $year, $type, $value['pic']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $result = Dever::load('collection/lib/create.up', $info_id, $v['id'], $name, $value['name'], $year, $type, $value['pic']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($result) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $update['pic_cover'] = $result['cover_center'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $update['pic_bg'][] = $result['cover'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::db('spider/data')->update(array('where_id' => $v['id'], 'use' => 2));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $update['pic_bg'] = implode(',', $update['pic_bg']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $update['where_id'] = $info_id;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Dever::db('collection/info')->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return 'ok';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 |