There is a function on the homepage of the mall, that is, when a user logs in for the first time that day, a [Points + 10] prompt will be given to the user on the homepage
Describe how the bug occurred:
When I logged in for the first time that day, a prompt of [Points +10] popped up. Then at this time, I clicked on any link on the homepage and clicked on that link. When returning, when I return to the homepage, the prompt [Points +10] will still appear repeatedly.
But it shouldn’t be, because I already have logic processing in the background. When the user logs in for the first time that day, a record is inserted into the table and 200
is returned. If the user has already logged in, 202 is returned.
, the front desk prompts based on the return status code, but when returns to the homepage from the previous page
, there will still be a prompt. If I refresh the homepage again, the prompt will disappear
I compared it twice (The page just entered
and The page returned from the previous level
) and the results returned by the url were both 200
, this is very strange
Post the code:
js
< /p>
php
< /p>
Please help~
orz~
After testing it like this, I found that there is no problem. It is recommended that you trace the code to determine whether you have logged in. Is there any cache or other factors that may affect it?
Is there any problem with the login status judgment of total?
Consider whether it is the impact of caching.
Check to see if the points have indeed increased twice in the background. If it does not increase the second time, it means that your background logic is correct, and it may be caused by browser cache. If the background is indeed increased, then the background logic is wrong.