【微信企业号考勤】用什么方法来判断员工在常驻办公室签到签退
新手一枚,在此请教各位前辈一个问题。
最近在做微信企业号的考勤签到签退功能,现在服务器后台已经可以接收到微信用户发送过来的地理位置(经纬度),我的需求是用户只允许在常驻办公室区域(假设办公室很大,几百个平方,在这区域内都可签到签退,区域外则不允许)的地理位置进行签到签退。
获取到用户返回的经纬度后用什么办法判断其是否允许签到签退??
如果采用在数据库存储员工的办公地点地理位置信息然后与其返回的经纬度进行比较的方法判断,可这办公地点很大,地理位置信息如何存储?判断又如何判断?
回复讨论(解决方案)
首先!目前的地图定位误差也不算太准,好在是在公司,不管是wifi,gps定位还算准确,一般误差在100米之内,姑且最好达到50米。
1:
数据库中存储公司人员半年办公地点所处中心位置经纬度。且以改点为圆心,存储改点到所允许最大办公距离之间的距离,也就是半径了。每次用户签到或则签退,假如A,B两点,A点经度,纬度分别为λA和ΦA,B点的经度、纬度分别为λB和ΦB,d为距离。
利用如下方法:
d=111.12cos{1/[sinΦAsinΦB十 cosΦAcosΦBcos(λB-λA)]}
计算之间距离与数据库中对应用户所允许的距离(半径)比较。在半径发范围内,则允许签到签退。
2:和1类似。问题转化为,已知一个点坐标,求以该点位圆心,半径为r,圆上的所有点的坐标。
2.1:
选取工作人员经常办公地点中心存入数据库,计算改点距离最大允许范围的所有经纬度,存入数据库(不建议,也不科学,数据量大了吃不消。)。
2.2:
。求得是矩形的四个点存入数据库。用户在签到签退的时候比较数据库中的值。
希望这篇文章帮得到你 http://digdeeply.org/archives/06152067.html
建议2.2方法。
误差肯定是有的。
给点分吧
范围小就定个中心点,判断半径呗.
不过有时候不准,不好解决啊
想问的是除了经纬度能搞到网络状态么?
或者提交时候的ip是公司外网/内网ip就可以签到之类
首先!目前的地图定位误差也不算太准,好在是在公司,不管是wifi,gps定位还算准确,一般误差在100米之内,姑且最好达到50米。
1:
数据库中存储公司人员半年办公地点所处中心位置经纬度。且以改点为圆心,存储改点到所允许最大办公距离之间的距离,也就是半径了。每次用户签到或则签退,假如A,B两点,A点经度,纬度分别为λA和ΦA,B点的经度、纬度分别为λB和ΦB,d为距离。
利用如下方法:
d=111.12cos{1/[sinΦAsinΦB十 cosΦAcosΦBcos(λB-λA)]}
计算之间距离与数据库中对应用户所允许的距离(半径)比较。在半径发范围内,则允许签到签退。
2:和1类似。问题转化为,已知一个点坐标,求以该点位圆心,半径为r,圆上的所有点的坐标。
2.1:
选取工作人员经常办公地点中心存入数据库,计算改点距离最大允许范围的所有经纬度,存入数据库(不建议,也不科学,数据量大了吃不消。)。
2.2:
。求得是矩形的四个点存入数据库。用户在签到签退的时候比较数据库中的值。
希望这篇文章帮得到你 http://digdeeply.org/archives/06152067.html
建议2.2方法。
误差肯定是有的。
给点分吧
新手一枚,在此请教各位前辈一个问题。
最近在做微信企业号的考勤签到签退功能,现在服务器后台已经可以接收到微信用户发送过来的地理位置(经纬度),我的需求是用户只允许在常驻办公室区域(假设办公室很大,几百个平方,在这区域内都可签到签退,区域外则不允许)的地理位置进行签到签退。
获取到用户返回的经纬度后用什么办法判断其是否允许签到签退??
如果采用在数据库存储员工的办公地点地理位置信息然后与其返回的经纬度进行比较的方法判断,可这办公地点很大,地理位置信息如何存储?判断又如何判断?
回答得很详细,谢谢你。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Alipay PHP...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

An official introduction to the non-blocking feature of ReactPHP in-depth interpretation of ReactPHP's non-blocking feature has aroused many developers' questions: "ReactPHPisnon-blockingbydefault...
