Suppose I set a total of 1000 gift packs, 100 each day. no matter whether all the 100 gift packs are received on the day, I re-count the remaining number of gift packs. The next day, if the remaining number of gift packs is 100, the number of new gift packs will be 100 on the same day. if the number is not 100, the current number of gift packs will be issued... suppose I set a total of 1000 gift packs, 100 each day. no matter whether all the 100 gift packs are received on the day, I re-count the remaining number of gift packs. The next day, if the remaining number of gift packs is 100, the number of new gift packs will be 100 on the same day. if not, the current number of gift packs will be issued until all the gift packs are received.
The problem is, how can I automatically update the quantity in the next day? Time acquisition is a problem. I should store a time field in the database, but automatic time update is a problem, do you understand what I mean?
Reply content:
Suppose I set a total of 1000 gift packs, 100 each day. no matter whether all the 100 gift packs are received on the day, I re-count the remaining number of gift packs. The next day, if the remaining number of gift packs is 100, the number of new gift packs will be 100 on the same day. if not, the current number of gift packs will be issued until all the gift packs are received.
The problem is, how can I automatically update the quantity in the next day? Time acquisition is a problem. I should store a time field in the database, but automatic time update is a problem, do you understand what I mean?
You fainted yourself.
Total database records Field
Each time you issue a service, you can determine whether or not 100 emails have been sent today. Where can I start automatic update?
Configuration Table
Id primary key id
Title gift bag name
Total nums gift packs
Day_nums total number of daily releases
Max_data activity end time
Ext extension field (you can record the use of the gift bag, because I don't know what features your gift bag has)
Gift bag issuance log table
Id primary key
Primary key of the lb_id package
Uid user ID
On_time time
Php
// Determine whether 100 gift packs have been issued today
(Select count (*) from logs where on_time = ". date (" Y-m-d ", time ()).")
~ Yes
// Do not issue
~ No
// Determine whether the user has received the gift package today
(Select * from logs where uid = $ uid and on_time = ". date (" Y-m-d ", time ()).")
~ Yes, no issue ~ No // decrease the number of gift packs by 1 // write the gift packs issuance log table
Isn't there a job?