商城首页有个功能,就是当用户当天首次登陆的时候,会在主页上给用户一个【积分+10】的提示
描述下bug出现的经过:
当我当天第一次登陆的时候,会弹出【积分+10】的提示,然后这时候我在主页上点击任意一个链接,并在那个链接点击返回的时候,这时候回到了主页,还是会重复出现【积分+10】的提示。
但是不应该啊,因为我在后台已经有了逻辑处理,当用户当天首次登陆的时候插入记录到表,并返回200
,如果已经登录过返回202
,前台根据返回状态码进行提示,但是当从上一页返回到主页
的时候还是会有提示出现。如果我在主页重复刷新一次的话,提示就没有了
我比较了一下两次(刚进入页面
和从上一层返回过来的页面
)url返回的结果都是200
,这就很奇怪了
贴一下代码:
js
php
求解救~
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.