Method and apparatus for generating unique identification number

By obtaining the generation record and value range of the unique identification number through the terminal device and requesting multiple unique identification numbers from the server, the problem of high database pressure in large-scale applications is solved, and efficient and low-pressure unique identification number generation is achieved.

CN114218281BActive Publication Date: 2025-10-24CCB FINTECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111553139.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2025-10-24
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

In large-scale applications, frequent requests for unique identification numbers from the database cause heavy database processing pressure and affect concurrency performance.

Method used

The terminal device obtains the generation record of the unique identification number, determines the value range, and requests multiple unique identification numbers within the range from the server. The server generates and returns the unique identification numbers within the range.

Benefits of technology

This reduces the processing pressure on the server to generate the unique identification number, reduces the impact on concurrent performance, and ensures the uniqueness and retrieval efficiency of the unique identification number.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114218281B_ABST
    Figure CN114218281B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a unique identification number generation method and device, which are applied to the technical field of big data intelligent analysis, and the method comprises the following steps: obtaining a unique identification number generation record; determining a value range of the unique identification number according to the unique identification number generation record and a target generation quantity of the unique identification number; sending a unique identification number generation request to a server, wherein the generation request contains the value range of the unique identification number; and receiving a plurality of unique identification numbers in the value range of the unique identification number sent by the server. Through the method, the terminal device obtains the plurality of unique identification numbers in the value range of the unique identification number each time, so that the processing pressure of the server in generating the unique identification number is reduced, and the influence on the concurrent performance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of big data intelligent analysis, and in particular to a unique identification number generation method and device. BACKGROUND

[0002] With the development of information technology, the use range of various applications is more and more extensive. In a bank service system, an application can apply for a unique identification number from a database in a server, so as to perform various businesses such as transfer and query.

[0003] In related technologies, a database self-increment identity (id) is usually used to ensure the uniqueness of the unique identification number. When an application program needs to generate a unique identification number, a generation request can be sent to the database, so as to request the database to generate a latest unique identification number id value according to the self-increment id mode.

[0004] However, when the use scale of the application is large, for example, thousands of services are running at the same time, the application needs to send a generation request to the database every time to obtain a unique identification number, thereby causing a large processing pressure of the database. SUMMARY

[0005] Embodiments of the present application provide a unique identification number generation method and device to solve the technical problem of large processing pressure of the database in the prior art.

[0006] In a first aspect, embodiments of the present application provide a unique identification number generation method applied to a terminal device, and the method comprises:

[0007] obtaining a unique identification number generation record;

[0008] determining a value range of the unique identification number according to the unique identification number generation record and a target generation quantity of the unique identification number;

[0009] sending a generation request of the unique identification number to a server, wherein the generation request contains the value range of the unique identification number;

[0010] receiving a plurality of unique identification numbers in the value range of the unique identification number sent by the server.

[0011] In an optional implementation, the unique identification number generation record contains a value of a latest generated unique identification number.

[0012] In an optional implementation, the obtaining of the unique identification number generation record comprises:

[0013] sending a read request of the unique identification number generation record to the server;

[0014] receiving the generation record of the unique identification number sent by the server.

[0015] In an optional implementation, before the obtaining of the generation record of the unique identification number, the method further comprises:

[0016] receiving an obtaining request of the unique identification number sent by a target application;

[0017] determining whether there is at least one unused unique identification number in the local cache;

[0018] if not, sending a read request of the generation record of the unique identification number to the server.

[0019] In an optional implementation, after the determination of whether there is at least one unused unique identification number in the local cache, the method further comprises:

[0020] if yes, determining the unique identification number to be obtained by the target application from the at least one unused unique identification number according to the use order of the unique identification number.

[0021] In an optional implementation, after the receiving of the multiple unique identification numbers in the value range of the unique identification number sent by the server, the method further comprises:

[0022] saving the multiple unique identification numbers in the local cache;

[0023] determining the unique identification number to be obtained by the target application from the multiple unique identification numbers according to the use order of the unique identification number.

[0024] In a second aspect, the embodiments of the present application provide a unique identification number generation method, applied to a terminal device, and the method comprises:

[0025] receiving a generation request of the unique identification number sent by the terminal device, wherein the generation request contains a value range of the unique identification number;

[0026] generating multiple unique identification numbers in the value range of the unique identification number;

[0027] sending the multiple unique identification numbers to the terminal device.

[0028] In an optional implementation, before the receiving of the generation request of the unique identification number sent by the terminal device, the method further comprises:

[0029] receiving a read request of the generation record of the unique identification number sent by the terminal device;

[0030] sending the terminal device a record of generation of the unique identification number.

[0031] In an alternative embodiment, the record of generation of the unique identification number comprises a value of a newly generated unique identification number.

[0032] After sending the terminal device the plurality of unique identification numbers, the method further comprises:

[0033] According to a value range of the unique identification number in the generation request, updating the value of the newly generated unique identification number in the record of generation of the unique identification number.

[0034] In an alternative embodiment, the server performs multi-thread synchronization concurrent control when generating the unique identification number.

[0035] In a third aspect, the embodiments of the present application provide a unique identification number generation device, which comprises:

[0036] a processing module configured to acquire a record of generation of the unique identification number, and determine a value range of the unique identification number according to the record of generation of the unique identification number and a target generation quantity of the unique identification number;

[0037] a sending module configured to send a generation request of the unique identification number to a server, the generation request comprising the value range of the unique identification number;

[0038] a receiving module configured to receive a plurality of unique identification numbers within the value range of the unique identification number sent by the server.

[0039] In an alternative embodiment, the record of generation of the unique identification number comprises a value of a newly generated unique identification number.

[0040] In an alternative embodiment, the sending module is further configured to send a read request of the record of generation of the unique identification number to the server.

[0041] The receiving module is further configured to receive the record of generation of the unique identification number sent by the server.

[0042] In an alternative embodiment, before acquiring the record of generation of the unique identification number, the receiving module is further configured to receive an acquisition request of the unique identification number sent by a target application.

[0043] The processing module is further configured to determine whether there is at least one unused unique identification number in a local cache.

[0044] The sending module is further configured to send a read request of the record of generation of the unique identification number to the server if there is not.

[0045] In an optional implementation, the processing module is further configured to determine the unique identifier to be acquired by the target application from the at least one unused unique identifier according to the use order of the unique identifiers.

[0046] In an optional implementation, the processing module is further configured to store the plurality of unique identifiers in a local cache, and determine the unique identifier to be acquired by the target application from the plurality of unique identifiers according to the use order of the unique identifiers.

[0047] In a fourth aspect, an embodiment of the present application provides a unique identifier generation apparatus, which comprises:

[0048] A receiving module configured to receive a unique identifier generation request sent by a terminal device, wherein the generation request comprises a value range of the unique identifier;

[0049] A processing module configured to generate a plurality of unique identifiers within the value range of the unique identifier;

[0050] A sending module configured to send the plurality of unique identifiers to the terminal device.

[0051] In an optional implementation, the receiving module is further configured to receive a reading request of a unique identifier generation record sent by the terminal device;

[0052] The sending module is further configured to send the unique identifier generation record to the terminal device.

[0053] In an optional implementation, the unique identifier generation record comprises a value of a newly generated unique identifier.

[0054] The processing module is further configured to update the value of the newly generated unique identifier in the unique identifier generation record according to the value range of the unique identifier in the generation request.

[0055] In an optional implementation, the apparatus performs multi-thread synchronization concurrent control when generating the unique identifier.

[0056] In a fifth aspect, an embodiment of the present application provides a terminal device, which comprises a processor and a memory; wherein the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to implement the method in the first aspect.

[0057] In a sixth aspect, an embodiment of the present application provides a server, comprising: a processor and a memory; wherein the memory stores a computer program, the computer program being adapted to be loaded and executed by the processor to implement the method according to the second aspect.

[0058] In a seventh aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of the first aspect.

[0059] In an eighth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of the second aspect.

[0060] In a ninth aspect, the present application further provides a non-transitory computer readable storage medium storing computer instructions, which stores a computer program, the computer program being executed by a processor to implement the method according to any one of the first aspect.

[0061] In a tenth aspect, the present application further provides a non-transitory computer readable storage medium storing computer instructions, which stores a computer program, the computer program being executed by a processor to implement the method according to any one of the second aspect.

[0062] The method and device for generating a unique identification number provided by the embodiments of the present application, the terminal device first acquires a generation record of the unique identification number. Secondly, the terminal device determines a value range of the unique identification number according to the generation record of the unique identification number and a target generation quantity of the unique identification number. Thirdly, the terminal device sends a generation request of the unique identification number to a server, the generation request containing the value range of the unique identification number. Finally, the terminal device receives a plurality of unique identification numbers in the value range of the unique identification number sent by the server. Unlike the prior art in which one unique identification number is applied to the server each time, the present application applies a plurality of unique identification numbers in a range to the server each time, thereby avoiding the terminal device from frequently applying unique identification numbers to the server and reducing the processing pressure of the server when generating unique identification numbers. Meanwhile, the generation record of the unique identification number can reduce the influence on the concurrent performance and guarantee the uniqueness of the unique identification number. BRIEF DESCRIPTION OF DRAWINGS

[0063] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0064] Figure 1 An application scenario diagram of a unique identification number generation method provided by an embodiment of the present application is shown in FIG. 1.

[0065] Figure 2 A signaling interaction diagram of a unique identification number generation method provided by an embodiment of the present application is shown in FIG. 2.

[0066] Figure 3 A unique identification number generation diagram provided by an embodiment of the present application is shown in FIG. 3.

[0067] Figure 4 A signaling interaction diagram of another unique identification number generation method provided by an embodiment of the present application is shown in FIG. 4.

[0068] Figure 5 A signaling interaction diagram of still another unique identification number generation method provided by an embodiment of the present application is shown in FIG. 5.

[0069] Figure 6 A structure diagram of a unique identification number generation apparatus provided by an embodiment of the present application is shown in FIG. 6.

[0070] Figure 7 A structure diagram of another unique identification number generation apparatus provided by an embodiment of the present application is shown in FIG. 7.

[0071] Figure 8 A structure diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 8. DETAILED DESCRIPTION

[0072] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0073] The acquisition, storage, use, processing and the like of data in the technical solutions of the present application comply with relevant provisions of national laws and regulations.

[0074] With the development of information technology, the use range of various applications is becoming more and more extensive. In a bank service system, an application can apply for a unique identification number from a database in a server, so as to perform various businesses such as transfer and query.

[0075] In the related art, two methods are usually used to ensure the uniqueness of the unique identification number. In the first method, the uniqueness of the unique identification number can be ensured by the database self-increment id. When the application needs to generate a unique identification number, a generation request can be sent to the database to request the database to generate a latest unique identification number id value according to the self-increment id mode. In the second method, the generation mode of the Universally Unique Identifier (UUID) and the related variants of the UUID can be used as the unique identification number to ensure the uniqueness of the unique identification number.

[0076] However, when the first method is used, if the use scale of the application is large, for example, thousands of services are running at the same time, the application sends a generation request to the database every time it obtains a unique identification number, which causes a large processing pressure of the database and affects the concurrent performance. When the second method is used, since the UUID has a similar form to the unordered letters, it cannot be determined from the unique identification number where it belongs, and the storage space of the UUID as a string in the database and the retrieval efficiency are negatively affected.

[0077] To solve the above problems, the embodiment of the present application provides a unique identification number generation method. The terminal device applies for a plurality of unique identification numbers in the value range from the server every time, so that the unique identification number with high readability can be generated efficiently under high concurrency without increasing the database pressure in the server. Moreover, the retrieval efficiency is not affected, and all unique identification number generation requirements of the full platform can be supported.

[0078] The application scenario of the unique identification number generation method related to the present application is described below.

[0079] Figure 1 The application scenario of the unique identification number generation method provided by the embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, when the application in the terminal device 101 needs to generate a unique identification number, it can first determine whether there is an unused unique identification number in the local cache. If there is an unused unique identification number in the local cache, the unused unique identification number can be directly taken from the local cache. If there is no unused unique identification number in the local cache, the generation record of the unique identification number can be obtained from the database of the server 102, and the value range of the unique identification number can be determined according to the generation record of the unique identification number and the target generation quantity of the unique identification number, so that the plurality of unique identification numbers in the value range can be applied for from the database of the server 102 based on the value range of the unique identification number.

[0080] The terminal device 101 can be a tablet computer, a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in smart home, and the like. In the embodiments of the present application, the device for implementing the function of the terminal can be a terminal, or a device capable of supporting the terminal to implement the function, such as a chip system, which can be installed in the terminal. In the embodiments of the present application, the chip system can be composed of a chip, or can include a chip and other discrete devices.

[0081] The server 102 can be, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of computers or network servers based on cloud computing. The cloud computing is a kind of distributed computing, which is a super virtual computer composed of a group of loosely coupled computers.

[0082] It should be understood that the application scenarios of the technical solutions of the present application can be scenarios in the above-mentioned scenarios, but are not limited thereto, and can also be applied to other scenarios that require generation of a unique identification number. Figure 1

[0083] It can be understood that the above-mentioned unique identification number generation method can be implemented by the unique identification number generation device provided by the embodiments of the present application. The unique identification number generation device can be part or all of a certain device, such as a terminal device and a server.

[0084] The technical solutions of the embodiments of the present disclosure will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments.

[0085] Figure 2 The signaling interaction diagram of the unique identification number generation method provided by the embodiments of the present application is provided. The present embodiment relates to the specific process of how to generate a unique identification number. As shown in Figure 2 The method comprises the following steps:

[0086] S201, the terminal device acquires the generation record of the unique identification number.

[0087] In the embodiments of the present application, when the target application in the terminal device needs to generate a unique identification number, the terminal device can acquire the generation record of the unique identification number. ​

[0088] The generation record of the unique identification number can include a value of the latest generated unique identification number.

[0089] The embodiments of the present application do not limit how the terminal device acquires the generation record of the unique identification number. In some embodiments, the terminal device can send a read request of the generation record of the unique identification number to the server, and thus receive the generation record of the unique identification number sent by the server.

[0090] For example, the generation record of the unique identification number can be maintained by a database in the server, and a table is used to record the value N of the currently generated unique identification number. The database in the server maintains different generation records for different unique identification numbers, so as to avoid mutual influence.

[0091] In some embodiments, if the terminal device receives the acquisition request of the unique identification number sent by the target application, the terminal device can further determine whether there is at least one unused unique identification number in the local cache before acquiring the generation record of the unique identification number. If there is no at least one unused unique identification number in the local cache, the terminal device can send a read request of the generation record of the unique identification number to the server again. If there is at least one unused unique identification number in the local cache, the terminal device can determine the unique identification number to be acquired by the target application from the at least one unused unique identification number according to the use order of the unique identification number.

[0092] It should be understood that the embodiments of the present application do not limit the target application, which can be any application that needs to generate a unique identification number. The embodiments of the present application do not limit the use order of the unique identification number, which can be the size order of natural numbers.

[0093] For example, if the local cache includes unused unique identification numbers N to N+k, the terminal device can take N as the unique identification number to be acquired by the target application according to the size order of natural numbers.

[0094] S202, the terminal device determines a value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number.

[0095] In this step, after the terminal device acquires the generation record of the unique identification number, the terminal device can determine the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number.

[0096] It should be understood that the embodiments of the present application do not limit the target generation number of the unique identification number, and the target generation number of the unique identification number can be set according to actual conditions. For example, the target generation number of the unique identification number can be set to 5, 20, 100, etc. It should be noted that as the target generation number of the unique identification number increases, the number of unique identification numbers applied by the terminal device each time will increase, and the pressure on the database in the server will also decrease.

[0097] It should be understood that the embodiments of the present application do not limit how the terminal device determines the target generation number of the unique identification number, and in some embodiments, the target generation number of the unique identification number can be predefined or indicated by the server.

[0098] For example, if the value of the latest generated unique identification number in the generation record of the unique identification number is N, and the target generation number of the unique identification number is k, the terminal device determines that the value range of the unique identification number is N to N+k.

[0099] S203, the terminal device sends a generation request of the unique identification number to the server, and the generation request contains a value range of the unique identification number.

[0100] In this step, after the terminal device determines the value range of the unique identification number, the terminal device can send a generation request of the unique identification number to the server, so as to obtain multiple unique identification numbers in the value range.

[0101] S204, the server generates multiple unique identification numbers in the value range of the unique identification number.

[0102] In this step, after the server receives the generation request of the unique identification number, the server can generate multiple unique identification numbers in the value range of the unique identification number.

[0103] It should be noted that the embodiments of the present application do not limit the number of generated unique identification numbers, and for example, if 100 can be generated in the value range, the server can generate 100 unique identification numbers accordingly.

[0104] In some embodiments, after the server generates multiple unique identification numbers in the value range of the unique identification number, the server can update the generation record of the unique identification number, thereby generating the value of the latest generated unique identification number.

[0105] It should be understood that in the embodiments of the present application, the server performs multi-thread synchronization concurrent control when generating the unique identification number. The multi-thread synchronization concurrent control can be synchronize concurrent control. Through the multi-thread synchronization concurrent control, the server can only generate a unique identification number corresponding to the generation request sent by the terminal device at the same time.

[0106] S205. The server sends the plurality of unique identification numbers to the terminal device.

[0107] In this step, after the server generates a plurality of unique identification numbers within the value range of the unique identification numbers, the plurality of unique identification numbers can be sent to the terminal device.

[0108] In some embodiments, after receiving the plurality of unique identification numbers, the terminal device can save the plurality of unique identification numbers in the local cache. Subsequently, the terminal device can determine the unique identification number to be obtained by the target application from the plurality of unique identification numbers according to the use order of the unique identification numbers. The use order of the unique identification numbers is not limited in the embodiments of the present application, and can be the natural number order.

[0109] An exemplary Figure 3 A generation diagram of a unique identification number is provided in the embodiments of the present application. As Figure 3 shown, when the function 1 of the target application needs to generate a unique identification number, the terminal device can obtain the unique identification numbers within the range of N to N+k from the database in the server, store the unique identification numbers within the range of N to N+k in the cache, and return the unique identification number N+1 to the function 1. Subsequently, when the function 2 of the target application needs to generate a unique identification number, if the unique identification numbers within the range of N to N+k in the local cache have all been used, the terminal device can obtain the unique identification numbers within the range of N+k to N+2k from the database in the server, store the unique identification numbers within the range of N+k to N+2k in the cache, and return the unique identification number N+k+1 to the function 2.

[0110] In the present application, by using the generation method of the unique identification number, the pressure on the database due to the generation of the unique identification number can be significantly reduced, thereby improving the system performance. At the same time, compared with the machine code, UUID and other solutions, the readability of the unique identification number can be significantly improved, and the retrieval efficiency of the database can be improved.

[0111] The generation method of the unique identification number provided in the embodiments of the present application is as follows. First, the terminal device obtains the generation record of the unique identification number. Second, the terminal device determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation quantity of the unique identification number. Third, the terminal device sends a generation request of the unique identification number to the server, and the generation request contains the value range of the unique identification number. Finally, the terminal device receives a plurality of unique identification numbers within the value range of the unique identification number sent by the server. By this way, since the terminal device obtains a plurality of unique identification numbers within the value range of the unique identification number each time, the processing pressure of the server when generating the unique identification number is reduced, and the influence on the concurrent performance is reduced.

[0112] On the basis of the above embodiment, the following describes how the terminal device acquires the generation record of the unique identifier. Figure 4 Another signaling interaction diagram of a method for generating a unique identifier provided in an embodiment of the present application is shown in FIG. 4, and the method includes the following steps. Figure 4

[0113] S301. The terminal device sends a read request for the generation record of the unique identifier to the server.

[0114] S302. The server sends the generation record of the unique identifier to the terminal device.

[0115] S303. The terminal device determines a value range of the unique identifier according to the generation record of the unique identifier and the target generation quantity of the unique identifier.

[0116] S304. The terminal device sends a generation request for the unique identifier to the server, and the generation request contains the value range of the unique identifier.

[0117] S305. The server generates a plurality of unique identifiers in the value range of the unique identifier.

[0118] S306. The server sends the plurality of unique identifiers to the terminal device.

[0119] The technical terms, technical effects, and technical features of S301-S306, as well as the optional implementation manners, can be understood with reference to S201-S204 shown in FIG. 2, and repeated descriptions are not given herein. Figure 2

[0120] On the basis of the above embodiment, the following describes whether the terminal device directly uses the locally cached unique identifier. Figure 5 Another signaling interaction diagram of a method for generating a unique identifier provided in an embodiment of the present application is shown in FIG. 4, and the method includes the following steps. Figure 5

[0121] S401. The terminal device receives an acquisition request for the unique identifier sent by a target application.

[0122] S402. The terminal device determines whether there is at least one unused unique identifier in the local cache.

[0123] If yes, step S403 is performed, and if no, step S404 is performed.

[0124] S403. The terminal device determines the unique identifier to be acquired by the target application from the at least one unused unique identifier according to the use order of the unique identifier.

[0125] ​​​S404, the terminal device sends a read request of the generation record of the unique identification number to the server.

[0126] S405, the server sends the generation record of the unique identification number to the terminal device.

[0127] S406, the terminal device determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation quantity of the unique identification number.

[0128] S407, the terminal device sends a generation request of the unique identification number to the server, and the value range of the unique identification number is contained in the generation request.

[0129] S408, the server generates a plurality of unique identification numbers in the value range of the unique identification number.

[0130] S409, the server sends the plurality of unique identification numbers to the terminal device.

[0131] The technical terms, technical effects, technical features, and optional embodiments of S401-S409 can be understood with reference to S201-S204 shown in Figure 2

[0132] The unique identification number generation method provided by the embodiment of the present application is that the terminal device first acquires the generation record of the unique identification number. Secondly, the terminal device determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation quantity of the unique identification number. Thirdly, the terminal device sends a generation request of the unique identification number to the server, and the value range of the unique identification number is contained in the generation request. Finally, the terminal device receives the plurality of unique identification numbers in the value range of the unique identification number sent by the server. In this way, since the terminal device acquires the plurality of unique identification numbers in the value range of the unique identification number each time, the processing pressure of the server in generating the unique identification number is reduced, and the influence on the concurrency performance is reduced.

[0133] Those skilled in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium. When the program is executed, the steps of the above method embodiments are executed; and the foregoing storage medium includes ROM, RAM, magnetic disc or optical disc and various storage medium capable of storing program codes.

[0134] Figure 6 A structure diagram of a unique identification number generation device provided by the embodiment of the present application. The unique identification number generation device can be realized by software, hardware or combination of the two to execute the unique identification number generation method of the terminal device side described above. As shown in Figure 6 ​As shown, the unique identification number generation apparatus 500 comprises:

[0135] The processing module 501 is configured to acquire a unique identification number generation record, and determine a value range of the unique identification number according to the unique identification number generation record and a target generation quantity of the unique identification number.

[0136] The sending module 502 is configured to send a unique identification number generation request to a server, the generation request comprising the value range of the unique identification number.

[0137] The receiving module 503 is configured to receive a plurality of unique identification numbers within the value range of the unique identification number sent by the server.

[0138] In an optional implementation, the unique identification number generation record comprises a value of the latest generated unique identification number.

[0139] In an optional implementation, the sending module 502 is further configured to send a reading request of the unique identification number generation record to the server.

[0140] The receiving module 503 is further configured to receive the unique identification number generation record sent by the server.

[0141] In an optional implementation, the receiving module 503 is further configured to receive a unique identification number acquisition request sent by a target application.

[0142] The processing module 501 is further configured to determine whether there is at least one unused unique identification number in the local cache.

[0143] The sending module 502 is further configured to send a reading request of the unique identification number generation record to the server if there is not.

[0144] In an optional implementation, the processing module 501 is further configured to determine the unique identification number to be acquired by the target application from the at least one unused unique identification number according to a use order of the unique identification number if there is.

[0145] In an optional implementation, the processing module 501 is further configured to save a plurality of unique identification numbers in the local cache, and determine the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the use order of the unique identification number.

[0146] It should be noted that, Figure 6 The unique identification number generation apparatus provided by the embodiments can be used to execute the method provided by the terminal device side, and the specific implementation manner and technical effects are similar, which will not be described here.

[0147] Figure 7Another structure diagram of a unique identification number generation apparatus provided by an embodiment of the present application is shown in FIG. 6. The unique identification number generation apparatus can be implemented by software, hardware or a combination of both to execute the unique identification number generation method provided by the server side. As shown in FIG. 6, the unique identification number generation apparatus 600 includes: Figure 7

[0148] A receiving module 601 is configured to receive a unique identification number generation request sent by a terminal device, and the generation request contains a value range of the unique identification number.

[0149] A processing module 602 is configured to generate a plurality of unique identification numbers within the value range of the unique identification number.

[0150] A sending module 603 is configured to send the plurality of unique identification numbers to the terminal device.

[0151] In an optional implementation, the receiving module 601 is further configured to receive a reading request of a unique identification number generation record sent by the terminal device.

[0152] The sending module 603 is further configured to send the unique identification number generation record to the terminal device.

[0153] In an optional implementation, the unique identification number generation record contains a value of the latest generated unique identification number.

[0154] The processing module 602 is further configured to update the value of the latest generated unique identification number in the unique identification number generation record according to the value range of the unique identification number in the generation request.

[0155] In an optional implementation, the apparatus performs multi-thread synchronization concurrent control when generating the unique identification number.

[0156] It should be noted that, Figure 7 The unique identification number generation apparatus provided by the embodiment shown in FIG. 6 can be used to execute the method provided by the server side, and the specific implementation manner and technical effects are similar, which will not be described here.

[0157] Figure 8 A structure diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 7. As shown in FIG. 7, the electronic device can include at least one processor 701 and a memory 702. Figure 8 Figure 8 It is shown that the electronic device takes one processor as an example, which can be the terminal device or the server.

[0158] The memory 702 is configured to store a program. Specifically, the program can include program code, and the program code includes computer operation instructions.

[0159] ​​The memory 702 can include a high-speed RAM memory, and can also include a non-volatile memory, for example, at least one disk memory.

[0160] The processor 701 is configured to execute the computer-executed instructions stored in the memory 702, so as to implement the terminal device-side unique identification number generation method or the server-side unique identification number generation method.

[0161] The processor 701 can be a central processing unit (CPU) or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0162] Optionally, in a specific implementation, if the communication interface, the memory 702 and the processor 701 are independently implemented, the communication interface, the memory 702 and the processor 701 can be connected with each other through a bus and complete the communication therebetween. The bus can be an industry standard architecture (ISA) bus, a peripheral component (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc., but does not mean that there is only one bus or one type of bus.

[0163] Optionally, in a specific implementation, if the communication interface, the memory 702 and the processor 701 are integrated on a chip, the communication interface, the memory 702 and the processor 701 can complete the communication through an internal interface.

[0164] The embodiments of the present application also provide a chip including a processor and an interface. The interface is configured to input and output data or instructions processed by the processor. The processor is configured to execute the method provided in the above method embodiments. The chip can be applied to a terminal device or a server.

[0165] The application further provides a computer readable storage medium, which can include a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium capable of storing program codes, and the computer readable storage medium specifically stores program information, and the program information is used for the generation method of the unique identification number.

[0166] The application further provides a program, which is used for executing the generation method of the unique identification number provided by the above method embodiments when executed by a processor.

[0167] The application further provides a program product, for example, a computer readable storage medium, which stores instructions, and when the instructions are executed on a computer, the computer executes the generation method of the unique identification number provided by the above method embodiments.

[0168] In the above embodiments, the implementation can be achieved by software, hardware, firmware or any combination thereof, entirely or partially. When the implementation is achieved by software, the implementation can be achieved in the form of a computer program product, entirely or partially. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the flow or function according to the embodiments of the application is entirely or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available medium sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD) or a semiconductor medium (for example, a solid state disk (SSD)) and the like.

[0169] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of generating a unique identification number, characterized by, The method applied to a terminal device comprises: receiving an acquisition request of a unique identification number sent by any function of a target application; the target application comprises multiple functions; the terminal device locally caches multiple unique identification numbers requested by the terminal device from a server and allocated by the server for the target application based on the request; determining whether there is at least one unused unique identification number in the local cache; if yes, determining the unique identification number to be acquired by the function from the at least one unused unique identification number according to the use order of the unique identification numbers; if no, requesting the server to allocate multiple unique identification numbers for the target application again to determine the unique identification number to be acquired by the function from the multiple allocated unique identification numbers according to the use order of the unique identification numbers; wherein, the step of requesting the server to allocate multiple unique identification numbers for the target application comprises: obtaining a generation record of the unique identification number from the server; determining a value range of the unique identification number according to the generation record of the unique identification number and a target generation number of the unique identification number; sending a generation request of the unique identification number to the server, the generation request containing the value range of the unique identification number; receiving multiple unique identification numbers in the value range of the unique identification number sent by the server.

2. The method of claim 1, wherein, The generation record of the unique identification number contains the value of the latest generated unique identification number.

3. The method according to claim 1 or 2, characterized in that, The step of obtaining the generation record of the unique identification number from the server comprises: sending a reading request of the generation record of the unique identification number to the server; receiving the generation record of the unique identification number sent by the server.

4. The method of claim 1, wherein, After the step of receiving the multiple unique identification numbers in the value range of the unique identification number sent by the server, the method further comprises: saving the multiple unique identification numbers in the local cache.

5. A method of generating a unique identification number, characterized by, The method applied to a server comprises: receiving a generation request of a unique identification number sent by a terminal device, the generation request containing a value range of the unique identification number; wherein, the terminal device locally caches multiple unique identification numbers requested by the terminal device from a server and allocated by the server for a target application based on the request; the generation request of the unique identification number is sent by the terminal device again when the terminal device receives an acquisition request of a unique identification number sent by any function of a target application and determines that there is not at least one unused unique identification number in the local cache; the target application comprises multiple functions; wherein, when the terminal device determines that there is at least one unused unique identification number in the local cache, the terminal device will determine the unique identification number to be acquired by the function from the at least one unused unique identification number according to the use order of the unique identification numbers; generating multiple unique identification numbers in the value range of the unique identification number; sending the multiple unique identification numbers to the terminal device to enable the terminal device to determine the unique identification number to be acquired by the function from the multiple unique identification numbers according to the use order of the unique identification numbers.

6. The method of claim 5, wherein, Before the receiving terminal device sends the generation request of the unique identification number, the method further comprises: Receiving the reading request of the generation record of the unique identification number sent by the terminal device; Sending the generation record of the unique identification number to the terminal device.

7. The method of claim 6, wherein, The generation record of the unique identification number contains the value of the newly generated unique identification number; After the sending the plurality of unique identification numbers to the terminal device, the method further comprises: According to the value range of the unique identification number in the generation request, updating the value of the newly generated unique identification number in the generation record of the unique identification number.

8. The method according to any one of claims 5-7, characterized in that, The server performs multi-thread synchronization concurrent control when generating the unique identification number.

9. An apparatus for generating a unique identification number, characterized by The device comprises: A receiving module, configured to receive the acquisition request of the unique identification number sent by any function of a target application; the target application comprises a plurality of functions; the device locally caches a plurality of unique identification numbers requested by the device from a server and allocated to the target application by the server based on the request; A processing module, configured to determine whether there is at least one unused unique identification number in the local cache; if yes, determine the unique identification number to be acquired by the function from the at least one unused unique identification number according to the use order of the unique identification number; if not, request the server to allocate a plurality of unique identification numbers to the target application again, so as to determine the unique identification number to be acquired by the function from the plurality of allocated unique identification numbers according to the use order of the unique identification number; Wherein, when requesting the server to allocate a plurality of unique identification numbers to the target application, the processing module is configured to acquire the generation record of the unique identification number from the server; and determine the value range of the unique identification number according to the generation record of the unique identification number and the target generation quantity of the unique identification number; A sending module, configured to send the generation request of the unique identification number to the server, wherein the generation request contains the value range of the unique identification number; The receiving module is configured to receive a plurality of unique identification numbers in the value range of the unique identification number sent by the server.

10. The apparatus of claim 9, wherein, The generation record of the unique identification number contains the value of the newly generated unique identification number.

11. The apparatus of claim 9 or 10, wherein, The sending module is further configured to send the reading request of the generation record of the unique identification number to the server; The receiving module is further configured to receive the generation record of the unique identification number sent by the server.

12. The apparatus of claim 9, wherein, The processing module is further configured to save the plurality of unique identification numbers in the value range of the unique identification number sent by the server in the local cache after receiving the plurality of unique identification numbers.

13. An apparatus for generating a unique identification number, characterized by The device comprises: The receiving module is configured to receive a generation request of a unique identification number sent by a terminal device, the generation request containing a value range of the unique identification number; the terminal device locally caches a plurality of unique identification numbers requested by the terminal device from the apparatus and allocated by the apparatus for a target application based on the request; the generation request of the unique identification number is sent by the terminal device again when the terminal device receives an acquisition request of a unique identification number sent by any function of the target application and determines that there is at least one unused unique identification number in the local cache; the target application includes a plurality of functions; when the terminal device determines that there is at least one unused unique identification number in the local cache, the terminal device determines a unique identification number to be acquired by the function from the at least one unused unique identification number according to a use order of the unique identification number; The processing module is configured to generate a plurality of unique identification numbers in the value range of the unique identification number; The sending module is configured to send the plurality of unique identification numbers to the terminal device, so that the terminal device determines a unique identification number to be acquired by the function from the plurality of unique identification numbers according to the use order of the unique identification number.

14. The apparatus of claim 13, wherein, The receiving module is further configured to receive a reading request of a generation record of the unique identification number sent by the terminal device; The sending module is further configured to send the generation record of the unique identification number to the terminal device.

15. The apparatus of claim 14, wherein, The generation record of the unique identification number contains a value of a newly generated unique identification number; The processing module is further configured to update the value of the newly generated unique identification number in the generation record of the unique identification number according to the value range of the unique identification number in the generation request.

16. The device according to any one of claims 13 to 15, characterized in that The apparatus performs multi-thread synchronization concurrent control when generating the unique identification number.

17. A terminal device, comprising: The apparatus comprises: a processor and a memory; the memory stores a computer program, the computer program is adapted to be loaded and executed by the processor, and the method in any one of claims 1-4 is executed.

18. A server, comprising: The apparatus comprises: a processor and a memory; the memory stores a computer program, the computer program is adapted to be loaded and executed by the processor, and the method in any one of claims 5-8 is executed.

19. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1-8.

20. A computer storage medium, comprising, The computer storage medium stores a plurality of instructions, the instructions are adapted to be loaded and executed by the processor, and the method steps in any one of claims 1-8 are executed.

Citation Information

Patent Citations

  • Service ID generating method, device and system

    CN106911780A