The problem of the change of the order status of the mall

when displaying a list of all orders, I want to process the overdue orders first and then query them (as shown above)
I can"t deal with the problem as shown in the figure. I"m afraid there will be an execution error during the loop, and I don"t want to prompt the front end
if I write a log, I can"t guarantee that the query behind is correct
how should I deal with this problem or not? Overdue orders should be processed before querying the list
consult ^ _ ^

Php
Mar.03,2021

suggest scheduled tasks,

in addition , exceptions can be caught here

try {
    // 
    
} catch (Exception $e) {
    // 
    
}

// 

generally this is handled by using the scheduled task execution script instead of looping through the list.


there is something wrong with the processing flow, such as the timed tasks mentioned above, and your processing in this way will also affect the query speed of the list

.
Menu