WeChat red envelope development issues

WBOY
Release: 2016-08-04 09:19:25
Original
1038 people have browsed it

Click to receive red envelopes through the WeChat menu. The rule is that you can get up to 1 red envelope with one click. The problem now is that sometimes two red envelopes can be issued with one click so that the merchant will not lose money. What I did before was to filter through database records and receive red envelopes. I tried inserting records in the online database, but it didn't work. Then I thought about using sessions. For each user, come in and receive a red envelope for a session, and then go out and clear the session. This way, the user will not have two identical red envelopes, but there is no session. Experiment, do you have any good ideas? ?

Reply content:

Click to receive red envelopes through the WeChat menu. The rule is that you can get up to 1 red envelope with one click. The problem now is that sometimes two red envelopes can be issued with one click so that the merchant will not lose money. What I did before was to filter through database records and receive red envelopes. I tried inserting records in the online database, but it didn't work. Then I thought about using sessions. For each user, come in and receive a red envelope for a session, and then go out and clear the session. This way, the user will not have two identical red envelopes, but there is no session. Experiment, do you have any good ideas? ?

With one click, a function is executed. The function of this function is to receive a red envelope. It is impossible to execute this function twice just by clicking on it, right?

If SESSION is used, if the user receives the red envelope, clears the COOKIE, and then receives the red envelope again, the problem will arise that the same user receives the red envelope multiple times.
It is recommended to use redis to store the user information that has received the red envelope to prevent the user from clearing the COOKIE and swiping the red envelope. There are no two identical red envelopes.

It can be solved by using token hidden domain.
Verify the token when requesting a red envelope, and delete it after successful verification.

Can’t trust the input from the client

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!