How to distinguish user registration when Wechat official account enters the system registration

process:
A: not registered: 1. Click on the system entry in the user"s official account-> 2. Initiate authorization callback-> 3. Pull user information openid- > 4. Query database-> 5. If there is no such openid- > 6. Save to database, save session- > 7. Redirect to the system registration page-> 8. Fill in the mobile phone number-> 9. The mobile terminal requests to obtain the verification code. at this time, the backend saves the user"s mobile phone number and associates it with the openid,. How to distinguish the user? -> 10. Register-> 11 Registered successfully-> 12. Return to the home page of the official website (not the home page of the system)

< hr >

B: registered: 1. Click on the system entry in the user"s official account-> 2. Initiate authorization callback-> 3. Pull user information openid- > 4. Query database-> 5. Save the openid, to session- > 6. Redirect to system function entry-> 7. Select function entry-> 8. Submit the form-> 9. The mobile terminal requests to transfer parameters to the background to save the database

< hr >

question: when A-> 9 steps, the session, cannot be read, or how can I maintain the login status of the user?
my idea: when the step A-> 6, a token string is generated according to the user"s openid and returned to the user. After the user jumps, it can be taken to the background to identify when the API is requested. The key is how to return the token to the user? The user is redirected to the system registration page. Can the token front end get it?
I hope you can communicate.
Don"t consider the redis cache method for the time being

has been solved. Take token as a parameter when redirecting.


if the database does not have openid, after authorization, save the database with openid and then jump to the registration page to bind the website account to this openid (associated with the database) after successful registration, and then save session to directly query whether openid exists in the database the next time it is authorized. Check again whether the bound website user skips the registration page and then finds out the information of the bound website user to save the session so that the user is considered to have logged in, and the authorization is equal to adding an unbinding interface


I think A-> 9 steps can first use cookie instead of session, to clear the cookie, after the user registers and completes the mobile phone number verification. Using session instead of cookie


has been solved. Take token as a parameter when redirecting.

Menu