$recommend_list = $mechanism_model
->field("id,img,name,lng,lat,branch,address,logo,label,(6378.138 * 2 * asin(sqrt(pow(sin((lat * pi() / 180 - ".$lat." * pi() / 180) / 2),2) + cos(lat * pi() / 180) * cos(".$lat." * pi() / 180) * pow(sin((lng * pi() / 180 - ".$lng." * pi() / 180) / 2),2))) * 1000) as distance")
->whereNotNull('name')
->where(['id'=>['in',$tids]])
->order($order_)
->where($map)
->where($where)
->select();
tp5.1 通过sql 计算距离并排序
最新推荐文章于 2023-04-07 15:45:52 发布