30 lines
839 B
PHP
30 lines
839 B
PHP
<?php
|
|
|
|
namespace app\api\logic;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\model\area\City;
|
|
use app\common\model\area\Area;
|
|
class AreaLogic extends BaseLogic
|
|
{
|
|
public static function getArea(){
|
|
$result = City::where('status',1)->with(['getArea'])->select()->toArray();
|
|
return $result;
|
|
}
|
|
|
|
public static function getDfaultArea($data){
|
|
$result = Area::where("lng",$data['longitude'])->where("lat",$data['latitude'])->find();
|
|
if($result == null){
|
|
return self::getDfault();
|
|
}
|
|
// $r = City::where('city_id',$result['id'])->find();
|
|
// if($r == null){
|
|
// return self::getDfault();
|
|
// }
|
|
return $result;
|
|
}
|
|
|
|
public static function getDfault(){
|
|
return Area::where("lng","121.472644")->where("lat","31.231706")->find();
|
|
}
|
|
} |