rabin 3 سال پیش
والد
کامیت
63476c6600
1فایلهای تغییر یافته به همراه29 افزوده شده و 0 حذف شده
  1. 29 0
      src/Api.php

+ 29 - 0
src/Api.php

@@ -184,6 +184,35 @@ class Api
         return $id;
     }
 
+    # 获取区域状态
+    public function getStatus($area)
+    {
+        $temp = explode(',', $area);
+        $num = count($temp);
+        if ($num == 4 && isset($temp[3]) && $temp[3] > 0) {
+            # 街道
+            $where['where_id'] = $temp[3];
+            $table = 'area/town';
+        } elseif ($num == 3 && isset($temp[2]) && $temp[2] > 0) {
+            # 区县
+            $where['where_id'] = $temp[2];
+            $table = 'area/county';
+        } elseif ($num == 2 && isset($temp[1]) && $temp[1] > 0) {
+            # 城市
+            $where['where_id'] = $temp[1];
+            $table = 'area/city';
+        }
+
+        if ($table) {
+            $where['clear'] = true;
+            $info = Dever::db($table)->find($where);
+            if ($info && $info['status'] == 2) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     # 修改区域状态
     public function upStatus($area, $status = 2)
     {