Home  >  Article  >  Backend Development  >  Multiple subscription accounts share the same website. How to tell the difference when placing an order?

Multiple subscription accounts share the same website. How to tell the difference when placing an order?

WBOY
WBOYOriginal
2016-08-25 10:37:301301browse

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

Reply content:

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn