Short link generation method and device, equipment, storage medium and program product

By generating short links in real time, using historical coded numbers and obfuscated encoded strings, the problem of waste of storage resources and low generation efficiency in the prior art is solved, and efficient, unique and unpredictable short link generation is achieved.

CN119537720APending Publication Date: 2025-02-28CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411344365.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The prior art wastes storage resources when generating short links, and the generation efficiency is low, requiring a lot of comparisons to ensure the uniqueness of short links.

Method used

When receiving the short link conversion instruction for the long link to be converted, the target short link is generated in real time, and the latest encoded numbers and confused encoded strings are used to determine the characters and sort them to generate a unique short link.

Benefits of technology

It realizes that target short links are generated in real time without pre-saving short links, saving storage and computing resources, and improving generation efficiency and unpredictability of short links by ensuring the uniqueness of the number to be encoded and the strings encoded, which improves the generation efficiency and unpredictability of short links.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention discloses a short link generation method and device, equipment, a storage medium and a program product. The invention relates to the technical field of data processing. The method comprises the following steps: when a first short link conversion instruction for a to-be-converted long link is received, changing a historical latest coded number to obtain a to-be-coded number; dividing the number to be coded by n to obtain a first remainder and a first quotient, and determining a character corresponding to the first remainder from the obfuscated coded character string; dividing the first quotient by n to obtain a second remainder and a second quotient, and determining a character corresponding to the second remainder from the obfuscated coded character string; taking the second quotient as a new first quotient, and returning to execute the previous step until the new first quotient is zero; and generating a target short link corresponding to the to-be-converted long link according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder. According to the short link generation method, storage resources are saved, and the generation efficiency of the target short link is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a short link generation method, device, equipment, storage medium and program product. Background Art

[0002] In some business scenarios, it is necessary to convert long links into short links for dissemination. The advantages of using short links include: more concise, easier to remember, easier to share, saving space, reducing word count limits, and saving communication costs.

[0003] Currently, long links can be converted to short links through the following offline generation method: a batch of short links of fixed length are pre-generated through a random algorithm and saved in the database. When a long link needs to be converted to a short link, an unused short link is directly taken from the database as the short link corresponding to the long link.

[0004] However, in the above generation method, since short links are generated in advance, a large number of short links need to be stored, wasting storage resources. At the same time, as more and more long links need to be converted, a large number of comparisons are required to ensure the uniqueness of the short links, and the generation efficiency is low. Summary of the invention

[0005] The present application provides a short link generation method, device, equipment, storage medium and program product, which are used to solve the technical problems of wasting storage resources and low generation efficiency when generating short links in related technologies.

[0006] In a first aspect, the present application provides a short link generation method, comprising:

[0007] When receiving the first short link conversion instruction for the long link to be converted, the latest historical encoded number is changed to obtain the number to be encoded; wherein the number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5;

[0008] Dividing the number to be encoded by n to obtain a first remainder and a first quotient, and determining the character corresponding to the first remainder from the obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10;

[0009] Dividing the first quotient by n to obtain a second remainder and a second quotient, and determining a character corresponding to the second remainder from the obfuscated encoded string; wherein the second remainders are different and the characters corresponding to the second remainders are different;

[0010] Taking the second quotient as a new first quotient, returning to the step of "dividing the first quotient by n to obtain a second remainder and a second quotient, and determining a character corresponding to the second remainder from the obfuscated encoded character string" until the new first quotient is zero;

[0011] A target short link corresponding to the long link to be converted is generated according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0012] In a second aspect, the present application provides a short link generation device, the device comprising:

[0013] A change module, for, when receiving a first short link conversion instruction for a long link to be converted, changing the latest historical encoded number to obtain a number to be encoded; wherein the number to be encoded is an m-digit decimal number, where m is an integer greater than or equal to 5;

[0014] A first determination module, configured to divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine a character corresponding to the first remainder from an obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10;

[0015] A second determination module is configured to divide the first quotient by n to obtain a second remainder and a second quotient, and determine a character corresponding to the second remainder from the obfuscated encoded string; wherein the second remainders are different and the characters corresponding to the second remainders are different;

[0016] a third determining module, configured to use the second quotient as a new first quotient and return to execute the steps executed by the second determining module until the new first quotient is zero;

[0017] A generating module is used to generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0018] In a third aspect, the present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a short link generation method as described in any one of the present applications is implemented.

[0019] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the short link generation method as described in any one of the present applications is implemented.

[0020] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements a short link generation method as described in any one of the present applications.

[0021] The technical solution provided by the present application includes: when a first short link conversion instruction for a long link to be converted is received, the latest historical encoded number is changed to obtain a number to be encoded, wherein the number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5; the number to be encoded is divided by n to obtain a first remainder and a first quotient, and the character corresponding to the first remainder is determined from the obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10; the first quotient is divided by n to obtain a second remainder and a second quotient, and the character corresponding to the second remainder is determined from the obfuscated encoded string, wherein the second remainder is different and the characters corresponding to the second remainder are different; the second quotient is used as a new first quotient, and the step of "dividing the first quotient by n to obtain a second remainder and a second quotient, and determining the character corresponding to the second remainder from the obfuscated encoded string" is returned until the new first quotient is zero; according to the character string obtained by sorting the character corresponding to the first remainder and the character corresponding to the second remainder, a target short link corresponding to the long link to be converted is generated. In the short link generation method, on the one hand, it is possible to generate the target short link in real time when the first short link conversion instruction is received, without pre-saving the short link, thus saving storage resources and computing resources. On the other hand, after the latest historical encoded number is changed, the number to be encoded is obtained, which ensures the uniqueness and unguessability of the number to be encoded, and the character is determined from the obfuscated encoded string using the number to be encoded, which ensures the uniqueness and unguessability of the obfuscated encoded string. The above two measures are used together to ensure that the uniqueness and unguessability of the generated target short link can be guaranteed without comparison, thereby improving the generation efficiency of the target short link while ensuring the generation quality of the target short link. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. 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 related drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 A schematic diagram of an application scenario of the short link generation method provided in an embodiment of the present application;

[0024] Figure 2A schematic diagram of another application scenario of the short link generation method provided in an embodiment of the present application;

[0025] Figure 3 A flowchart of a short link generation method provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of an obfuscated encoding string in an embodiment of the present application;

[0027] Figure 5 A schematic diagram of a sorted string in an embodiment of the present application;

[0028] Figure 6 A flowchart of another short link generation method provided in an embodiment of the present application;

[0029] Figure 7 A schematic diagram of historical encoded numbers stored in a database in an embodiment of the present application;

[0030] Figure 8 A flowchart of another short link generation method provided in an embodiment of the present application;

[0031] Fig. 9 A flowchart of another short link generation method provided in an embodiment of the present application;

[0032] Fig.10 A flowchart of another short link generation method provided in an embodiment of the present application;

[0033] Fig.11 A flowchart of another short link generation method provided in an embodiment of the present application;

[0034] Fig.12 A schematic diagram of the structure of a short link generation device provided in an embodiment of the present application;

[0035] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.

[0037] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. At the same time, in the description of this application, the terms "first" and "second" are only used to distinguish the description and cannot be understood as indicating or implying relative importance. The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of this application, certain software, components, models, and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. The purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0038] Figure 1 A schematic diagram of an application scenario of the short link generation method provided in an embodiment of the present application. Figure 1 As shown, the short link generation method provided in this embodiment can be applied to Figure 1 In the first electronic device 11 shown. The first electronic device 11 in this embodiment can be a computer device, a server, etc. The second electronic device 12 can send a short link conversion instruction for the long link to be converted to the first electronic device 11. When the first electronic device 11 receives the short link conversion instruction, it can execute the short link generation method provided in this embodiment. After generating the target short link, the first electronic device 11 can feed back the target short link to the second electronic device 12, or to the terminal device 13.

[0039] Figure 2 A schematic diagram of another application scenario of the short link generation method provided in the embodiment of the present application. Figure 2 As shown, the short link generation method provided in this embodiment can be applied to Figure 2 In the electronic device cluster 21 shown, the electronic device cluster 21 includes at least two third electronic devices 211 . Figure 2 In the example, the electronic device cluster 21 includes three third electronic devices 211. The second electronic device 12 can send a short link conversion instruction for the long link to be converted to the electronic device cluster 21. When the electronic device cluster 21 receives the short link conversion instruction, it can select a third electronic device 211 to execute the short link generation method provided in this embodiment. After generating the target short link, the third electronic device 211 can feed back the target short link to the second electronic device 12, or to the terminal device 13.

[0040] The short link generation method of the present application is further described in detail below through several specific embodiments.

[0041] Figure 3The flowchart of a short link generation method provided in an embodiment of the present application is shown in FIG. The method can be executed by a short link generation device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. The electronic device here can be Figure 1 The first electronic device 11 or Figure 2 The third electronic device 211 in the embodiment. For example, the electronic device in this embodiment may be a server. Figure 3 As shown, the short link generation method provided in this embodiment includes the following steps.

[0042] Step 301: When a first short link conversion instruction for a long link to be converted is received, the latest historical encoded number is changed to obtain the number to be encoded.

[0043] The number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5.

[0044] The long link in this embodiment refers to a Uniform Resource Locator (URL) with relatively more characters. The short link in this embodiment refers to a URL with relatively fewer characters. The short link in this embodiment can also be called a short link key.

[0045] In order to ensure security and user experience, for the same long link, after converting it to a short link, in some scenarios, it is necessary to ensure the uniqueness of the short link generated this time. The purpose of the short link generation method provided in this embodiment is to efficiently generate a unique short link for the long link to be converted.

[0046] The first short link conversion instruction of the long link to be converted in this embodiment can be sent by other electronic devices to the short link generation device. Optionally, the first short link conversion instruction may include at least one of the following: the number of target short links generated, the sending path of the target short link, and the sending address of the target short link. Among them, the sending path of the target short link may include: sending via SMS, sending via instant messaging software, sending via social software, and sending via shopping software. Exemplarily, when the sending path of the target short link is sending via SMS, the sending address of the target short link can be a mobile phone number. It can be understood that when the sending path is sending via SMS, using the target short link can reduce communication costs. When the sending path is sending via instant messaging software, using the target short link can reduce communication traffic. Therefore, using the target short link can reduce the cost of communication.

[0047] In this embodiment, there is no restriction on the business scenarios corresponding to the long links to be converted. For example, the business scenarios corresponding to the long links to be converted may include: shopping sharing, information sharing, and information reporting, etc. Exemplarily, the long links to be converted in this embodiment are long links corresponding to financial services.

[0048] In this embodiment, the historical encoded number refers to the number that has been used to generate the short link. The historical latest encoded number refers to the number that has been used to generate the short link most recently from the current time.

[0049] In this embodiment, changing the latest historical encoded number may include: performing an increment operation on the latest historical encoded number and performing a decrement operation on the latest historical encoded number. The purpose of changing the latest historical encoded number is to make the number to be encoded different from the historical encoded number (including the latest historical encoded number) to ensure the uniqueness of the generated target short link.

[0050] Optionally, the latest historical encoded number can be changed by using a database self-increment primary key to obtain the number to be encoded.

[0051] The number to be encoded in this embodiment is a decimal number of m digits. In order to further ensure uniqueness, m is an integer greater than or equal to 5. It should be noted that the number of digits of the latest historical encoded number in this embodiment is the same as the number to be encoded.

[0052] In this embodiment, the number of digits to be encoded is proportional to the number of characters included in the target short link. Therefore, although the more digits to be encoded, the more unique the target short link can be, this will also result in the target short link including more characters, resulting in a higher cost for propagating the target short link. In order to strike a balance between uniqueness and reducing propagation costs, in this embodiment, m can be 10.

[0053] Step 302: Divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine the character corresponding to the first remainder from the obfuscated encoded character string.

[0054] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0055] In this embodiment, in order to further ensure the uniqueness of the target short link, when generating the target short link, the obfuscated encoding string is used to determine the characters included in the target short link. The obfuscated encoding string in this embodiment refers to the encoding string obtained by scrambling the order of the original regular encoding string. The original regular encoding string in this embodiment can be an existing encoding string, or an encoding string generated by this embodiment. This embodiment does not limit the specific implementation method of the encoding string, as long as it is ensured that there are n non-repeating characters in the encoding string.

[0056] The obfuscated encoding string includes n non-repeating characters. Exemplarily, n may be 62. For example, the originally regular encoding string may include: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy z. The obfuscated encoding string may include: W0uexCgKU8MImHOtcjoZbRLzB9PDYlVwirGQyh3F7sSN5vdka6Xpf2A4TEnJ1q.

[0057] In this embodiment, the character corresponding to the first remainder refers to the character determined from the obfuscated encoded string according to the first remainder. In this embodiment, a one-to-one mapping relationship between the remainder and the character in the obfuscated encoded string has been pre-established, that is, different remainders correspond to different characters in the obfuscated encoded string.

[0058] In this embodiment, in order to facilitate the determination of the character corresponding to the remainder and improve the efficiency of generating a short link, before step 302, the following steps are also included: numbering the characters in the obfuscated encoded string in a preset order to obtain the number of each character in the encoded string. The number is an integer greater than or equal to 0 and less than or equal to n-1, and the difference between the numbers of adjacent characters is 1.

[0059] For ease of implementation, the preset order in this embodiment can be a left-to-right order or a right-to-left order. For example, according to the order from left to right, the characters in the obfuscated encoded string W0uexCgKU8MImHOtcjoZbRLzB9PDYlVwirGQyh3F7sSN5vdka6Xpf2A4TEnJ1q are numbered, then the character W is numbered 0, the character 0 is numbered 1, the character u is numbered 2, ..., and the character q is numbered 61. For another example, according to the order from right to left, the characters in the above obfuscated encoded string are numbered, then the character q is numbered 0, the character 1 is numbered 1, the character J is numbered 2, ..., and the character W is numbered 61.

[0060] Figure 4 Schematic diagram of an obfuscated encoding string in an embodiment of the present application. Figure 4 As shown, assuming that the characters in the obfuscated encoded string 41 are numbered from left to right, the number of each character is as follows Figure 4 as shown in .

[0061] Based on the above implementation, in step 302, the character corresponding to the first remainder can be determined in the following manner: the character whose corresponding number is the same as the first remainder in the numbered obfuscated encoded string is determined as the character corresponding to the first remainder. For example, assuming that the remainder is 2, then it corresponds to the character numbered 2 in the numbered obfuscated encoded string. This implementation can efficiently and accurately determine the character corresponding to the first remainder from the obfuscated encoded string.

[0062] Step 303: Divide the first quotient by n to obtain a second remainder and the second quotient, and determine the character corresponding to the second remainder from the obfuscated encoded character string.

[0063] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0064] In step 303, the implementation method for determining the character corresponding to the second remainder is similar to the implementation method for determining the character corresponding to the first remainder in step 302: the character whose corresponding number in the numbered obfuscated encoded string is the same as the second remainder is determined as the character corresponding to the second remainder.

[0065] Step 304: Use the second quotient as the new first quotient and return to execute step 303 until the new first quotient is zero.

[0066] In this embodiment, step 303 and step 304 are executed in a loop until the new first quotient is 0. When the loop is executed, the quotient obtained last time is used as the dividend and then divided by n, and the remainder obtained is used to determine the corresponding character from the obfuscated encoded string.

[0067] Step 305: Generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0068] In this embodiment, after step 302, step 303 and step 304, the character corresponding to the first remainder and the characters corresponding to each second remainder can be obtained. It can be understood that in the scenario where m is 10 and n is 62, the number of the first remainder and each second remainder is 6, and correspondingly, the string obtained after sorting includes 6 characters. This implementation method can support the generation of hundreds of millions of short links.

[0069] It should be noted that in the short link generation method provided in this embodiment, the values ​​of m and n can be flexibly adjusted based on different application scenarios and the required number of short links, thereby achieving dynamic expansion according to business development and having high flexibility.

[0070] In step 305, a target short link corresponding to the long link to be converted may be generated according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0071] Optionally, step 305 may be implemented through the following steps 3051 and 3052. Steps 3051 and 3052 may facilitate standard and rapid generation of a target short link.

[0072] Step 3051: Sort the characters corresponding to the first remainder and the characters corresponding to the second remainder according to the generation order of the first remainder and the second remainder to obtain a sorted character string.

[0073] In one implementation, the implementation process of step 3051 is: taking the character corresponding to the first remainder as the first character in the sorted string; taking the character corresponding to the second remainder as the i-th character in the sorted string. Wherein, i represents the number of times the division operation is performed when the second remainder is obtained, and i is an integer greater than or equal to 2.

[0074] In this implementation, the character corresponding to the remainder generated earlier is located to the left in the sorted string. This implementation is simple to implement and has high reliability.

[0075] In another implementation, the implementation process of step 3051 is: taking the character corresponding to the first remainder as the last character in the sorted string; taking the character corresponding to the second remainder as the w-i+1th character in the sorted string. Wherein, i represents the number of times the division operation is performed when the second remainder is obtained, i is an integer greater than or equal to 2, and w represents the number of characters included in the sorted string.

[0076] In this implementation, the character corresponding to the remainder generated earlier is located closer to the right in the sorted string.

[0077] Step 3052: Generate a target short link corresponding to the long link to be converted based on the sorted character string.

[0078] In one implementation, the implementation process of step 3052 may be: obtaining a preset domain name; adding a single slash after the domain name, and adding a sorted string after the single slash to obtain a target short link corresponding to the long link to be converted. For example, assuming that the preset domain name is https: / / XX.cn and the sorted string is ngMeG3, the target short link finally generated is: https: / / XX.cn / ngMeG3.

[0079] The target short link obtained based on this implementation conforms to the user's general cognition of links and is easier to gain the user's trust, thereby improving the dissemination effect of the short link.

[0080] In another implementation, the implementation process of step 3052 may be: directly using the sorted character string as the target short link corresponding to the long link to be converted.

[0081] The implementation process of step 301 to step 305 is described below with a specific example. Assume that m is 10 and n is 62. First, execute step 301, assume that the latest historical encoded number is 1000000000, and after the latest historical encoded number is incremented (assuming that it is added by 1), the number to be encoded is 1000000001. Execute step 302, the first remainder is 17, and the first quotient is 16129032. Assume that the obfuscated encoded string is W0uexCgKU8MImHOtcjoZbRLzB9PDYlVwirGQyh3F7sSN5vdka6Xpf2A4TEnJ1q, and the characters in the obfuscated encoded string are numbered from left to right. Then the character corresponding to the first remainder 17 in the obfuscated encoded string is j. Execute step 303 to obtain the second remainder 42 and the second quotient 260145. The character corresponding to the second remainder 42 in the obfuscated encoding string is S. Execute step 304, take 260145 as the new first quotient, return to execute step 303, and obtain the second remainder 55 and the second quotient 4195. The character corresponding to the second remainder 55 in the obfuscated encoding string is 4. Execute step 304, take 4195 as the new first quotient, return to execute step 303, and obtain the second remainder 41 and the second quotient 67. The character corresponding to the second remainder 41 in the obfuscated encoding string is s. Execute step 304, take 67 as the new first quotient, return to execute step 303, and obtain the second remainder 5 and the second quotient 1. The character corresponding to the second remainder 5 in the obfuscated encoding string is C. Execute step 304, take 1 as the new first quotient, return to execute step 303, and obtain the second remainder 1 and the second quotient 0. The character corresponding to the second remainder 1 in the obfuscated encoding string is 0. Take 0 as the new first quotient, and the new first quotient is zero at this time, and the training ends. Execute step 305 to sort the characters corresponding to the first remainder and the characters corresponding to the second remainder. Figure 5 Schematic diagram of a sorted string in an embodiment of the present application. Figure 5 As shown, in Figure 4 Based on the above, assuming that the remainders are sorted from front to back in the order in which they are generated, the sorted string is: jS4sC0. Assuming that the pre-set domain name is https: / / XXX.cn, the target short link generated is: https: / / XXX.cn / jS4sC0.

[0082] The short link generation method provided by the present embodiment includes: when receiving a first short link conversion instruction for a long link to be converted, changing the latest historical encoded number to obtain a number to be encoded, wherein the number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5; dividing the number to be encoded by n to obtain a first remainder and a first quotient, and determining the character corresponding to the first remainder from the obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10; dividing the first quotient by n to obtain a second remainder and a second quotient, and determining the character corresponding to the second remainder from the obfuscated encoded string, wherein the second remainders are different and the characters corresponding to the second remainders are different; taking the second quotient as a new first quotient, returning to execute the step of "dividing the first quotient by n to obtain a second remainder and a second quotient, and determining the character corresponding to the second remainder from the obfuscated encoded string" until the new first quotient is zero; generating a target short link corresponding to the long link to be converted according to a string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder. In the short link generation method, on the one hand, it is possible to generate the target short link in real time when the first short link conversion instruction is received, without pre-saving the short link, thus saving storage resources and computing resources. On the other hand, after the latest historical encoded number is changed, the number to be encoded is obtained, which ensures the uniqueness and unguessability of the number to be encoded, and the character is determined from the obfuscated encoded string using the number to be encoded, which ensures the uniqueness and unguessability of the obfuscated encoded string. The above two measures are used together to ensure that the uniqueness and unguessability of the generated target short link can be guaranteed without comparison, thereby improving the generation efficiency of the target short link while ensuring the generation quality of the target short link.

[0083] Figure 6 A flowchart of another short link generation method provided in an embodiment of the present application. Figure 3 Based on the illustrated embodiment and various optional implementations, a detailed description is given of how to obtain the number to be encoded in the short link generation method. Figure 6 As shown, the short link generation method provided in this embodiment includes the following steps.

[0084] Step 601: when receiving a first short link conversion instruction for a long link to be converted, obtaining the latest historical encoded number from a database.

[0085] In this embodiment, in order to facilitate implementation and further improve the efficiency of generating the target short link, a database can be used as a global counter to store the latest historical encoded number. After each historical encoded number is obtained, it can be stored in the database. The database can determine the latest stored historical encoded number as the latest historical encoded number.

[0086] Exemplarily, the database in this embodiment may be a Remote Dictionary Server (Remote Dictionary Server, Redis for short) database.

[0087] Step 602: By using the database self-increment method, the latest historical encoded number is changed to obtain the number to be encoded.

[0088] The number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5.

[0089] In this embodiment, in order to facilitate implementation and further improve the efficiency of generating the target short link, the latest historical encoded number is changed through the database's self-increment method to obtain the number to be encoded. Exemplarily, when the database is a Redis database, the incrby self-increment method can be used to change the latest historical encoded number to obtain the number to be encoded. In this embodiment, incrby can perform increment or decrement operations according to the specified value and return the incremented or decremented result, where incrby increments or decrements depending on the positive or negative value passed in).

[0090] Optionally, step 602 may be implemented through the following steps 6021 and 6022 .

[0091] Step 6021: Determine the random change amount based on the random generation algorithm and the attribute information of the long link to be converted.

[0092] In this embodiment, the attribute information of the long link to be converted may include at least one of the following: the number of characters included in the long link to be converted, the confidentiality level of the long link to be converted, and the importance level of the long link to be converted.

[0093] Step 6022: Input the random variation and the latest historical encoded number into the database's self-increment algorithm to obtain the number to be encoded output by the database's self-increment algorithm.

[0094] Among them, the number to be encoded is the sum of the latest historical encoded number and the random change amount.

[0095] For example, assuming that the latest historical encoded number is 1000000002 and the random change is 42, the number to be encoded is 1000000044.

[0096] This implementation method can generate a number to be encoded that matches the attribute information of the long link to be converted, and can realize adaptive short link generation on the basis of ensuring the uniqueness of the short link.

[0097] Step 603: Divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine the character corresponding to the first remainder from the obfuscated encoded character string.

[0098] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0099] Step 604: Divide the first quotient by n to obtain a second remainder and the second quotient, and determine the character corresponding to the second remainder from the obfuscated encoded character string.

[0100] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0101] Step 605: Use the second quotient as the new first quotient and return to execute step 604 until the new first quotient is zero.

[0102] Step 606: Generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0103] The implementation process and technical principle of step 603 and step 302, step 604 and step 303, step 605 and step 304, and step 606 and step 305 are similar, and will not be repeated here.

[0104] Step 607: The number to be encoded is stored in the database, and the number to be encoded is determined as the new historical latest encoded number.

[0105] In this embodiment, after the target short link is generated, in order to facilitate the subsequent generation of short links, the number to be encoded is determined as the new historical latest encoded number. The specific process may be: the number to be encoded is stored in a database. The database marks the number to be encoded as the new historical latest encoded number.

[0106] Figure 7 Schematic diagram of the historical encoded numbers stored in the database in the embodiment of the present application. Figure 7As shown, it is assumed that there are 3 historical encoded numbers stored in the database, namely: 1000000000, 1000000001 and 1000000002. Among them, 1000000002 is the latest historical encoded number. After executing step 602, the number to be encoded is 1000000003. Then after executing steps 603 to 607, the historical encoded numbers stored in the database are updated to 4, namely: 1000000000, 1000000001, 1000000002 and 1000000003. Among them, 1000000003 is the new latest historical encoded number.

[0107] The short link generation method provided in this embodiment can obtain the latest historical encoded number from the database when receiving the first short link conversion instruction for the long link to be converted. Through the self-increment method of the database, the latest historical encoded number is changed to obtain the number to be encoded, thereby further improving the efficiency of short link generation.

[0108] Figure 8 A flowchart of another short link generation method provided in an embodiment of the present application. Figure 6 Based on the illustrated embodiment and various optional implementations, the implementation after generating the target short link is described in detail. Figure 8 As shown, the short link generation method provided in this embodiment includes the following steps.

[0109] Step 801: When a first short link conversion instruction for a long link to be converted is received, the latest historical encoded number is changed to obtain the number to be encoded.

[0110] The number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5.

[0111] Step 802: Divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine the character corresponding to the first remainder from the obfuscated encoded character string.

[0112] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0113] Step 803: Divide the first quotient by n to obtain a second remainder and the second quotient, and determine the character corresponding to the second remainder from the obfuscated encoded character string.

[0114] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0115] Step 804: Use the second quotient as the new first quotient and return to execute step 803 until the new first quotient is zero.

[0116] Step 805: Generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0117] Step 806: The number to be encoded is stored in the database, and the number to be encoded is determined as the new historical latest encoded number.

[0118] The implementation process and technical principles of step 801 are similar to those of step 601 and step 602, step 802 and step 302, step 803 and step 303, step 804 and step 304, step 805 and step 305, and step 806 and step 607, and are not repeated here.

[0119] Step 807: If a second short link conversion instruction for the long link to be converted is received, the difference between the generation time of the target short link and the current time is determined.

[0120] In order to save resources, the short link generation method provided in this embodiment first determines whether it is necessary to generate a target short link again when receiving the second short link conversion instruction for the long link to be converted. The judgment method is to determine the difference between the generation time of the target short link and the current time. The generation time of the target short link in this embodiment refers to the generation time of the target short link in step 805.

[0121] Step 808: If the difference between the generation time of the target short link and the current time is less than the preset time threshold, the target short link is determined as the short link corresponding to the second short link conversion instruction.

[0122] The preset duration threshold in this embodiment refers to the preset expiration duration of the target short link, or the expiration duration of the target short link set according to actual business needs. If the difference between the generation time of the target short link and the current time is less than the preset duration threshold, it means that the target short link generated in step 805 has not expired, then in step 808, the target short link generated in step 805 is determined as the short link corresponding to the second short link conversion instruction to save computing resources.

[0123] Step 809: If the difference between the generation time of the target short link and the current time is greater than or equal to the preset time threshold, it is determined to return to the step of "obtaining the number to be encoded after changing the latest historical encoded number" in step 801.

[0124] If the difference between the generation time of the target short link and the current time is greater than or equal to the preset time threshold, it means that the target short link generated in step 805 has expired, and the process returns to the step of "changing the latest historical encoded number to obtain the number to be encoded" in step 801, that is, re-executing the step of generating the target short link. It should be noted that the latest historical encoded number at this time has been updated to the number to be encoded generated when step 801 was first executed to ensure the uniqueness of the target short link generated again.

[0125] The short link generation method provided in this embodiment, when receiving the second short link conversion instruction for the long link to be converted, determines whether it is necessary to generate the target short link again based on the difference between the generation time of the target short link and the current time. When it is determined that the target short link needs to be generated again, the operation of generating the target short link is performed, thereby further saving computing resources.

[0126] Fig. 9 A flowchart of another short link generation method provided in an embodiment of the present application. Figure 3 , Figure 6 and Figure 8 Based on the illustrated embodiment and various optional implementations, a detailed description is given of how to obtain the obfuscated encoded string. Fig. 9 As shown, the short link generation method provided in this embodiment includes the following steps.

[0127] Step 901: When a first short link conversion instruction for a long link to be converted is received, the latest historical encoded number is changed to obtain the number to be encoded.

[0128] The number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5.

[0129] The implementation process and technical principle of step 901 are similar to those of step 301 and will not be repeated here.

[0130] Step 902: Obtain the importance level of the long link to be converted.

[0131] In one implementation, the importance level of the long link to be converted may be determined according to the importance level indication information.

[0132] In another implementation, the importance level of the long link to be converted can be determined based on a pre-trained importance level model.

[0133] In yet another implementation, the importance level of the long link to be converted may be determined based on a predetermined mapping relationship between the URL and the importance level.

[0134] Step 903: Determine the degree of obfuscation of the encoded string according to the importance level of the long link to be converted.

[0135] Among them, the higher the importance level, the higher the obfuscation procedure.

[0136] Optionally, a mapping relationship between the importance level of the long link and the obfuscation degree may be established in advance, and the obfuscation degree when obfuscating the encoded character string may be determined according to the importance level of the long link to be converted and the mapping relationship.

[0137] Step 904: Obfuscate the encoded string according to the degree of obfuscation to obtain an obfuscated encoded string.

[0138] The higher the obfuscation degree is, the greater the edit distance between the obfuscated encoded string and the encoded string obtained based on the obfuscation degree is.

[0139] The edit distance in this embodiment is a quantitative measurement of the difference between two strings. The measurement method is to see how many times it takes to transform one string into another string. The larger the edit distance, the less similar the obfuscated encoded string is to the encoded string.

[0140] Through step 903 and step 904, it is achieved that the more important the long link to be converted is, the more difficult it is to predict the obfuscated encoded string, which further ensures that the target short link corresponding to the long link to be converted is unpredictable, and further improves information security.

[0141] Step 905: Divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine the character corresponding to the first remainder from the obfuscated encoded character string.

[0142] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0143] Step 906: Divide the first quotient by n to obtain a second remainder and a second quotient, and determine the character corresponding to the second remainder from the obfuscated encoded character string.

[0144] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0145] Step 907: Use the second quotient as the new first quotient and return to execute step 906 until the new first quotient is zero.

[0146] Step 908: Generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0147] The implementation process and technical principle of step 905 and step 302, step 906 and step 303, step 907 and step 304, and step 908 and step 305 are similar, and will not be repeated here.

[0148] The short link generation method provided in the present embodiment obtains the importance level of the long link to be converted, and determines the degree of obfuscation when obfuscating the encoded string according to the importance level of the long link to be converted, wherein the higher the importance level, the higher the obfuscation program, and the encoded string is obfuscated according to the degree of obfuscation to obtain an obfuscated encoded string, wherein the higher the degree of obfuscation, the greater the edit distance between the obfuscated encoded string obtained based on the degree of obfuscation and the encoded string, thereby achieving that the more important the long link to be converted is, the more difficult it is to predict the obfuscated encoded string, further ensuring that the target short link corresponding to the long link to be converted is unpredictable, and further improving information security.

[0149] Fig.10 A flowchart of another short link generation method provided in an embodiment of the present application. Figure 3 , Figure 6 , Figure 8 and Fig. 9 Based on the illustrated embodiment and various optional implementations, a detailed description is given of how to obtain the number to be encoded. Fig.10 As shown, the short link generation method provided in this embodiment includes the following steps.

[0150] Step 1001: When a first short link conversion instruction for a long link to be converted is received, the propagation quantity of the long link to be converted is obtained.

[0151] The propagation quantity of the long link to be converted in this embodiment refers to the propagation quantity of its corresponding target short link.

[0152] Optionally, the number of propagations of the long link to be converted may be obtained through the following three implementation methods.

[0153] In a first implementation, the number of propagations of the long link to be converted is determined according to the received indication information of the number of propagations.

[0154] The second implementation method is to determine the propagation quantity of the long link to be converted based on the historical access data of the long link to be converted.

[0155] The larger the amount of historical access data is, the larger the number of propagations of the long link to be converted is. In this embodiment, the number of propagations of the long link to be converted can be obtained by quantifying the historical access data.

[0156] A third implementation method is to perform semantic analysis on the page corresponding to the long link to be converted, obtain a semantic analysis result, and determine the propagation quantity of the long link to be converted based on the semantic analysis result.

[0157] Optionally, a semantic database may be predefined, and the semantic database includes semantic analysis results that need to be widely disseminated. For example, the semantic database may include semantic analysis results of common sense, popular science, etc. that need to be widely disseminated. In this implementation, the number of disseminations of the long link to be converted may be determined based on the semantic analysis results of the semantic analysis of the page corresponding to the long link to be converted and the degree of matching with the semantic database. Exemplarily, the higher the degree of matching, the greater the number of disseminations of the long link to be converted.

[0158] Step 1002: Determine the latest historical encoded number from a plurality of candidate latest historical encoded numbers according to the propagation number of the long link to be converted.

[0159] Among them, the larger the number of transmissions, the smaller the number of bits of the latest historical encoded number.

[0160] In this implementation, there are multiple candidate historical latest encoded numbers. The number of digits of each candidate historical latest encoded number is different. In this embodiment, the historical latest encoded number can be determined from multiple candidate historical latest encoded numbers according to the number of propagations of the long link to be converted. Moreover, the larger the number of propagations, the smaller the number of digits of the historical latest encoded number.

[0161] It can be understood that the smaller the number of bits of the latest historical encoded number, the shorter the length of the target short link finally generated, and the lower the propagation cost of the target short link. In other words, the short link generation method provided in this embodiment can ensure that when the propagation number of the long link to be converted is larger, the length of the target short link corresponding to the long link to be converted is shorter, and the propagation cost of the target short link is lower.

[0162] Step 1003: After changing the latest historical encoded number, the number to be encoded is obtained.

[0163] The number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5.

[0164] The implementation process and technical principle of obtaining the number to be encoded after the latest historical encoded number is changed in step 1003 and step 301 are similar, and will not be repeated here.

[0165] Step 1004: Divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine the character corresponding to the first remainder from the obfuscated encoded character string.

[0166] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0167] Step 1005: Divide the first quotient by n to obtain a second remainder and a second quotient, and determine the character corresponding to the second remainder from the obfuscated encoded character string.

[0168] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0169] Step 1006: Use the second quotient as the new first quotient and return to execute step 1005 until the new first quotient is zero.

[0170] Step 1007: Generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0171] The implementation process and technical principles of step 1004 and step 302, step 1005 and step 303, step 1006 and step 304, and step 1007 and step 305 are similar and will not be repeated here.

[0172] The short link generation method provided in this embodiment obtains the propagation number of the long link to be converted when receiving the first short link conversion instruction for the long link to be converted, and determines the historical latest encoded number from multiple candidate historical latest encoded numbers according to the propagation number of the long link to be converted, wherein the larger the propagation number, the smaller the number of bits of the historical latest encoded number, which can ensure that when the propagation number of the long link to be converted is larger, the length of the target short link corresponding to the long link to be converted is shorter, thereby further reducing the propagation cost of the target short link.

[0173] Fig.11 A flowchart of another short link generation method provided in an embodiment of the present application. Figure 3 , Figure 6 , Figure 8 , Fig. 9 and Fig.10 Based on the illustrated embodiment and various optional implementations, a detailed description is given of how to access a long link based on a short link. For simplicity, this embodiment only describes the steps after generating a target short link corresponding to the long link to be converted. Fig.11 As shown, the short link generation method provided in this embodiment also includes the following steps.

[0174] Step 1101: Send a target short link to an indicated terminal device.

[0175] In one implementation, the first short link conversion instruction may include an indicated terminal device identifier. After the target short link is generated, the target short link is sent to the terminal device corresponding to the indicated terminal device identifier.

[0176] Step 1102: Add the mapping relationship between the long link to be converted and the target short link to the pre-stored mapping relationship table of long links and short links to form an updated mapping relationship table.

[0177] In order to successfully access the long link to be converted through the target short link, in step 1102, the mapping relationship between the long link to be converted and the target short link needs to be updated in the mapping relationship table between the long link and the short link.

[0178] Step 1103: after receiving the short link to be visited sent by the target terminal device, determine the long link to be visited corresponding to the short link to be visited from the updated mapping relationship table.

[0179] The target terminal device in this embodiment may be at least one of the terminal devices indicated in step 1101. The target terminal device may send the short link to be accessed based on actual needs. It should be noted that the short link to be accessed in this embodiment may be the same as or different from the target short link.

[0180] In this embodiment, after receiving the short link to be accessed, the long link to be accessed corresponding to the short link to be accessed is determined from the updated mapping relationship table.

[0181] Step 1104: Send the long link to be accessed to the target terminal device, so that the target terminal device can access the long link to be accessed.

[0182] After determining the long link to be accessed corresponding to the short link to be accessed, the long link to be accessed may be sent to the target terminal device so that the target terminal device accesses the long link to be accessed.

[0183] The short link generation method provided in this embodiment can realize access to a long link based on a short link, and the access process has high reliability and high access efficiency.

[0184] Fig.12 This is a schematic diagram of the structure of a short link generation device provided in an embodiment of the present application. Fig.12 As shown, the short link generating device provided by this embodiment includes the following modules: a changing module 1201 , a first determining module 1202 , a second determining module 1203 , a third determining module 1204 and a generating module 1205 .

[0185] The changing module 1201 is used to change the latest historical encoded number to obtain the number to be encoded when receiving the first short link conversion instruction for the long link to be converted.

[0186] The number to be encoded is an m-digit decimal number, where m is an integer greater than or equal to 5.

[0187] The first determination module 1202 is configured to divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine a character corresponding to the first remainder from the obfuscated encoded character string.

[0188] The obfuscated encoded string includes n non-repeating characters, where n is a 2-digit decimal number and n is an integer greater than 10.

[0189] The second determination module 1203 is configured to divide the first quotient by n to obtain a second remainder and a second quotient, and determine a character corresponding to the second remainder from the obfuscated encoded character string.

[0190] Among them, the second remainders are different, and the characters corresponding to the second remainders are different.

[0191] The third determining module 1204 is used to use the second quotient as a new first quotient and return to execute the steps executed by the second determining module 1203 until the new first quotient is zero.

[0192] The generating module 1205 is used to generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

[0193] In one embodiment, the generation module 1205 is used to: sort the characters corresponding to the first remainder and the characters corresponding to the second remainder according to the generation order of the first remainder and the second remainder to obtain a sorted string; and generate a target short link corresponding to the long link to be converted according to the sorted string.

[0194] In one embodiment, in the aspect of sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder according to the generation order of the first remainder and the second remainder to obtain the sorted string, the generating module 1205 is used to: use the character corresponding to the first remainder as the first character in the sorted string; and use the character corresponding to the second remainder as the i-th character in the sorted string. Wherein, i represents the number of times the division operation is performed when obtaining the second remainder, and i is an integer greater than or equal to 2.

[0195] In one embodiment, the device further includes a numbering module for numbering the characters in the obfuscated encoded string in a preset order to obtain a number for each character in the encoded string, wherein the number is an integer greater than or equal to 0 and less than or equal to n-1, and the difference between the numbers of adjacent characters is 1.

[0196] In the aspect of determining the character corresponding to the first remainder from the obfuscated encoded string, the first determination module 1202 is used to: determine the character whose corresponding number is the same as the first remainder in the numbered obfuscated encoded string as the character corresponding to the first remainder.

[0197] In one embodiment, in the aspect of generating the target short link corresponding to the long link to be converted based on the sorted string, the generation module 1205 is used to: obtain a preset domain name; add a single slash after the domain name, and add the sorted string after the single slash to obtain the target short link corresponding to the long link to be converted.

[0198] In one embodiment, the change module 1201 is used to obtain the latest historical encoded number from the database when receiving the first short link conversion instruction for the long link to be converted; and obtain the number to be encoded after changing the latest historical encoded number through the self-increment method of the database. The device also includes a storage module, which is used to store the number to be encoded in the database and determine the number to be encoded as the new latest historical encoded number.

[0199] In one embodiment, in the aspect of obtaining the number to be encoded after changing the latest historical encoded number through the self-increment method of the database, the change module 1201 is used to: determine the random change amount according to the random generation algorithm and the attribute information of the long link to be converted; input the random change amount and the latest historical encoded number into the self-increment algorithm of the database to obtain the number to be encoded output by the self-increment algorithm of the database. The number to be encoded is the sum of the latest historical encoded number and the random change amount.

[0200] In one embodiment, the device further includes: a fourth determination module, a fifth determination module and a sixth determination module.

[0201] The fourth determining module is configured to determine the difference between the generation time of the target short link and the current time if a second short link conversion instruction for the long link to be converted is received.

[0202] The fifth determining module is configured to determine the target short link as the short link corresponding to the second short link conversion instruction if the difference between the generation time of the target short link and the current time is less than a preset duration threshold.

[0203] The sixth determination module is used to determine the step of "changing the latest historical encoded number to obtain the number to be encoded" in the execution change module 1201 if the difference between the generation time of the target short link and the current time is greater than or equal to the preset time threshold.

[0204] In one embodiment, the device further includes: an acquisition module, a seventh determination module and an obfuscation module.

[0205] The acquisition module is used to acquire the importance level of the long link to be converted.

[0206] The seventh determination module is used to determine the degree of obfuscation when obfuscating the encoded string according to the importance level of the long link to be converted, wherein the higher the importance level, the higher the obfuscation level.

[0207] The obfuscation module is used to obfuscate the coded string according to the obfuscation degree to obtain an obfuscated coded string, wherein the higher the obfuscation degree is, the greater the edit distance between the obfuscated coded string obtained based on the obfuscation degree and the coded string is.

[0208] In one embodiment, the change module 1201 is used to: when receiving a first short link conversion instruction for a long link to be converted, obtain the propagation number of the long link to be converted; determine the historical latest encoded number from multiple candidate historical latest encoded numbers based on the propagation number of the long link to be converted, wherein the larger the propagation number, the smaller the number of bits of the historical latest encoded number; after changing the historical latest encoded number, the number to be encoded is obtained.

[0209] In one embodiment, in terms of obtaining the propagation number of the long link to be converted, the change module 1201 is used to: determine the propagation number of the long link to be converted based on the received propagation number indication information; or, determine the propagation number of the long link to be converted based on the historical access data of the long link to be converted; or, perform semantic analysis on the page corresponding to the long link to be converted to obtain a semantic analysis result, and determine the propagation number of the long link to be converted based on the semantic analysis result.

[0210] In one embodiment, the device further includes: a sending module, an updating module and an eighth determining module.

[0211] The sending module is used to send the target short link to the indicated terminal device.

[0212] The updating module is used to add the mapping relationship between the long link to be converted and the target short link to a pre-stored mapping relationship table between long links and short links to form an updated mapping relationship table.

[0213] The eighth determination module is used to determine the long link to be visited corresponding to the short link to be visited from the updated mapping relationship table after receiving the short link to be visited sent by the target terminal device.

[0214] The sending module is further used to send the long link to be accessed to the target terminal device, so that the target terminal device accesses the long link to be accessed.

[0215] In one embodiment, the long link to be converted is a long link corresponding to a financial service. m is 10, and n is 62.

[0216] The short link generation device provided in the embodiment of the present application can be used to execute the technical solution of the short link generation method in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0217] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the change module 1201, the first determination module 1202, the second determination module 1203, the third determination module 1204 and the generation module 1205 can be separately established processing elements, or they can be integrated in a chip of the above device for implementation. In addition, they can also be stored in the memory of the above device in the form of program code, and a processing element of the above device can call and execute the functions of the above change module 1201, the first determination module 1202, the second determination module 1203, the third determination module 1204 and the generation module 1205. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.

[0218] Fig.13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.13 As shown, the electronic device may include: a processor 142 and a memory 143.

[0219] The processor 142 executes the computer execution instructions stored in the memory, so that the processor 142 executes the scheme in the above embodiment. The processor 142 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0220] The memory 143 is connected to the processor 142 via a system bus to complete the communication between them. The memory 143 is used to store computer program instructions.

[0221] Optionally, the electronic device may further include a transceiver 141. The transceiver 141 may be used to receive training data or receive target feedback information of a target user on a financial activity.

[0222] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the short link generation device and other computer devices. The memory may include random access memory (RAM) and may also include non-volatile memory.

[0223] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the short link generation method in the above embodiment.

[0224] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the short link generation method of the above embodiment.

[0225] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements a short link generation method as provided in any embodiment of the present application.

[0226] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present application, and the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as "C" language or similar programming language. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0227] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims

1. A short link generation method, characterized in that: include: When receiving the first short link conversion instruction for the long link to be converted, the latest historical encoded number is changed to obtain the number to be encoded; wherein the number to be encoded is an m-digit decimal number, and m is an integer greater than or equal to 5; Dividing the number to be encoded by n to obtain a first remainder and a first quotient, and determining the character corresponding to the first remainder from the obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10; Dividing the first quotient by n to obtain a second remainder and a second quotient, and determining a character corresponding to the second remainder from the obfuscated encoded string; wherein the second remainders are different and the characters corresponding to the second remainders are different; Taking the second quotient as a new first quotient, returning to execute the step of "dividing the first quotient by n to obtain a second remainder and a second quotient, and determining a character corresponding to the second remainder from the obfuscated encoded character string" until the new first quotient is zero; A target short link corresponding to the long link to be converted is generated according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

2. The method according to claim 1, characterized in that The generating, according to a character string obtained by sorting characters corresponding to the first remainder and characters corresponding to the second remainder, a target short link corresponding to the long link to be converted includes: Sort the characters corresponding to the first remainder and the characters corresponding to the second remainder according to the generation order of the first remainder and the second remainder to obtain a sorted character string; A target short link corresponding to the long link to be converted is generated according to the sorted character string.

3. The method according to claim 2, characterized in that The step of sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder according to the generation order of the first remainder and the second remainder to obtain a sorted character string includes: Using the character corresponding to the first remainder as the first character in the sorted character string; The character corresponding to the second remainder is used as the i-th character in the sorted character string; wherein i represents the number of times the division operation is performed when obtaining the second remainder, and i is an integer greater than or equal to 2.

4. The method according to claim 2, characterized in that: Before dividing the number to be encoded by n to obtain a first remainder and a first quotient, and determining the character corresponding to the first remainder from the obfuscated encoded character string, the method further includes: Numbering the characters in the obfuscated encoded string in a preset order to obtain a number for each character in the encoded string; wherein the number is an integer greater than or equal to 0 and less than or equal to n-1, and the difference between the numbers of adjacent characters is 1; The determining the character corresponding to the first remainder from the obfuscated encoded character string includes: In the numbered obfuscated encoded string, the character whose corresponding number is the same as the first remainder is determined as the character corresponding to the first remainder.

5. The method according to any one of claims 2 to 4, characterized in that: Generating a target short link corresponding to the long link to be converted according to the sorted character string includes: Get a pre-set domain name; A single slash is added after the domain name, and the sorted string is added after the single slash to obtain a target short link corresponding to the long link to be converted.

6. The method according to any one of claims 1 to 4, characterized in that: When receiving the first short link conversion instruction for the long link to be converted, the latest historical encoded number is changed to obtain the number to be encoded, including: When receiving a first short link conversion instruction for a long link to be converted, obtaining the latest historical encoded number from a database; By using the self-increment method of the database, the latest historical encoded number is changed to obtain the number to be encoded; After generating the target short link corresponding to the long link to be converted according to the character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder, the method further includes: The number to be encoded is stored in the database, and the number to be encoded is determined as a new historical latest encoded number.

7. The method according to claim 6, characterized in that The method of self-incrementing the database to obtain the number to be encoded after changing the latest historical encoded number includes: Determine the random change amount according to the random generation algorithm and the attribute information of the long link to be converted; The random variation and the latest historical encoded number are input into the self-increment algorithm of the database to obtain the number to be encoded output by the self-increment algorithm of the database; wherein the number to be encoded is the sum of the latest historical encoded number and the random variation.

8. The method according to claim 6, characterized in that After storing the number to be encoded in the database and determining the number to be encoded as the new historical latest encoded number, the method further includes: If a second short link conversion instruction for the long link to be converted is received, determining the difference between the generation time of the target short link and the current time; If the difference between the generation time of the target short link and the current time is less than a preset time threshold, the target short link is determined as the short link corresponding to the second short link conversion instruction; If the difference between the generation time of the target short link and the current time is greater than or equal to the preset duration threshold, it is determined to return to the step of "obtaining the number to be encoded after changing the latest historical encoded number".

9. The method according to any one of claims 1 to 4, characterized in that: Before dividing the number to be encoded by n to obtain a first remainder and a first quotient, and determining the character corresponding to the first remainder from the obfuscated encoded string, the method further includes: Obtaining the importance level of the long link to be converted; Determining the degree of obfuscation when obfuscating the encoded string according to the importance level of the long link to be converted; wherein the higher the importance level, the higher the obfuscation level; According to the obfuscation degree, the coded string is obfuscated to obtain an obfuscated coded string; wherein, the higher the obfuscation degree is, the greater the edit distance between the obfuscated coded string obtained based on the obfuscation degree and the coded string is.

10. The method according to any one of claims 1 to 4, characterized in that: When receiving the first short link conversion instruction for the long link to be converted, the latest historical encoded number is changed to obtain the number to be encoded, including: When receiving a first short link conversion instruction for a long link to be converted, obtaining a propagation quantity of the long link to be converted; According to the propagation number of the long link to be converted, the historical latest encoded number is determined from a plurality of candidate historical latest encoded numbers; wherein the larger the propagation number, the smaller the number of digits of the historical latest encoded number; After changing the latest historical encoded number, the number to be encoded is obtained.

11. The method according to claim 10, characterized in that The obtaining the propagation quantity of the long link to be converted includes: Determine the propagation quantity of the long link to be converted according to the received propagation quantity indication information; or, Determine the number of propagations of the long link to be converted according to the historical access data of the long link to be converted; or, A semantic analysis is performed on the page corresponding to the long link to be converted to obtain a semantic analysis result, and the propagation quantity of the long link to be converted is determined according to the semantic analysis result.

12. The method according to any one of claims 1 to 4, characterized in that: After generating the target short link corresponding to the long link to be converted according to the character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder, the method further includes: Sending the target short link to the indicated terminal device; In the pre-stored mapping relationship table of long links and short links, add the mapping relationship between the long link to be converted and the target short link to form an updated mapping relationship table; After receiving the short link to be accessed sent by the target terminal device, determining the long link to be accessed corresponding to the short link to be accessed from the updated mapping relationship table; The long link to be accessed is sent to the target terminal device, so that the target terminal device accesses the long link to be accessed.

13. The method according to any one of claims 1 to 4, characterized in that: The long link to be converted is a long link corresponding to financial services; The m is 10, and the n is 62.

14. A short link generation device, characterized in that: include: A change module, for, when receiving a first short link conversion instruction for a long link to be converted, changing the latest historical encoded number to obtain a number to be encoded; wherein the number to be encoded is an m-digit decimal number, where m is an integer greater than or equal to 5; A first determination module, configured to divide the number to be encoded by n to obtain a first remainder and a first quotient, and determine a character corresponding to the first remainder from an obfuscated encoded string; wherein the obfuscated encoded string includes n non-repeating characters, n is a 2-digit decimal number, and n is an integer greater than 10; A second determination module is configured to divide the first quotient by n to obtain a second remainder and a second quotient, and determine a character corresponding to the second remainder from the obfuscated encoded string; wherein the second remainders are different and the characters corresponding to the second remainders are different; a third determining module, configured to use the second quotient as a new first quotient and return to execute the steps executed by the second determining module until the new first quotient is zero; A generating module is used to generate a target short link corresponding to the long link to be converted according to a character string obtained by sorting the characters corresponding to the first remainder and the characters corresponding to the second remainder.

15. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the short link generation method as claimed in any one of claims 1 to 13 when executing the computer program.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the short link generation method according to any one of claims 1 to 13 is implemented.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the short link generation method according to any one of claims 1 to 13.