Home > Article > Backend Development > Multiple subscription accounts share the same website. How to tell the difference when placing an order?
My idea is: when a user places an order in one of the subscription accounts, get the unique identifier of the current subscription account. When an order is generated, an identifier is inserted into the database.
There is a demand now, that is, multiple subscription accounts share one website, but distinctions need to be made when placing orders.
So, I hope all friends passing by can take a look and express their personal opinions, thank you
My idea is: when a user places an order in one of the subscription accounts, get the unique identifier of the current subscription account. When an order is generated, an identifier is inserted into the database.
There is a demand now, that is, multiple subscription accounts share one website, but distinctions need to be made when placing orders.
So, I hope all friends passing by can take a look and express their personal opinions, thank you
It seems that the unique identification of the subscription account cannot be obtained. We can only use dynamic routing to distinguish which subscription account the user is operating in, and then distinguish the identification when inserting into the database
Each subscription account has a unique id, and the user of each subscription account also has a unique openid.
If your website does not require additional registration, or uses other authentication methods (mobile phone number or email) to distinguish users, then you can use the id of the subscription account to group and openid to distinguish users.
If you use mobile phone numbers to distinguish users, then just bring the subscription ID.
Your idea is quite good. Generally, you need to add a field for identification like this. You can also have different order number ranges for different subscription numbers. For example, the orders for subscription number A are 1000001~1999999, and the orders for subscription number B are 2000001~2999999.
You must first complete web page authorization through OAuth2.0 to obtain the user's openid to identify the user. However, to obtain the openid, you must obtain the appid and AppSecret of the official account. Since you know these two, you can definitely know which subscription account it is. Yes.
If you don’t need to know who the user is when placing an order on your website, then when your subscription account jumps to the website, just put an ID after the URL to identify which subscription account it is.