Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.
A method for generating a card number and an apparatus therefor according to an embodiment of the present application are described below with reference to the drawings.
fig. 1a is a flow diagram of a method of generating a card number according to one embodiment of the present application. As shown in fig. 1a, the method for generating the card number includes:
S101, obtaining a card number application request of a user.
In this embodiment, when the user needs to apply for the membership card and the benefit card, the corresponding card application column may be clicked at the client, and at this time, the client may obtain the corresponding card number application request. The embodiment is particularly suitable for processing the situation that a user applies for a card number in a large quantity.
s102, the card number application request is distributed to one or more nodes, wherein each node has non-repeated number field information.
In the embodiment, the operation of subsequently and efficiently generating a large number of card numbers is realized by setting a plurality of callable nodes with non-repeated number field information.
Note that S102 may be completed by the client or the server. When S102 is completed by the client, the nodes refer to a plurality of nodes located at the client, and when S102 is completed by the server, the nodes refer to a plurality of nodes located at the server. Distributing the card number application request to multiple nodes may improve processing efficiency.
Specifically, the distribution of the card number application request to one or more nodes may be implemented by: the method comprises the steps of obtaining card number basic information according to a card number application request, inquiring a locally stored information list according to the obtained card number basic information so as to determine the information of a plurality of callable nodes, and then distributing the card number application request to one or more nodes of the plurality of nodes.
The information list may include the card number basic information, the information of the plurality of callable nodes corresponding to the card number basic information, and the number field information corresponding to each node, and may also include the first data corresponding to the card number basic information, that is, the BIN value. The card number base information may include card issuer information, card type information, and the like. For example: the card issuing institution may include mertesbang, carrefour, etc., and the card type information may include a general membership card, a VIP (VIP) membership card, a coupon card, etc. For example, as shown in table 1: the BIN value corresponding to the membership card of mettesbangwei is 000001, which can be distributed to four nodes. The number segment information corresponding to the node 1 is 0/1000, the number segment information corresponding to the node 2 is 1001/2000, the number segment information corresponding to the node 3 is 2001/3000, and the number segment information corresponding to the node 4 is 3001/4000. The BIN value corresponding to the happy membership card is 000005, and the value can be distributed to the node 10, and the number segment information corresponding to the node 10 is 0/1000. The BIN value corresponding to the happy honoured guest card is 000006, and the BIN value can be distributed to the node 11, and the number segment information corresponding to the node 11 is 0/1000.
TABLE 1 information List
S103, obtaining corresponding card number basic information and a corresponding card number segment value through the node receiving the card number application request, and generating the card number according to the corresponding card number basic information and the corresponding card number segment value, wherein the obtained card number segment values corresponding to the same card number basic information are different.
Because the number segment information corresponding to each node is not repeated, the nodes can obtain different number segment values in the corresponding number segment in parallel based on the number segment information of the nodes, thereby ensuring that a plurality of non-repeated card numbers can be generated simultaneously and efficiently.
It should be noted that the above operations may be performed by the client, that is, the client may first obtain the information list from the server, then determine the callable nodes according to the information list, then distribute the obtained card number application request to one or more callable nodes, and finally generate the card number according to the obtained corresponding card number basic information and the obtained number segment value by the node that receives the card number application request, as shown in fig. 1 b; the above operations may also be performed by the server, that is, the server determines a plurality of callable nodes according to the information list stored by the server, then distributes the obtained card number application request to one or more callable nodes, finally generates a card number according to the obtained corresponding card number basic information and the obtained number segment value by the node that receives the card number application request, and then returns the generated card number to the client, as shown in fig. 1c, and finally executes the card issuing operation by the client.
According to the method for generating the card number, the different number segment values in the number segment are obtained in parallel through the plurality of nodes, and the card number is generated according to the obtained different number segment values and the corresponding card number basic information, so that the generated card number is not repeated, the problem of performance bottleneck during a large number of card issuing is solved, and the card issuing efficiency is improved.
Fig. 2 is a flow chart of a method of generating a card number according to an embodiment of the present application. The embodiment is described from the side of the node receiving the card number application request, wherein the node receiving the card number application request can be positioned at the side of the server or the side of the client; for each node receiving the card number application request, the process of generating the card number is executed as shown in fig. 2, and includes:
S201, the information list is inquired to obtain first data corresponding to the basic information of the current card number, and a current number segment value is obtained according to the first data and the number segment information corresponding to the current node.
specifically, the current node determines whether first data exists in the local information list, and if so, the assigned number segment value is used as the current number segment value, and then the assigned number segment value is subjected to an addition operation. For example, assuming that the segment information corresponding to the current node is 0 to 1000, and the current card number basis information includes mettesland and ordinary membership cards, if the local information list has the first data, i.e., BIN value, of the ordinary membership card corresponding to mettesland, and it is assumed that 000001, the assigned segment value in the segment information corresponding to the first data is used as the current segment value, and it is assumed that the assigned segment value is 3, 3 is used as the current segment value, and then the assigned segment value is set to 4, so that when the current node receives the next request for applying for the ordinary membership card of mettesland, it may use 4 as the segment value corresponding to the request, and similarly, it is necessary to set the assigned segment value to 5, thereby ensuring that the obtained segment values corresponding to the same card number basis information are different.
In addition, in order to ensure that the BIN value corresponding to the card number basic information included in the card number application request is stored in the information list, in this embodiment, after the server receives the card number application request sent by the client, the card number basic information included in the card number application request is obtained, if the local information list does not have the first data, that is, the BIN value, corresponding to the card number basic information, for example, the BIN value of the ordinary membership card corresponding to mestra, the corresponding first data is allocated, and the allocated first data and the corresponding card number basic information are written into the information list; in addition, after the client sends an information query request to the server, the server can return an information list containing the distributed first data and the corresponding card number basic information to the client; therefore, the BIN value corresponding to the card number basic information contained in the current card number application request is ensured to be contained in the information list stored at the server side or the client side.
in this embodiment, the current node may determine whether the assigned number segment value is smaller than a predetermined threshold, and if so, take the assigned number segment value as the current number segment value. And when the assigned number segment value is determined to be larger than or equal to the preset threshold value, inquiring whether an available number segment exists in the information list, if the available number segment exists, obtaining the available number segment, if the available number segment does not exist, generating new first data, and setting the assigned number segment value corresponding to the new first data as the initial value of the corresponding number segment. For example, if the number segment information corresponding to the current node is 0-1000 and the predetermined threshold is 900, if the assigned number segment value is 800, which is smaller than the predetermined threshold, the current number segment value is 800. If the assigned number segment value is 950 and is greater than the preset threshold value, the information list is inquired, and since the information list can also contain the assigned number segment information, the maximum available number segment information and the like of each node, whether the current node has available number segments or not can be judged according to the information, if the available number segments still exist, the available number segments are obtained, and the available number segments are used as the number segment information of the current node. If there is no available number segment, new first data is generated such as: 000002 and setting the assigned number segment value corresponding to the new first data as the start value 0 of the number segment 0-1000 corresponding to the current node. The purpose of this is: when the assigned number segment value of the current node is larger than a preset threshold value, namely the available number segment value of the current node is few, more available number segment values are obtained in advance, and the efficiency of obtaining the number segment value by the node is improved.
s202, check bit information is obtained.
After the current number segment value is obtained according to the first data and the corresponding number segment information, the current node can obtain check bit information so as to ensure the legality of the card number.
S203, generating the card number according to the obtained first data, the current number segment value and the check digit information.
After obtaining the check digit information, the current node may generate the card number according to the obtained first data, the current number segment value, and the check digit information. Specifically, a schematic diagram of generating a card number is shown in fig. 3, wherein the card number base information may include card issuer information and card type information. The first data may be obtained through the card issuer information and the card type information. The card issuing element may include: first data (BIN value), a random number segment (number segment value), and a check bit. The card number can be generated by the three card issuing elements.
according to the method for generating the card number, the different number segment values in the number segment are obtained in parallel through the plurality of nodes, and the card number is generated according to the obtained different number segment values and the corresponding card number basic information, so that the generated card number is not repeated, the problem of performance bottleneck during a large number of card issuing is solved, and the card issuing efficiency is improved.
in order to implement the above embodiment, the present application further provides a device for generating a card number.
Fig. 4 is a block diagram of a card number generation apparatus according to an embodiment of the present application. The card number generation device may include, as shown in fig. 4: an obtaining module 110, a distributing module 120, and a generating module 130. Wherein, the generating module 130 includes: a first obtaining unit 131, a second obtaining unit 132, and a generating unit 133.
The obtaining module 110 is used for obtaining a card number application request of a user.
The distribution module 120 is configured to distribute the card number application request to one or more nodes, wherein each node has non-repeating number segment information.
the generating module 130 is configured to obtain corresponding card number basic information and a corresponding card number segment value through a node that receives a card number application request, and generate a card number according to the corresponding card number basic information and the corresponding card number segment value, where the obtained card number segment values corresponding to the same card number basic information are different.
the card number generation device of the embodiment of the application obtains different number segment values in the number segment of the device through a plurality of nodes in parallel, and generates the card number according to the obtained different number segment values and the corresponding card number basic information, so that the generated card number is not repeated, the problem of performance bottleneck during a large number of card issuing is solved, and the card issuing efficiency is improved.
It should be noted that the modules may be located in the client or the server. Therefore, the following detailed description is made separately from the server and the client, and is not repeated herein.
Fig. 5 is a block diagram of a card number generation apparatus according to another embodiment of the present application. When the operation of generating the card number is performed by the server, the card number generation device may include, as shown in fig. 5: an obtaining module 110, a distributing module 120, a generating module 130, and a returning module 140. Wherein, the generating module 130 includes: a first obtaining unit 131, a second obtaining unit 132, and a generating unit 133.
The obtaining module 110 is used for obtaining a card number application request of a user.
In this embodiment, the obtaining module 110 may receive an issuing request sent by a client. The card issuing request is generated by clicking a corresponding card of the client when the user needs to apply for the membership card and the preferential card. The obtaining module 110 may then obtain a card number application request of the user according to the card issuing request.
The distribution module 120 is configured to distribute the card number application request to one or more nodes, wherein each node has non-repeating number segment information.
Specifically, the distribution module 120 may distribute the card number application request to one or more nodes by: the distribution module 120 may obtain the card number basic information according to the card number application request, query the locally stored information list according to the obtained card number basic information, thereby determining the information of the plurality of callable nodes, and then distribute the card number application request to one or more nodes of the plurality of nodes, specifically, distribute the card number application request according to the idle state of the callable nodes.
The information list may include card number basic information, information of a plurality of callable nodes corresponding to the card number basic information, and number segment information corresponding to each node, and may also include first data corresponding to the card number basic information, that is, a BIN value, specifically, as shown in table 1: the BIN value corresponding to the membership card of mettesbangwei is 000001, which can be distributed to four nodes. The number segment information corresponding to the node 1 is 0/1000, the number segment information corresponding to the node 2 is 1001/2000, the number segment information corresponding to the node 3 is 2001/3000, and the number segment information corresponding to the node 4 is 3001/4000. The BIN value corresponding to the happy membership card is 000005, and the value can be distributed to the node 10, and the number segment information corresponding to the node 10 is 0/1000. The BIN value corresponding to the happy honoured guest card is 000006, and the BIN value can be distributed to the node 11, and the number segment information corresponding to the node 11 is 0/1000. The generating module 130 is configured to obtain corresponding card number basic information and a corresponding number segment value according to the received card number application request and the corresponding number segment information through a node that receives the card number application request, and generate a card number according to the corresponding card number basic information and the number segment value, where the obtained number segment values corresponding to the same card number basic information are different.
specifically, the generating module 130 includes: a first obtaining unit 131, a second obtaining unit 132, and a generating unit 133.
The first obtaining unit 131 is configured to obtain first data corresponding to the current card number basic information by querying the information list through the current node, and obtain a current number segment value according to the first data and number segment information corresponding to the current node.
Specifically, the first obtaining unit 131 determines whether there is first data in the local information list, and if so, takes the assigned number segment value as the current number segment value, and then adds one to the assigned number segment value. For example, assuming that segment information corresponding to the current node is 0 to 1000, and the current card number basis information includes mettesland and ordinary membership cards, if the local information list has the first data, i.e., BIN value, of the ordinary membership card corresponding to mettesland, and it is assumed that 000001, the assigned segment value in the segment information corresponding to the first data is taken as the current segment value, and it is assumed that the assigned segment value is 3, 3 is taken as the current segment value, and then the assigned segment value is set to 4, so that when the current node receives the next request for applying for the ordinary membership card of mettesland, 4 is taken as the segment value corresponding to the request, and similarly, the assigned segment value needs to be set to 5, thereby ensuring that the obtained segment values corresponding to the same card number basis information are different.
In this embodiment, the first obtaining unit 131 may determine whether the assigned number segment value is smaller than a predetermined threshold, and if so, take the assigned number segment value as the current number segment value. And when the assigned number segment value is determined to be larger than or equal to the preset threshold value, inquiring whether an available number segment exists in the information list, if the available number segment exists, obtaining the available number segment, if the available number segment does not exist, generating new first data, and setting the assigned number segment value corresponding to the new first data as the initial value of the corresponding number segment. For example, if the number segment information corresponding to the current node is 0-1000 and the predetermined threshold is 900, if the assigned number segment value is 800, which is smaller than the predetermined threshold, the current number segment value is 800. If the assigned number segment value is 950 and is greater than the preset threshold value, the information list is inquired, and since the information list can also contain the assigned number segment information, the maximum available number segment information and the like of each node, whether the current node has available number segments or not can be judged according to the information, if the available number segments still exist, the available number segments are obtained, and the available number segments are used as the number segment information of the current node. If there is no available number segment, new first data is generated such as: 000002 and setting the assigned number segment value corresponding to the new first data as the start value 0 of the number segment 0-1000 corresponding to the current node. The purpose of this is: when the assigned number segment value of the current node is larger than a preset threshold value, namely the available number segment value of the current node is few, more available number segment values are obtained in advance, and the efficiency of obtaining the number segment value by the node is improved.
The second obtaining unit 132 is configured to obtain the check bit information through the current node.
after obtaining the current number segment value according to the first data and the corresponding number segment information, the second obtaining unit 132 may obtain the check digit information to ensure the validity of the card number.
The generating unit 133 is configured to generate a card number according to the obtained first data, the current number segment value, and the check digit information through the current node.
After obtaining the check digit information, the generating unit 133 may generate the card number according to the obtained first data, the current number segment value and the check digit information.
the returning module 140 is used for returning the card number to the client after the generating module 130 generates the card number according to the corresponding card number basic information and the number field value.
The card number generation device of the embodiment of the application obtains different number segment values in the number segment of the device through a plurality of nodes in parallel, and generates the card number according to the obtained different number segment values and the corresponding card number basic information, so that the generated card number is not repeated, the problem of performance bottleneck during a large number of card issuing is solved, and the card issuing efficiency is improved.
Fig. 6 is a block diagram of a card number generation apparatus according to still another embodiment of the present application. When the operation of generating the card number is performed by the client, the card number generation device may include, as shown in fig. 6: an obtaining module 110, a distributing module 120, a generating module 130 and an information obtaining module 150. Wherein, the generating module 130 includes: a first obtaining unit 131, a second obtaining unit 132, and a generating unit 133.
The obtaining module 110 is used for obtaining a card number application request of a user.
In this embodiment, when the user needs to apply for the membership card and the benefit card, the user may click the corresponding card at the client, and at this time, the obtaining module 110 obtains the corresponding card number application request. The embodiment is particularly suitable for processing the situation that a user applies for a card number in a large quantity.
The distribution module 120 is configured to distribute the card number application request to one or more nodes, wherein each node has non-repeating number segment information.
Specifically, the distribution module 120 may first obtain the information list from the server, then determine a plurality of callable nodes according to the information list, and then distribute the obtained card number application request to one or more callable nodes.
The function and structure of the generating module 130 are the same as those described in the embodiment shown in fig. 4, and are not described herein again.
The information obtaining module 150 is configured to send an information query request to the server according to the obtained card number basic information and receive an information list returned by the server according to the information query request before the distribution module 120 queries the locally stored information list according to the obtained card number basic information.
In an embodiment of the present application, the information obtaining module 150 may send an information query request to the server in advance according to the obtained card number basic information, receive an information list returned by the server according to the information query request, and locally store the returned information list, so that the client obtains the card number basic information and the corresponding number field information from the returned information list after receiving the application request. The information list includes basic information of card number and corresponding number field information.
The card number generation device of the embodiment of the application receives the information list returned by the server according to the information query request, not only ensures that the generated card numbers are not repeated, but also solves the problem of performance bottleneck during a large number of card issuing, and improves the card issuing efficiency.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
it should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
in addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.