[WeChat enterprise account attendance] how can I determine whether an employee signs in and signs out in a resident office?

Source: Internet
Author: User
Tags acos asin
[Enterprise ID attendance] how can I determine a new employee sign-in and sign-out in the resident office? I would like to ask you a question.
Recently, I was working on the attendance sign-in and exit function of the enterprise number. now the server background can receive the geographical location (longitude and latitude) sent by the user ), my requirement is that the user is only allowed in the resident office area (assuming that the office is large and hundreds of square meters, sign in and exit within the area, but not outside the area) to sign in and exit.

After obtaining the longitude and latitude returned by the user, how can I determine whether the user is allowed to sign in and sign off ??

If you use a database to store the location information of an employee's office and compare it with the latitude and longitude returned by the database, how can you store the location information? How to judge?


Reply to discussion (solution)

First! The current map positioning error is not accurate. Fortunately, it is in the company, whether it is wifi, gps positioning is still accurate, the general error is within 100, and it is best to reach 50 meters.
1:
The database stores the longitude and latitude of the company's staff's office location for half a year. Take the change point as the center, and store the distance from the change point to the maximum allowed office distance, that is, the radius. If A user signs in or signs out, if A and B are at two points, the longitude and latitude of point A are λ A and phi A, and the longitude and latitude of point B are λ B and Phi B, respectively, d indicates the distance.
Use the following methods:
D = 111.12cos {1/[sin phi Asin Phi B ten cos Phi Acos Phi Bcos (λ B-λ A)]}
The distance between the calculation and the distance (radius) allowed by the corresponding user in the database. Within the sending range of the radius, you can sign in and exit.

2: similar to 1. The problem is converted to knowing the coordinate of a point, and finding the coordinates of all points on the circle with the center of the point, the radius as r.
2.1:
Select a staff member's frequent office location and store the data in the database to calculate all the longitude and latitude ranges from the change point to the maximum allowable range, and store the data in the database (not recommended or scientific, the amount of data is too large to eat .).
2.2:
. The four points of the rectangle are saved to the database. When you sign in and sign off, you can compare the values in the database.
Hope this article will help you http://digdeeply.org/archives/06152067.html

The 2.2 method is recommended.

There must be some errors.



Give me some points.

If the range is small, a central point is set to determine the radius.
But sometimes it's not correct. it's hard to solve it.

Can I get the network status in addition to the longitude and latitude?
Or the ip address you submit is the internet/intranet ip address of the company.

First! The current map positioning error is not accurate. Fortunately, it is in the company, whether it is wifi, gps positioning is still accurate, the general error is within 100, and it is best to reach 50 meters.
1:
The database stores the longitude and latitude of the company's staff's office location for half a year. Take the change point as the center, and store the distance from the change point to the maximum allowed office distance, that is, the radius. If A user signs in or signs out, if A and B are at two points, the longitude and latitude of point A are λ A and phi A, and the longitude and latitude of point B are λ B and Phi B, respectively, d indicates the distance.
Use the following methods:
D = 111.12cos {1/[sin phi Asin Phi B ten cos Phi Acos Phi Bcos (λ B-λ A)]}
The distance between the calculation and the distance (radius) allowed by the corresponding user in the database. Within the sending range of the radius, you can sign in and exit.

2: similar to 1. The problem is converted to knowing the coordinate of a point, and finding the coordinates of all points on the circle with the center of the point, the radius as r.
2.1:
Select a staff member's frequent office location and store the data in the database to calculate all the longitude and latitude ranges from the change point to the maximum allowable range, and store the data in the database (not recommended or scientific, the amount of data is too large to eat .).
2.2:
. The four points of the rectangle are saved to the database. When you sign in and sign off, you can compare the values in the database.
Hope this article will help you http://digdeeply.org/archives/06152067.html

The 2.2 method is recommended.

There must be some errors.



Give me some points.

Here, I would like to ask you a question.
Recently, I was working on the attendance sign-in and exit function of the enterprise number. now the server background can receive the geographical location (longitude and latitude) sent by the user ), my requirement is that the user is only allowed in the resident office area (assuming that the office is large and hundreds of square meters, sign in and exit within the area, but not outside the area) to sign in and exit.

After obtaining the longitude and latitude returned by the user, how can I determine whether the user is allowed to sign in and sign off ??

If you use a database to store the location information of an employee's office and compare it with the latitude and longitude returned by the database, how can you store the location information? How to judge?


The answer is very detailed. thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.