CN110851748A - Short link generation method, server, storage medium and computer equipment - Google Patents

Short link generation method, server, storage medium and computer equipment Download PDF

Info

Publication number
CN110851748A
CN110851748A CN201910974469.8A CN201910974469A CN110851748A CN 110851748 A CN110851748 A CN 110851748A CN 201910974469 A CN201910974469 A CN 201910974469A CN 110851748 A CN110851748 A CN 110851748A
Authority
CN
China
Prior art keywords
identifier
identification code
short link
identification
link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910974469.8A
Other languages
Chinese (zh)
Inventor
黄士保
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910974469.8A priority Critical patent/CN110851748A/en
Publication of CN110851748A publication Critical patent/CN110851748A/en
Priority to PCT/CN2020/099251 priority patent/WO2021073156A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9558Details of hyperlinks; Management of linked annotations

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a short link generation method, a server, a storage medium and computer equipment, wherein the short link generation method is applied to the server and comprises the following steps: receiving a short-link acquisition request sent by terminal equipment, wherein the short-link acquisition request comprises a long link; generating a first identification code according to the current time, the number of short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of numeric characters; taking the first identification code as a decimal number, and converting the decimal number into a sixty binary number for the first identification code to obtain a second identification code; and acquiring the domain name of the long link, generating a short link according to the second identification code and the domain name, and returning the short link to the terminal equipment. The method can solve the problem of the generated short link conflict.

Description

Short link generation method, server, storage medium and computer equipment
Technical Field
The invention relates to the field of pedestal operation and maintenance, in particular to a short link generation method, a server, a storage medium and computer equipment.
Background
The short link is to convert a long Uniform Resource Locator (URL) website into a short website string by means of program calculation, so as to achieve the purpose of saving the number of characters. The existing short link generation method is to use the original long link as input and generate a short link corresponding to the original long link by a hash (hash) algorithm. When the user carries the short link to analyze, the short link can search according to the link storage unit, return the original website link and redirect the address.
However, it is found in the research that although a short link corresponding to an original long link can be generated by the prior art, the short link is automatically generated by the hash algorithm, and due to the limitation of the maximum 16-bit system of the hash algorithm, the short link collision may occur due to the same short link generated corresponding to different long links, so that an access error occurs when a visitor accesses the short link.
Disclosure of Invention
The embodiment of the invention provides a short link generation method, a server, a storage medium and computer equipment, which are used for solving the problem of conflict of generated short links in the prior art.
In a first aspect, an embodiment of the present invention provides a method for generating a short link, where the method is applied to a server, and the method includes:
receiving a short link acquisition request sent by terminal equipment, wherein the short link acquisition request comprises a long link;
generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of numeric characters;
taking the first identification code as a decimal numerical value, and converting the decimal numerical value into a sexagesimal numerical value for the first identification code to obtain a second identification code;
and generating a short link according to the second identification code and the domain name in the long link, and returning the short link to the terminal equipment.
Optionally, the generating a first identification code according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server specifically includes:
determining a first identifier, a second identifier and a third identifier, wherein the first identifier is the number of time units with a difference between a current time unit and a preset starting time unit, the second identifier is determined by the number of short link acquisition requests received in the current time unit, and the third identifier is an identification number of the server, and the identification number of the server is composed of digital characters;
and judging whether the first identification, the second identification and the third identification all meet corresponding preset lengths, if so, splicing the first identification, the second identification and the third identification together according to a preset splicing sequence to form the first identification code.
Optionally, the method further comprises:
if the first identifier, the second identifier and the third identifier do not meet the corresponding preset length, adding a numeric character 0 before the first identifier and/or the second identifier and/or the third identifier which do not meet the preset length, so that the first identifier, the second identifier and the third identifier all meet the corresponding preset length;
and splicing the first identification, the second identification and the third identification together according to the preset splicing sequence to form the first identification code.
Optionally, the receiving a short link acquisition request of the terminal device specifically includes:
receiving a short link acquisition request of terminal equipment, wherein the short link acquisition request comprises a long link;
extracting the domain name in the long link, and judging whether the domain name exists in a preset domain name blacklist or not;
and if not, generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server.
Optionally, the generating a short link according to the second identification code and the domain name in the long link specifically includes:
acquiring a character set, wherein each character in the character set and each character in the second identification code have a one-to-one correspondence of a sexagesimal system;
determining a character corresponding to each character in the second identification code in the character set, converting each character in the second identification code into a corresponding character, and generating a third identification code;
and splicing the domain name in the long link and the third identification code together to form the short link.
Optionally, after generating the short link according to the second identification code, the method further comprises:
establishing a corresponding relation between the short link and the long link, taking the short link as a key value, taking the long link corresponding to the short link as a value, and storing the key value and the value as a pair of key value pairs into an LRU cache space
In a second aspect, an embodiment of the present invention provides a short link generation server, including:
the receiving module is used for receiving a short link acquisition request sent by the terminal equipment, wherein the short link acquisition request comprises a long link;
the first identification code generation module is used for generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of digital characters;
the second identification code generation module is used for taking the first identification code as a decimal numerical value, and carrying out conversion processing from the decimal numerical value to a sexagesimal numerical value on the first identification code to obtain a second identification code; and
and the short link generating module is used for generating a short link according to the second identification code and the domain name in the long link and returning the short link to the terminal equipment.
Optionally, the first identification code generation module includes:
a first determining unit, configured to determine a first identifier, a second identifier, and a third identifier, where the first identifier is a number of time units that are different from a preset starting time unit in a current time unit, the second identifier is determined by a number of short access acquisition requests received in the current time unit, and the second identifier is determined by a number of short access acquisition requests received in the current time unit
The third identification is an identification number of the server, wherein the identification number of the server is formed by numeric characters; and
the first judging unit is used for judging whether the first mark, the second mark and the third mark all meet corresponding preset lengths;
and the first splicing unit is used for splicing the first identifier, the second identifier and the third identifier together according to a preset splicing sequence to form the first identifier code when the first identifier, the second identifier and the third identifier all meet the corresponding preset length.
In a third aspect, an embodiment of the present invention provides a storage medium, where the storage medium includes a stored program, and when the program runs, a device in which the storage medium is located is controlled to execute the method.
In a fourth aspect, an embodiment of the present invention provides a computer device, including a memory for storing information including program instructions and a processor for controlling execution of the program instructions, wherein the program instructions are loaded by the processor and executed to implement the steps of the above method.
It can be understood that, in the embodiment of the present invention, the first identification code is generated according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server, and then the decimal conversion is performed on the first identification code to obtain the second identification code, and then the short link is generated.
Drawings
The invention is further illustrated with reference to the following figures and examples.
Fig. 1 is a flowchart of a method for generating a short link according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of a short link generation server according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention.
DETAILED DESCRIPTION OF EMBODIMENT (S) OF INVENTION
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Referring to fig. 1, a method for generating a short link according to an embodiment of the present invention is applied to a server, where in this embodiment, the server is a server in a distributed server cluster, and the method for generating a short link according to an embodiment of the present invention includes:
step S01: and receiving a short link acquisition request sent by the terminal equipment, wherein the short link acquisition request comprises a long link.
Step S02: and generating a first identification code according to the current time, the number of short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of numeric characters.
Step S03: and taking the first identification code as a decimal numerical value, and converting the decimal numerical value into a sixty binary numerical value for the first identification code to obtain a second identification code.
Step S04: and generating a short link according to the second identification code and the domain name in the long link, and returning the short link to the terminal equipment.
It can be understood that, in the embodiment of the present invention, the first identification code is generated according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server, then the decimal system is converted into the sixty-binary system for the first identification code, so as to obtain the second identification code, and further generate the short link.
The following describes in detail a specific technical solution of the short link generation method provided in this embodiment with reference to fig. 1 again.
First, step S01 is executed: and receiving a short link acquisition request sent by the terminal equipment, wherein the short link acquisition request comprises a long link.
Specifically, the terminal device may be a system side device, or may also be a terminal device of a general user, or may also be a partner device, and the like. The terminal device may include various smart phones, tablet computers, Personal Computers (PCs), and the like.
In the embodiment of the present invention, a short link acquisition request sent by a terminal device is received by a server, which may be any server in a distributed server cluster.
In the embodiment of the present invention, the short link acquisition request may also include user information corresponding to the terminal device, where the user information may be user-defined description information, such as a type identifier of the user, an attribute identifier of the user, or other information.
A complete long link consists of transport protocols, domain names, path names, file names, etc., such as: http:// wenwenwenwenn. so. com/z/q136244386. htm? ci ═ ti.k.a.n, where http is the hypertext transfer protocol, wenwenwenwenwen.soso.com is the domain name, z/is the pathname, q136244386. htm? cid is a file name ti.k.a.n.
Preferably, receiving a short-link acquisition request of a requester may include:
step S011: receiving a short link acquisition request of a requester, wherein the short link acquisition request comprises a long link;
step S012: extracting the domain name of the long link, and judging whether the domain name exists in a preset domain name blacklist or not;
step S013: and if not, generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server.
Specifically, a domain name identifier which is not allowed to be accessed by the server is recorded in the domain name blacklist, and if a domain name corresponding to a long link carried in a short link acquisition request received by the server exists in the domain name blacklist, the server returns error information or information which cannot be accessed.
It can be understood that by setting a domain name blacklist and comparing the domain name of the long link, security check can be performed on the long link to be converted, and when the domain name of the long link carried by the short link acquisition request does not meet the requirement, conversion is not allowed, so that the security of the short link generation method provided by the invention can be improved.
Next, step S02 is executed: and generating a first identification code according to the current time, the number of short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of numeric characters.
It is to be understood that the first identification code is generated independently of the long link.
Optionally, the generating the first identification code according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server specifically includes:
step S021: determining a first identifier, a second identifier and a third identifier, wherein the first identifier is the number of time units with the difference between the current time unit and a preset starting time unit, the second identifier is determined by the number of short link acquisition requests received in the current time unit, and the third identifier is an identification number of a server, and the identification number of the server is composed of digital characters.
Specifically, the time unit may be milliseconds, seconds, minutes, hours, and the like, and is determined according to the requirement, in this embodiment, the time unit is milliseconds, for example, if the current time is different from the preset starting time by 1613024787541 milliseconds, the first identifier is: 1613024787541.
the current time may be a local standard time, for example, the beijing time is: 0 minutes 0 seconds 0 milliseconds at 1 month 1 day 0 of 2009, the start time may be preset, for example: 0 minute 0 second 0 millisecond at 1 month 1 day 0 of 2000.
The second identifier is determined by the number of short link acquisition requests received in the current time unit, for example, within the current millisecond, if the server receives 8 short link acquisition requests, the second identifier is: 8.
the third identifier is an identifier of the server, and the identifier of the server is formed by arabic numeric characters, for example, if the identifier of the server is: 233, the third flag is: 233. it should be noted that the third identifier is a unique identifier of a server, each server in the distributed server cluster is assigned with a different identifier, and the identifier assigned by each server is unique, for example, the identifiers of four servers in the distributed server cluster may be: 1,2,3,4.
Step S022: and judging whether the first identification, the second identification and the third identification all meet the corresponding preset lengths.
It should be noted that the lengths of the first mark, the second mark and the third mark mean the number of bits of the first mark, the second mark and the third mark, for example, when the first mark is: 1613024787541, it is 13 bits long.
The first mark, the second mark and the third mark are respectively provided with corresponding preset lengths, it is required to be known that the preset lengths corresponding to the first mark, the second mark and the third mark are not smaller than the lengths of the first mark, the second mark and the third mark under normal conditions, and the preset lengths corresponding to the first mark, the second mark and the third mark can be the same or different. In this embodiment, the preset length corresponding to the first identifier is 13 bits, the preset length corresponding to the second identifier is 1 bit, and the preset length corresponding to the third identifier is 5 bits.
The preset length of each identifier can basically meet the requirements of each existing service scene, for example, the preset length corresponding to the second identifier is set to be 1, so that one server can generate 10 first identifiers within 1 millisecond, and the normal service requirements are completely met. Of course, the present invention is not limited thereto, and the preset lengths corresponding to the first identifier, the second identifier and the third identifier may be adjusted according to specific situations.
Whether the lengths of the first mark/the second mark/the third mark meet the corresponding preset lengths or not is determined by judging whether the lengths of the first mark/the second mark/the third mark are equal to the preset lengths corresponding to the first mark/the second mark/the third mark or not. For example, when the first identifier is: 1613024787541, the length is 13 bits, and if the preset length corresponding to the first identifier is also 13 bits, it is determined that the first identifier satisfies the corresponding preset length.
Step S023: and if so, splicing the first identification, the second identification and the third identification together according to a preset splicing sequence to form a first identification code.
Specifically, there may be 6 splicing sequences between the first identifier, the second identifier, and the third identifier, which are respectively:
a first splicing sequence: a first identifier, a second identifier and a third identifier;
the second splicing sequence: a first identifier, a third identifier and a second identifier;
the third splicing sequence: a second identifier, a third identifier and a first identifier;
and a fourth splicing sequence: a second identifier, a first identifier and a third identifier;
and a fifth splicing sequence: a third identifier, a first identifier and a second identifier;
a sixth splicing sequence: the third identification, the second identification and the first identification.
Any one of the above splicing sequences can be selected as a preset splicing sequence.
For example, taking the preset splicing sequence as the first splicing sequence as an example, if the first identifier is: 1613024787541, a second identification of 9, a third identification of: 55444, under the condition that the first identifier, the second identifier and the third identifier all satisfy the preset length correspondingly, the first identifier, the second identifier and the third identifier are spliced together according to a first splicing sequence, and the formed first identifier is: 1613024787541955444.
the method and the device can generate the first identification code according to the current timestamp, the access number in the current time unit and the identification number of the server, so that the generated first identification code does not generate identification collision in the server cluster, each server in the distributed server cluster can work at the same time, the efficiency is improved, and the uniqueness of the first identification code generated by a plurality of servers can be ensured.
It should be noted that the preset lengths corresponding to the first identifier, the second identifier and the third identifier are configured to be at least longer than the length of the first identifier, at least longer than the length of the second identifier and at least longer than the length of the third identifier, respectively.
Further, the short link generation method further comprises the following steps:
if the first identifier, the second identifier and the third identifier do not meet the corresponding preset length, adding a digital character 0 before the first identifier and/or the second identifier and/or the third identifier which do not meet the preset length, so that the first identifier, the second identifier and the third identifier all meet the corresponding preset length.
For example, the first identifier is: 3024787541, the first mark has a preset length of 13 bits, and the second mark is: 9, the preset length corresponding to the second identifier is 1 bit, and the third identifier is: 544, the preset length corresponding to the third identifier is 5 bits. It can be known through the judgement that first sign and third sign do not satisfy the corresponding length of predetermineeing, consequently, need add digit character 0 before first sign and third sign, until first sign, second sign and third sign all satisfy the corresponding length of predetermineeing, specifically, add the first sign after the processing of digit character 0 and be: 0003024787541, the third label after the process of adding numeric character 0 is: 00544. if the preset splicing sequence is the first splicing sequence, the first identification code generated by splicing the first identification, the second identification and the third identification together is as follows: 0003024787541900544.
the first identification code is formed by splicing the first identification code, the second identification code and the third identification code, the positions of the three sections of identification codes in the first identification code are limited by setting the preset number of bits (length), so that the three sections of identification codes change at the respective preset positions, and the generated first identification code does not have a repeated phenomenon on the premise of ensuring the normal service requirements.
Next, step S03 is executed: and taking the first identification code as a decimal numerical value, and converting the decimal numerical value into a sixty binary numerical value for the first identification code to obtain a second identification code.
For example, the generated first identification code is 0001613024787541981316, the first identification code is used as a decimal value, that is, the first identification code "0001613024787541981316" is used as a numerical value "1613024787541981316", then the operation processing from the decimal value to a sixty binary value is performed on the first identification code, and the generated second identification code is: dITqmhw2 He.
It can be understood that the first identification code is used as a decimal value by setting a sexagesimal system algorithm, and the decimal conversion operation from the decimal system to the sexagesimal system is carried out on the first identification code, so that the length of the first identification can be greatly shortened to meet the requirement of short link. In addition, compared with the conversion from decimal to sixty-four, the generated second identification code has no characters '@' and '#' and is relatively simpler and can meet the requirement of greatly shortening the length of the first identification, so that the user experience can be further improved.
Then, step S04 is executed: and generating a short link according to the second identification code and the domain name in the long link, and returning the short link to the terminal equipment.
Further, in order to increase the security of the generated short link, the generating the short link according to the second identification code and the domain name in the long link may include:
step S041: acquiring a character set, wherein each character in the character set and each character in the second identification code have a one-to-one correspondence of a sexagesimal system;
specifically, 62 different characters are recorded on the character set, and the corresponding relationship between each character of the 62 different characters and one character of the remaining 61 characters is recorded, and the character corresponding to each character is unique, and the 62 different characters include 26 lower case letters, 26 upper case letters and 10 arabic numerals.
For example, the character corresponding to the capital letter "a" may be the arabic numeral "4", and the character corresponding to the lowercase letter "b" may be the arabic numeral "8".
Step S042: and determining the character corresponding to each character in the second identification code in the character set, converting each character in the second identification code into the corresponding character, and generating a third identification code.
Specifically, each character of the second identification code is converted into a corresponding character according to the corresponding relation on the character set, so that a third identification code is obtained.
Step S043: and splicing the domain name in the long link with the third identification code to form a short link.
For example, the long links are: http:/domain1/poem _ qianmo/arrow/details/52344732, so the domain name of the long link is: domain1, if the generated third identifier is: rtffvic, the resulting short linker is: http:/domain 1/Rtffvic.
It can be understood that the security and privacy of the short link generation method provided by the present invention can be further effectively improved by converting the second identification code into the third identification code according to the character set, for example, after the short link is acquired, others can easily know the number of short links generated by the server in a time unit according to the acquired short link, and further may cause leakage of service data.
Further, after the short link is generated according to the second identification code and the domain name in the long link, the method further includes:
establishing a corresponding relation between the short link and the long link, taking the short link as a key value, taking the long link corresponding to the short link as a value, and storing the key value and the value as a pair of key value pairs into a cache space of an LRU (Least Used by using a page replacement algorithm).
According to the method and the device, after the short link is generated, the corresponding relation between the generated short link and the generated long link is established and stored, so that when the short link request is received, the short link carried by the short link request is analyzed to obtain a key value in the short link request, whether a value corresponding to the key value exists in a cache space is judged according to the key value, and if yes, the value is returned as the long link corresponding to the short link.
It can be understood that, by using a certain size of LRU cache space to store the corresponding relationship between the short link and the long link, when the cache capacity reaches the upper limit, the LRU cache space will automatically delete the least recently used data value (key, value), thereby leaving a space for new data value, implementing automatic elimination of the LRU mechanism, and obtaining the beneficial effects of scalability and high availability.
Referring to fig. 2, the present invention provides a short link generation server 1, including:
the receiving module 11 is configured to receive a short link acquisition request sent by a terminal device, where the short link acquisition request includes a long link;
a first identification code generation module 12, configured to generate a first identification code according to the current time, the number of short-link acquisition requests received in the current time unit, and an identification number of the server, where the first identification code is formed by numeric characters;
the second identification code generation module 13 is configured to use the first identification code as a decimal value, and perform conversion processing from the decimal value to a sixty-binary value on the first identification code to obtain a second identification code; and
and the short link generating module 14 is configured to generate a short link according to the second identification code and the domain name in the long link, and return the short link to the terminal device.
It can be understood that, in the embodiment of the present invention, the first identification code is generated according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server, then the decimal system is converted into the sixty-binary system for the first identification code, so as to obtain the second identification code, and further generate the short link.
Alternatively, the first identification code generation module 12 may include:
the system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining a first identifier, a second identifier and a third identifier, the first identifier is the number of time units with a difference between a current time unit and a preset starting time unit, the second identifier is determined by the number of short link acquisition requests received in the current time unit, and the third identifier is an identification number of a server, wherein the identification number of the server is formed by digital characters; and
the first judging unit is used for judging whether the first mark, the second mark and the third mark all meet the corresponding preset length; and
and the first splicing unit is used for splicing the first identifier, the second identifier and the third identifier together according to a preset splicing sequence to form a first identification code when the first identifier, the second identifier and the third identifier all meet corresponding preset lengths.
Optionally, the first identification code generation module 12 may further include:
the processing unit is used for adding a digital character 0 before the first identifier and/or the second identifier and/or the third identifier which do not meet the preset length when the first identifier, the second identifier and the third identifier do not meet the corresponding preset length, so that the first identifier, the second identifier and the third identifier all meet the corresponding preset length;
and the second splicing unit is used for splicing the first identifier, the second identifier and the third identifier together according to a preset splicing sequence to form the first identifier.
Alternatively, the receiving module 11 may include:
the receiving unit is used for receiving a short link acquisition request of a requester, wherein the short link acquisition request comprises a long link; and
and the extraction unit is used for extracting the domain name of the long link and judging whether the domain name exists in a preset domain name blacklist or not.
Optionally, the short link generating module 14 may include:
the character set acquisition unit is used for acquiring a character set, wherein each character in the character set and each character in the second identification code have one-to-one correspondence of sixty binary system;
the conversion unit is used for determining the character corresponding to each character in the second identification code in the character set, and converting each character in the second identification code into the corresponding character to form a third identification code; and
and the third splicing unit is used for splicing the domain name in the long link with the third identification code to form a short link.
Optionally, the short link generation server 1 may further include:
and the corresponding relation establishing module is used for establishing the corresponding relation between the short link and the long link, taking the short link as a key value, taking the long link corresponding to the short link as a value, and storing the key value and the value as a pair of key value pairs into the LRU cache space.
An embodiment of the present invention further provides a storage medium, where the storage medium includes a stored program, where, when the program runs, a device in which the storage medium is located is controlled to execute the short link generation method in any one or more embodiments of the present invention, and in order to avoid repetition, details are not repeated here.
Referring to fig. 3, an embodiment of the present invention further provides a computer device 50, where the computer device 50 of the embodiment includes: the processor 51, the memory 52, and the computer program 53 stored in the memory 52 and capable of running on the processor 51, where the computer program 53 when executed by the processor 51 implements the short link generation method in the embodiment, and in order to avoid repetition, details are not repeated herein. Alternatively, the computer program is executed by the processor 51 to implement the functions of the models/units in the short link generation server 1 in the embodiment, and for avoiding redundancy, the description is omitted here.
The computing device 50 may be a desktop computer, a notebook, a palm top computer, a cloud server, or other computing device. The computer device 50 may include, but is not limited to, a processor 51, a memory 52. Those skilled in the art will appreciate that fig. 3 is merely an example of a computer device 50 and is not intended to limit the computer device 50 and that it may include more or fewer components than shown, or some components may be combined, or different components, e.g., the computer device may also include input output devices, network access devices, buses, etc.
The Processor 51 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 52 may be an internal storage unit of the computer device 50, such as a hard disk or a memory of the computer device 50. The memory 52 may also be an external storage device of the computer device 50, such as a plug-in hard disk provided on the computer device 50, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 52 may also include both internal and external storage devices for the computer device 50. The memory 52 is used for storing computer programs and other programs and data required by the computer device. The memory 52 may also be used to temporarily store data that has been output or is to be output.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The present invention is not limited to the above preferred embodiments, and any modifications, equivalent substitutions, improvements, etc. within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for generating short links, the method being applied to a server and comprising:
receiving a short link acquisition request sent by terminal equipment, wherein the short link acquisition request comprises a long link;
generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of numeric characters;
taking the first identification code as a decimal numerical value, and converting the decimal numerical value into a sexagesimal numerical value for the first identification code to obtain a second identification code;
and generating a short link according to the second identification code and the domain name in the long link, and returning the short link to the terminal equipment.
2. The method for generating a short link according to claim 1, wherein the generating a first identification code according to the current time, the number of short link acquisition requests received in the current time unit, and the identification number of the server specifically includes:
determining a first identifier, a second identifier and a third identifier, wherein the first identifier is the number of time units with a difference between a current time unit and a preset starting time unit, the second identifier is determined by the number of short link acquisition requests received in the current time unit, and the third identifier is an identification number of the server, and the identification number of the server is composed of digital characters;
judging whether the first mark, the second mark and the third mark all meet corresponding preset lengths;
and if so, splicing the first identification, the second identification and the third identification together according to a preset splicing sequence to form the first identification code.
3. The method of generating a short link according to claim 2, further comprising:
if the first identifier, the second identifier and the third identifier do not meet the corresponding preset length, adding a numeric character 0 before the first identifier and/or the second identifier and/or the third identifier which do not meet the preset length, so that the first identifier, the second identifier and the third identifier all meet the corresponding preset length;
and splicing the first identification, the second identification and the third identification together according to the preset splicing sequence to form the first identification code.
4. The method for generating a short link according to claim 1, wherein the receiving of the short link acquisition request by the terminal device specifically includes:
receiving a short link acquisition request of the terminal equipment, wherein the short link acquisition request comprises a long link;
extracting the domain name in the long link, and judging whether the domain name exists in a preset domain name blacklist or not;
and if not, generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server.
5. The method for generating a short link according to claim 1 or 4, wherein the generating a short link according to the second identification code and the domain name in the long link specifically includes:
acquiring a character set, wherein each character in the character set and each character in the second identification code have a one-to-one correspondence of a sexagesimal system;
determining a character corresponding to each character in the second identification code in the character set, converting each character in the second identification code into a corresponding character, and generating a third identification code;
and splicing the domain name in the long link and the third identification code together to form the short link.
6. The method for generating a short link according to claim 1, wherein after the short link is generated according to the second identification code and the domain name in the long link, the method further comprises:
and establishing a corresponding relation between the short link and the long link, taking the short link as a key value, taking the long link corresponding to the short link as a value, and storing the key value and the value as a pair of key value pairs into an LRU cache space.
7. A short link generation server, comprising:
the receiving module is used for receiving a short link acquisition request sent by the terminal equipment, wherein the short link acquisition request comprises a long link;
the first identification code generation module is used for generating a first identification code according to the current time, the number of the short link acquisition requests received in the current time unit and the identification number of the server, wherein the first identification code is composed of digital characters;
the second identification code generation module is used for taking the first identification code as a decimal numerical value, and carrying out conversion processing from the decimal numerical value to a sexagesimal numerical value on the first identification code to obtain a second identification code; and
and the short link generating module is used for generating a short link according to the second identification code and the domain name in the long link and returning the short link to the terminal equipment.
8. The server of claim 7, wherein the first identification code generation module comprises:
a first determining unit, configured to determine a first identifier, a second identifier, and a third identifier, where the first identifier is a number of time units that are different from a preset starting time unit in a current time unit, the second identifier is determined by a number of short link acquisition requests received in the current time unit, and the third identifier is an identifier of the server, where the identifier of the server is formed by digital characters;
the first judging unit is used for judging whether the first mark, the second mark and the third mark all meet corresponding preset lengths; and
and the first splicing unit is used for splicing the first identifier, the second identifier and the third identifier together according to a preset splicing sequence to form the first identifier code when the first identifier, the second identifier and the third identifier all meet the corresponding preset length.
9. A storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the storage medium is located to perform the method of any one of claims 1 to 6.
10. A computer device comprising a memory for storing information including program instructions and a processor for controlling execution of the program instructions, characterized in that: the program instructions, when loaded and executed by a processor, implement the steps of the method of any one of claims 1 to 6.
CN201910974469.8A 2019-10-14 2019-10-14 Short link generation method, server, storage medium and computer equipment Pending CN110851748A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910974469.8A CN110851748A (en) 2019-10-14 2019-10-14 Short link generation method, server, storage medium and computer equipment
PCT/CN2020/099251 WO2021073156A1 (en) 2019-10-14 2020-06-30 Short link generation method, server, storage medium and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910974469.8A CN110851748A (en) 2019-10-14 2019-10-14 Short link generation method, server, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN110851748A true CN110851748A (en) 2020-02-28

Family

ID=69597554

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910974469.8A Pending CN110851748A (en) 2019-10-14 2019-10-14 Short link generation method, server, storage medium and computer equipment

Country Status (2)

Country Link
CN (1) CN110851748A (en)
WO (1) WO2021073156A1 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307058A (en) * 2020-10-27 2021-02-02 北京健康之家科技有限公司 Short link processing method and device, storage medium and computer equipment
CN112380464A (en) * 2020-11-10 2021-02-19 中国平安人寿保险股份有限公司 Short link generation method and related equipment
CN112417326A (en) * 2020-11-20 2021-02-26 百度在线网络技术(北京)有限公司 URL conversion method and device, electronic equipment and storage medium
CN112487317A (en) * 2020-11-23 2021-03-12 中国人寿保险股份有限公司 Uniform Resource Locator (URL) conversion method, device, equipment and medium
CN112883301A (en) * 2021-02-03 2021-06-01 叮当快药科技集团有限公司 Method and device for generating short link based on 55 system and storage medium
CN113378083A (en) * 2021-05-19 2021-09-10 北京沃东天骏信息技术有限公司 Short link generation method, device, equipment and storage medium
CN113676562A (en) * 2021-08-17 2021-11-19 平安普惠企业管理有限公司 Short-chain request convergence method and device, computer equipment and storage medium
CN115391689A (en) * 2022-08-23 2022-11-25 北京泰迪熊移动科技有限公司 Short link generation method, device, equipment and storage medium
CN116938871A (en) * 2023-09-18 2023-10-24 北京木屋时代科技有限公司 Domain name short code determining method and device, storage medium and electronic device
CN113761406B (en) * 2021-09-03 2024-06-04 丰巢网络技术有限公司 Intelligent cabinet two-dimension code short-chain generation method and device, medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630927A (en) * 2015-12-22 2016-06-01 北京奇虎科技有限公司 Link generation method and apparatus
US20160248837A1 (en) * 2013-10-30 2016-08-25 Tencent Technology (Shenzhen) Company Limited Methods and apparatus for realizing short url service
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device
WO2019095416A1 (en) * 2017-11-16 2019-05-23 平安科技(深圳)有限公司 Information pushing method and apparatus, and terminal device and storage medium
CN110134889A (en) * 2019-04-30 2019-08-16 中国联合网络通信集团有限公司 Short link generation method, device and server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10187447B1 (en) * 2016-01-28 2019-01-22 Twitter, Inc. Method and system for online conversion attribution
CN107612692B (en) * 2017-09-25 2020-06-12 咪咕文化科技有限公司 Information processing method, device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160248837A1 (en) * 2013-10-30 2016-08-25 Tencent Technology (Shenzhen) Company Limited Methods and apparatus for realizing short url service
CN105630927A (en) * 2015-12-22 2016-06-01 北京奇虎科技有限公司 Link generation method and apparatus
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device
WO2019095416A1 (en) * 2017-11-16 2019-05-23 平安科技(深圳)有限公司 Information pushing method and apparatus, and terminal device and storage medium
CN110134889A (en) * 2019-04-30 2019-08-16 中国联合网络通信集团有限公司 Short link generation method, device and server

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307058A (en) * 2020-10-27 2021-02-02 北京健康之家科技有限公司 Short link processing method and device, storage medium and computer equipment
CN112307058B (en) * 2020-10-27 2024-03-15 北京水滴科技集团有限公司 Short link processing method and device, storage medium and computer equipment
CN112380464A (en) * 2020-11-10 2021-02-19 中国平安人寿保险股份有限公司 Short link generation method and related equipment
CN112380464B (en) * 2020-11-10 2023-07-28 中国平安人寿保险股份有限公司 Short link generation method and related equipment
CN112417326A (en) * 2020-11-20 2021-02-26 百度在线网络技术(北京)有限公司 URL conversion method and device, electronic equipment and storage medium
CN112487317A (en) * 2020-11-23 2021-03-12 中国人寿保险股份有限公司 Uniform Resource Locator (URL) conversion method, device, equipment and medium
CN112883301A (en) * 2021-02-03 2021-06-01 叮当快药科技集团有限公司 Method and device for generating short link based on 55 system and storage medium
WO2022242678A1 (en) * 2021-05-19 2022-11-24 北京沃东天骏信息技术有限公司 Short link generation method and apparatus, device, and storage medium
CN113378083B (en) * 2021-05-19 2023-09-29 北京沃东天骏信息技术有限公司 Short link generation method, device, equipment and storage medium
CN113378083A (en) * 2021-05-19 2021-09-10 北京沃东天骏信息技术有限公司 Short link generation method, device, equipment and storage medium
CN113676562B (en) * 2021-08-17 2022-10-14 平安普惠企业管理有限公司 Short-chain request convergence method and device, computer equipment and storage medium
CN113676562A (en) * 2021-08-17 2021-11-19 平安普惠企业管理有限公司 Short-chain request convergence method and device, computer equipment and storage medium
CN113761406B (en) * 2021-09-03 2024-06-04 丰巢网络技术有限公司 Intelligent cabinet two-dimension code short-chain generation method and device, medium and electronic equipment
CN115391689A (en) * 2022-08-23 2022-11-25 北京泰迪熊移动科技有限公司 Short link generation method, device, equipment and storage medium
CN115391689B (en) * 2022-08-23 2023-08-22 北京泰镝科技股份有限公司 Short link generation method, device, equipment and storage medium
CN116938871A (en) * 2023-09-18 2023-10-24 北京木屋时代科技有限公司 Domain name short code determining method and device, storage medium and electronic device
CN116938871B (en) * 2023-09-18 2023-11-28 北京木屋时代科技有限公司 Domain name short code determining method and device, storage medium and electronic device

Also Published As

Publication number Publication date
WO2021073156A1 (en) 2021-04-22

Similar Documents

Publication Publication Date Title
CN110851748A (en) Short link generation method, server, storage medium and computer equipment
CN108460115B (en) Message pushing method and device, computer equipment and storage medium
CN107798108B (en) Asynchronous task query method and device
CN109766479B (en) Data processing method and device, electronic equipment and storage medium
CN112422702A (en) CDN back-to-source method, system and computer equipment
CN108093026B (en) Method and device for processing multi-tenant request
US11244153B2 (en) Method and apparatus for processing information
CN106534268B (en) Data sharing method and device
CN110019873B (en) Face data processing method, device and equipment
CN111368697A (en) Information identification method and device
CN109614327B (en) Method and apparatus for outputting information
CN112015806A (en) Method and device for storing data by block chain
CN107707686B (en) Equipment identification method and device
CN110020040B (en) Method, device and system for querying data
CN113626512A (en) Data processing method, device, equipment and readable storage medium
CN112182108A (en) Block chain based distributed data storage updating method and electronic equipment
CN114039801B (en) Short link generation method, short link analysis system, short link analysis equipment and storage medium
CN112948138A (en) Method and device for processing message
CN115470302A (en) Database bidirectional synchronization method, medium and equipment based on canal
CN112559546B (en) Database synchronization method, database synchronization device, computer equipment and readable storage medium
CN111756749B (en) Secure access method, device, equipment and storage medium
CN110147531B (en) Method, device and storage medium for identifying similar text content
CN113032820B (en) File storage method, access method, device, equipment and storage medium
CN116069802A (en) Method, device, electronic equipment and storage medium for accessing database
JP2014524210A (en) Generate variable length nonce

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination