xxxrrrdddd 2 years ago
parent
commit
8333b52f7f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      application/api/controller/Common.php

+ 6 - 1
application/api/controller/Common.php

@@ -249,7 +249,12 @@ class Common extends Api
     public function get_area(){
         $rs=null;
         if($name=input('name')){
-            $rs=Area::where('name|shortname',$name)->find();
+            $cacheName="area_name_".$name;
+            $rs=Cache::get($cacheName,null);
+            if(!$rs){
+                $rs=Area::where('name|shortname',$name)->find();
+                Cache::set($cacheName,$rs);
+            }
         }
         $this->success('',$rs);
     }