开发者

Increment counter w.r.t date

i am currently working on anppication where i need to increment a 开发者_StackOverflow社区counter depending on date. i mean i want to send 3 sms per day. How can in implement this feature.

Thanks in advance.


You will need a database (or some other permanent way) to store the count, with columns like "account id", "date" and "count".

When the user wants to send an sms, get his record by his account id (whatever that is). Check the date from that record against the current date. When you get no record, that user never sent an sms. When the date is not the current date, the user didn't send anything today.

Else check the count.

After sending, update (or insert) the record with the new count and date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜