java - 怎么批量生成优惠券的编码
伊谢尔伦
伊谢尔伦 2017-04-17 17:55:26
0
4
1112

1.后台管理系统中批量生成优惠券的编码
2.优惠券编码不能太长,否则用户领取优惠券时不方便输入编码
3.优惠券编码也不能太短,同时编码还不能有规律,否则会被猜出来
4.所有的优惠券编码不能重复

各位大神有不有什么好的方案

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
洪涛
  1. Taobao order number

2016-04-28 Order number: 1846204025999235

2016-04-28 Order number: 1846669615349235

2016-04-27 Order number: 1846164650079235

2016-04-27 Order number: 1845531842409235

2016-04-26 Order number: 1840290749419235

2012-07-29 Order number: 148557304839235

Several rules for naming coupon codes:
1. No duplication.
2. Security.
Your order number cannot reveal your company’s real operating information. For example, if your order is a serial number, then others can infer your company’s overall operation summary from the order number. Therefore, the order code must be basically incomprehensible to others except for a few people in your company. Referring to the coding rules of JD.com and Taobao, others will basically not be able to figure out what it means. In fact, the best anti-leak coding rule is not to add any data related to company operations in the coding.
3. Large-scale random codes cannot be used.
When many people analyze the order encoding rules, the first thought is definitely non-repetitive uniqueness, then the second thought may be security, and the third thought that satisfies the first two is random code. Because large-scale random codes are randomly generated, there is no need to leak them because they are meaningless. But in fact, this coding rule will have big problems in implementation.
The random code meets the second security requirement. In order to meet the first non-repetitive feature, you have to compare the historical data to see if there are any duplications when generating the random code. If your order quantity reaches 100,000 times, you will When generating order codes, you have to compare 100,000 pieces of historical data. You can imagine the huge problems this will cause.
But can’t random codes be used in encoding? Small-scale random codes can be used, such as 2 to 3 digits. This kind of random code is generally used in combination with serial numbers. Its main function is to hide the real data of the serial number.
4. Prevent concurrency.
This rule is mainly for time settings in coding.
5. Number of control digits.
This is easy to understand. The purpose of the order number is to facilitate inquiry.
Generally, the normal usage scenario should be when there is an abnormality in the order or when the order is returned, the user will report the order number to the customer service, and the customer service will inquire.
So it is generally better to be in the 10th to 15th place.
10th on JD.com and 15th on Taobao.

阿神

Generate 16-digit UUID

大家讲道理


This is currently done, but it always feels inconvenient. This coupon needs to be printed out, and the user may need to manually enter @jiangxiao

洪涛

https://www.zhihu.com/question/19805896


Time + user ID + product/store ID to which the coupon belongs + random code

Sensitive information can be md5 or other algorithms

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!