WeChat red packet development problems

Source: Internet
Author: User
Click "receive red envelopes" in the menu. The rule is to click at most one red envelope at a time. now the problem is that sometimes two red envelopes can be caught at a time, so that merchants cannot lose money. what I did previously was filter through database records, I got a red packet online database entry record, but it was useless. then I thought about it... click "receive red envelopes" in the menu. The rule is to click at most one red envelope at a time. now the problem is that sometimes two red envelopes can be caught at a time, so that merchants cannot lose money. what I did previously was filter through database records, I got a red packet online database entry record, but it was useless. then I tried to pass the session. for each user, I received a red packet and sent it to a session to clear the session, in this way, there will be no two identical red packets for users, but the session has not been tested. What are the best solutions ??

Reply content:

Click "receive red envelopes" in the menu. The rule is to click at most one red envelope at a time. now the problem is that sometimes two red envelopes can be caught at a time, so that merchants cannot lose money. what I did previously was filter through database records, I got a red packet online database entry record, but it was useless. then I tried to pass the session. for each user, I received a red packet and sent it to a session to clear the session, in this way, there will be no two identical red packets for users, but the session has not been tested. What are the best solutions ??

Click it to execute a function. the function is used to receive a red packet. it is impossible to implement this function twice if it gets stuck?

If the SESSION is used, if the user receives the red packet, clears the COOKIE, and then receives the red packet again, the same user may receive the packet multiple times.
We recommend that you use apsaradb for redis to store the user information that has received red packets. This prevents users from clearing the cookies and refreshing the red packets.

You can use the token to hide the domain.
Verify the token when requesting a red envelope, and delete it after the verification is successful.

Cannot trust input from the client

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.