Historical summary:

  • Wechat applets custom component – table component is coming
  • Make a note of the subcontracting of wechat small program project and the pre-downloading of subcontracting
  • Micro channel small program actual combat

Demand background

The product hopes to count the attendance of offline staff of our company. Currently, the function of Dingding cannot meet the demand of punching in multiple times a day in the field, so we plan to develop a punching system by ourselves. Our offline staff daily use an internal wechat mini program, and the product hopes to realize the function of field punching in the mini program. It is convenient for offline personnel to operate on the same platform.

Wechat mini program field punching

We have offline staff all over the country, and everyone’s workplace may be different. How do we get offline staff to punch in at designated places?

1. How to determine the target and scope of punching

In order to facilitate unified clocking management, a module is added for volunteer managers, who can add field objects. Offline workers select field objects matching within a radius of 1 km according to their current positioning, and select the objects to be clocked.

Field target: the target place for offline workers to clock in

2. How to ensure that you punch in multiple times a day

In the field, one offline work day to go to multiple work sites, each location has to be clocked, how to ensure multiple clocked a day? The product hopes that there will be corresponding sign-in and sign-off for each attendance. If they fail to complete the sign-in, they cannot create a new field. Each successful sign-in creates a field.

A field trip: a pair of check-ins and check-outs. The check-outs must be completed before the check-outs can be carried out at the next location.

3. Punch in

For the punch card function, we choose wechat small program development inside the location API: location, and location.

The user authorization scope. UserLocation is required before the location API is called.

The two main location apis used this time are:

  • Wx. chooseLocation opens the map to select a location;
  • Wx. getLocation Gets the current geographical location.

Reverse analysis of latitude and longitude requires the application of Tencent map key, application of developer key (KEY).

Come and go, check in:

4. How to prevent punching through the swipe interface?

  • MD5 encryption

Considering the possibility of clocking by capturing the longitude and latitude of packet submission, we specify a set of clocking encryption mechanism at the front and back ends. MD5 encryption is adopted to encrypt the combination of longitude and latitude, time stamp, small program key and so on. Each time the front end punches, 32 encrypted keys must be transmitted to the back end. Only after the back end verifies, can the punches be punched. This can prevent some of the operations through the interface card.

  • Clock autodyne

We require every check-in and check-out to take a selfie, although it can not completely eliminate the swipe card, but it can avoid some cheating.

Finally we clock in:

summary

Finally, the summary of the development team, front-end initiative drive, after the demand assessment, to think of a solution in advance, as far as possible to reduce unexpected problems, after the demand assessment can do a demo in advance, the technology selection, the degree of function realization, and the development cycle of the demand have a rough expectation.

reference

  • Wechat applets – Location API
  • Tencent Map – Application key
  • Tencent map – wechat small program plug-in – map selection plug-in