The actual data

Below is the actual transaction data of Taobao.

Payment Order No.

Actual data Alipay Transaction Number: 20180701 2100100112 0555709512 Alipay Transaction number: 20170924 2100100112 0275850112


Format 1. date: year month day //6 bits 2. Fixed data //10 bits 3. Change data //10 bits


The length is 26 bits


The feature is much longer than the order number

The order number

Actual data Order number: 169307238912 880512 Order number: 61820557812 880512


The last six characters: user ID


The length used to be 17, then 18 // in the early days it was shorter, 12, 13, 14, 16, and it got longer step by step

Logistics Order No.

Actual data logistics company: Yunda Express Tracking number: 3967967825112

Logistics company: Zhongtong Express tracking number: 455455326212

The length of the

2. At the product level, user experience is not good. Many products and businesses may need to manually input order number to query data. For example, customer service. Express delivery.

conclusion

Interesting. Look at the history. Why is the order number designed this way? Then, combined with practice, is the actual order number generation rules of major e-commerce platforms.


A few principles 1. Keep it short because of technical storage and user experience 2. Make it as meaningful as possible, i.e. include business fields because of user experience


Even for Taobao and Jingdong, their order number also includes the merchant number, and the concurrent data of the same merchant is not so high. When paying, the same merchant generally does not have such a high concurrency. Unless it is the second kill inventory, there are jingdong’s own self-run goods, the concurrent amount may be relatively large. The user ID field can be added even if the same merchant has a large number of concurrent transactions.

Design rules

Field 1. date: year month day hour minute second //14 or 8(only date) bit 2. Random number //6 or 2 digits 3. Merchant ID // Which merchant’s data 4. User ID // Which user’s data. Take the last four digits 5. Commodity ID 6. Business ID field // Payment channel 7. Other unique ID fields


Rule 1. Combine the fields based on service requirements. Technical and product communication to confirm final required fields. 2. The digits. Choose different bits as needed.

concurrent

In fact, after adding year, month, day, hour, minute, second, merchant ID, user ID, basically there is no concurrency problem. Because in 1s, the same merchant’s data is not very much, even if it is a lot, the same user only has one request in 1s. Therefore, the operation of different users will basically not have the problem of repeating the order number. Even if the system has a lot of concurrency.

reference

www.zhihu.com/question/19…

www.jianshu.com/p/544ab3d60…