Method and device for generating exchange code

Unique redemption codes are generated through multiple target attribute parameter encoding, random number generation and encryption algorithms, which solves the problem that existing redemption codes are easy to crack and reuse, improves security and uniqueness, and optimizes user experience and server performance.

CN120655345APending Publication Date: 2025-09-16SHANGHAI ZHUO YOU NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510747062.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

The existing redemption code generation logic is vulnerable to attacks and cracking, and is too long, has limited information carrying capacity, and is difficult to guarantee uniqueness, posing a risk of repeated redemption.

Method used

It uses multiple target attribute parameter encoding, random number generation, encryption algorithm and Redis atomic operations to generate unique and encrypted redemption codes, and ensures the uniqueness and security of redemption codes by optimizing encoding strategies and encryption algorithms.

Benefits of technology

The generated redemption code is short and highly secure, which can effectively prevent reuse and cracking, improve user experience and reduce server burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120655345A_ABST
    Figure CN120655345A_ABST
Patent Text Reader

Abstract

The invention provides a redemption code generation method and device, and the method comprises the steps: converting a target attribute parameter into a target attribute coding text with a corresponding length according to a target coding strategy for each obtained target attribute parameter; obtaining a quantity attribute parameter of a to-be-generated redemption code, and generating a target random number required by the generation of the redemption code according to the quantity attribute parameter and a plurality of target attribute parameters; converting the target random number into a target random number coded text with a corresponding length according to a target coding strategy; splicing the target random number coded text and all the target attribute coded texts according to a preset sequence to obtain a target plaintext; based on a preset key, performing encryption processing on the target plaintext by using a target encryption algorithm to obtain a target ciphertext; and performing coding conversion processing on the target ciphertext according to the target coding strategy to obtain a target redeeming code. Thus, through the technical scheme of the invention, the security of the generated redemption code can be effectively improved, and the risk of being attacked and cracked is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a redemption code. Background Art

[0002] A redemption code is a string of letters and numbers that users can enter to receive specific rewards or offers. These rewards may include discounts, virtual currency, exclusive content, or other benefits. Redemption codes are typically issued by merchants or platforms as part of promotional campaigns and are widely used in a variety of fields, including mobile games, e-commerce platforms, and social media. However, existing redemption codes generated by existing technologies pose a risk of being easily hacked due to flaws in their generation logic. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide a method and device for generating a redemption code, which can effectively improve the security of the generated redemption code and reduce the risk of being attacked and cracked.

[0004] An embodiment of the present application provides a method for generating a redemption code, the method comprising:

[0005] Get multiple target attribute parameters of the redemption code to be generated;

[0006] For each target attribute parameter, determine the corresponding target encoding length according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy;

[0007] Obtaining a quantity attribute parameter of a redemption code to be generated, and generating a target random number required for generating the redemption code this time based on the quantity attribute parameter and the multiple target attribute parameters;

[0008] Determining a target encoding length corresponding to the target random number, and converting the target random number into a target random number encoding text of the target encoding length according to a target encoding strategy;

[0009] The target random number encoded text and all target attribute encoded texts are concatenated in a preset order to obtain the target plaintext;

[0010] Based on a preset secret key, the target plaintext is encrypted using a target encryption algorithm to obtain a target ciphertext;

[0011] The target ciphertext is subjected to encoding conversion processing according to the target encoding strategy to obtain a target redemption code.

[0012] Optionally, the multiple target attribute parameters include at least a subject ID, a redemption deadline, and current batch information.

[0013] Optionally, for each target attribute parameter, determining a corresponding target encoding length according to the type of the target attribute parameter includes:

[0014] For the subject ID, determining a target encoding length of the subject ID as a first length;

[0015] With respect to the exchange deadline, determining a target encoding length of the exchange deadline as a second length;

[0016] For the current batch information, determining a target encoding length of the current batch information as a third length; wherein the first length, the second length, and the third length are not necessarily the same.

[0017] Optionally, the target encoding strategy is a base58 encoding strategy.

[0018] Optionally, encrypting the target plaintext using a target encryption algorithm based on a preset key to obtain a target ciphertext includes:

[0019] Obtain the preset key from the configuration file of the server;

[0020] Based on the preset secret key, the target plaintext is encrypted using the AES encryption algorithm to obtain the target ciphertext.

[0021] Optionally, after obtaining the target redemption code, the generating method further includes:

[0022] In response to a redemption operation by a user, obtaining a target redemption code and related verification parameters to be redeemed by the user;

[0023] Verify the target redemption code and related verification parameters according to preset rules to determine whether the redemption conditions are met;

[0024] If satisfied, the target redemption code is deleted from the database, and a target interface corresponding to the successful redemption of the target redemption code is displayed to the user.

[0025] Optionally, after obtaining the target redemption code, the generating method further includes:

[0026] The target redemption code is stored in the Redis cache of the MySQL database.

[0027] The embodiment of the present application further provides a device for generating a redemption code, the device comprising:

[0028] An acquisition module, used to obtain multiple target attribute parameters of the redemption code to be generated;

[0029] A first conversion module is configured to determine, for each target attribute parameter, a corresponding target encoding length according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy;

[0030] A generation module, configured to obtain a quantity attribute parameter of a redemption code to be generated, and generate a target random number required for generating the redemption code according to the quantity attribute parameter and the plurality of target attribute parameters;

[0031] A second conversion module is used to determine a target code length corresponding to the target random number, and convert the target random number into a target random number code text of the target code length according to a target coding strategy;

[0032] A splicing module is used to splice the target random number encoded text and all target attribute encoded texts in a preset order to obtain a target plaintext;

[0033] An encryption module, configured to encrypt the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext;

[0034] The third conversion module is configured to perform encoding conversion processing on the target ciphertext according to the target encoding strategy to obtain a target redemption code.

[0035] Optionally, the multiple target attribute parameters include at least a subject ID, a redemption deadline, and current batch information.

[0036] Optionally, when the first conversion module is used to determine, for each target attribute parameter, a corresponding target encoding length according to a type of the target attribute parameter, the first conversion module is used to:

[0037] For the subject ID, determining a target encoding length of the subject ID as a first length;

[0038] With respect to the exchange deadline, determining a target encoding length of the exchange deadline as a second length;

[0039] For the current batch information, determining a target encoding length of the current batch information as a third length; wherein the first length, the second length, and the third length are not necessarily the same.

[0040] Optionally, the target encoding strategy is a base58 encoding strategy.

[0041] Optionally, when the encryption module is used to encrypt the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext, the encryption module is used to:

[0042] Obtain the preset key from the configuration file of the server;

[0043] Based on the preset secret key, the target plaintext is encrypted using the AES encryption algorithm to obtain the target ciphertext.

[0044] Optionally, the generating device further includes a redemption module, and the redemption module is configured to:

[0045] After obtaining the target redemption code, in response to a redemption operation by the user, obtaining the target redemption code to be redeemed by the user and related verification parameters;

[0046] Verify the target redemption code and related verification parameters according to preset rules to determine whether the redemption conditions are met;

[0047] If satisfied, the target redemption code is deleted from the database, and a target interface corresponding to the successful redemption of the target redemption code is displayed to the user.

[0048] Optionally, the generating device further includes a storage module, and the storage module is configured to:

[0049] After obtaining the target redemption code, the target redemption code is stored in the Redis cache of the MySQL database.

[0050] An embodiment of the present application also provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the generation method as described above are performed.

[0051] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the generation method described above are executed.

[0052] The embodiments of the present application provide a method and device for generating a redemption code. The generation method includes: obtaining multiple target attribute parameters of a redemption code to be generated; for each target attribute parameter, determining a corresponding target encoding length according to the type of the target attribute parameter, and converting the target attribute parameter into a target attribute encoding text of the target encoding length according to a target encoding strategy; obtaining a quantity attribute parameter of the redemption code to be generated, and generating a target random number required for generating the redemption code according to the quantity attribute parameter and the multiple target attribute parameters; determining a target encoding length corresponding to the target random number, and converting the target random number into a target random number encoding text of the target encoding length according to a target encoding strategy; concatenating the target random number encoding text and all target attribute encoding texts in a preset order to obtain a target plaintext; encrypting the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext; and performing encoding conversion on the target ciphertext according to the target encoding strategy to obtain a target redemption code.

[0053] In this way, the present application shortens the length of the target redemption code finally generated through optimized encoding methods and encryption algorithms, thereby improving the user experience; and the present application encodes valid information such as the subject ID and the redemption deadline into the redemption code, thereby improving the information carrying capacity of the redemption code, so that this information can be obtained without additional database queries, greatly reducing the burden on the server; and the present application also ensures that each redemption code is unique by adopting a generation algorithm that combines multiple information such as time information and ID information, fundamentally and effectively eliminating the possibility of repeated generation; and introduces atomic operations (Redis) in the redemption process to ensure that each redemption code can only be used once, effectively preventing concurrent use and reuse; and the present application adopts a high-strength encryption algorithm and a unique encoding method, which makes the redemption code difficult to crack and forge, thereby greatly improving the security of the redemption code and effectively resisting cracking and attacks.

[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0056] Figure 1 A flowchart of a method for generating a redemption code provided in an embodiment of the present application;

[0057] Figure 2 A schematic diagram of the structure of a redemption code generation device provided in an embodiment of the present application;

[0058] Figure 3 A schematic diagram of the structure of another redemption code generation device provided in an embodiment of the present application;

[0059] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for which protection is claimed, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work falls within the scope of protection of the present application.

[0061] A redemption code is an alphanumeric string that users can enter to receive a specific reward or offer. These rewards may include discounts, virtual currency, exclusive content, or other benefits. Redemption codes are typically issued by merchants or platforms as part of promotional activities and are widely used in various fields, including mobile games, e-commerce platforms, and social media.

[0062] However, the redemption codes generated by the existing technology usually have at least one of the following problems: the redemption code is too long and inconvenient for users to input; the redemption code has limited information carrying capacity; there is a risk that the redemption code is difficult to guarantee its uniqueness; there is a risk of repeated redemption of the redemption code; and there is a risk that the redemption code is easily attacked and cracked.

[0063] Based on this, the embodiments of the present application provide a method and device for generating a redemption code, which can effectively improve the security of the generated redemption code and reduce the risk of being attacked and cracked.

[0064] See also Figure 1 , Figure 1 This is a flow chart of a method for generating a redemption code provided in an embodiment of the present application. Figure 1 As shown in , the generation method provided in the embodiment of the present application includes:

[0065] S101. Obtain multiple target attribute parameters of a redemption code to be generated.

[0066] S102 : For each target attribute parameter, determine the corresponding target encoding length according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy.

[0067] S103: Obtain the quantity attribute parameter of the redemption code to be generated, and generate the target random number required for generating the redemption code this time according to the quantity attribute parameter and the multiple target attribute parameters.

[0068] S104: Determine a target coding length corresponding to the target random number, and convert the target random number into a target random number coded text of the target coding length according to a target coding strategy.

[0069] S105. Concatenate the target random number encoded text and all target attribute encoded texts in a preset order to obtain a target plaintext.

[0070] S106. Encrypt the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext.

[0071] S107: Perform encoding conversion processing on the target ciphertext according to the target encoding strategy to obtain a target redemption code.

[0072] The following describes the exemplary steps of the embodiment of the present application:

[0073] With respect to step S101 , the target attribute parameter is a valid parameter related to the redemption code and can be determined in advance.

[0074] In one embodiment provided by the present application, the multiple target attribute parameters include at least a subject ID, a redemption deadline, and current batch information. The subject ID may also be a product ID.

[0075] In addition, when obtaining multiple target attribute parameters for the redemption code to be generated, parameter verification is required to determine whether all the required multiple target attribute parameters have been obtained. If the verification fails, a verification failure prompt is fed back to the relevant personnel and the redemption code generation process is terminated.

[0076] With respect to step S102 , the target encoding length is the length of a character string obtained after encoding the target attribute parameter using a target encoding strategy.

[0077] For example, the target encoding strategy is a base58 encoding strategy.

[0078] In one embodiment provided in the present application, for each target attribute parameter, determining the corresponding target encoding length according to the type of the target attribute parameter includes:

[0079] S1021. For the topic ID, determine that the target encoding length of the topic ID is a first length.

[0080] S1022. With respect to the exchange deadline, determine a target encoding length of the exchange deadline as a second length.

[0081] S1023. Determine, for the current batch information, that the target encoding length of the current batch information is a third length; wherein the first length, the second length, and the third length are not necessarily the same.

[0082] For step S1021, the first length may be set to a 3-digit string length. Thus, the target encoding length of the subject ID is determined to be a 3-digit string length, and then the subject ID is converted into a target attribute encoding text of a 3-digit string length according to the base58 encoding strategy.

[0083] For step S1022, the second length can be set to a 4-digit string length. In this way, the target encoding length of the redemption deadline is determined to be a 4-digit string length, and then the redemption deadline is converted into a target attribute encoding text of a 4-digit string length according to the base58 encoding strategy.

[0084] For step S1023, the third length can be set to a 1-bit string length. In this way, the target encoding length of the current batch information is determined to be a 1-bit string length, and then the current batch information is converted into a target attribute encoding text with a 1-bit string length according to the base58 encoding strategy.

[0085] It should be noted that when encoding and converting each target attribute parameter according to the target encoding strategy, if any conversion fails, a conversion failure prompt will be fed back to the relevant personnel and the redemption code generation process will be terminated.

[0086] With respect to step S103, the quantity attribute parameter is pre-determined parameter information, specifically representing the total number of redemption codes required to be generated in this batch.

[0087] This step may specifically include: determining the total number of target random numbers required to be generated based on the quantity attribute parameter, and performing cyclic generation of random numbers based on the quantity attribute parameter and the multiple target attribute parameters to obtain at least one target random number (generally multiple target random numbers) required for generating this redemption code.

[0088] With respect to step S104 , the target encoding length corresponding to the target random number may be predetermined, and for example, may be set to a 4-bit character string length.

[0089] This step may specifically include: determining that the target encoding length of the target random number is a 4-bit string length, and then converting the target random number into a target random number encoding text with a 4-bit string length according to the base58 encoding strategy.

[0090] Here, when generating the target random number encoded text, the target random number encoded text is generated for each target random number.

[0091] Among them, if there is a conversion failure when generating any target random number encoding text, the failure is recorded and then the conversion is continued for the next target random number.

[0092] If there are target random numbers that fail to be converted, the number of target redemption codes generated will be less than the required number.

[0093] For step S105, the preset order may specifically be: subject ID coded text + redemption deadline coded text + target random number coded text + current batch information coded text.

[0094] For step S106, in an embodiment provided in the present application, the target plaintext is encrypted using a target encryption algorithm based on a preset key to obtain a target ciphertext, including: obtaining the preset key from a configuration file of the server; and encrypting the target plaintext using an AES encryption algorithm based on the preset key to obtain a target ciphertext.

[0095] Among them, the preset secret key is predetermined static data, and the random number in the plaintext is dynamic data. In this way, the data combined with static and dynamic data is encrypted by the AES encryption algorithm, which can build a multi-level security protection system and effectively prevent the redemption code from being decrypted, tampered with and forged.

[0096] When multiple redemption codes need to be generated, the target ciphertexts obtained by the encryption algorithm may also be multiple.

[0097] Regarding step S107, this step may specifically include performing encoding conversion processing on the target ciphertext according to the base58 encoding strategy to obtain the target redemption code.

[0098] However, when there are multiple target ciphertexts, for each target ciphertext, the target ciphertext is encoded and converted according to the base58 encoding strategy to obtain the target redemption code corresponding to the target ciphertext.

[0099] In addition, in an embodiment provided by the present application, after obtaining the target redemption code, the generation method further includes: storing the target redemption code in a Redis cache of a MySQL database.

[0100] In this way, by utilizing Redis's atomic operations, the atomic use of redemption codes is achieved, ensuring that each redemption code can only be successfully redeemed once, effectively preventing concurrent use and reuse, and achieving excellent performance.

[0101] In another embodiment provided by the present application, after obtaining the target redemption code, the generation method further includes:

[0102] S201: In response to a redemption operation by a user, obtaining a target redemption code and related verification parameters to be redeemed by the user.

[0103] S202: Verify the target redemption code and related verification parameters according to preset rules to determine whether the redemption conditions are met.

[0104] S203: If the conditions are met, the target redemption code is deleted from the database, and a target interface corresponding to a successful redemption of the target redemption code is displayed to the user.

[0105] For step S201, for example, the relevant verification parameters may include: subject ID, open ID, device ID, account ID, etc.

[0106] With respect to step S202, if the redemption conditions are met, step S203 is executed; otherwise, an error message is fed back to the user and the redemption is determined to be invalid.

[0107] Is it true? Step S203, deleting the target redemption code from the database may specifically include deleting the target redemption code from the Redis cache of the MySQL database. For example, the target interface may specifically be an order interface.

[0108] In this way, the present application shortens the length of the target redemption code finally generated through optimized encoding methods and encryption algorithms, thereby improving the user experience; and the present application encodes valid information such as the subject ID and the redemption deadline into the redemption code, thereby improving the information carrying capacity of the redemption code, so that this information can be obtained without additional database queries, greatly reducing the burden on the server; and the present application also ensures that each redemption code is unique by adopting a generation algorithm that combines multiple information such as time information and ID information, fundamentally and effectively eliminating the possibility of repeated generation; and introduces atomic operations (Redis) in the redemption process to ensure that each redemption code can only be used once, effectively preventing concurrent use and reuse; and the present application adopts a high-strength encryption algorithm and a unique encoding method, which makes the redemption code difficult to crack and forge, thereby greatly improving the security of the redemption code and effectively resisting cracking and attacks.

[0109] Based on the same inventive concept, a generation device corresponding to the generation method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned generation method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0110] See also Figure 2 、 Figure 3 , Figure 2 This is a structural diagram of a redemption code generation device provided in an embodiment of the present application. Figure 3 This is a schematic diagram of the structure of another redemption code generation device provided in an embodiment of the present application. Figure 2 As shown in , the generating device 200 includes:

[0111] An acquisition module 210 is used to acquire multiple target attribute parameters of a redemption code to be generated;

[0112] The first conversion module 220 is configured to determine the corresponding target encoding length for each target attribute parameter according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy;

[0113] The generating module 230 is configured to obtain a quantity attribute parameter of a redemption code to be generated, and generate a target random number required for generating the redemption code according to the quantity attribute parameter and the plurality of target attribute parameters;

[0114] The second conversion module 240 is used to determine the target encoding length corresponding to the target random number, and convert the target random number into a target random number encoding text of the target encoding length according to the target encoding strategy;

[0115] A splicing module 250 is used to splice the target random number encoded text and all target attribute encoded texts in a preset order to obtain a target plaintext;

[0116] The encryption module 260 is configured to encrypt the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext;

[0117] The third conversion module 270 is configured to perform encoding conversion on the target ciphertext according to the target encoding strategy to obtain a target redemption code.

[0118] Optionally, the multiple target attribute parameters include at least a subject ID, a redemption deadline, and current batch information.

[0119] Optionally, when the first conversion module 220 is used to determine the corresponding target encoding length for each target attribute parameter according to the type of the target attribute parameter, the first conversion module 220 is used to:

[0120] For the subject ID, determining a target encoding length of the subject ID as a first length;

[0121] With respect to the exchange deadline, determining a target encoding length of the exchange deadline as a second length;

[0122] For the current batch information, determining a target encoding length of the current batch information as a third length; wherein the first length, the second length, and the third length are not necessarily the same.

[0123] Optionally, the target encoding strategy is a base58 encoding strategy.

[0124] Optionally, when the encryption module 260 is used to encrypt the target plaintext using a target encryption algorithm based on a preset key to obtain a target ciphertext, the encryption module 260 is used to:

[0125] Obtain the preset key from the configuration file of the server;

[0126] Based on the preset secret key, the target plaintext is encrypted using the AES encryption algorithm to obtain the target ciphertext.

[0127] Optional, such as Figure 3 As shown, the generating device 200 further includes a conversion module 280, and the conversion module 280 is used to:

[0128] After obtaining the target redemption code, in response to a redemption operation by the user, obtaining the target redemption code to be redeemed by the user and related verification parameters;

[0129] Verify the target redemption code and related verification parameters according to preset rules to determine whether the redemption conditions are met;

[0130] If satisfied, the target redemption code is deleted from the database, and a target interface corresponding to the successful redemption of the target redemption code is displayed to the user.

[0131] Optionally, the generating device 200 further includes a storage module 290, and the storage module 290 is configured to:

[0132] After obtaining the target redemption code, the target redemption code is stored in the Redis cache of the MySQL database.

[0133] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown in FIG, the electronic device 400 includes a processor 410 , a memory 420 and a bus 430 .

[0134] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, the above-mentioned Figure 1 The specific implementation of the steps in the method embodiment shown can be found in the method embodiment and will not be repeated here.

[0135] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The specific implementation of the steps in the method embodiment shown can be found in the method embodiment and will not be repeated here.

[0136] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0137] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0138] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0139] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0140] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0141] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The scope of protection of the present application is not limited thereto. Although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-mentioned embodiments within the technical scope disclosed in the present application, or perform equivalent replacements for some of the technical features thereof. These modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A method for generating a redemption code, characterized in that: The generation method comprises: Get multiple target attribute parameters of the redemption code to be generated; For each target attribute parameter, determine the corresponding target encoding length according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy; Obtaining a quantity attribute parameter of a redemption code to be generated, and generating a target random number required for generating the redemption code this time based on the quantity attribute parameter and the multiple target attribute parameters; Determining a target encoding length corresponding to the target random number, and converting the target random number into a target random number encoding text of the target encoding length according to a target encoding strategy; The target random number encoded text and all target attribute encoded texts are concatenated in a preset order to obtain the target plaintext; Based on a preset secret key, the target plaintext is encrypted using a target encryption algorithm to obtain a target ciphertext; The target ciphertext is subjected to encoding conversion processing according to the target encoding strategy to obtain a target redemption code.

2. The generation method according to claim 1, characterized in that The multiple target attribute parameters include at least a subject ID, a redemption deadline, and current batch information.

3. The generation method according to claim 2, characterized in that The step of determining the corresponding target encoding length for each target attribute parameter according to the type of the target attribute parameter includes: For the subject ID, determining a target encoding length of the subject ID as a first length; With respect to the exchange deadline, determining a target encoding length of the exchange deadline as a second length; For the current batch information, determining a target encoding length of the current batch information as a third length; wherein the first length, the second length, and the third length are not necessarily the same.

4. The generation method according to claim 1, characterized in that The target encoding strategy is the base58 encoding strategy.

5. The generation method according to claim 1, characterized in that The target plaintext is encrypted using a target encryption algorithm based on a preset secret key to obtain a target ciphertext, including: Obtain the preset key from the configuration file of the server; Based on the preset secret key, the target plaintext is encrypted using the AES encryption algorithm to obtain the target ciphertext.

6. The generation method according to claim 1, characterized in that After obtaining the target redemption code, the generation method further includes: In response to a redemption operation by a user, obtaining a target redemption code and related verification parameters to be redeemed by the user; Verify the target redemption code and related verification parameters according to preset rules to determine whether the redemption conditions are met; If satisfied, the target redemption code is deleted from the database, and a target interface corresponding to the successful redemption of the target redemption code is displayed to the user.

7. The generation method according to claim 1, characterized in that After obtaining the target redemption code, the generation method further includes: The target redemption code is stored in the Redis cache of the MySQL database.

8. A device for generating a redemption code, characterized in that: The generating device comprises: An acquisition module, used to obtain multiple target attribute parameters of the redemption code to be generated; A first conversion module is configured to determine, for each target attribute parameter, a corresponding target encoding length according to the type of the target attribute parameter, and convert the target attribute parameter into a target attribute encoding text of the target encoding length according to the target encoding strategy; A generation module, configured to obtain a quantity attribute parameter of a redemption code to be generated, and generate a target random number required for generating the redemption code according to the quantity attribute parameter and the plurality of target attribute parameters; A second conversion module is used to determine a target code length corresponding to the target random number, and convert the target random number into a target random number code text of the target code length according to a target coding strategy; A splicing module is used to splice the target random number encoded text and all target attribute encoded texts in a preset order to obtain a target plaintext; An encryption module, configured to encrypt the target plaintext using a target encryption algorithm based on a preset secret key to obtain a target ciphertext; The third conversion module is configured to perform encoding conversion processing on the target ciphertext according to the target encoding strategy to obtain a target redemption code.

9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the generation method as 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, and when the computer program is executed by a processor, the steps of the generation method according to any one of claims 1 to 7 are executed.