Sign in

PHP + redis balance reminder function

user2999345 edited in Mon, 11 Jul 2022

API interface call times reminder function

1: When the user calls the interface and finds that the number of times is less than 100, the added redis2.php opens the resident process mode, gets the data from redis and sends a short message to the customer

Facing problems

1. After the customer recharges , How to reset this state 2 , When the balance is insufficient , Prevent sending text messages constantly .. (important)

The great God gave me a thought,

2 Replies
commented on Mon, 11 Jul 2022

After sending SMS, delete the corresponding user record in redis

commented on Mon, 11 Jul 2022

Less than 100 times , Push the interface into the redis queue , PHP starts resident process timer consumption queue to send SMS to customers , If after recharging , To determine whether your wallet is enough money, do not need to send , Sorry, your credit is running low , Prevent sending SMS constantly , We have to judge , How long has the current user sent it , You can also use redis to record ( Is to determine whether the redis key exists , Like pre_ Cache1382380000 1 survived for 24 hours )

lock This question has been locked and the reply function has been disabled.