|
@@ -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");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|