dever 3 年之前
父节点
当前提交
aa34345f71
共有 1 个文件被更改,包括 18 次插入13 次删除
  1. 18 13
      app/shop/lib/Info.php

+ 18 - 13
app/shop/lib/Info.php

@@ -39,25 +39,30 @@ class Info
     # 获取店铺基本信息
     public function get($city, $lng, $lat, $name = '', $method = 'fetch', $shop_id = false, $address = false)
     {
-        if (!$city) {
+        $pingtai = 2;
+        $data = array();
+        if (!$city && !$lng && !$lat && !$address) {
             //Dever::alert('请传入城市');
+            $pingtai = 1;
+            $data = $this->fetch(false, $city, $lng, $lat, 10, $name, $method);
         }
+        
+        if ($pingtai == 2) {
+            if ((!$lng || !$lat) && $address) {
+                list($lng, $lat) = Dever::load('shop/lib/info')->geo($city, $address);
+            }
 
-        if ((!$lng || !$lat) && $address) {
-            list($lng, $lat) = Dever::load('shop/lib/info')->geo($city, $address);
-        }
-
-        if (!$lng || !$lat) {
-            $city_info = Dever::db('area/city')->find($city);
-            list($lng, $lat) = Dever::load('shop/lib/info')->geo($city, $city_info['name']);
             if (!$lng || !$lat) {
-                Dever::alert('请传入用户坐标');
+                $city_info = Dever::db('area/city')->find($city);
+                list($lng, $lat) = Dever::load('shop/lib/info')->geo($city, $city_info['name']);
+                if (!$lng || !$lat) {
+                    Dever::alert('请传入用户坐标');
+                }
             }
-        }
 
-        $data = array();
-        if ($city) {
-            $data = $this->fetch(false, $city, $lng, $lat, 1, $name, $method);
+            if ($city) {
+                $data = $this->fetch(false, $city, $lng, $lat, 1, $name, $method);
+            }
         }
         
         $type = Dever::input('type', 1);