dever 3 years ago
parent
commit
e34dc9d3ac
6 changed files with 71 additions and 0 deletions
  1. 11 0
      database/city.php
  2. 11 0
      database/county.php
  3. 9 0
      database/province.php
  4. 11 0
      database/town.php
  5. 1 0
      database/village.php
  6. 28 0
      src/Api.php

+ 11 - 0
database/city.php

@@ -127,6 +127,15 @@ return array
 			'order'		=> 'desc',
 			'edit'		=> true,
 		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
 		
 		'state'		=> array
 		(
@@ -164,6 +173,8 @@ return array
 			(
 				'province_id' => 'yes',
 				'level_id' => array('yes', '<'),
+				'noid' => array('yes-id', 'not in'),
+				'status' => 'yes',
 				'state' => 1,
 			),
 			'type' => 'all',

+ 11 - 0
database/county.php

@@ -165,6 +165,15 @@ return array
 			'order'		=> 'desc',
 			'edit'		=> true,
 		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
 		
 		'state'		=> array
 		(
@@ -202,6 +211,8 @@ return array
 			(
 				'city_id' => 'yes',
 				'level' => array('yes', '<'),
+				'noid' => array('yes-id', 'not in'),
+				'status' => 'yes',
 				'state' => 1,
 			),
 			'type' => 'all',

+ 9 - 0
database/province.php

@@ -77,6 +77,15 @@ return array
 			'order'		=> 'desc',
 			'edit'		=> true,
 		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
 		
 		'state'		=> array
 		(

+ 11 - 0
database/town.php

@@ -154,6 +154,15 @@ return array
 			'order'		=> 'desc',
 			'edit'		=> true,
 		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
 		
 		'state'		=> array
 		(
@@ -204,6 +213,8 @@ return array
 			(
 				'county_id' => 'yes',
 				'type' => array('yes', '>'),
+				'noid' => array('yes-id', 'not in'),
+				'status' => 'yes',
 				'state' => 1,
 			),
 			'type' => 'all',

+ 1 - 0
database/village.php

@@ -194,6 +194,7 @@ return array
 			'option' => array
 			(
 				'town_id' => 'yes',
+				'noid' => array('yes-id', 'not in'),
 				'state' => 1,
 			),
 			'type' => 'all',

+ 28 - 0
src/Api.php

@@ -167,6 +167,34 @@ class Api
         return $id;
     }
 
+    # 修改区域状态
+    public function upStatus($area, $status = 2)
+    {
+        $table = '';
+        $update['status'] = $status;
+        $temp = explode(',', $area);
+        $num = count($temp);
+        if ($num == 4) {
+            # 街道
+            $update['where_id'] = $temp[3];
+            $table = 'area/town';
+        } elseif ($num == 3) {
+            # 区县
+            $update['where_id'] = $temp[2];
+            $table = 'area/county';
+        } elseif ($num == 2) {
+            # 城市
+            $update['where_id'] = $temp[1];
+            $table = 'area/city';
+        }
+
+        $state = false;
+        if ($table) {
+            $state = Dever::db($table)->update($update);  
+        }
+        return $state;
+    }
+
     public function getProvince()
     {
         return Dever::db('area/province')->getAll();