| 
					
				 | 
			
			
				@@ -120,14 +120,15 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$k = 'attr_' . $v['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$config['struct'][$k] = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$option = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$v['type_option'] = explode("\n", $v['type_option']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					foreach ($v['type_option'] as $k1 => $v1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						$option[$k1+1] = $v1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}*/
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$option = Dever::db('attr/value')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$config['struct'][$k]['name'] = $v['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$config['struct'][$k]['default'] = '';
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -208,7 +209,7 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if ($v['option_type'] && $v['option_type'] == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if ($v['is_must'] && $v['is_must'] == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$config['struct'][$k]['match'] = 'option';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -282,7 +283,14 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} elseif ($info['type'] == 9 && $info['value']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$info['value'] = explode(',', $info['value']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$info['value'] = $info['value'][0];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} elseif ($info['type'] >= 9 && $info['value']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} elseif ($info['type'] > 9 && $info['value']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$value = Dever::db('attr/value')->getData(array('info_id' => $info['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ($value) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if (isset($value[$info['value']])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$info['value'] = $value[$info['value']]['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$temp = explode("\n", $info['type_option']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if ($temp) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$info['value'] = $info['value'] - 1;
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -294,6 +302,7 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			*/
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($info['unit']) {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -337,9 +346,12 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($attr) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			foreach ($attr as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				$sort[$k] = $v[$reorder];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$attr[$k]['option'] = Dever::db('attr/value')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $attr[$k]['option'] = explode("\n", $v['type_option']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			array_multisort($sort, SORT_DESC, $attr);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -379,7 +391,7 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function getSearch($ids, $cate = true, $city = false, $search_value = false, $total = 3)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$value = array();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$search_value = Dever::preInput('attr_', $search_value);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$search_value = Dever::preInput('attr_', array(), $search_value);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($cate && $ids && Dever::project('category')) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$data = $this->getAttrByCate($ids, 'search_reorder', $total);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -401,6 +413,8 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if ($v['type'] == 7 && $city > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					# 获取地区,获取最后一个级别的地区
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$data[$k]['option'] = Dever::db('area/county')->state(array('city_id' => $city));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} elseif ($v['type'] == 1 || $v['type'] == 9) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					$data[$k]['option'] = Dever::db('attr/search')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					$data[$k]['option'] = Dever::db('attr/value')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -461,7 +475,12 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } elseif ($v['type'] == 1 && $v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //} elseif ($v['type'] == 1 && $v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } elseif ($v['type'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	$search = Dever::db('attr/search')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	print_r($where[$key]);die;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $temp = explode("\n", $v['type_option']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (isset($temp[$where[$key]-1])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $temp = explode(',', $temp[$where[$key]-1]);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -473,7 +492,14 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $match = str_replace('{v}', $tname . '.' . $key, $match);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $sql[] = $match;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //} elseif ($v['type'] == 9 && $v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } elseif ($v['type'] == 9 && $v['type_option']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	$search = Dever::db('attr/search')->getData(array('info_id' => $v['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	print_r($where[$key]);die;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $temp = explode("\n", $v['type_option']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (isset($temp[$where[$key]-1])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $temp = explode(',', $temp[$where[$key]-1]);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -487,6 +513,7 @@ class Api 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $match = str_replace('{v}', $tname . '.' . $key . '_e', $match);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         $sql[] = $match;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $sql[] = ' '.$tname.'.'.$key.' = "'.$where[$key].'"';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }
 
			 |