当前位置:网站首页>php 根据经纬度查询距离
php 根据经纬度查询距离
2022-07-02 09:38:00 【木子李826】
$having = 'distance <= 5000'
$merch_store_info = db('merch_store')
->alias('ms')
->join('merch_cate mc','ms.cateid = mc.id','left')
->join('merch_sign sn','ms.sign_id = sn.id','left')
->where($where)
->field("ms.id,name,ms.business_time,ms.business_time_start,ms.business_time_end,ms.head_img,ms.address,ms.sales_count,mc.title as cate_name,sn.title as sign_name,sn.color,ms.lng,ms.lat,(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")
->having($having)
->order($sort)
->page($page, $pagesize)
->select();
边栏推荐
猜你喜欢
Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
[cloud native] 2.5 kubernetes core practice (Part 2)
基于Hardhat和Openzeppelin开发可升级合约(一)
RPA进阶(二)Uipath应用实践
What is the relationship between digital transformation of manufacturing industry and lean production
Thanos Receiver
MTK full dump grab
可昇級合約的原理-DelegateCall
Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
随机推荐
ctf 记录
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Attribute acquisition method and operation notes of C # multidimensional array
The working day of the month is calculated from the 1st day of each month
II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation
Win11 arm system configuration Net core environment variable
Homer预测motif
TIPC protocol
Homer forecast motif
Solve the problem of data blank in the quick sliding page of the uniapp list
The difference between SQL left join main table restrictions written after on and where
高德根据轨迹画线
JS -- take a number randomly from the array every call, and it cannot be the same as the last time
sql left join 主表限制条件写在on后面和写在where后面的区别
Tick Data and Resampling
C#基于当前时间,获取唯一识别号(ID)的方法
Functional interfaces and method references
Xiao Sha's pain (double pointer
二.Stm32f407芯片GPIO编程,寄存器操作,库函数操作和位段操作
mysql链表数据存储查询排序问题