提交其他文件
This commit is contained in:
30
app/api/logic/AreaLogic.php
Normal file
30
app/api/logic/AreaLogic.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user