Two-dimensional code production method and system, electronic equipment and medium
By obtaining string constraints and using MySQL horizontal segmentation strategy, the problem of slow generation of traditional QR code production solutions is solved, and the technical goal of efficiently generating and storing large-scale QR codes is achieved.
Patent Information
- Application Number
- CN202510275338.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-06
AI Technical Summary
The existing traditional QR code production solutions are slow to generate and cannot meet the needs of large-scale application scenarios.
By obtaining string constraints, a random string generation plan is used to obtain a string collection, and a MySQL horizontal slicing strategy is introduced to allocate and store the string collection to distributed memory. Then, the string groups in the memory are written to the MySQL database in parallel, and the target string is converted into a QR code through the QR code generation library.
It significantly improves the generation and storage efficiency of QR codes, and can quickly generate large-scale QR codes, meeting the high performance and efficiency requirements of large-scale application scenarios.
Smart Images

Figure CN120106114A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of two-dimensional code production, and in particular to a two-dimensional code production method, system, electronic equipment and medium. Background Art
[0002] In modern software development, random string generation is a common requirement and is widely used in password generation, verification code generation, test data filling and other fields. Traditional random string generation methods usually rely on built-in libraries of programming languages, such as Python's random module. However, these methods have performance bottlenecks when generating large-scale random strings, especially in scenarios where hundreds of millions or even billions of non-repeating strings need to be generated.
[0003] To sum up, the existing traditional QR code production solutions have technical problems such as slow generation speed and inability to meet the needs of large-scale application scenarios. Summary of the invention
[0004] The purpose of this application is to provide a two-dimensional code production method, system, electronic device and medium to solve the technical problem that the existing traditional two-dimensional code production scheme has a slow generation speed and cannot meet the needs of large-scale application scenarios.
[0005] In view of the above problems, the present application provides a two-dimensional code production method, system, electronic device and medium.
[0006] In a first aspect, the present application provides a two-dimensional code production method, which is implemented by a two-dimensional code production system, wherein the two-dimensional code production method includes: obtaining a string constraint, and obtaining a string set through a random string generation plan under the string constraint; introducing a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; writing a first string group in the first memory and a second string group in the second memory to a MySQL database in parallel; calling a two-dimensional code generation library to convert a target string in the MySQL database into a target two-dimensional code.
[0007] In the second aspect, the present application also provides a two-dimensional code production system for executing a two-dimensional code production method as described in the first aspect, wherein the two-dimensional code production system includes: a string acquisition module, the string acquisition module is used to obtain string constraints, and obtain a string set through a random string generation plan under the string constraints; an allocation storage module, the allocation storage module is used to introduce a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; a parallel write module, the parallel write module is used to write a first string group in the first memory and a second string group in the second memory in parallel to a MySQL database; a two-dimensional code conversion module, the two-dimensional code conversion module is used to call a two-dimensional code generation library to convert a target string in the MySQL database into a target two-dimensional code.
[0008] In a third aspect, the present application further provides an electronic device, including: at least one processor; a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of a two-dimensional code production method described in any one of the first aspects above.
[0009] In a fourth aspect, a computer-readable storage medium stores a computer program, and when the computer program is executed, the steps of a two-dimensional code production method described in any one of the first aspects are implemented.
[0010] One or more technical solutions provided in this application have at least the following technical effects or advantages: By obtaining string constraints, and obtaining a string set through a random string generation plan under the string constraints; introducing a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; writing the first string group in the first memory and the second string group in the second memory to the MySQL database in parallel; calling a QR code generation library to convert the target string in the MySQL database into a target QR code. That is to say, under given constraints, a string set is obtained through a random string generation plan, and these strings are allocated to a distributed memory using a MySQL horizontal segmentation strategy. Subsequently, the string group in the memory is written in parallel to the MySQL database, and the target string is converted into a QR code through the QR code generation library, thereby realizing efficient generation and storage of large-scale QR codes. The technical effect of significantly improving the generation and storage efficiency of QR codes and being able to quickly generate large-scale QR codes is achieved, and the technical goal of meeting the high requirements for performance and efficiency of large-scale QR code application scenarios is achieved.
[0011] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented according to the contents of the specification, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are specifically cited below. It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easy to understand through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A schematic diagram of a process for producing a two-dimensional code for this application; Figure 2 A structural schematic diagram of a two-dimensional code production system for this application; Figure 3 This is a schematic diagram of the structure of an exemplary electronic device of the present application.
[0013] Description of reference numerals: 11. Get string module; 12. Allocate storage module; 13. Parallel write module; 14. Convert QR code module; 300. Bus; 301. Receiver; 302. Processor; 303. Transmitter; 304. Memory; 305. Bus interface. DETAILED DESCRIPTION
[0014] This application provides a two-dimensional code production method, system, electronic device and medium, which solves the technical problem that the existing traditional two-dimensional code production scheme has a slow generation speed and cannot meet the needs of large-scale application scenarios. It achieves the technical effect of significantly improving the generation and storage efficiency of two-dimensional codes, and can quickly generate large-scale two-dimensional codes, and achieves the technical goal of meeting the high requirements of large-scale two-dimensional code application scenarios for performance and efficiency.
[0015] Below, the technical solutions in the present application will be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments of the present application. It should be understood that the present application is not limited to the example embodiments described herein. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application. It should also be noted that, for the convenience of description, only the parts related to the present application are shown in the accompanying drawings, rather than all of them.
[0016] For example, please refer to the attached Figure 1 The present application provides a two-dimensional code production method, wherein the method is applied to a two-dimensional code production system, and the two-dimensional code production method specifically includes the following steps: Step P10: Obtain a string constraint, and obtain a string set through a random string generation plan under the string constraint.
[0017] Specifically, the core goal of this technical solution is to obtain a set of strings that meet specific constraints. Its main content includes two key steps: first, obtaining the constraints of the string, which may be rules about the length, character type, character order, etc. of the string; second, based on these constraints, using the random string generation plan to obtain a set of strings that meet the conditions.
[0018] First, the constraints of the string need to be clear. These constraints may be input by the user or preset rules. Then, according to these constraints, the random string generation plan is called. During the generation process, the length range of the string is first determined, and then a random selection is made according to the character set specified in the constraints (such as letters, numbers, special symbols, etc.). In addition, if the constraints include requirements for the order of characters, the system will make corresponding adjustments during the generation process. Finally, the generated string is verified to ensure that it fully meets the constraints, and the strings that meet the conditions are added to the final string set. It should be noted that the entire generation process is dynamic and can be flexibly adjusted according to different constraints, so as to achieve efficient and accurate string generation. Obviously, in this way, the system can quickly generate a large number of strings that meet specific rules to meet diverse needs.
[0019] Through clear constraints and flexible random generation plans, the goal of efficiently generating a set of strings that meet specific rules has been successfully achieved. Its technical effect is reflected in the ability to quickly respond to different constraints and generate a diverse set of strings while ensuring the accuracy and reliability of the generated results. For example, it has important application value in scenarios such as password generation, test data generation, and code generation, and its technical effect is reflected in the ability to quickly and flexibly meet diverse needs.
[0020] Step P20: Introduce the MySQL horizontal segmentation strategy to distribute and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory.
[0021] Specifically, by introducing the MySQL horizontal sharding strategy, the string set is distributed and stored in a distributed memory, which includes multiple memories, wherein the first memory refers to any one of the multiple memories, and the second memory refers to any one of the multiple memories that is different from the first memory. Horizontal sharding is a common database sharding technology, and its main idea is to split data into multiple storage nodes according to certain rules to achieve distributed storage and management of data.
[0022] First, you need to determine the rules for horizontal segmentation, which is usually formulated according to the characteristics of the string set or business requirements, such as segmentation according to the hash value range, string length or other attributes of the string. Then, split the string set into multiple subsets according to these rules. Among them, each subset will be assigned to a different memory. Next, store the first subset in the first memory, and store the second subset in the second memory, and so on. Finally, verify the stored data to ensure that the data in each memory complies with the segmentation rules and is complete and correct.
[0023] By introducing the MySQL horizontal sharding strategy, the string collection is successfully allocated and stored in the distributed memory, achieving efficient and scalable data storage, and enhancing the system's fault tolerance and data management efficiency through the distributed memory architecture. Its technical effect is reflected in the ability to flexibly allocate data according to business needs, avoiding the pressure of single-point storage, and enhancing the system's fault tolerance and data management efficiency through the distributed architecture, effectively dispersing storage pressure, improving data reading and writing speed, and realizing flexible data management and query through the sharding strategy. In addition, through the reasonable design of sharding rules, the solution can also effectively improve data query speed and storage utilization, providing a reliable solution for large-scale data storage and management.
[0024] Step P30: writing the first string group in the first memory and the second string group in the second memory into the MySQL database in parallel.
[0025] Specifically, the first string group in the first memory and the second string group in the second memory, that is, multiple groups of strings in multiple memories are written in parallel to the MySQL database. By writing in parallel, the solution can fully utilize the advantages of multi-threading or multi-processing to improve the speed of data processing, and is particularly suitable for the scenario of fast import of large-scale data.
[0026] First, it is necessary to read the first string group from the first memory and the second string group from the second memory, that is, to obtain the string groups in each memory in turn. In order to achieve parallel writing, the system will start multiple independent writing tasks to process multiple string groups respectively. For example, the first task is responsible for writing the first string group into the MySQL database, and the second task is responsible for writing the second string group into the same database, and so on. Next, multi-threading or asynchronous programming technology is used in the writing process to ensure that multiple tasks can be executed simultaneously without blocking each other. In addition, in order to ensure the integrity and consistency of data writing, the system will introduce a transaction management mechanism in each task to ensure that the writing operation of each string group is either all successful or all failed. Finally, after all tasks have completed the writing operation, the writing results are verified to confirm that all data has been correctly stored in the MySQL database. Obviously, the data processing efficiency can be significantly improved by parallel writing, especially when processing large-scale data, which can effectively reduce the writing time.
[0027] By writing string groups from multiple memories into the MySQL database in parallel, the goal of efficient data writing and processing was successfully achieved. The technical effect is reflected in the significant reduction of data writing time and the improvement of the overall performance of the system, which is especially suitable for scenarios where large amounts of data need to be imported quickly. In addition, the introduction of transaction management and parallel processing mechanisms can also ensure the integrity and consistency of data, providing a strong guarantee for the reliable storage of data.
[0028] Step P40: Retrieve the QR code generation library to convert the target character string in the MySQL database into a target QR code.
[0029] Specifically, the target string stored in the MySQL database is converted into a QR code image using the QR code generation library. Its technical goal is to visualize the text data in the form of a QR code to facilitate subsequent scanning, recognition and application.
[0030] First, the target string is read from the MySQL database. This step is usually completed through a database query statement to ensure that accurate data is obtained. Then, the QR code generation library is called, which is a tool library specifically used to convert text data into QR code images. During the conversion process, the target string is passed as an input parameter to the QR code generation library. Then, the QR code generation library encodes the target string into QR code image data according to the preset encoding rules and format. In addition, in order to ensure the readability and quality of the QR code, the system may perform some optimization processing on the generated QR code, such as adjusting the size, color or fault tolerance level of the QR code. Finally, the generated target QR code image will be saved to the specified storage location, or directly returned to the caller for subsequent use.
[0031] By calling the QR code generation library, the target string in the MySQL database is successfully converted into the target QR code, realizing the visualization and convenient processing of text data. This solution has broad application prospects in the fields of information encoding, mobile payment, and fast identification, and can achieve efficient information transmission and convenient interactive experience. Its technical effect is reflected in the ability to quickly generate high-quality QR code images, which is convenient for subsequent scanning and identification. In addition, through reasonable library selection and optimization processing, the solution can also ensure the readability and stability of the QR code, providing an efficient and reliable solution for information encoding and interaction.
[0032] Further, a string constraint is obtained, and a string set is obtained through a random string generation plan under the string constraint, including: Extracting a predetermined character set from the string constraint, the predetermined character set comprising a plurality of characters identified by index numbers; Obtaining an arbitrary index number according to the random string generation plan, and traversing the plurality of characters identified by the index number to obtain an arbitrary character; Based on the length constraint in the string constraint, the arbitrary characters are concatenated to obtain an arbitrary string; The character string set is constructed based on the arbitrary character string.
[0033] Specifically, by extracting a predetermined character set from the string constraint, and using a random string generation plan, an arbitrary string is generated according to the length constraint, and finally a string set is formed. First, a predetermined character set is extracted from the string constraint. This character set contains multiple characters with index numbers, and the index number is used to quickly locate and select characters. Next, according to the random string generation plan, an arbitrary index number is obtained. This process is usually implemented by a random number generation algorithm. Then, traverse among multiple characters with index numbers, and find the corresponding arbitrary character according to the obtained index number. Next, the obtained arbitrary characters are spliced based on the length constraint in the string constraint to generate an arbitrary string that meets the length requirement. In addition, in order to construct a complete string set, the above process is repeated multiple times until a sufficient number of strings are generated. Finally, all generated arbitrary strings are combined together to form the final string set.
[0034] By extracting a predetermined character set, randomly selecting characters, concatenating characters according to length constraints, and forming a string set, the technical goal of efficiently generating a string set that meets specific rules has been successfully achieved. Its technical effect is reflected in the ability to quickly generate a variety of strings while ensuring that the generated results meet the preset constraints. In addition, through the combination of randomness and constraints, the solution can also ensure that the generated strings are unpredictable, providing an efficient and reliable solution for application scenarios such as password generation and test data generation.
[0035] Further, after concatenating the arbitrary characters based on the length constraint in the string constraint to obtain an arbitrary string, the method further includes: activating a Bloom filter, and repeatedly distinguishing the arbitrary character string through the Bloom filter to obtain an arbitrary distinction result; If any of the determination results show that the any character string already exists, issuing a regeneration instruction; A second arbitrary character string is obtained based on the regeneration instruction, and the arbitrary character string is replaced by the second arbitrary character string to form the character string set.
[0036] Specifically, the Bloom filter is used to identify the repetitiveness of any generated string, and decides whether to regenerate the string based on the identification result, ultimately ensuring that the string set does not contain duplicate strings. The Bloom filter is an efficient space-saving data structure that can quickly determine whether an element exists in a set, but there may be a small number of false positives.
[0037] First, the Bloom filter is activated, which is the basis of the entire duplication discrimination process. Next, the generated arbitrary string is subjected to duplication discrimination through the Bloom filter. The Bloom filter will quickly determine whether the string already exists in the set based on its internal hash function and bit array structure, and return any discrimination result. Then, the state of the arbitrary string is determined based on the discrimination result. If any discrimination result shows that the string already exists, a regeneration instruction will be issued. Based on the regeneration instruction, a new string will be generated again, that is, the second arbitrary string. Next, the original arbitrary string is replaced with the second arbitrary string, and the duplication discrimination is continued. This process will be repeated until the generated string is determined by the Bloom filter to be non-existent. Finally, the verified string is added to the string set. Obviously, through the efficient discrimination mechanism of the Bloom filter, duplicate strings can be quickly excluded, and the efficiency of generating a set of non-duplicate strings can be improved.
[0038] By activating the Bloom filter to identify the repetitiveness of any string and deciding whether to regenerate the string based on the identification result, the technical goal of generating a set of non-repetitive strings was successfully achieved. Its technical effect is reflected in the ability to quickly detect and exclude repeated strings, optimize the string generation process, and improve overall efficiency. In addition, the high efficiency of the Bloom filter makes this solution perform well when processing large-scale string generation tasks, providing reliable technical support for generating unique string sets.
[0039] Further, if any of the determination results shows that the arbitrary character string is in a non-existent state, the arbitrary character string is added to the Bloom filter.
[0040] Specifically, after performing a repeatability check on any string in the Bloom filter, if the result shows that the string does not exist, it will be added to the Bloom filter. This process is a typical application of Bloom filters in string collection management, and its technical goal is to dynamically update the content of the Bloom filter to ensure that subsequent repeatability checks can be performed based on the latest data.
[0041] First, the Bloom filter is used to perform a repeatability check on any string to obtain any judgment result. Then the judgment result is checked to determine whether the string does not exist. If the judgment result shows that the string does not exist, the add function of the Bloom filter is called to add the string to the Bloom filter. By performing a repeatability check on any string in the Bloom filter and adding it to the Bloom filter after confirming that it does not exist, the technical goal of dynamically updating the Bloom filter is successfully achieved.
[0042] Further, after the character string set is formed based on the arbitrary character string, the method further includes: Perform distributed caching on the string set based on Redis to obtain a distributed caching result; Comparing and analyzing the distribution cache result with the historical neighboring distribution cache result to obtain a repetition rate; When the repetition rate is within a predetermined repetition threshold, the character string set is output.
[0043] Specifically, the string collection is distributedly cached through Redis, and the cache results are analyzed for repetition rate. Finally, it is decided whether to output the string collection based on whether the repetition rate is within a predetermined threshold.
[0044] First, the string collection is distributed cached based on Redis. The high performance and distributed characteristics of Redis are used to store the string collection in the cache to obtain the distributed cache results. Next, it is necessary to obtain the historical neighboring distributed cache results, which are used for comparative analysis with the current distributed cache results. Among them, the purpose of the comparative analysis is to calculate the repetition rate, that is, the proportion of the current cache results that are repeated with the historical cache results. Next, the calculated repetition rate is compared with the preset repetition threshold. When the repetition rate is within the predetermined repetition threshold range, the current string collection will be output.
[0045] Through Redis-based distributed caching, repetition rate analysis, and conditional judgment, we have successfully achieved efficient management and quality control of string collections. We have achieved the technical effect of fast caching and processing string collections, and at the same time, through repetition rate analysis, we ensure that the output collection meets the preset quality standards.
[0046] Further, including: reading predetermined memory performance characteristics; Collecting performance of the first memory based on the predetermined memory performance characteristic to obtain a first performance characteristic parameter; Analyzing the first performance characteristic parameter to obtain a first performance index, where the first performance index is used to characterize the comprehensive performance of the first memory; matching a first predetermined load threshold corresponding to the first performance index, and determining whether a first real-time load of the first memory is within the first predetermined load threshold; If not, a load balancing control instruction is issued, and load control is performed on the first memory based on the load balancing control instruction.
[0047] Specifically, by collecting, analyzing and evaluating the performance characteristics of the first memory, it is determined whether it is within a predetermined load threshold range, and load balancing control is performed according to the judgment result. First, the performance characteristics of the predetermined memory need to be read, and these characteristics may include key indicators such as the read and write speed, capacity utilization, and response time of the memory. Then, based on these predetermined performance characteristics, the performance of the first memory is collected, and the actual operation data of the first memory is obtained through a monitoring tool or a system interface to obtain a first performance characteristic parameter. Then, these first performance characteristic parameters are analyzed to calculate a first performance index, which is used to comprehensively characterize the performance state of the first memory. In addition, the system will match the first predetermined load threshold corresponding to the first performance index, which is pre-set according to the design capacity and actual operation requirements of the memory. Next, it is determined whether the first real-time load of the first memory is within the first predetermined load threshold range. If the judgment result is not within, that is, the load is too high or too low, the system will issue a load balancing control instruction. Finally, based on the control instruction, the load of the first memory is controlled, for example, by adjusting the storage task allocation, optimizing the data storage structure, etc., so that the load of the memory returns to a reasonable range. Obviously, in this way, the system can dynamically monitor and adjust the load status of the first memory to ensure its efficient and stable operation.
[0048] By reading the performance characteristics of the predetermined memory, collecting performance data, calculating the performance index, matching the load threshold, and performing load balancing control, the dynamic monitoring and optimization management of the first memory is successfully realized. Its technical effect is reflected in the ability to monitor the operating status of the memory in real time, timely discover and adjust the load abnormality, and ensure that the memory works within a reasonable load range.
[0049] Further, matching a first predetermined load threshold corresponding to the first performance index includes: Reading predetermined performance load correlation coefficients; Calculating the first performance index by taking the predetermined performance load correlation coefficient as a weight to obtain a first predetermined load; The first predetermined load threshold is set based on the first predetermined load.
[0050] Specifically, by reading the predetermined performance load correlation coefficient and using it as a weight to calculate the first performance index, the first predetermined load is obtained, and the first predetermined load threshold is set based on this. First, the predetermined performance load correlation coefficient is read. This coefficient is pre-set according to the performance characteristics of the memory and the actual operation requirements, and is used to reflect the relationship between performance and load. Then, the first performance index is calculated with the predetermined performance load correlation coefficient as the weight. Among them, the first performance index is obtained by analyzing the performance characteristic parameters of the memory and is used to characterize the comprehensive performance state of the memory. A more representative first predetermined load value can be obtained by weighted calculation. Then, based on the calculated first predetermined load, the first predetermined load threshold is set. This threshold will serve as a benchmark for subsequent load monitoring and regulation, and is used to determine whether the real-time load of the memory is within a reasonable range. By reading the predetermined performance load correlation coefficient, the first performance index is weightedly calculated, and the first predetermined load threshold is set based on the calculation result, and the dynamic adjustment and precise setting of the memory load threshold are successfully realized.
[0051] In summary, the two-dimensional code production method provided by this application has the following technical effects: By obtaining string constraints, and obtaining a string set through a random string generation plan under the string constraints; introducing a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; writing the first string group in the first memory and the second string group in the second memory to the MySQL database in parallel; calling a QR code generation library to convert the target string in the MySQL database into a target QR code. That is to say, under given constraints, a string set is obtained through a random string generation plan, and these strings are allocated to a distributed memory using a MySQL horizontal segmentation strategy. Subsequently, the string group in the memory is written in parallel to the MySQL database, and the target string is converted into a QR code through the QR code generation library, thereby realizing efficient generation and storage of large-scale QR codes. The technical effect of significantly improving the generation and storage efficiency of QR codes and being able to quickly generate large-scale QR codes is achieved, and the technical goal of meeting the high requirements for performance and efficiency of large-scale QR code application scenarios is achieved.
[0052] Embodiment 2: Based on the same inventive concept as the two-dimensional code production method in the above embodiment, the present application also provides a two-dimensional code production system, please refer to the attached Figure 2 , the two-dimensional code production system comprises: A string acquisition module 11, wherein the string acquisition module 11 is used to acquire string constraints and acquire a string set through a random string generation plan under the string constraints; An allocation storage module 12, wherein the allocation storage module 12 is used to introduce a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; A parallel writing module 13, the parallel writing module 13 is used to write the first string group in the first memory and the second string group in the second memory to the MySQL database in parallel; The QR code conversion module 14 is used to call a QR code generation library to convert the target character string in the MySQL database into a target QR code.
[0053] Furthermore, the character string obtaining module 11 in the two-dimensional code production system is also used for: Extracting a predetermined character set from the string constraint, the predetermined character set comprising a plurality of characters identified by index numbers; Obtaining an arbitrary index number according to the random string generation plan, and traversing the plurality of characters identified by the index number to obtain an arbitrary character; Based on the length constraint in the string constraint, the arbitrary characters are concatenated to obtain an arbitrary string; The character string set is constructed based on the arbitrary character string.
[0054] Furthermore, the character string obtaining module 11 in the two-dimensional code production system is also used for: activating a Bloom filter, and repeatedly distinguishing the arbitrary character string through the Bloom filter to obtain an arbitrary distinction result; If any of the determination results show that the any character string already exists, issuing a regeneration instruction; A second arbitrary character string is obtained based on the regeneration instruction, and the arbitrary character string is replaced by the second arbitrary character string to form the character string set.
[0055] Furthermore, the character string acquisition module 11 in the two-dimensional code production system is also used for: if any judgment result shows that the arbitrary character string is not present, then adding the arbitrary character string to the Bloom filter.
[0056] Furthermore, the two-dimensional code production system further includes a duplication check module, and the duplication check module is used to: Perform distributed caching on the string set based on Redis to obtain a distributed caching result; Comparing and analyzing the distribution cache result with the historical neighboring distribution cache result to obtain a repetition rate; When the repetition rate is within a predetermined repetition threshold, the character string set is output.
[0057] Furthermore, the two-dimensional code production system further includes a load control module, and the load control module is used to: reading predetermined memory performance characteristics; Collecting performance of the first memory based on the predetermined memory performance characteristic to obtain a first performance characteristic parameter; Analyzing the first performance characteristic parameter to obtain a first performance index, where the first performance index is used to characterize the comprehensive performance of the first memory; matching a first predetermined load threshold corresponding to the first performance index, and determining whether a first real-time load of the first memory is within the first predetermined load threshold; If not, a load balancing control instruction is issued, and load control is performed on the first memory based on the load balancing control instruction.
[0058] Furthermore, the load control module in the two-dimensional code production system is also used for: Reading predetermined performance load correlation coefficients; Calculating the first performance index by taking the predetermined performance load correlation coefficient as a weight to obtain a first predetermined load; The first predetermined load threshold is set based on the first predetermined load.
[0059] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. Figure 1 The two-dimensional code production method and specific examples in the first embodiment are also applicable to a two-dimensional code production system in the present embodiment. Through the above detailed description of a two-dimensional code production method, those skilled in the art can clearly know a two-dimensional code production system in the present embodiment, so for the sake of brevity of the specification, it will not be described in detail here. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0060] Embodiment three, based on the inventive concept of a two-dimensional code production method in the aforementioned embodiment, the present application also provides an electronic device, comprising: at least one processor; a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of a two-dimensional code production method described in any one of the aforementioned embodiments one.
[0061] Attached Figure 3 This is a schematic diagram of the structure of an exemplary electronic device of this application. Figure 3In the embodiment, the bus architecture is represented by bus 300, which may include any number of interconnected buses and bridges, and bus 300 connects various circuits including one or more processors represented by processor 302 and memory represented by memory 304. Bus 300 may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 305 provides an interface between bus 300 and receiver 301 and transmitter 303. Receiver 301 and transmitter 303 may be the same element, namely a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 302 is responsible for managing bus 300 and general processing, while memory 304 may be used to store data used by processor 302 when performing operations.
[0062] Embodiment 4, based on the same inventive concept as a two-dimensional code production method in the aforementioned embodiment, the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of a two-dimensional code production method described in any one of the aforementioned embodiments are implemented.
[0063] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0064] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application belong to the scope of the present application and its equivalent technology, the present application is also intended to include these modifications and variations.
Claims
1. A two-dimensional code production method, characterized in that: include: Obtaining a string constraint, and obtaining a string set through a random string generation plan under the string constraint; Introducing the MySQL horizontal segmentation strategy to distribute and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; Writing the first string group in the first memory and the second string group in the second memory to the MySQL database in parallel; The QR code generation library is called to convert the target character string in the MySQL database into a target QR code.
2. A two-dimensional code production method as claimed in claim 1, characterized in that: Obtaining a string constraint, and obtaining a string set through a random string generation plan under the string constraint, including: Extracting a predetermined character set from the string constraint, the predetermined character set comprising a plurality of characters identified by index numbers; Obtaining an arbitrary index number according to the random string generation plan, and traversing the plurality of characters identified by the index number to obtain an arbitrary character; Based on the length constraint in the string constraint, the arbitrary characters are concatenated to obtain an arbitrary string; The character string set is constructed based on the arbitrary character string.
3. A two-dimensional code production method as claimed in claim 2, characterized in that: After concatenating the arbitrary characters based on the length constraint in the string constraint to obtain an arbitrary string, the method further includes: activating a Bloom filter, and repeatedly distinguishing the arbitrary character string through the Bloom filter to obtain an arbitrary distinction result; If any of the determination results show that the any character string already exists, issuing a regeneration instruction; A second arbitrary character string is obtained based on the regeneration instruction, and the arbitrary character string is replaced by the second arbitrary character string to form the character string set.
4. A two-dimensional code production method as claimed in claim 3, characterized in that: If any of the determination results shows that the arbitrary character string does not exist, the arbitrary character string is added to the Bloom filter.
5. A two-dimensional code production method as claimed in claim 2, characterized in that: After the character string set is formed based on the arbitrary character string, the method further includes: Perform distributed caching on the string set based on Redis to obtain a distributed caching result; Comparing and analyzing the distribution cache result with the historical neighboring distribution cache result to obtain a repetition rate; When the repetition rate is within a predetermined repetition threshold, the character string set is output.
6. A two-dimensional code production method as claimed in claim 1, characterized in that: include: reading predetermined memory performance characteristics; Collecting performance of the first memory based on the predetermined memory performance characteristic to obtain a first performance characteristic parameter; Analyzing the first performance characteristic parameter to obtain a first performance index, where the first performance index is used to characterize the comprehensive performance of the first memory; matching a first predetermined load threshold corresponding to the first performance index, and determining whether a first real-time load of the first memory is within the first predetermined load threshold; If not, a load balancing control instruction is issued, and load control is performed on the first memory based on the load balancing control instruction.
7. A two-dimensional code production method as claimed in claim 6, characterized in that: Matching a first predetermined load threshold corresponding to the first performance index includes: Reading predetermined performance load correlation coefficients; Calculating the first performance index by taking the predetermined performance load correlation coefficient as a weight to obtain a first predetermined load; The first predetermined load threshold is set based on the first predetermined load.
8. A two-dimensional code production system, characterized in that: The system is used to perform the method according to any one of claims 1 to 7, and the system comprises: A string acquisition module, the string acquisition module is used to acquire string constraints and acquire a string set through a random string generation plan under the string constraints; An allocation storage module, wherein the allocation storage module is used to introduce a MySQL horizontal segmentation strategy to allocate and store the string set to a distributed memory, wherein the distributed memory includes a first memory and a second memory; A parallel writing module, the parallel writing module is used to write the first string group in the first memory and the second string group in the second memory in parallel to the MySQL database; The QR code conversion module is used to call a QR code generation library to convert a target character string in the MySQL database into a target QR code.
9. An electronic device, comprising: at least one processor; a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of a two-dimensional code production method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed, implements the steps of a two-dimensional code production method as described in any one of claims 1 to 7.