Kirin vor 3 Jahren
Ursprung
Commit
9655bdfb31
2 geänderte Dateien mit 11 neuen und 8 gelöschten Zeilen
  1. 1 1
      app/api/controller/PublicController.php
  2. 10 7
      app/models/system/SystemStore.php

+ 1 - 1
app/api/controller/PublicController.php

@@ -281,7 +281,7 @@ class PublicController
             ['latitude', ''],
             ['latitude', ''],
             ['longitude', ''],
             ['longitude', ''],
             ['page', 1],
             ['page', 1],
-            ['limit', 10]
+            ['limit', 10],
         ], $request, true);
         ], $request, true);
         $list = SystemStore::lst($latitude, $longitude, $page, $limit);
         $list = SystemStore::lst($latitude, $longitude, $page, $limit);
         if (!$list) $list = [];
         if (!$list) $list = [];

+ 10 - 7
app/models/system/SystemStore.php

@@ -88,7 +88,8 @@ class SystemStore extends BaseModel
     {
     {
         $model = new self();
         $model = new self();
         $model = $model->where('is_del', 0);
         $model = $model->where('is_del', 0);
-        $model = $model->where('is_show',1);
+        $model = $model->where('is_show', 1);
+        $model = $model->where('is_triple', 0);
         if ($latitude && $longitude) {
         if ($latitude && $longitude) {
             $model = $model->field(['*', self::distanceSql($latitude, $longitude)])->order('distance asc');
             $model = $model->field(['*', self::distanceSql($latitude, $longitude)])->order('distance asc');
         }
         }
@@ -106,13 +107,14 @@ class SystemStore extends BaseModel
         }
         }
         return $list;
         return $list;
     }
     }
+
     public static function getDistance($lat1, $lng1, $lat2, $lng2)
     public static function getDistance($lat1, $lng1, $lat2, $lng2)
     {
     {
         $earthRadius = 6367000; //approximate radius of earth in meters
         $earthRadius = 6367000; //approximate radius of earth in meters
-        $lat1 = ($lat1 * pi() ) / 180;
-        $lng1 = ($lng1 * pi() ) / 180;
-        $lat2 = ($lat2 * pi() ) / 180;
-        $lng2 = ($lng2 * pi() ) / 180;
+        $lat1 = ($lat1 * pi()) / 180;
+        $lng1 = ($lng1 * pi()) / 180;
+        $lat2 = ($lat2 * pi()) / 180;
+        $lng2 = ($lng2 * pi()) / 180;
         $calcLongitude = $lng2 - $lng1;
         $calcLongitude = $lng2 - $lng1;
         $calcLatitude = $lat2 - $lat1;
         $calcLatitude = $lat2 - $lat1;
         $stepOne = pow(sin($calcLatitude / 2), 2) + cos($lat1) * cos($lat2) * pow(sin($calcLongitude / 2), 2);
         $stepOne = pow(sin($calcLatitude / 2), 2) + cos($lat1) * cos($lat2) * pow(sin($calcLongitude / 2), 2);
@@ -120,8 +122,9 @@ class SystemStore extends BaseModel
         $calculatedDistance = $earthRadius * $stepTwo;
         $calculatedDistance = $earthRadius * $stepTwo;
         return round($calculatedDistance);
         return round($calculatedDistance);
     }
     }
-    public  function  amindinfo()
+
+    public function amindinfo()
     {
     {
-        return $this->hasOne(SystemAdmin::class,"id","admin_id");
+        return $this->hasOne(SystemAdmin::class, "id", "admin_id");
     }
     }
 }
 }