Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 【微信企业号考勤】用什么方法来判断员工在常驻办公室签到签退

【微信企业号考勤】用什么方法来判断员工在常驻办公室签到签退

Jun 23, 2016 pm 01:39 PM

新手一枚,在此请教各位前辈一个问题。
最近在做微信企业号的考勤签到签退功能,现在服务器后台已经可以接收到微信用户发送过来的地理位置(经纬度),我的需求是用户只允许在常驻办公室区域(假设办公室很大,几百个平方,在这区域内都可签到签退,区域外则不允许)的地理位置进行签到签退。

获取到用户返回的经纬度后用什么办法判断其是否允许签到签退??

如果采用在数据库存储员工的办公地点地理位置信息然后与其返回的经纬度进行比较的方法判断,可这办公地点很大,地理位置信息如何存储?判断又如何判断?


回复讨论(解决方案)

首先!目前的地图定位误差也不算太准,好在是在公司,不管是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方法。

误差肯定是有的。



给点分吧

新手一枚,在此请教各位前辈一个问题。
最近在做微信企业号的考勤签到签退功能,现在服务器后台已经可以接收到微信用户发送过来的地理位置(经纬度),我的需求是用户只允许在常驻办公室区域(假设办公室很大,几百个平方,在这区域内都可签到签退,区域外则不允许)的地理位置进行签到签退。

获取到用户返回的经纬度后用什么办法判断其是否允许签到签退??

如果采用在数据库存储员工的办公地点地理位置信息然后与其返回的经纬度进行比较的方法判断,可这办公地点很大,地理位置信息如何存储?判断又如何判断?


回答得很详细,谢谢你。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

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.

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

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

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

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,

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

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

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

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�...

Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

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

What exactly is the non-blocking feature of ReactPHP? How to handle its blocking I/O operations? What exactly is the non-blocking feature of ReactPHP? How to handle its blocking I/O operations? Apr 01, 2025 pm 03:09 PM

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...

See all articles