rabin 3 years ago
parent
commit
4981a79b4d
2 changed files with 19 additions and 4 deletions
  1. 13 0
      database/city.php
  2. 6 4
      lib/Manage.php

+ 13 - 0
database/city.php

@@ -222,6 +222,19 @@ return array
 			'col' => '*',
 		),
 
+		'getDatas' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'name' => array('yes', 'like'),
+				'province_id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'one',
+			'col' => '*',
+		),
+
 		'updateLevel' => array
 		(
 			'where' => array

+ 6 - 4
lib/Manage.php

@@ -50,11 +50,13 @@ class Manage
                     continue;
                 }
                 $w['name'] = $v;
-                $source = Dever::db('area/city')->getOne($w);
+                $source = Dever::db('area/city')->getDatas($w);
                 if ($source) {
-                    $update['where_id'] = $source['id'];
-                    $update['level_id'] = $id;
-                    Dever::db('area/city')->update($update);
+                    foreach ($source as $k => $v) {
+                        $update['where_id'] = $v['id'];
+                        $update['level_id'] = $id;
+                        Dever::db('area/city')->update($update);
+                    }
                 }
             }
             if ($id == 1) {