Short link generation method and related device
By using methods for generating, incrementing, and converting long links to different number systems, the problems of excessively long, repetitive, and insecure HTTP short link generation in existing technologies are solved, achieving more efficient and secure short link generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-25
- Publication Date
- 2026-04-10
AI Technical Summary
Existing HTTP short link generation technologies suffer from problems such as excessively long links, duplicate links, poor security, and difficulty in maintenance in certain scenarios.
By obtaining long links and organizational parameters, the first short link is generated using the short link generation table in the database, and then incremented to become the second short link. The second short link is then converted to a third short link using base-62 and stored in the short link mapping table, thus generating the final short link.
It simplifies the address length of long links, improves conversion and access efficiency, enhances the effectiveness and security of long links, and facilitates maintenance.
Smart Images

Figure CN115098807B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a short link generation method and related equipment thereof. BACKGROUND
[0002] With the development of the Internet, online operation activities are becoming more and more rich. For example, an activity page is realized through H5 technology (i.e., the 5th generation HTML), and finally the http address link of the activity is distributed and reached through a poster, a circle of friends sharing and the like. At present, the most commonly used way is a two-dimensional code and the like, but the display density of the two-dimensional code is determined by the original content. When the http link address of the activity is too long, the two-dimensional code may be too dense to be scanned. Based on the above pain points, an http short link generation technical solution appears, which can convert the original long link of the activity into a shorter http short link for easy sharing.
[0003] However, the http short link generation technology currently used in the industry is mostly in the form of six random digits and letters. In some scenarios, the length requirement is not particularly sensitive, and the technology can meet the business demand, but the way still has problems such as a long link, repeated links, poor security, and is not conducive to maintenance in some scenarios. SUMMARY
[0004] Therefore, the present application provides a short link generation method and related equipment thereof, which can further simplify the length of the address corresponding to the long link, improve the conversion and access efficiency of the long link, improve the effectiveness and security of the long link, and facilitate maintenance.
[0005] According to an aspect of the present application, a short link generation method is provided, which includes: obtaining a current input long link and an institution parameter corresponding to the long link; generating a first short link corresponding to the institution parameter according to a preset short link generation table in a database; incrementing the first short link to obtain a second short link corresponding to the long link; performing a radix conversion on the second short link to obtain a third short link in a target radix form, and storing the third short link and the long link together in a short link mapping table in the database; and generating a short link corresponding to the long link based on the short link mapping table.
[0006] Further, generating a first short link corresponding to the institution parameter according to a preset short link generation table in a database includes: obtaining a validity period of the long link and a domain name parameter corresponding to the long link; configuring the short link generation table according to the validity period of the long link, the domain name parameter corresponding to the long link, and the institution parameter corresponding to the long link; and generating a first short link corresponding to the institution parameter according to the short link generation table.
[0007] Further, the first short chain and the second short chain are both numerical values in decimal form, and the first short chain is incremented to obtain the second short chain corresponding to the long link, including: listening to the input of the long link; in the case of inputting a new long link, the first short chain is increased by a preset step to obtain the second short chain corresponding to the long link.
[0008] Further, there are multiple long links input simultaneously, and in the case of inputting a new long link, the first short chain is increased by a preset step to obtain the second short chain corresponding to the long link, including: obtaining multiple processes corresponding to multiple long links respectively; selecting a process with the highest priority from the multiple processes; based on the process with the highest priority, the first short chain is increased by a preset step to obtain the second short chain corresponding to the long link.
[0009] Further, the first short chain is incremented to obtain the second short chain corresponding to the long link, and further includes: obtaining a generation state of the second short chain; in the case that the generation state of the second short chain is failure, the process corresponding to the second short chain stops the conversion and returns an exception information to the input end.
[0010] Further, the third short chain includes 62-base 4-bit letters and / or numbers, and the second short chain is converted to obtain a third short chain in a target base, including: obtaining a conversion threshold of the third short chain; in the case that the third short chain does not exceed the conversion threshold, the second short chain is directly converted to obtain a third short chain in a target base; in the case that the third short chain exceeds the conversion threshold, the first short chain is updated to obtain a third short chain in a target base.
[0011] Further, the short link generation method further includes: inputting the short link; querying the long link corresponding to the third short chain in the short chain mapping table, wherein the third short chain is associated with the institution parameter; and redirecting to the long link through a jump interface.
[0012] According to another aspect of the present application, a short link generation apparatus is provided, which comprises: a long link acquisition module configured to acquire a currently input long link and an institution parameter corresponding to the long link; a first short link generation module configured to generate a first short link corresponding to the institution parameter according to a preset short link generation table in a database; a second short link generation module configured to increment the first short link to obtain a second short link corresponding to the long link; a third short link generation module configured to perform a base conversion on the second short link to obtain a third short link in a target base form, and store the third short link and the long link together in a short link mapping table in the database; and a short link generation module configured to generate a short link corresponding to the long link based on the short link mapping table.
[0013] According to another aspect of the present application, a computer readable medium having a computer program stored thereon is provided, the computer program being executed by a processor to implement the short link generation method.
[0014] According to another aspect of the present application, an electronic device is provided, which comprises: one or more processors; and a storage device configured to store one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the short link generation method.
[0015] By acquiring a currently input long link and an institution parameter corresponding to the long link, then generating a first short link corresponding to the institution parameter according to a preset short link generation table in a database, and incrementing the first short link to obtain a second short link corresponding to the long link, then performing a base conversion on the second short link to obtain a third short link in a target base form, and storing the third short link and the long link together in a short link mapping table in the database, and finally generating a short link corresponding to the long link based on the short link mapping table, according to aspects of the present application, the length of an address corresponding to a long link can be further simplified, the conversion and access efficiency of a long link can be improved, the effectiveness and security of a long link can be improved, and maintenance is facilitated. BRIEF DESCRIPTION OF DRAWINGS
[0016] The technical solutions and other advantages of the present application will be apparent from the following detailed description of the specific embodiments of the present application, taken in conjunction with the accompanying drawings.
[0017] Figure 1 A flow chart of a short link generation method according to an embodiment of the present application is shown.
[0018] Figure 2 A schematic diagram of short link conversion according to an embodiment of the present application is shown.
[0019] Figure 3 A schematic diagram of short link jumping according to an embodiment of the present application is shown.
[0020] Figure 4 A schematic diagram of a short chain platform according to an embodiment of the application is shown.
[0021] Figure 5 A block diagram of a short link generation apparatus according to an embodiment of the application is shown.
[0022] Figure 6 A structural schematic diagram of an electronic device according to an embodiment of the application is shown. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0024] In the description of the present application, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features limited by "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise explicitly specified and limited.
[0025] In the description of the present application, it should be noted that unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting" should be understood broadly, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or electrically connected or can communicate with each other; it can be directly connected, or indirectly connected through an intermediate medium, or the internal communication of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0026] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplifying the present application, the components and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeatedly refer to numbers and / or letters in different examples, and such repetition is for the purpose of simplification and clarity, which does not indicate the relationship between the various embodiments and / or settings discussed. In addition, the present application provides examples of various specific processes and materials, but those skilled in the art can realize the application of other processes and / or the use of other materials. In some examples, methods, means, elements and circuits well known to those skilled in the art are not described in detail in order to highlight the main ideas of the present application.
[0027] The present application mainly provides a short link generation method, which comprises: obtaining a current input long link and an institution parameter corresponding to the long link; generating a first short link corresponding to the institution parameter according to a preset short link generation table in the database; incrementing the first short link to obtain a second short link corresponding to the long link; performing a base conversion on the second short link to obtain a third short link in a target base form, and storing the third short link and the long link together in a short link mapping table in the database; and generating a short link corresponding to the long link based on the short link mapping table.
[0028] By obtaining a current input long link and an institution parameter corresponding to the long link, then generating a first short link corresponding to the institution parameter according to a preset short link generation table in the database, and incrementing the first short link to obtain a second short link corresponding to the long link, then performing a base conversion on the second short link to obtain a third short link in a target base form, and storing the third short link and the long link together in a short link mapping table in the database, and finally generating a short link corresponding to the long link based on the short link mapping table, the present application can further simplify the length of the address corresponding to the long link, improve the conversion and access efficiency of the long link, improve the effectiveness and security of the long link, and facilitate maintenance.
[0029] Figure 1 A flowchart of the short link generation method of the embodiment of the present application is shown.
[0030] As shown in Figure 1 The short link generation method of the embodiment of the present application can include:
[0031] Step S1: obtaining a current input long link and an institution parameter corresponding to the long link;
[0032] The long link can be an http link address, also referred to as a Uniform Resource Locator (URL). The URL is a representation method for specifying the location of information on the Internet, and the target resource on the network can be found through the URL.
[0033] For example, the institution parameter can be the name of an institution. For example, A Bank and B Bank are two different banking institutions. After accessing the official websites of the two institutions respectively, two different long links corresponding to the two banking institutions can be obtained. Of course, the institution parameter can also be the address of the institution, the name of the product, or other parameters, and the specific meaning of the institution parameter is not limited in the present application.
[0034] Step S2: generating a first short link corresponding to the institution parameter according to a preset short link generation table in the database;
[0035] The short link generation table can be preset in the present application. The short link generation table can include the institution parameter, the domain name parameter corresponding to each institution, the validity period of the long link, etc. The first short link is associated with the institution parameter. For example, for different institutions, the generated first short link can be located in different numerical intervals. It can be understood that the mapping relationship between the institution parameter and the first short link is not limited in the present application.
[0036] Further, generating a first short link corresponding to the institution parameter according to a preset short link generation table in the database includes:
[0037] Step S21: obtaining the validity period of the long link and the domain name parameter corresponding to the long link;
[0038] For example, the abbreviation of A Bank can be bankwf, and the domain name parameter corresponding to the bank can be bankwf.com. In the present application, the domain name parameter can also be set by the user. The short link can include the domain name parameter, that is, the domain name parameter can be assembled in the short link of the present application.
[0039] Step S22: configuring the short link generation table according to the validity period of the long link, the domain name parameter corresponding to the long link, and the institution parameter corresponding to the long link;
[0040] In actual application, the long link can belong to different institutions, and each institution has a different domain name parameter. In addition, the related activities of the institution can have a time limit, and the activities will be closed after the time limit is exceeded. When the long link expires, the expired long link and the corresponding short link can be removed from the short link generation table, so as to reduce the query burden of the database.
[0041] Exemplarily, for the same institution, the domain name parameters are the same, at this time, if the long link is permanently valid, the short link and the long link can be a one-to-one mapping relationship; if the long link is limited period valid, multiple short links can correspond to the same long link. In the case of different institutions, the domain name parameters can be different, at this time, since the first short chain of the application corresponds to the institution parameter, therefore the long links of different institutions can be the same, and the short links of different institutions can also be the same, and do not affect each other. By integrating the institution parameter in the generation process of the short link, the application can reduce the repetition of the short link, improve the security of the short link, and facilitate the maintenance of the short link.
[0042] Step S23: generating a first short chain corresponding to the institution parameter according to the short chain generation table.
[0043] The generated first short chain can be stored in the short chain mapping table. The first short chain has a mapping relationship with the institution parameter, and each institution can correspond to a first short chain (i.e. short_num).
[0044] Step S3: incrementing the first short chain to obtain a second short chain corresponding to the long link;
[0045] The first short chain can be incremented by optimistic locking. Optimistic locking believes that it will not modify data when using data, and only judges whether the data has been updated by other threads when updating the data. If the data has not been updated, the current thread can successfully write the modified data. Since the increment of the first short chain is relatively simple, the use of optimistic locking can avoid unnecessary locking overhead and improve the generation efficiency of the short link.
[0046] The first short chain and the second short chain are both decimal values. The first short chain can be an initial decimal value at the start of the increment, and the second short chain can be a decimal value incremented by a preset step. The second short chain corresponds to the long link currently input.
[0047] Further, the first short chain is incremented to obtain a second short chain corresponding to the long link, including:
[0048] Step S31: listening to the input of the long link;
[0049] Step S32: in the case of inputting a new long link, increasing the first short chain by a preset step to obtain a second short chain corresponding to the long link.
[0050] In one example, the preset step length can be 1. The first short chain is short chain data in an initial state, which can be configured as 1. When a new input long link is detected, the first short chain starts to increase by 1, and the value 2 obtained after the increase is the second short chain corresponding to the new input long link. That is, a one-to-one correspondence is established between the second short chain and the new input long link. In this way, the first short chain starts to increase whenever a new input long link is detected, until the first short chain overflows.
[0051] Further, there are multiple long links input simultaneously. In the case of inputting a new long link, the first short chain is increased by a preset step length to obtain a second short chain corresponding to the long link, including:
[0052] Step S321: obtaining multiple processes respectively corresponding to multiple long links;
[0053] Step S322: selecting a process with the highest priority from the multiple processes;
[0054] Step S323: increasing the first short chain by a preset step length based on the process with the highest priority to obtain a second short chain corresponding to the long link.
[0055] In the present application, when multiple processes simultaneously modify the first short chain, only one process can successfully modify the first short chain. At this time, a process with the highest priority can be selected from the multiple processes. Specifically, the process with the highest priority can be randomly selected, or the process with the highest priority can be selected according to the mechanism parameter. There are multiple ways to select the process with the highest priority, which are not limited by the present application.
[0056] Further, increasing the first short chain to obtain a second short chain corresponding to the long link further includes:
[0057] Step S33: obtaining a generation state of the second short chain;
[0058] Step S34: in the case where the generation state of the second short chain is failure, the process corresponding to the second short chain stops the conversion, and returns an exception information to an input end.
[0059] Specifically, after the process with the highest priority successfully modifies the first short chain, the second short chain in decimal is converted into a third short chain in base 62, the third short chain and the corresponding long link are stored in a short chain mapping table, and are returned to a calling party. In the case where the generation state of the second short chain is failure, subsequent conversion is not performed, and the process of modification failure directly returns an error information (i.e., an exception code).
[0060] Exemplarily, the exception code can be defined as in Table 1 as follows:
[0061] Table 1 Definition of exception code
[0062]
[0063] For example, in the case of a request timeout, the returned exception code can be 900104. It can be understood that the definition of the exception code of the present application can be adjusted according to actual conditions, and the enumeration of the exception code in Table 1 is exemplary and not exhaustive, and the definition of the exception code in the present application is not limited.
[0064] Step S4: converting the second short chain into a third short chain in a target radix, and storing the third short chain and the long link together into a short chain mapping table in a database;
[0065] The third short chain includes a 62-radix 4-bit string, and the 4-bit string can be letters and / or numbers. For example, the 62-radix character sequence can be:
[0066] eqHnWrkaIzxTJ5YQfi1GUd3MKsyOXo09RwpDVNglLECmv824tjB6uPcbF7hAZS.
[0067] Specifically, the 62-radix string can be composed of 62 letters or numbers of a-z, A-Z, and 0-9. The 62-radix rule is 1 for every 62, and the display rule can be set to left carry. Since the third short chain of the present application is 4 bits, there are a total of (26+26+10) 4 =14776336 combinations, which can meet most use scenarios.
[0068] Exemplarily, 62-radix eee can correspond to 10-radix 1, 62-radix eeeH can correspond to 10-radix 2, and 62-radix eeen can correspond to 10-radix 3. Since the second short chain is a decimal number, the decimal number can be converted into a 62-radix third short chain. In this way, a mapping relationship is established between the third short chain and the long link.
[0069] Further, converting the second short chain into a third short chain in a target radix includes:
[0070] Step S41: obtaining a conversion threshold of the third short chain;
[0071] Step S42: in the case that the third short chain does not exceed the conversion threshold, directly converting the second short chain into the third short chain in the target numeral system;
[0072] Step S43: in the case that the third short chain exceeds the conversion threshold, re-updating the first short chain to obtain the third short chain in the target numeral system.
[0073] For example, since the third short chain of the present application is a 62 numeral system 4-digit value, the maximum value is ZZZZ (14776335) in the 62 numeral system. That is, the conversion threshold of the third short chain can be 14776335. When the converted third short chain reaches 14776336, it exceeds the conversion threshold, the third short chain overflows, and the generated third short chain is a 5-digit short chain, at which time the third short chain needs to be monitored. At this time, the first short chain can be reset, for example, reset to 1 or other constants, and then steps 3 and 4 are repeated to generate a new third short chain. When the third short chain overflows, overflow information can also be returned to remind the user.
[0074] After obtaining the third short chain in the target numeral system, the third short chain and the long link can be stored together in a short chain mapping table in the database. It should be noted that the short chain mapping table can also store the domain name parameter and the time limit of the long link. The short chain data that has been queried and converted can be cached in the database to improve the query efficiency.
[0075] Figure 2 A schematic diagram of the short chain conversion of the embodiment of the present application is shown.
[0076] As Figure 2 shown, when it is necessary to convert a long link into a short chain, a long link to short link interface can be called first, and then it is judged whether the IP corresponding to the long link is in a preset whitelist. If the IP corresponding to the long link is in the whitelist, the long link can be converted into a short chain, and the correspondence between the long link and the short chain is stored in a short chain mapping table; if the IP corresponding to the long link is outside the whitelist, a corresponding error code can be returned. After storing the correspondence between the long link and the short chain in the short chain mapping table, an access log of the long link to short link interface can also be recorded, and then the generated short chain is returned.
[0077] Step S5: generating a short link corresponding to the long link based on the short chain mapping table.
[0078] The short link can include a transmission protocol such as http and https and the domain name parameter in addition to the third short chain in base 62. In the present application, the distinction between http and https can be sensitive. It can be understood that the present application does not limit how the third short chain is further encapsulated to obtain the short link.
[0079] Further, the short link generation method further includes:
[0080] Step S6: input the short link;
[0081] The short link can be input on a short chain platform, which can be a cloud platform or application software.
[0082] Further, the short chain platform performs long-short link conversion and recording, simultaneously realizes access query through a short chain and jumping to a corresponding long link, and can be implemented based on a SpringBoot framework. SpringBoot is a scaffolding built on the basis of a Spring framework, provides an automatic configuration function based on a rapid construction concept, can simplify the initial construction and development process of a new Spring application, and can realize functions such as out-of-box use, start dependency, automatic configuration, health check, and the like, and is simple and convenient.
[0083] Step S7: query the long link corresponding to the third short chain in the short chain mapping table, wherein the third short chain is associated with the institution parameter;
[0084] Specifically, the 4-bit short chain of the present application can jump to a corresponding long link by querying a database, and the host in the request header of the short chain platform distinguishes the institution, queries the long link of the corresponding institution corresponding to the 4-bit short chain in the short chain mapping table, and then jumps to the long link.
[0085] It should be noted that in the present application, only short chains containing st in the path can access the jump interface of the short chain platform through http and https at the same time. If the st path is not contained in the https type short chain, an exception information 404 will be directly returned.
[0086] In one example, reverse proxy Nginx configuration can be used to access the short chain jump. Specifically, the following configuration can be added to the Nginx of the application:
[0087] location / st {
[0088] proxy_pass http: / / application F5 server ip:port;
[0089] proxy_set_header Host $host;
[0090] proxy_set_header X-Real-IP $remote_addr;
[0091] proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
[0092] }
[0093] Nginx (pronounced like engine x) is a lightweight Web server / reverse proxy server and email (IMAP / POP3) proxy server, which can be used to implement short chain jumping. Using Nginx to implement short chain jumping can further improve the efficiency of short chain jumping.
[0094] Step S8: redirect to the long link through the jump interface.
[0095] Figure 3 A schematic diagram of short chain jumping according to an embodiment of the application is shown.
[0096] As shown in Figure 3 , when it is necessary to jump or access the corresponding long link through the short chain, the short chain long link obtaining interface can be called first, and then it is judged whether the IP corresponding to the short chain is in the preset whitelist. If the IP corresponding to the short chain is in the whitelist, the corresponding long link can be queried from the database according to the short chain; if the IP corresponding to the short chain is outside the whitelist, the corresponding error code is returned. Then, in the case that the corresponding long link can be queried, the access log of the short chain long link obtaining interface is recorded, and then the long link is returned; in the case that the corresponding long link cannot be queried, the corresponding error code is returned.
[0097] Therefore, the 4-bit short chain generation scheme of the application can provide a highly available long chain to short chain service, which is more concise and efficient, and facilitates the processing and handling of online links such as operation activities by business operation personnel. The design standard of the scheme of the application is based on the principles of short chain length simplification, high security, easy maintenance, fast generation speed, etc. The technical scheme can be implemented in a platform to build a short chain service platform to serve business needs from the aspects of generation, maintenance, use, data statistics, etc.
[0098] Figure 4 A schematic diagram of a short chain platform according to an embodiment of the application is shown.
[0099] As shown in Figure 4As shown, the short-chain platform of this application can be a cloud platform, implemented based on a Virtual Private Cloud (VPC) model. A VPC can be divided into two basic network areas: a Demilitarized Zone (DMZ) and a Server Farm (SF).
[0100] The DMZ network zone is an isolated area between the internal network and the Internet, typically used to deploy web servers or front-end / proxy servers. It can provide services to the Internet by opening a firewall. The SF network zone can be used to deploy internal network applications and core applications.
[0101] See Figure 4 The short-chain platform may also include a load balancer (F5) that can balance the load (work tasks) and distribute them to multiple operating units for execution, such as web servers, FTP servers, enterprise critical application servers and other critical task servers, so as to jointly complete the work tasks.
[0102] exist Figure 4 In this context, Bank A and Bank B can be two different banking institutions. Bank A's internet access address could be https: / / a1... or http: / / a2..., and Bank B's internet access address could be http: / / b1... or https: / / b2.... Each institution's respective database can store its corresponding internet access address.
[0103] Furthermore, the `apply()` method can be used to call the domain name parameters in the internet access addresses of different organizations, binding them through ports 443 and 80. The bound data can then be sent to the load balancer F5 for processing. Short-link redirection is then implemented through a reverse proxy Nginx. During the redirection process, network requests (i.e., online applications) can also be handled by Nginx, and the data flow between the load balancer and Nginx can be coordinated through ports 80 and 443.
[0104] For example, after receiving the latest promotional activities, the event operators compile the long URLs for the corresponding activities and log in to a short link platform. Next, on the platform, in the corresponding short link management section, the operators enter basic information such as the long link address and validity period to create the necessary short links. Then, after receiving the short links, the operators first verify their availability locally. If the verification is successful, the short link is applied to promotional materials such as QR codes and posters. After the event ends, the short link platform can be used to control the link's validity period, such as setting it to invalid.
[0105] The short link generation device provided by the application can generate a four-digit short link from a long link according to the operation demand of an operator, and the short link can be used for creating a two-dimensional code, a poster or other operation carriers of an activity, so that the length of the long link address of the activity is simplified, and the long link can be put on more link carriers. On the basis of meeting the operation of the activity, the effectiveness and security of the long link are ensured. Meanwhile, the data statistics and monitoring of the access of the activity link can be performed according to the scheme, and the configuration and maintenance of all the activity links realized by the scheme can be performed in various dimensions, such as success rate, failure rate, transmission time and the like, on a visual platform. Through the scheme, the short link demand of the long link address of the activity can be quickly realized, the link can be quickly and flexibly configured, the execution efficiency of the business demand can be improved, and the response rate of the business operation is further improved.
[0106] Figure 5 A block diagram of a short link generation device of an embodiment of the application is shown.
[0107] As shown in Figure 5 , the short link generation device 50 of the embodiment of the application can include:
[0108] A long link acquisition module 51 is configured to acquire a currently input long link and an institution parameter corresponding to the long link.
[0109] A first short link generation module 52 is configured to generate a first short link corresponding to the institution parameter according to a preset short link generation table in a database.
[0110] A second short link generation module 53 is configured to increment the first short link to obtain a second short link corresponding to the long link.
[0111] A third short link generation module 54 is configured to perform a base conversion on the second short link to obtain a third short link in a target base form, and store the third short link and the long link together in a short link mapping table in the database.
[0112] A short link generation module 55 is configured to generate a short link corresponding to the long link based on the short link mapping table.
[0113] In addition, the application provides a computer readable medium having a computer program stored thereon, and the computer program is executed by a processor to implement the short link generation method.
[0114] Further, the application further provides an electronic device, including one or more processors, a storage device configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the short link generation method.
[0115] Figure 6 A structural schematic diagram of an electronic device of an embodiment of the present application is shown.
[0116] As shown in Figure 6 the electronic device can be used to implement the test method based on the service code. Specifically, the electronic device can include a computer system. It should be noted that Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0117] As shown in Figure 6 the computer system includes a central processing unit (CPU) 1801, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1802 or programs loaded from a storage portion 1808 into a random access memory (RAM) 1803, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in the RAM 1803. The CPU 1801, the ROM 1802, and the RAM 1803 are connected to each other through a bus 1804. An input / output (I / O) interface 1805 is also connected to the bus 1804.
[0118] The following components are connected to the I / O interface 1805: an input portion 1806 including a keyboard, a mouse, and the like; an output portion 1807 including a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage portion 1808 including a hard disk, and the like; and a communication portion 1809 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication portion 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to the I / O interface 1805 as necessary. A removable recording medium 1811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 1810 as necessary, so that a computer program read therefrom is installed into the storage portion 1808 as necessary.
[0119] In particular, the processes described above with reference to the flow charts can be implemented as computer software programs in accordance with the embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing computer programs for executing the methods shown in the flow charts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 1809, and / or installed from the detachable medium 1811. When the computer program is executed by the central processing unit (CPU) 1801, various functions defined in the system of the present application are executed.
[0120] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable computer programs. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium, which can send, propagate or transmit programs for use by or in conjunction with an instruction execution system, device or apparatus. The computer programs contained on the computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination of the above.
[0121] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.
[0122] The units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The units described may
[0123] As another aspect, the present application also provides a computer readable medium, which can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to implement the method described in the above embodiments.
[0124] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, the division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0125] From the above description of the embodiments, those skilled in the art will readily appreciate that the example embodiments described herein can be implemented by software and / or by hardware coupled with software. Accordingly, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, or the like) or on a network, and includes a number of instructions for causing a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the methods according to the embodiments of the present application.
[0126] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0127] The above describes in detail the test method based on the service code and the related device provided by the embodiments of the present application. The principle and implementation manner of the present application are described by applying specific examples. The above embodiment description is only used to help understand the technical solutions and core ideas of the present application. Those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced equivalently. The modification or replacement does not change the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating short links, characterized in that, The method includes: Get the currently input long link and the corresponding organizational parameters; Based on the preset short chain generation table in the database, a first short chain corresponding to the institutional parameters is generated. For different institutions, the generated first short chain is located in different numerical ranges. The short link generation table is generated through the following steps: Obtain the validity period of the long link and the domain name parameters corresponding to the long link; Configure the short link generation table according to the validity period of the long link, the domain name parameters corresponding to the long link, and the organization parameters corresponding to the long link; Listen for input from the long link, and multiple long links may be input simultaneously; When a new long link is input, multiple processes corresponding to the multiple long links are obtained; Select the process with the highest priority from the plurality of processes; Based on the highest priority process, the first short chain is increased by a preset step size until the first short chain overflows, and a second short chain corresponding to the long chain is obtained. Both the first short chain and the second short chain are decimal values. Obtain the generation status of the second short chain; If the generation status of the second short chain is a failure, the process corresponding to the second short chain stops the number system conversion and returns an exception message to the input terminal. The second short chain is converted to a different base to obtain a third short chain in the target base form. The third short chain and the long chain are then stored together in a short chain mapping table in the database. This process includes: obtaining a conversion threshold for the third short chain; if the third short chain does not exceed the conversion threshold, directly converting the second short chain to a different base form to obtain the third short chain in the target base form; if the third short chain exceeds the conversion threshold, updating the first short chain to obtain the third short chain in the target base form. The short links corresponding to the long links are generated based on the short link mapping table.
2. The short link generation method according to claim 1, characterized in that, The third short chain consists of 4 letters and / or numbers in base 62.
3. The short link generation method according to claim 1, characterized in that, The short link generation method also includes: Enter the short link; Query the long link corresponding to the third short link in the short link mapping table, wherein the third short link is associated with the institutional parameters; Redirecting to the long link via the redirect interface.
4. A short link generation device, characterized in that, The short link generation device includes: The long link acquisition module is used to obtain the currently input long link and the corresponding organizational parameters of the long link; The first short link generation module is used to generate a first short link corresponding to the organization parameters according to a preset short link generation table in the database. For different organizations, the generated first short links are located in different numerical ranges. The short link generation table is generated through the following steps: obtaining the validity period of the long link and the domain name parameters corresponding to the long link; configuring the short link generation table according to the validity period of the long link, the domain name parameters corresponding to the long link, and the organization parameters corresponding to the long link. The second short link generation module is used to listen to the input of the long link, where multiple long links are input simultaneously; when a new long link is input, it obtains multiple processes corresponding to the multiple long links; selects the process with the highest priority among the multiple processes; based on the process with the highest priority, it increments the first short link by a preset step size until the first short link overflows, obtaining the second short link corresponding to the long link, where both the first short link and the second short link are decimal values; it obtains the generation status of the second short link; if the generation status of the second short link is a failure, the process corresponding to the second short link stops the base conversion and returns an exception information to the input terminal; The third short link generation module is used to perform a base conversion on the second short link to obtain a third short link in the target base form, and store the third short link and the long link together in a short link mapping table in the database. The module includes: obtaining a conversion threshold for the third short link; if the third short link does not exceed the conversion threshold, directly performing a base conversion on the second short link to obtain a third short link in the target base form; if the third short link exceeds the conversion threshold, updating the first short link to obtain a third short link in the target base form. The short link generation module is used to generate short links corresponding to the long links based on the short link mapping table.
5. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the short link generation method as described in any one of claims 1 to 3.
6. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the short link generation method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Short link processing method and device, storage medium and computer equipment
CN112307058A