Two-dimensional code generation method and device, equipment and storage medium
By receiving code packet application instructions, parsing code generation rules, and performing deduplication, a unique QR code character is generated, solving the problem of limited character length in QR code generation, achieving efficient and secure QR code generation, and meeting the recognition needs of Budweiser products.
Patent Information
- Application Number
- CN202511120946.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-12-30
AI Technical Summary
Existing technologies cannot efficiently, quickly, and securely generate unique QR codes with limited QR code characters, especially failing to meet the requirement of clear and identifiable QR codes on Budweiser can and bottle caps.
The method for generating QR codes includes receiving code packet application instructions, parsing code generation rules, generating QR codes and performing deduplication. It uses Set containers and Bloom filters to ensure character uniqueness, and combines hexadecimal and random character generation to ensure the uniqueness and security of QR codes.
The generated QR code characters are highly unique, avoiding duplicate codes, improving code generation efficiency, enhancing data security, and meeting the identification needs of Budweiser products.
Smart Images

Figure CN121234975A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of QR code technology, and specifically relates to a QR code generation method, apparatus, device, and storage medium. Background Technology
[0002] The prior art discloses a method for generating merchant QR codes (patent number CN119782639A, publication date April 8, 2025), such as... Figure 1 As shown, the QR code generation method includes the following steps: S01, registering a merchant user client and inputting necessary information; S02, the client collects and stores the necessary information to form first data; S03, processing the necessary information according to a predetermined algorithm and generating a QR code containing a geographic link that can be recognized by the client; S04, creating a private key to access the first data based on the geographic link. The merchant QR code generation method provided by this invention shortens the QR code link length, reduces the complexity of QR code generation, and increases customer scanning efficiency; furthermore, sensitive information such as the merchant number and merchant name are not directly exposed in the QR code link, increasing the security and confidentiality of the QR code. However, because this merchant QR code generation method does not have high requirements for QR code character length, the number of QR codes generated is relatively small, which is not suitable for the retail beverage industry, which has a large volume of terminal products and a small printable area for QR codes.
[0003] To better help Budweiser products reach end users, enable users to participate in marketing activities more conveniently, collect user information, help the company build user profiles, and provide data support for subsequent optimization of marketing strategies and improvement of user consumption experience, Budweiser needs an efficient and secure QR code generation and management system to provide a reliable data medium for marketing activities.
[0004] Because the area available for printing QR codes on Budweiser can and bottle caps is limited, and the QR code images must be clear and legible, this imposes additional constraints on QR code design and generation. After multiple verifications, to ensure accurate recognition by end-user devices, the character length of the converted QR code image should not exceed 30 characters. If it exceeds 30 characters, the characters will be too dense, making it impossible for end-user devices to effectively recognize the code after printing on the can or bottle cap.
[0005] There is an urgent need for a QR code generation method to efficiently, quickly, and securely generate QR codes from QR code characters within a limited length constraint. Summary of the Invention
[0006] This invention overcomes one of the shortcomings of the prior art and provides a QR code generation method, apparatus, device and storage medium that can meet the needs of business scenarios. Under the constraint of limited QR code characters, it can efficiently, quickly and securely become a unique QR code character, and provide the QR code character to the packaging material supplier to convert the image and print it on the packaging of the end product.
[0007] According to one aspect of this disclosure, a QR code generation method is proposed, the method comprising:
[0008] Receive QR code package application instructions;
[0009] Based on the QR code package application instruction, the QR code package generation rules are parsed;
[0010] A QR code is generated based on the code generation rules of the QR code package;
[0011] The QR code is deduplicated to obtain a unique QR code character.
[0012] In one possible implementation, the code generation rules for the QR code package include the domain name associated with the QR code package, the short link of the brand associated with the QR code package, the base conversion rules for the application date of the QR code package, and a randomly generated eight-character string.
[0013] In one possible implementation, the radix conversion rule for the QR code package application date includes converting the decimal year, month, and day of the QR code package application date into sixty-binary characters.
[0014] In one possible implementation, converting the decimal year, month, and day of the QR code application date into sixty-binary characters includes:
[0015] Extract the last two digits of the year from the application date of the QR code package, convert the last two digits of the decimal year to hexadecimal, and obtain the year character of the application date of the QR code package.
[0016] Extract the month from the application date of the QR code package, convert the decimal month to hexadecimal, and obtain the month character of the application date of the QR code package;
[0017] Extract the date of the QR code package application, convert the decimal date to hexadecimal, and obtain the date character of the QR code package application date.
[0018] In one possible implementation, generating the QR code based on the QR code packet's code generation rules includes:
[0019] A QR code is composed of the domain name associated with the QR code package, the short link of the brand associated with the QR code package, the sixty-binary characters of the application date of the QR code package, and a randomly generated eight-character string.
[0020] In one possible implementation, the QR code is deduplicated to obtain unique QR code characters, including:
[0021] The QR code is checked for duplicate codes using a Set container until the generation of QR code characters in the QR code package is completed;
[0022] The Set container set of the QR code characters is split, and the Set container set of the QR code characters of the QR code package of the day is deduplicated in batches based on the application date of the QR code package using the Bloom filter of the day, so that any QR code character in the QR code package is unique.
[0023] In one possible implementation, the step of using a Set container to perform duplicate code verification on the QR code until the generation of QR code characters in the QR code packet is completed includes:
[0024] P1: When a new QR code character is generated, the new QR code character is stored in a Set container. If it cannot be stored in a Set container, the new QR code character is determined to be a duplicate character and is discarded.
[0025] P2: Regenerate new QR code characters again and store them in the Set container for verification. If they cannot be stored in the Set container, the regenerated QR code characters are determined to be duplicate characters and are discarded.
[0026] P3: Repeat the P2 process until the newly generated QR code characters are successfully stored in the Set container, completing the generation of QR code characters, until all QR code characters in the QR code package are generated.
[0027] In one possible implementation, the step of batch deduplicating the Set container set of QR code characters for the current day using a Bloom filter includes:
[0028] L1: A Set container collection that splits the QR code characters in the current QR code packet;
[0029] L2: Use the Bloom filter of the day to perform batch deduplication of the QR code characters of the day. If duplicate QR code characters are detected in the QR code characters of the day, it is downgraded to duplicate check of each QR code character.
[0030] L3: If a duplicate QR code character is found during the duplicate check of each QR code character, the duplicate QR code character is discarded.
[0031] L4: Regenerate new QR code characters again, repeating steps L2-L3 until a unique QR code character is generated, thus completing the batch deduplication of the Set container set of QR code characters for the day's QR code package.
[0032] According to another aspect of this disclosure, a QR code generation apparatus is provided, the apparatus comprising:
[0033] The receiving module is used to receive QR code package application instructions;
[0034] The parsing module is used to parse the QR code package's generation rules based on the QR code package application instruction;
[0035] The QR code generation module is used to generate a QR code based on the QR code packet's generation rules; the deduplication module is used to perform deduplication processing on the QR code to obtain unique QR code characters.
[0036] According to another aspect of this disclosure, an electronic device is proposed, the device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.
[0037] According to another aspect of this disclosure, a computer-readable storage medium is provided that stores a computer program, which, when executed by a processor, implements the method described above.
[0038] This disclosed QR code generation method includes: receiving a QR code package application instruction; parsing the QR code package generation rules based on the QR code package application instruction; generating a QR code based on the QR code package generation rules; and performing deduplication processing on the QR code to obtain a unique QR code character. This method can meet the needs of business scenarios, efficiently, quickly, and securely creating unique QR code characters within a limited length constraint, and then providing these QR code characters to packaging material suppliers for image conversion and printing onto the final product packaging. Attached Figure Description
[0039] The accompanying drawings are used to provide a further understanding of the technical solutions of this application or the prior art, and constitute a part of the specification. The drawings illustrating embodiments of this application, together with the embodiments of this application, are used to explain the technical solutions of this application, but do not constitute a limitation on the technical solutions of this application.
[0040] Figure 1 A flowchart illustrating a method for generating a merchant QR code according to an embodiment of the prior art is shown;
[0041] Figure 2 A flowchart of a QR code generation method according to an embodiment of the present disclosure is shown;
[0042] Figure 3 A flowchart of a QR code generation method according to another embodiment of the present disclosure is shown;
[0043] Figure 4 A schematic diagram illustrating the principle of a QR code generation rule according to an embodiment of the present disclosure is shown.
[0044] Figure 5 A schematic diagram illustrating the deduplication principle of QR codes according to an embodiment of the present disclosure is shown;
[0045] Figure 6 A schematic diagram of a QR code generation apparatus according to an embodiment of the present disclosure is shown;
[0046] Figure 7 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0047] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples, so that the process of how the present invention uses technical means to solve technical problems and achieve corresponding technical effects can be fully understood and implemented accordingly. The embodiments of this application and the various features in the embodiments can be combined with each other without conflict, and the resulting technical solutions are all within the protection scope of the present invention.
[0048] Furthermore, the steps illustrated in the flowcharts of the accompanying drawings can be executed in a computer, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than that presented here.
[0049] Figure 2 and Figure 2 Flowcharts of a QR code generation method according to an embodiment of the present disclosure are shown respectively; as follows: Figure 2 As shown, the method may include:
[0050] Step S1: Receive the QR code package application instruction.
[0051] The efficient deduplication QR code generation system of this invention mainly consists of a QR code management platform and a QR code generation service. Packaging material manufacturers can apply for QR code packages through the QR code management platform, and the efficient deduplication QR code generation system utilizes message queue middleware to achieve decoupling. Figure 3 As shown, the efficient deduplication QR code generation service obtains QR code package application instructions (QR code generation signals) by listening to a queue, and parses the QR code package's generation requirements or generation rules to generate QR code characters.
[0052] Step S2: Based on the QR code package application instruction, parse the QR code package generation rules.
[0053] like Figure 3 As shown, after receiving a QR code packet application instruction (QR code generation signal), the QR code generation service of this invention first changes the status of the packet to "generating code," then parses the QR code packet's generation rules, including the conversion rules for the first three digits of the QR code characters, and generates a unique set of QR code characters. After the QR code packet is generated, the efficient deduplication QR code generation system filters and deduplicates the QR codes through a Redis cache database, ensuring the uniqueness and randomness of each QR code.
[0054] Figure 4 A schematic diagram illustrating the principle of a QR code generation rule according to an embodiment of the present disclosure is shown.
[0055] To ensure that consumers can easily participate in the operation after the generated QR code characters enter the market, the prefix of the QR code characters can be set to the QR code package associated domain name, i.e., the public domain name of the mini program (17 characters) and the QR code package associated brand short link, i.e., the subdomain of each mini program (2 characters). Only 11 characters remain that can be used for variation. A 62-bit character set (including uppercase letters AZ, lowercase letters az and numbers 0-9) was selected to generate variable characters, which can ensure that these characters are easy to read and unambiguous.
[0056] like Figure 4 As shown, the QR code character generation rules may include the domain name associated with the QR code package, the short brand link associated with the QR code package, the base conversion rules for the QR code package application date, and randomly generated eight characters. Specifically, the base conversion rules for the QR code package application date include converting the decimal year, month, and day of the QR code package application date into sixty-binary characters.
[0057] In one example, converting the decimal year, month, and day of the QR code application date into hexadecimal characters includes:
[0058] Extract the last two digits of the year from the application date of the QR code package, convert the last two digits of the decimal year to hexadecimal, and obtain the year character of the application date of the QR code package.
[0059] Extract the month from the application date of the QR code package, convert the decimal month to hexadecimal, and obtain the month character of the application date of the QR code package;
[0060] Extract the date of the QR code package application, convert the decimal date to hexadecimal, and obtain the date character of the QR code package application date.
[0061] For example, the timestamp conversion of the Budweiser brand code QR code applied for on January 1, 2024 is as follows:
[0062] Month: The system uses the M2_62BuildCode rule to convert the month to binary, taking one digit. For example, the month is represented as 01, which is converted to the binary number 0.
[0063] Year: The conversion is performed by extracting the last two digits of the year using the base conversion rule Y2_62BuildCode. This converts the last two digits of the current year to hexadecimal (binary), and then extracts one character. For example, the last two digits of the year are 24, which, in hexadecimal, corresponds to the lowercase letter 'o'.
[0064] Date: The date is converted to a binary number using the rule MD2_62BuildCode, which converts the current date to binary and extracts one digit. For example, if the date is 01, then 01 is converted to the Arabic numeral 0 in binary.
[0065] These three hexadecimal characters combine to form 0o0, ensuring that the first three digits of the QR code characters can uniquely identify the generation date, avoiding data overlap and duplication across days.
[0066] Based on the first three hexadecimal timestamp characters, an additional eight random characters, SAN8_CNBuildCode, are generated, resulting in eight random characters. For example, the randomly generated eight characters are 3b4B73sU. These eight random characters ensure the randomness and unpredictability of the QR code, further enhancing its uniqueness and security, and ensuring its randomness and uncrackability.
[0067] Step S3: Generate a QR code based on the QR code generation rules of the QR code packet.
[0068] In one example, a QR code is formed by combining the domain name associated with the QR code package, the short link of the brand associated with the QR code package, the sixty-binary characters of the application date of the QR code package, and a randomly generated eight-bit character.
[0069] For example, if the 11-digit domain name associated with the QR code package is 0o03b4B73sU; and the short link associated with the QR code package is a / , then the complete QR code is composed of an immutable character made up of the domain name associated with the QR code package (mini-program domain name), the short link associated with the QR code package (mini-program short link), and the sixty-binary characters of the QR code package application date (QR code package application date), combined with a randomly generated eight-digit character, which is HTTPS: / / R.BUD.CN / a / 0o03b4B73sU.
[0070] Step S4: Perform deduplication on the QR code to obtain unique QR code characters.
[0071] In the current QR code generation algorithm, the eleven variable characters consist of three binary characters representing the year, month, and day, and eight random characters. Because the generation of the eight random characters is completely random, and Budweiser's demand for QR codes is enormous, the QR code generation system may generate duplicate strings. If duplicate QR codes are printed and enter the market, it could lead to a situation of "multiple items, one code," which would not only harm consumers' interests but also potentially damage Budweiser's brand image. Therefore, a deduplication logic has been added to the QR code generation process to ensure the uniqueness of the generated QR code characters.
[0072] In one example, deduplication of the QR code yields unique QR code characters, including:
[0073] Use a Set container to perform duplicate code verification on the QR code until the QR code characters in the QR code package are generated.
[0074] The Set container set of QR code characters is split. Based on the application date of the QR code package, the Set container set of QR code characters of the QR code package of the day is deduplicated in batches using the Bloom filter of the day, so that any QR code character in the QR code package is unique.
[0075] During the QR code generation process, the QR code generation system initializes a native container, Set, provided by the JDK (Java Development Kit). A key characteristic of the Set container is that it cannot store duplicate elements. Whenever a QR code character is generated, the system attempts to add it to the Set container. If the QR code character cannot be added, the system determines that the current QR code character is a duplicate, discards it, and recursively calls the generation logic to regenerate a new QR code character, then attempts to add it to the Set container again, until a unique QR code character is successfully generated. This ensures that the QR code characters generated in the current code package are unique.
[0076] When a packaging material factory applies for QR code packages on a per-package basis, the QR code generation system creates a Bloom filter for that day. A Bloom filter is an efficient data structure used to detect whether an element exists in a set. In this QR code system, the Bloom filter is used to deduplicate the QR code characters in the final generated QR code packages, ensuring that the generated QR code characters are not duplicated. The specific deduplication scheme is as follows.
[0077] Figure 5 A schematic diagram illustrating the deduplication principle of QR codes according to an embodiment of the present disclosure is shown.
[0078] In one example, such as Figure 5As shown, the QR code is checked for duplicate codes using a Set container until the generation of QR code characters in the QR code packet is complete, including:
[0079] P1: When a new QR code character is generated, the new QR code character is stored in a Set container. If it cannot be stored in a Set container, the new QR code character is determined to be a duplicate character and is discarded.
[0080] P2: Regenerate new QR code characters again and store them in the Set container for verification. If they cannot be stored in the Set container, the regenerated QR code characters are determined to be duplicate characters and are discarded.
[0081] P3: Repeat the P2 process (recursively call the P2 step) until the newly generated QR code characters are successfully stored in the Set container, completing the generation of QR code characters. If not completed, continue to generate random codes and repeat the verification logic until all QR code characters in the QR code package are generated.
[0082] In one example, such as Figure 5 As shown, batch deduplication of the Set container set of QR code characters for the current day using a Bloom filter can include:
[0083] L1: Split the Set container collection of QR code characters in the current QR code package; that is, after all QR code characters in the QR code package are generated, the QR code generation service will split the Set container collection of QR code characters generated in the current QR code package.
[0084] L2: Use the Bloom filter of the day to deduplicate the QR code characters of the day in batches. If duplicate QR code characters are detected in the QR code characters of the day, it will be downgraded to duplicate check of each QR code character individually.
[0085] L3: If duplicate QR code characters are found during the duplicate check of each QR code character, the duplicate QR code characters are discarded.
[0086] L4: Regenerate new QR code characters again, repeating steps L2-L3 until a unique QR code character is generated, thus completing the batch deduplication of the Set container set of QR code characters for the day's QR code package.
[0087] Once all QR code characters in the QR code package pass duplicate verification to ensure uniqueness, the QR code data will be written to the database. The QR code characters will then be concatenated with a prefix, the QR code package's associated domain name, and a short link to the mini-program, forming the final QR code image characters. These QR code image characters will be encrypted and written to a text file, which will then be packaged and uploaded to the file server. The QR code generation system will then update the QR code package status, completing the entire QR code generation process.
[0088] This disclosed QR code generation method involves receiving a QR code package application instruction; parsing the QR code package generation rules based on the application instruction; generating a QR code based on the QR code package generation rules; and performing deduplication on the QR code to obtain unique QR code characters. This achieves the following beneficial effects:
[0089] Ensuring QR code uniqueness: The QR code generation algorithm combines the JDK's native Set container and a Redis Bloom filter for batch deduplication, ensuring the uniqueness of the QR code character data generated by the system. This dual deduplication mechanism not only improves data accuracy but also effectively avoids the generation of duplicate data, ensuring that each QR code is unique on the day of generation. This avoids the problem of "multiple items, one code," protecting consumer rights and maintaining brand image.
[0090] Improving QR code generation efficiency: The current QR code generation algorithm uses a date-month-year base conversion to generate the first three characters of a sixty-binary QR code, ensuring that QR code characters do not overlap across days. In this way, the QR code generation system can limit the range of data deduplication to the data generated on the current day, significantly narrowing the deduplication scope and greatly improving generation efficiency. This meets the needs of large-scale production and ensures that the system can quickly generate unique QR codes even in high-concurrency environments.
[0091] Enhanced data security: The current QR code generation algorithm uses random character combinations for the last eight digits of the variable characters in the QR code, making the generated QR code characters unpredictable and impossible to crack. This effectively avoids the risk of asset loss caused by finding patterns in the generated code and launching credential stuffing attacks.
[0092] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0093] Figure 6 A schematic diagram of a QR code generation apparatus according to an embodiment of the present disclosure is shown; as follows: Figure 6 As shown, the QR code generating device may include:
[0094] Receiver module 601 is used to receive QR code package application instructions;
[0095] The parsing module 602 is used to parse the code generation rules of the QR code package based on the QR code package application instruction;
[0096] The QR code generation module 603 is used to generate QR codes based on the QR code packet generation rules;
[0097] The deduplication module 604 is used to deduplicatize QR codes to obtain unique QR code characters.
[0098] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0099] Figure 7 This is a schematic diagram of the structure of the electronic device 3 provided in an embodiment of this application. Figure 7 As shown, the electronic device 3 of this embodiment includes a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. When the processor 301 executes the computer program 303, it implements the steps in the various method embodiments described above. Alternatively, when the processor 301 executes the computer program 303, it implements the functions of each module / unit in the various device embodiments described above.
[0100] For example, computer program 303 may be divided into one or more modules / units, which are stored in memory 302 and executed by processor 301 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 303 in electronic device 3.
[0101] Electronic device 3 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 3 may include, but is not limited to, processor 301 and memory 302. Those skilled in the art will understand that... Figure 7 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device may also include input / output devices, network access devices, buses, etc.
[0102] Processor 301 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0103] The memory 302 can be an internal storage unit of the electronic device 3, such as a hard disk or RAM. The memory 302 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 302 can include both internal and external storage units of the electronic device 3. The memory 302 is used to store computer programs and other programs and data required by the electronic device. The memory 302 can also be used to temporarily store data that has been output or will be output.
[0104] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0105] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0106] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments claimed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0107] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0108] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0109] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0110] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0111] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method of generating a two-dimensional code, characterized by, The method comprises: receiving a two-dimensional code package application instruction; based on the two-dimensional code package application instruction, analyzing the two-dimensional code package generation rule; generating a two-dimensional code based on the two-dimensional code package generation rule; de-duplication processing of the two-dimensional code to obtain unique two-dimensional code characters.
2. The method of claim 1, wherein The two-dimensional code package generation rule comprises a two-dimensional code package associated domain name, a two-dimensional code package associated brand short chain, a two-dimensional code package application date binary conversion rule, and a randomly generated eight-bit character.
3. The method of claim 2, wherein The two-dimensional code package application date binary conversion rule comprises converting the decimal year, month, and day of the two-dimensional code package application date into a sixty-two-bit character.
4. The method of claim 3, wherein The conversion of the decimal year, month, and day of the two-dimensional code package application date into a sixty-two-bit character comprises: extracting the last two digits of the year of the two-dimensional code package application date, converting the last two digits of the decimal year into a sixty-two-bit character to obtain the year character of the two-dimensional code package application date; extracting the month of the two-dimensional code package application date, converting the decimal month into a sixty-two-bit character to obtain the month character of the two-dimensional code package application date; extracting the day of the two-dimensional code package application date, converting the decimal day into a sixty-two-bit character to obtain the day character of the two-dimensional code package application date.
5. The method of claim 4, wherein The generation of a two-dimensional code based on the two-dimensional code package generation rule comprises: combining the two-dimensional code package associated domain name, the two-dimensional code package associated brand short chain, the sixty-two-bit character of the two-dimensional code package application date, and the randomly generated eight-bit character to form a two-dimensional code.
6. The method of claim 4, wherein The de-duplication processing of the two-dimensional code to obtain unique two-dimensional code characters comprises: using a Set container to check the two-dimensional code for duplicates until the generation of two-dimensional code characters in the two-dimensional code package is complete; splitting the Set container collection of the two-dimensional code characters, and using a Bloom filter of the current day to perform batch de-duplication on the Set container collection of the two-dimensional code characters of the two-dimensional code package of the current day based on the two-dimensional code package application date, so that any two-dimensional code character in the two-dimensional code package is unique.
7. The method of claim 6, wherein The use of a Set container to check the two-dimensional code for duplicates until the generation of two-dimensional code characters in the two-dimensional code package is complete comprises: P1: when a new two-dimensional code character is generated, store the new two-dimensional code character in the Set container; if the new two-dimensional code character cannot be stored in the Set container, determine that the new two-dimensional code character is a duplicate character and discard the new two-dimensional code character; P2: generate a new two-dimensional code character again and store it in the Set container for checking; if the new two-dimensional code character cannot be stored in the Set container, determine that the newly generated two-dimensional code character is a duplicate character and discard the newly generated two-dimensional code character; P3: repeat the P2 process until the newly generated two-dimensional code character is successfully stored in the Set container, the generation of two-dimensional code characters is complete, and all two-dimensional code characters in the two-dimensional code package are generated.
8. The method of claim 6, wherein, The use of a Bloom filter of the current day to perform batch de-duplication on the Set container collection of the two-dimensional code characters of the current day comprises: L1: split the Set container collection of the two-dimensional code characters in the current two-dimensional code package; L2: using the day bloom filter to batch deduplicate the two-dimensional code characters of the day, if it is detected that there is a repeated two-dimensional code character in the two-dimensional code characters of the day, then downgrading to a two-dimensional code character by two-dimensional code character repetition check; L3: in the two-dimensional code character by two-dimensional code character repetition check, if a repeated two-dimensional code character is found, the repeated two-dimensional code character is discarded; L4: the new two-dimensional code character is generated again, and steps L2-L3 are repeated until a unique two-dimensional code character is generated, and the batch deduplication of the Set container set of the two-dimensional code characters of the two-dimensional code package of the day is completed.
9. A two-dimensional code generating apparatus characterized by comprising: The device comprises: a receiving module configured to receive a two-dimensional code package application instruction; a parsing module configured to parse a two-dimensional code package generation rule based on the two-dimensional code package application instruction; a two-dimensional code generation module configured to generate a two-dimensional code based on the two-dimensional code package generation rule; a deduplication module configured to perform deduplication processing on the two-dimensional code to obtain a unique two-dimensional code character.
10. An electronic device, comprising: The device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the program to implement the method of any one of claims 1 to 8.
11. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 8.
Citation Information
Patent Citations
A method for generating a merchant QR code
CN119782639A