CN110134889B - Short link generation method and device and server - Google Patents

Short link generation method and device and server Download PDF

Info

Publication number
CN110134889B
CN110134889B CN201910362089.9A CN201910362089A CN110134889B CN 110134889 B CN110134889 B CN 110134889B CN 201910362089 A CN201910362089 A CN 201910362089A CN 110134889 B CN110134889 B CN 110134889B
Authority
CN
China
Prior art keywords
character string
converted
link
long
server
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.)
Active
Application number
CN201910362089.9A
Other languages
Chinese (zh)
Other versions
CN110134889A (en
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.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201910362089.9A priority Critical patent/CN110134889B/en
Publication of CN110134889A publication Critical patent/CN110134889A/en
Application granted granted Critical
Publication of CN110134889B publication Critical patent/CN110134889B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/9566URL specific, e.g. using aliases, detecting broken or misspelled links

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 Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a short link generation method, a device and a server, wherein the method comprises the following steps: determining a first character string corresponding to a long chain connection to be converted according to the identification of the server; distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the server; and generating a short chain connection corresponding to the long chain connection to be converted according to the domain name, the first character string and the second character string corresponding to the long chain connection to be converted. The short link generation method, the short link generation device and the server provided by the invention can jointly determine the short link corresponding to the long link to be converted according to the first character string and the second character string, and the uniqueness of the short link corresponding to the long link to be converted can be ensured because the combination of the first character string and the second character string is unique.

Description

Short link generation method and device and server
Technical Field
The present invention relates to communications technologies, and in particular, to a short link generation method, an apparatus, and a server.
Background
Various contents in the internet application have corresponding links, and a user can access the corresponding contents through the links. When the content provider pushes the link to the user, the link can be written in the short message and pushed to the user in a short message mode, and the short message sharing link can be sent between the users through the terminal.
Taking the terminal as a mobile phone as an example, since the length of the short message of the mobile phone is limited, when the link is a long link containing more characters, the information received by the user may not be complete or split into two short messages, thereby affecting the user to access the link. Therefore, it is usually necessary to convert the long links into short links containing fewer characters, and to push the short links to the user in the short message.
In the prior art, a long link is usually switched to a short link by adopting a hash algorithm, but the hash algorithm has collision, so that the switched short link has no uniqueness, that is, different long links may be switched to the same short link, thereby causing access abnormality when a user accesses through the short link.
Disclosure of Invention
The invention provides a short link generation method, a short link generation device and a short link generation server, which enable a converted short link to have uniqueness when a long link is converted into a short link, thereby improving the accuracy of access.
The invention provides a short link generation method, which is applied to a server and comprises the following steps:
determining a first character string corresponding to the long chain connection to be converted according to the identification of the server;
distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chains in the server;
and generating a short chain connection corresponding to the long chain connection to be converted according to the domain name corresponding to the long chain connection to be converted, the first character string and the second character string.
Optionally, the determining, according to the identifier of the server, a first character string corresponding to the long link to be converted includes:
acquiring the identifier of the server from a database cluster;
and shortening the identifier of the server to obtain a first character string corresponding to the long chain connection to be converted.
Optionally, the allocating a corresponding second character string for the long link to be converted includes:
acquiring a preset character; the preset character is a sequence value of the server for processing the long link to be converted, or the preset character is a random value distributed by the server for the long link to be converted;
and shortening the preset character to obtain a second character string corresponding to the long chain to be converted.
Optionally, the generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string includes:
sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result;
and determining the first splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string includes:
sequentially splicing the domain name, the second character string and the first character string to obtain a second splicing result;
and determining the second splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string includes:
calculating a third character string corresponding to the long chain connection to be converted by adopting a message digest algorithm;
sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result;
and determining the third splicing result as a short link corresponding to the long link to be converted.
Optionally, the method further includes:
and establishing and storing a mapping relation between the long chain connection to be converted and the corresponding short chain connection.
Optionally, the database cluster is a Redis cluster.
The invention provides a short link generation device, which comprises:
the determining module is used for determining a first character string corresponding to the long chain connection to be converted according to the identifier of the device;
the distribution module is used for distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the device;
and the generating module is used for generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string.
Optionally, the determining module is specifically configured to:
obtaining an identification of the device from a database cluster; and the mark of the device is shortened to obtain a first character string corresponding to the long chain connection to be converted. Optionally, the database cluster is a Redis cluster.
Optionally, the allocation module is specifically configured to:
acquiring a preset character; the preset character is a sequence value of the device for processing the long link to be converted, or the preset character is a random value distributed by the device for the long link to be converted; and shortening the preset character to obtain a second character string corresponding to the long chain to be converted.
Optionally, the generating module is specifically configured to:
sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result; and determining the first splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating module is specifically configured to:
sequentially splicing the domain name, the second character string and the first character string to obtain a second splicing result; and determining the second splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating module is specifically configured to:
calculating a third character string corresponding to the long chain connection to be converted by adopting a message digest algorithm; sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result; and determining the third splicing result as a short link corresponding to the long link to be converted.
Optionally, the apparatus further comprises:
and the storage module is used for establishing and storing the mapping relation between the long link to be converted and the corresponding short link.
The invention provides a server, which is characterized by comprising a memory and a processor; the memory is connected with the processor;
the memory is used for storing a computer program;
the processor is configured to implement the short link generation method as described in any one of the above when the computer program is executed.
The invention provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a short link generation method as defined in any one of the above.
The invention provides a short link generation method, a short link generation device and a server.A first character string corresponding to a long link to be converted is determined according to an identifier of the server; and distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the server; and generating a short chain connection corresponding to the long chain connection to be converted according to the domain name, the first character string and the second character string corresponding to the long chain connection to be converted. Therefore, when the short link corresponding to the long link to be converted is generated, the short link corresponding to the long link to be converted can be determined according to the first character string and the second character string, and the uniqueness of the short link corresponding to the long link to be converted can be ensured due to the unique combination of the first character string and the second character string, so that the accuracy of access is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a short chain-link generation method according to the present invention;
FIG. 2 is a schematic structural diagram of a short link generator according to the present invention;
fig. 3 is a schematic structural diagram of a server according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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.
FIG. 1 is a schematic flow diagram of a short chain joint generation method provided by the present invention. The execution subject of the method is a server, and the server can be realized by software and/or hardware. As shown in fig. 1, the method of this embodiment may include:
s101, determining a first character string corresponding to the long chain connection to be converted according to the identification of the server.
It will be appreciated that the identity of the server is unique. For example, the identifier of the server may be an identifier set before the server leaves a factory, or may be an identifier allocated to the server when the server is used, as long as the server can be uniquely identified.
In this embodiment, the server has an external interface to provide a service for converting a long link into a short link, and the user can send a request to the server by calling the interface, where the request includes the long link to be converted. After receiving the request, the server firstly determines a first character string corresponding to the long link to be converted according to the identifier of the server, wherein the identifier of the server is the unique identifier of the server.
At present, systems such as internet application and the like mostly adopt a distributed architecture, a plurality of servers can provide services in one application system, for example, a service for converting a long link into a short link can be provided by a plurality of servers, the number of the servers can be dynamically changed, namely, dynamic expansion or contraction, and each server has different server identifications. When the user calls the interface to use the service of converting the long link into the short link, the request sent by the user is distributed to one of the servers, and the first character string generated by the server according to the identification of the server can be used for distinguishing the server from other servers in the plurality of servers.
When a server processes a plurality of long links, if the first character strings corresponding to the long links are determined only according to the identification of the server, the first character strings corresponding to the long links are the same, and at this time, the uniqueness of the short links corresponding to the long links cannot be guaranteed, so that the short links corresponding to the long links need to be determined together with the second character strings, that is, the following steps S102 to S103 are executed:
and S102, distributing a corresponding second character string for the long chain connection to be converted.
And the second character string corresponding to the long link to be converted is different from the second character string corresponding to other long links in the server.
In the above S101, the server may be distinguished from other servers in the plurality of servers by the first character string, on this basis, in order to ensure uniqueness of the short link corresponding to the long link to be converted, a second character string needs to be further determined, and since the second character string corresponding to the long link to be converted is different from the second character strings corresponding to other long links in the server, the short link corresponding to the long link to be converted may be distinguished from the short links corresponding to other long links in the server by the second character string, thereby ensuring uniqueness of the short link corresponding to the long link to be converted.
S103, generating a short chain connection corresponding to the long chain connection to be converted according to the domain name, the first character string and the second character string corresponding to the long chain connection to be converted.
The long link to be converted consists of a domain name and a long string of characters, the domain name is taken out, and a short link corresponding to the long link to be converted is generated according to the domain name, the first character string and the first character string. The server can be distinguished from other servers in the servers by the first character string, and the second character string corresponding to the long chain connection to be converted is different from the second character strings corresponding to other long chain connections in the server, so that the short chain connection corresponding to the long chain connection to be converted is distinguished from the short chain connection corresponding to other long chain connections in the server by the second character string, and the uniqueness of the short chain connection corresponding to the long chain connection to be converted is ensured.
In the short link generation method provided by this embodiment, a first character string corresponding to a long link to be converted is determined according to an identifier of a server; and distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the server; and generating a short chain connection corresponding to the long chain connection to be converted according to the domain name, the first character string and the second character string corresponding to the long chain connection to be converted. Therefore, when the short link corresponding to the long link to be converted is generated, the short link corresponding to the long link to be converted can be determined according to the first character string and the second character string, and the uniqueness of the short link corresponding to the long link to be converted can be ensured due to the unique combination of the first character string and the second character string, so that the accuracy of access is improved.
Based on the embodiment shown in fig. 1, when determining the first character string corresponding to the long link to be converted according to the identifier of the server in S101, the determining may include:
acquiring an identifier of a server from a database cluster; and shortening the identifier of the server to obtain a first character string corresponding to the long chain connection to be converted.
In this embodiment, the identifier of the server may be stored in a database cluster connected to the servers, that is, the database cluster allocates a corresponding server identifier to each server, so as to ensure that each server has a unique identifier, and when the number of servers increases, the database may automatically allocate an identifier to the newly added server. Alternatively, the database may be a Key-Value (Key-Value) type database, such as Redis, or may be a database in other forms, which is not specifically limited in the present invention. The server can perform data preloading when being started, and acquire a corresponding server identifier from the database cluster. In this way, when the server performs conversion of the long link, the first character string can be generated according to the server identifier acquired from the database in advance.
Further, a character set may be preset in the server, for example, the character set may include 62 characters from a to Z, a to z and from 0 to 9, and the character set is used to shorten the identifier of the server. Taking the character set of 62 characters as an example, arranging the 62 characters in sequence, dividing the identifier of the server by 62, replacing the quotient and the remainder in the obtained result with the characters in the corresponding sequence in the character set respectively, if the quotient is greater than 62, continuing dividing by 62, replacing the quotient and the remainder with the characters in the corresponding sequence in the character set respectively until the quotient is less than 62, and obtaining the first character string. And the identifier of the server is shortened by adopting the character set, so that the obtained first character string is shorter, and the short chain length corresponding to the long chain connection to be converted is shorter.
After the identifier of the server is shortened to obtain the first character string corresponding to the long link to be converted, in order to ensure the uniqueness of the short link, a corresponding second character string needs to be allocated to the long link to be converted, and S102 allocates a corresponding second character string to the long link to be converted, which may include:
acquiring a preset character string; the preset character string is a sequence value of the server for processing the long link to be converted, or the preset character string is a random value distributed by the server for the long link to be converted; and shortening the preset character string to obtain a second character string corresponding to the long chain to be converted.
In this embodiment, the preset character strings obtained by the server when performing long link conversion each time are different, and the preset character strings may be numerical values that sequentially increase according to the order of processing the long links to be converted, for example, a value of the preset character string increases by one or two or the preset character string may be a preset memory value in the server when processing the long links to be converted each time, and the server performs a self-increment calculation on the preset memory value each time performing long link conversion, thereby ensuring that the values obtained each time are different; the preset character string can also be an assigned random value, and the random value assigned by the server every time is different. And then, shortening the preset character string to obtain a second character string corresponding to the long chain to be converted. The method for shortening the preset character string is the same as the method for using the character set in the above embodiment, and details are not repeated here. And the preset character string is shortened by adopting the character set, so that the obtained second character string is shorter, and the short chain length corresponding to the long chain connection to be converted is shorter. The initial value of the preset character string can be set according to actual needs, so that the length of the second character string obtained when long link conversion is carried out each time is the same.
After the first character string and the second character string corresponding to the long chain connection to be converted are obtained, S103 may be executed to generate the short chain connection corresponding to the long chain connection to be converted according to the domain name, the first character string and the second character string corresponding to the long chain connection to be converted. For example, when the short link corresponding to the long link to be converted is generated according to the domain name corresponding to the long link to be converted, the first character string and the second character string, at least three possible implementation manners may be included, and the three possible implementation manners will be described in detail below.
In one possible implementation mode, sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result; and determining the first splicing result as a short link corresponding to the long link to be converted.
In another possible implementation manner, the domain name, the second character string and the first character string are spliced in sequence to obtain a second splicing result; and determining the second splicing result as a short link corresponding to the long link to be converted.
In the two possible implementation manners, the first character string is obtained according to the identifier of the server, so that the first character string can distinguish one server from other servers, meanwhile, the second character strings determined on one server are different, so that the first character string and the second character string are spliced to determine the only one character string in the multiple servers, the domain name, the first character string and the second character string are spliced to obtain the short link corresponding to the long link to be converted, and the uniqueness of the short link can be ensured.
In another possible implementation manner, a Message Digest (MD) algorithm is used to calculate a third string corresponding to the long chain to be converted; sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result; and determining the third splicing result as a short link corresponding to the long link to be converted.
In practical application, a fifth version of the MD algorithm, that is, the MD5 algorithm, may be used to encrypt the long link to be converted to obtain 32-bit numbers, and the 32-bit numbers are segmented according to the length 8 to obtain 4 sets of data. The 16-ary number of each set of data performs a bitwise AND operation on 0x3FFFFFFF, with low 30-bit digital fidelity. The 30-bit data is cycled for 6 times, each cycle is shifted to the right by 5 bits, the 5 bits shifted to the right are scaled down by 62 bits through a 0x0000003D bitwise AND operation, and the 6-bit scaled-down number is obtained after 6 cycles. Each set of data is processed separately to obtain 4 sets of 6-bit reduced numbers, and any one of the 4 sets of 6-bit reduced numbers can be selected as the third string, and preferably, the first set of reduced numbers can be selected as the third string.
And sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a splicing result, namely the short link corresponding to the long link to be converted. Optionally, when the domain name, the first character string, the second character string, and the third character string are spliced, different splicing orders may be adopted for the first character string, the second character string, and the third character string, which is not limited in this invention.
Illustratively, if the long link to be converted is: https:// cc.xxxxx.com/kc/base/html/app _ open/detail-sendmsg. htmlklid. 1812140017540050748& isPublished. 1& isBackStage. 0& reginId. 97& ismissing. splitlld. 1812140017180050719& channelCode. CHNL 00000001. the domain name in the long link to be converted is cc.xxxxx.com. the first string determined using the method of this embodiment is q8, the second string is gLA9q, and the third string is bQrAzm. And taking the result https:// cc. xxxxx. com/s/q8gLA9qbQrAzm of the sequential splicing of the domain name, the first character string, the second character string and the third character string as the short link corresponding to the long link to be converted, wherein the sequential result of the first character string, the second character string and the third character string can be called as a short link code, namely q8gLA9qbQrAzm is a short link code.
In this embodiment, a third character string corresponding to the long chain connection to be converted is calculated by using an MD5 algorithm, and the domain name, the first character string, the second character string, and the third character string are spliced into a short chain connection corresponding to the long chain connection to be converted. In the method, if the first character string obtained by the server is abnormal, for example, when the server obtains the identifier of the server from the database cluster, the identifier obtained by the server is abnormal due to the database abnormality, for example, the identifier is empty, only the first character string and the second character string cannot uniquely identify a short link corresponding to a long link to be converted, and therefore, the short link corresponding to the long link to be converted is distinguished by adding the third character string, and high availability of the service is ensured.
In another embodiment, the short link generation method provided by the present invention further comprises: and establishing and storing a mapping relation between the long chain connection to be converted and the corresponding short chain connection. Therefore, when the user accesses through the short link, the long link corresponding to the short link can be directly obtained from the mapping relation, and then the content corresponding to the long link is accessed, so that the accessing efficiency is improved.
The following exemplifies a usage scenario of the short link generation method provided by the present invention in conjunction with practical applications.
In practical applications, after the long link is converted into the short link, the user can access the short link. Two services can thus be designed: the system comprises a front-end service and a back-end service, wherein the front-end service receives a request for converting a long link into a long link and skips the long link, and the back-end service provides a service for converting the long link into a short link and a service for converting the short link into the long link.
For example, when the connection needs to be released to the user by sending the short message, the long-link switching short-link service is firstly called through the interface, the short link corresponding to the long link is obtained, and the obtained short link is added into the short message template and sent to the user.
When a user accesses corresponding content through a short link in a received short message, in order to ensure that the same response is required when the user accesses different short links, a reverse proxy is used for intercepting related paths and reversely acting the related paths to the same inlet, a short link switching long link service is called when an inlet page is loaded, a long link address is obtained, and the long link address is requested in a page redirection mode.
Fig. 2 is a schematic structural diagram of a short link generation device provided by the present invention. As shown in fig. 2, the short link generation device 20 includes:
the determining module 201 is configured to determine, according to the identifier of the short link generating device 20, a first character string corresponding to the long link to be converted.
The distribution module 202 is configured to distribute a corresponding second character string to the long link to be converted; the second character string corresponding to the long chain link to be converted is different from the second character string corresponding to the other long chain links in the short chain link generation device 20.
The generating module 203 is configured to generate a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string, and the second character string.
Optionally, the determining module 201 is specifically configured to:
obtaining an identification of the short link generator 20 from the database cluster; and shortening the mark of the short link generation device 20 to obtain a first character string corresponding to the long link to be converted. Optionally, the database cluster is a Redis cluster.
Optionally, the allocating module 202 is specifically configured to:
acquiring a preset character; the preset character is a sequence value of the short link generation device 20 for processing the long link to be converted, or the preset character is a random value allocated by the short link generation device 20 for the long link to be converted; and shortening the preset character to obtain a second character string corresponding to the long chain to be converted.
Optionally, the generating module 203 is specifically configured to:
sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result; and determining the first splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating module 203 is specifically configured to:
sequentially splicing the domain name, the second character string and the first character string to obtain a second splicing result; and determining the second splicing result as a short link corresponding to the long link to be converted.
Optionally, the generating module 203 may be further specifically configured to:
calculating a third character string corresponding to the long chain connection to be converted by adopting a message digest algorithm; sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result; and determining the third splicing result as a short link corresponding to the long link to be converted.
Optionally, the short link generation device 20 further includes:
the storage module 204 is configured to establish and store a mapping relationship between the long link to be converted and the corresponding short link.
The short link generation device provided by the embodiment is used for realizing the short link generation method in any embodiment, the realization principle and the technical effect are the same, and the details are not repeated here.
Fig. 3 is a schematic structural diagram of a server according to the present invention. As shown in fig. 3, the server 30 includes a memory 301 and a processor 302; the memory 301 is connected to the processor 302.
The memory 301 is used to store computer programs.
The processor 302 is configured to implement the short link generation method in any of the above embodiments when the computer program is executed.
The server provided by this embodiment is used to implement the short link generation method in any of the above embodiments, and the implementation principle and technical effect are the same, which are not described herein again.
The present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the short link generation method of any of the above embodiments.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (16)

1. A short link generation method applied to a server, the method comprising:
determining a first character string corresponding to the long chain connection to be converted according to the identification of the server;
distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the server;
generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string;
the determining a first character string corresponding to the long link to be converted according to the identifier of the server includes:
the server performs data preloading when being started, and acquires the identifier of the server from a database cluster; the identity of the server is stored in the database cluster to which the server is connected;
and shortening the identifier of the server to obtain a first character string corresponding to the long chain to be converted.
2. The method according to claim 1, wherein the allocating a corresponding second character string to the long link to be converted comprises:
acquiring a preset character string; the preset character string is an order value of the server for processing the long link to be converted, or the preset character string is a random value distributed by the server for the long link to be converted;
and shortening the preset character string to obtain a second character string corresponding to the long chain to be converted.
3. The method according to any one of claims 1 or 2, wherein the generating of the short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string comprises:
sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result;
and determining the first splicing result as a short link corresponding to the long link to be converted.
4. The method according to any one of claims 1 or 2, wherein the generating of the short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string comprises:
sequentially splicing the domain name, the second character string and the first character string to obtain a second splicing result;
and determining the second splicing result as a short link corresponding to the long link to be converted.
5. The method according to any one of claims 1 or 2, wherein the generating of the short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string comprises:
calculating a third character string corresponding to the long chain connection to be converted by adopting a message digest algorithm;
sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result;
and determining the third splicing result as a short link corresponding to the long link to be converted.
6. The method according to any one of claims 1 or 2, further comprising:
and establishing and storing a mapping relation between the long chain connection to be converted and the corresponding short chain connection.
7. The method of claim 1, wherein the database cluster is a Redis cluster.
8. A short link generation device, comprising:
the determining module is used for determining a first character string corresponding to the long chain connection to be converted according to the identifier of the device;
the distribution module is used for distributing a corresponding second character string for the long chain connection to be converted; the second character string corresponding to the long chain connection to be converted is different from the second character string corresponding to other long chain connections in the device;
the generating module is used for generating a short link corresponding to the long link to be converted according to the domain name corresponding to the long link to be converted, the first character string and the second character string;
the determining module is specifically configured to:
the device performs data preloading when being started, and acquires the identifier of the device from a database cluster; the identity of the apparatus is stored in the database cluster to which the apparatus is connected;
and shortening the identifier of the device to obtain a first character string corresponding to the long chain to be converted.
9. The apparatus of claim 8, wherein the assignment module is specifically configured to:
acquiring a preset character string; the preset character string is a sequence value of the device for processing the long link to be converted, or the preset character string is a random value distributed by the device for the long link to be converted;
and shortening the preset character string to obtain a second character string corresponding to the long chain to be converted.
10. The apparatus according to any one of claims 8 or 9, wherein the generating module is specifically configured to:
sequentially splicing the domain name, the first character string and the second character string to obtain a first splicing result;
and determining the first splicing result as a short link corresponding to the long link to be converted.
11. The apparatus according to any one of claims 8 or 9, wherein the generating module is specifically configured to:
sequentially splicing the domain name, the second character string and the first character string to obtain a second splicing result;
and determining the second splicing result as a short link corresponding to the long link to be converted.
12. The apparatus according to any one of claims 8 or 9, wherein the generating module is specifically configured to:
calculating a third character string corresponding to the long chain connection to be converted by adopting a message digest algorithm;
sequentially splicing the domain name, the first character string, the second character string and the third character string to obtain a third splicing result;
and determining the third splicing result as a short link corresponding to the long link to be converted.
13. The apparatus according to any one of claims 8 or 9, further comprising:
and the storage module is used for establishing and storing the mapping relation between the long chain connection to be converted and the corresponding short chain connection.
14. The apparatus of claim 8, wherein the database cluster is a Redis cluster.
15. A server, comprising a memory and a processor; the memory is connected with the processor;
the memory for storing a computer program;
the processor, configured to, when the computer program is executed, implement the short link generation method according to any one of claims 1 to 7.
16. A storage medium having stored thereon a computer program, characterized in that the computer program, when being executed by a processor, carries out the short link generation method according to any one of the preceding claims 1-7.
CN201910362089.9A 2019-04-30 2019-04-30 Short link generation method and device and server Active CN110134889B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910362089.9A CN110134889B (en) 2019-04-30 2019-04-30 Short link generation method and device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910362089.9A CN110134889B (en) 2019-04-30 2019-04-30 Short link generation method and device and server

Publications (2)

Publication Number Publication Date
CN110134889A CN110134889A (en) 2019-08-16
CN110134889B true CN110134889B (en) 2021-08-10

Family

ID=67575826

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910362089.9A Active CN110134889B (en) 2019-04-30 2019-04-30 Short link generation method and device and server

Country Status (1)

Country Link
CN (1) CN110134889B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment
CN110968460B (en) * 2019-11-27 2020-10-27 上海众言网络科技有限公司 Method and device for recovering website in system breakdown state
CN111047413B (en) * 2019-12-17 2023-11-07 秒针信息技术有限公司 Method, device, computer equipment and readable storage medium for acquiring text content
CN112035763A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Information processing method, device and system, electronic equipment and storage medium
CN112861032A (en) * 2021-01-20 2021-05-28 银盛通信有限公司 Short link generation method and system
CN112883301A (en) * 2021-02-03 2021-06-01 叮当快药科技集团有限公司 Method and device for generating short link based on 55 system and storage medium
CN113420238A (en) * 2021-06-18 2021-09-21 浙江集享电子商务有限公司 Short link generation method, device, electronic device and storage medium
CN113505318A (en) * 2021-07-26 2021-10-15 全景智联(武汉)科技有限公司 Short link generation method, device, 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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984287A (en) * 2012-11-19 2013-03-20 青岛海信传媒网络技术有限公司 Microblog application server and microblog platform chained address sharing method thereof
CN104080059A (en) * 2013-03-25 2014-10-01 中国移动通信集团福建有限公司 Method, device and system of implementing short message sending and receiving
CN106210161A (en) * 2016-06-24 2016-12-07 中国银联股份有限公司 A kind of short chain delivers a child into method and system
CN106933854A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 Short linking processing method, device and server
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device
CN107749861A (en) * 2017-11-16 2018-03-02 平安科技(深圳)有限公司 Information-pushing method, device, terminal device and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674374A (en) * 2009-09-02 2010-03-17 优视动景(北京)技术服务有限公司 Webpage content extraction forwarding system for mobile communication terminal and application method thereof
US20150095487A1 (en) * 2013-09-30 2015-04-02 Trksit, Llc Third-party link tracker system and method
CN104702677B (en) * 2015-02-13 2017-06-23 腾讯科技(深圳)有限公司 Linking processing method, device and system
CN106412140A (en) * 2015-08-03 2017-02-15 沈阳东软睿道教育服务有限公司 Short link address generating method and system thereof
CN106933871B (en) * 2015-12-30 2021-08-17 创新先进技术有限公司 Short link processing method and device and short link server
CN109582395B (en) * 2019-01-10 2022-05-17 北京三快在线科技有限公司 Applet running method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984287A (en) * 2012-11-19 2013-03-20 青岛海信传媒网络技术有限公司 Microblog application server and microblog platform chained address sharing method thereof
CN104080059A (en) * 2013-03-25 2014-10-01 中国移动通信集团福建有限公司 Method, device and system of implementing short message sending and receiving
CN106933854A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 Short linking processing method, device and server
CN106210161A (en) * 2016-06-24 2016-12-07 中国银联股份有限公司 A kind of short chain delivers a child into method and system
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device
CN107749861A (en) * 2017-11-16 2018-03-02 平安科技(深圳)有限公司 Information-pushing method, device, terminal device and storage medium

Also Published As

Publication number Publication date
CN110134889A (en) 2019-08-16

Similar Documents

Publication Publication Date Title
CN110134889B (en) Short link generation method and device and server
CN107819828B (en) Data transmission method and device, computer equipment and storage medium
AU2016367801B2 (en) Method and apparatus for generating random character string
CN110572451B (en) Data processing method, device and storage medium
CN108733802B (en) Identification code generation and analysis method and device, storage medium and electronic equipment
CN113032156B (en) Memory allocation method and device, electronic equipment and storage medium
CN103731472A (en) Method and system for downloading files by adopting P2P technology and client-side
CN109800236A (en) Support the distributed caching method and equipment of multinode
CN105530311A (en) Load distribution method and device
CN106060131B (en) A kind of method and apparatus for distributing dns server
CN111629063A (en) Block chain based distributed file downloading method and electronic equipment
CN110334103B (en) Recommendation service updating method, providing device, access device and recommendation system
CN112035763A (en) Information processing method, device and system, electronic equipment and storage medium
CN113179295B (en) Message processing method and device
US8452902B2 (en) Methods for transmitting buffer size information
CN103051480B (en) The storage means of a kind of DN and DN storage device
CN113163028A (en) Service data transmission method, device and system
CN110049133B (en) Method and device for issuing full amount of DNS zone files
CN113922972B (en) Data forwarding method and device based on MD5 identification code
CN113612869B (en) Short website generation method, terminal and storage medium
CN111756678B (en) Information verification method, device and equipment
CN116530071A (en) CAN address allocation
CN112445800A (en) Method and system for generating data serial number and electronic equipment
CN110362336B (en) Method for acquiring machine room routing information and method and device for configuring script data
CN117056102B (en) Data calling method, system, computer equipment and readable storage medium

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
GR01 Patent grant
GR01 Patent grant