TP中根據座標計算距離並排序分頁
list($lng,$lat) = explode(',',$map['location']);
$EARTH=6378.137; //地球半徑
$PI=3.1415926535898; //PI值
unset($map['location']);
//work_lat、work_lng 代表數據庫中存儲的位置
$package_list=$this->where($map)
->field("*,(2 * $EARTH* ASIN(SQRT(POW(SIN($PI*(".$lat."-work_lat)/360),2)+COS($PI*".$lat."/180)* COS(work_lat * $PI/180)*POW(SIN($PI*(".$lng."-work_lng)/360),2)))) as juli")
->order('juli asc')
->paginate(10);