CN110362573A - Recommend generation method, device, electronic equipment and the storage medium of code - Google Patents

Recommend generation method, device, electronic equipment and the storage medium of code Download PDF

Info

Publication number
CN110362573A
CN110362573A CN201910565671.5A CN201910565671A CN110362573A CN 110362573 A CN110362573 A CN 110362573A CN 201910565671 A CN201910565671 A CN 201910565671A CN 110362573 A CN110362573 A CN 110362573A
Authority
CN
China
Prior art keywords
code
storage
target string
recommendation
storage system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910565671.5A
Other languages
Chinese (zh)
Inventor
高强伟
邢雪霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dami Technology Co Ltd
Original Assignee
Beijing Dami Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dami Technology Co Ltd filed Critical Beijing Dami Technology Co Ltd
Priority to CN201910565671.5A priority Critical patent/CN110362573A/en
Publication of CN110362573A publication Critical patent/CN110362573A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application discloses a kind of generation method, device, electronic equipment and storage mediums for recommending code, the target string of specified format is obtained from user identifier, inquiry target string is the sequence number of the recommendation code of index in storing the storage system that generated storage recommends code collection to close, it is carried out with the Serial No. basis from increasing, target, which is obtained, after target string and the sequence number from after increasing are spliced recommends code, in the storage system for recommending code storage to storage that code collection is recommended to close the target of production, unduplicated check code can be automatically generated.

Description

Recommend generation method, device, electronic equipment and the storage medium of code
Technical field
This application involves computer field more particularly to a kind of generation method, device, electronic equipment and storages for recommending code Medium.
Background technique
In order in Rapid Popularization internet service (such as: application program or website registration), recommend the use of code more next It is more extensive.Recommend code to be used to indicate the identity of mark nominator, the form of code is recommended to be generally character string, two dimensional code or bar code Deng.When inputting the server for recommending code to obtain server offer, server can identify the identity of nominator according to recommendation code, from And it can effectively assess the Generalization Ability of nominator.The mode for generating random code at present mainly generates one by random algorithm Recommend code, then stores the recommendation code in the database.
Summary of the invention
The technical issues of the application solves is: requiring to repeat every time in such a way that random fashion generates recommendation code Property verifying, complexity it is higher and generate recommendation code readability it is poor.
In order to solve the above technical problems, in a first aspect, this application provides a kind of generation methods for recommending code, comprising:
The target string of preset length is obtained in user identifier;Code collection is recommended to close in storage according to target string It is inquired in storage system;If inquiring with target string associated one in the storage system that storage recommends code collection to close Or multiple recommendation codes;Wherein, each recommendation code includes character string and sequence number in the storage system that the storage recommends code collection to close; It determines the maximum sequence number in the corresponding sequence number of one or more recommendations code, and is obtained after maximum sequence number is increased preset value To target sequence number;Target string and target sequence number are spliced to obtain the first recommendation code, recommend code storage for first In the storage system for recommending code collection to close to storage.
In a kind of possible design, further includes:
It is pushed away if not inquired in the storage system that storage recommends code collection to close with the associated one or more of target string Code is recommended, target string and preset initial sequence number are spliced to obtain the second recommendation code;
In the storage system for recommending code storage to storage that code collection is recommended to close for second.
In a kind of possible design, the storage system that storage recommends code collection to close is including recommending code caching and recommending code data Library;
Wherein, it is inquired in the storage system that storage recommends code collection to close according to target string, comprising:
It is inquired in the buffer according to target string, if inquiring the associated recommendation code of target string in the buffer, It determines and is inquired in the storage system that storage recommends code collection to close and the associated one or more character strings of target string.
In a kind of possible design, code storage to storage is recommended to recommend in the storage system of code collection conjunction by first, comprising:
Remove in the caching with the associated recommendation code of the target string, and by it is described first recommendation code be written to In the caching, and the recommendation code persistence in the caching is written in the database.
It is described to be looked into the storage system that storage recommends code collection to close according to character string in a kind of possible design It askes, further includes:
If not inquiring in the database and the associated one or more recommendations code of the target string, it is determined that It is not inquired and the associated one or more recommendations of the target string in the storage system that the storage recommends code collection to close Code.
The another aspect of the application provides a kind of device, and the processing side of the business datum of above-mentioned first aspect may be implemented Method.Such as described device can be chip (such as digital processing chip DSP or application processor chip) or server.It can be with The corresponding software realization above method is executed by software, hardware or by hardware.
It in one possible implementation, include processor, memory in the structure of described device;The processor quilt It is configured to that described device is supported to execute corresponding function in above-mentioned application testing method.Memory is used to couple with processor, Save the necessary program of described device (instruction) and/or data.Optionally, described device can also include communication interface for branch Hold the communication between described device and other network elements.
In alternatively possible implementation, the apparatus may include the units for executing corresponding actions in the above method Module.
In another possible implementation, including processor and R-T unit, the processor and the transmitting-receiving fill Set coupling, the processor for executing computer program or instruction, with control the R-T unit carry out information reception and It sends;When the processor executes the computer program or instruction, the processor is also used to realize the above method.Its In, the R-T unit can be transceiver, transmission circuit or input/output interface.When described device is chip, the receipts Transmitting apparatus is transmission circuit or input/output interface.
When described device is chip, transmission unit can be output unit, such as output circuit or communication interface;It connects Receiving unit can be input unit, such as input circuit or communication interface.When described device is the network equipment, transmission unit It can be transmitter or transmitter;Receiving unit can be receiver or receiver.
The another aspect of the application provides a kind of device, which includes: memory and processor;Wherein, the storage Batch processing code is stored in device, and the processor executes each side for calling the program code stored in the memory Method described in face.
The another aspect of the application has been mentioned for a kind of computer readable storage medium, in the computer readable storage medium It is stored with instruction, when run on a computer, so that computer executes method described in above-mentioned various aspects.
The another aspect of the application provides a kind of computer program product comprising instruction, when it runs on computers When, so that computer executes method described in above-mentioned various aspects.
Implement embodiments herein, the target string of specified format is obtained from user identifier, has been generated in storage Storage recommend code collection close storage system in inquiry target string be index recommend code sequence number, with the Serial No. Basis obtain target from increasing after being spliced target string and the sequence number from after increasing and recommend code, by the mesh of production In the storage system that mark recommends code storage to storage that code collection is recommended to close, avoid recommending code using random fashion production in the prior art There may be repeating, the embodiment of the present application provides readable higher recommendation code, avoid generating duplicate recommendation code, Not needing to generate every time recommends code to require to carry out repeated verifying, reduces the complexity for generating and recommending code.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is that the embodiment of the present application provides a kind of network architecture diagram;
Fig. 2 is another flow diagram of the processing method of business datum provided by the embodiments of the present application;
Fig. 3 is another flow diagram of processing method of business datum provided by the embodiments of the present application;
Fig. 4 is a kind of another structural schematic diagram of device provided by the embodiments of the present application;
Fig. 5 is a kind of another structural schematic diagram of device provided by the embodiments of the present application.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, and It is not used in restriction the application.Meanwhile in the description of the present application, term " first ", " second " etc. are only used for distinguishing description, without It can be interpreted as indication or suggestion relative importance.It will be clear to one skilled in the art that these details its The application also may be implemented in its embodiment.In other situations, it omits to well-known system, device, circuit and side The detailed description of method, so as not to obscure the description of the present application with unnecessary details.
Fig. 1 shows the exemplary system architecture that can be applied to the generating means of recommendation code of the application.
As shown in Figure 1, system architecture may include electronic equipment 10, cache server 11 and database server 12.It is slow Depositing server 11 can be connected by multiple cache servers by trunking mode.Database server deployment 12 is deployed with data Library 120, wherein database 120 may include primary database and multiple from database.The quantity of electronic equipment can in system architecture Be it is multiple, only using an electronic equipment as example in Fig. 1.Cache server 11 and database server 12 can merge portion Administration, the independent deployment being also possible in Fig. 1, the embodiment of the present application is with no restriction.Cache server 11 is generated for temporarily storing Recommendation code, database server 12 for persistence storage generate recommendation code.Electronic equipment can be terminal device It can be server.
Wherein, wired communications links can be passed through between electronic equipment 10, cache server 11 and database server 13 Or wireless communication link is attached.Such as: wired communications links include optical fiber, twisted pair or coaxial cable, wireless communication Link includes bluetooth communications link, Wireless Fidelity (Wireless-Fidelity, Wi-Fi) communication link or microwave communications link Deng.
Wherein, various communication customer end applications can be installed on the electronic equipment and server in the embodiment of the present application, Such as: video record application, video playing application, interactive voice application, searching class application, timely means of communication, mailbox client End, social platform software etc..
Wherein, the electronic equipment in the embodiment of the present application can be hardware, be also possible to software.When electronic equipment is hardware When, it can be the various electronic equipments with display screen, including but not limited to smart phone, tablet computer, laptop portable Computer and desktop computer etc..When electronic equipment is software, it can be and install in above-mentioned cited electronic equipment.Its May be implemented in multiple softwares or software module (such as: for providing Distributed Services), also may be implemented into single software or Software module is not specifically limited herein.
When electronic equipment is terminal device, it is also equipped with display equipment and camera thereon, display equipment is shown It can be the various equipment for being able to achieve display function, camera is for acquiring video data;Such as: display equipment can be cathode Ray tube display (Cathode ray tubedisplay, abbreviation CR), light emitting diode indicator (Light-emitting Diode display, abbreviation LED), electronic ink screen, liquid crystal display (Liquid crystal display, abbreviation LCD), Plasmia indicating panel (Plasma display panel, abbreviation PDP) etc..User can use the display on electronic equipment and set It is standby, come information such as the texts, picture, video of checking display.
Server can be to provide the server of various services, and server can be hardware, be also possible to software.Work as service When device is hardware, the distributed server cluster of multiple server compositions may be implemented into, individual server also may be implemented into. When server is software, multiple softwares or software module (such as providing Distributed Services) may be implemented into, it can also be with It is implemented as single software or software module, is not specifically limited herein.
It should be understood that the number of electronic equipment, network and server in Fig. 1 is only illustrative.It, can according to needs are realized To be any number of electronic equipment, network and server.
The course of work of system architecture in Fig. 1 includes: that electronic equipment 10 obtains target string, root in user identifier It is inquired in cache server 11 according to target string, if inquiring the corresponding recommendation code of target string, code will be recommended In sequence number spliced to obtain target from increasing for target string and the sequence number from after increasing and recommended according to preset value Target is recommended code covering to be written to the associated cache lines for recommending code of target string inquired in cache server 11 by code In;If not inquiring the associated recommendation code of target string in cache server 11, continuation is traversed in database 120 Inquiry will be corresponding in one or more recommendations code if inquiring with target string is the one or more recommendations code indexed Maximum sequence number, from increasing, target string and the sequence number from after increasing is spliced to obtain target recommendation according to preset value progress Target recommendation code is written in cache server 11 by code;If not inquiring recommendation code in database 120, by target character String and preset initial sequence number are spliced to obtain target recommendation code, and target recommendation code is written in cache server 11.
Wherein, cache server 11 is written to database according to the preset recommendation code persistence that will temporarily store of consuming In 120.
Referring to fig. 2, Fig. 2 is the flow diagram of the generation method provided by the embodiments of the present application for recommending code, in the application In embodiment, which comprises
S201, target string is obtained in user identifier.
Wherein, when needing to be generated for user recommendation code, the user identifier of the user is obtained, user identifier is used for identifying The identity at family, target string can be address name, user's surname or user name, such as: target string is user name Word.
Wherein, it is logging state, account that the corresponding process for recommending code of triggering generation user identifier, which may include: account information, Family information includes user identifier and account password, and user interface is shown on electronic equipment, includes trigger button, electricity in user interface When sub- equipment receives the trigger action on trigger button, to server send generate recommend code request, server in response to The request generates the corresponding recommendation code of the user identifier.
In one or more embodiments, of length no more than preset length of target string, electronic equipment are marked in user User name is identified in knowledge, and the target string of preset length is then obtained in user name, it is big in the length of user name When preset length, the target string of preset length can be obtained directly in user name;In user name When length is less than preset length, directly using user name as target string, it is pre-stored that preset length can be electronic equipment Or the length being pre-configured, occurrence can be with determining according to actual needs, the embodiment of the present application is with no restriction.
Such as: preset length 5, the type of target string are user name, the user name obtained in user identifier Word is " jennifer ", and it is " jenni " that preceding 5 characters for obtaining " jennifer ", which obtain target string,.
Another example is: preset length is 5, the type of target string is user name, the user obtained in user identifier Name is " tom ", and " tom " is directly used as target string.
Another example is: preset length is 5, the type of target string is address name, the user obtained in user identifier Name is " zhangsan ", and obtaining preceding 5 characters in " zhangsan " and obtaining target string is " zhangs ".
S202, it is inquired in the storage system that storage recommends code collection to close according to target string.
In general, being index by target string obtained in S201, adopted in the storage system that storage recommends code collection to close One or more recommendations code corresponding with the target string is inquired with the mode of traversal.The storage system that storage recommends code collection to close To be pre-stored or pre-configuration, storage recommends data structure the embodiment of the present application of the storage system of code collection conjunction with no restriction, example Such as: the storage system that storage recommends code collection to close can be relevant database or non-relational database and relational data The combination in library and non-relational database.It include one or more generated recommendations in the storage system that storage recommends code collection to close Code.Each recommendation code includes character string and sequence number in the storage system that storage recommends code collection to close, and character string is recommended for indicating The index of code, sequence number indicate the genesis sequence of the recommendation code including the character string.
For example: user identifier includes address name, address name is obtained in user identifier as target string, The spelling of the address name Chinese phonetic alphabet indicates, the recommendation code for including in the storage system that storage recommends code collection to close are as follows: Zhangsan001, zhangsan002, zhangsan003, lisi001, lisi002, lisi003, wangwu001 and Zhangliu001, it can be seen that the recommendation code in storage system that storage recommends code collection to close includes address name and sequence number, is used For family name as the index for recommending code, sequence number indicates the genesis sequence of the recommendation code including address name."zhangsan001" Indicate that address name is first for the recommendation code of " zhangsan " and generates that " zhangsan002 " indicates that address name is The recommendation code of " zhangsan " is second generation.The target string obtained in user identifier is " zhangsan ", will " zhangsan " is that index is inquired in the storage system that storage recommends code collection to close, 3 recommendation codes of query result: zhangsan001、zhangsan002、zhangsan003。
Another example is: the target string obtained in user identifier is " zhaoliu ", it is index upper with " zhaoliu " It is inquired in the storage system that the storage stated recommends code collection to close, does not inquire " zhaoliu " associated recommendation code, it is determined that not It is inquired and the associated one or more recommendations code of target string in recommending code.
If S203, being inquired and the associated one or more of target string in the storage system that storage recommends code collection to close Recommend code, obtains target sequence after the maximum sequence number in the corresponding sequence number of one or more recommendations code is increased preset value Number.
In general, the mode according to traversal inquires and target string in the storage system that storage recommends code collection to close Associated one or more recommendations code, the one or more recommendations code are all with mesh in the storage system of storage recommendation code collection conjunction Mark character string is the recommendation code of index, parses each sequence number for recommending code in the one or more recommendations code inquired, determines Maximum sequence number in the corresponding sequence number of one or more recommendations code obtains target sequence after maximum sequence number is increased preset value Row number, it is pre-stored that preset value is available or pre-configuration, occurrence can be determined according to actual needs, and the embodiment of the present application does not limit System.
Such as: it is index in the storage system that storage recommends code collection to close by " zhangsan " according to the example in S202 It is inquired, 3 recommendation codes of query result: zhangsan001, zhangsan002, zhangsan003, preset value 1, inquiry To 3 maximum sequence numbers recommended in codes be 3, obtained target sequence number is 4 after maximum sequence number 3 is increased by 1.
In one or more embodiments, further includes:
If not inquiring associated one or more in the storage system that storage recommends code collection to close according to target string Recommend code, target string and preset initial sequence number are spliced to obtain the second recommendation code, recommends code storage for second In the storage system for recommending code collection to close to storage.
Such as: it is that index carries out in the storage system that storage recommends code collection to close with " zhaoliu " according to the example of S202 Inquiry, query result are not inquire " zhaoliu " associated one or more recommendations code, and preset initial sequence number is to prestore Storage is pre-configured, the value of initial sequence number can with determining according to actual needs, the embodiment of the present application with no restriction, with initial sequence Row number is to splice " zhaoliu " and initial sequence number " 1 ", the length of sequence number is fixed as 3, obtains after splicing for 1 Second recommends code " zhaoliu001 ".
S204, target string and target sequence number are spliced to obtain the first recommendation code.
In general, target sequence number is used as suffix, by target string and target sequence using target string as prefix Number splicing after obtain the first recommendation code.
In one or more embodiments, first to recommend the length of code be preset regular length, in target string and When the length of target sequence number is less than regular length, regular length is obtained by the way of mending 0 before target sequence number Target string.Such as: the length of the first recommendation code is 9, and the length of target string is 5, and the length of sequence number is 4.
For example, spliced target string " zhangsan " and sequence number " 4 " to obtain the first recommendation code " zhangsan004 ", will be in the storage system of " zhangsan004 " storage to storage recommendation code collection conjunction.
In S205, the storage system for recommending code storage to storage that code collection is recommended to close for first.
Wherein, the first recommendation code persistence is written in the storage system that storage recommends code collection to close.In one or more In embodiment, the first recommendation code can be written in the storage system that storage recommends code collection to close using asynchronous system, such as: to First recommendation code is written in caching, then caches and is written to the recommendation code persistence of storage according to certain consumption rate In database.
Implement embodiments herein, the target string of specified format is obtained from user identifier, has been generated in storage Storage recommend code collection close storage system in inquiry target string be index recommend code sequence number, with the Serial No. Basis obtain target from increasing after being spliced target string and the sequence number from after increasing and recommend code, by the mesh of production In the storage system that mark recommends code storage to storage that code collection is recommended to close, avoid recommending code using random fashion production in the prior art There may be repeating, the embodiment of the present application provides readable higher recommendation code, avoid generating duplicate recommendation code, Not needing to generate every time recommends code to require to carry out repeated verifying, reduces the complexity for generating and recommending code.
It is a kind of another flow diagram of the processing method of business datum provided by the embodiments of the present application referring to Fig. 3, In the embodiment of the present application, which comprises
S301, address name is obtained in user identifier.
Wherein, user identifier user uniquely indicates user identity, includes address name in user identifier, address name by with Family surname and user name composition.When needing to be generated for user recommendation code, the user identifier of the user is obtained.User identifier Format be it is pre-set, the position of the user name in user identifier is fixed, therefore can be in the specified of user identifier Position acquisition address name.
In one or more embodiments, the length of address name is less than or equal to preset length, wraps in user identifier When the length of the address name included is greater than preset length, the character string of front preset length in address name is intercepted as actual Address name.
Such as: preset length 5, the type of target string are user name, the user name obtained in user identifier Word is " jennifer ", and it is " jenni " that preceding 5 characters for obtaining " jennifer ", which obtain target string,.
Another example is: preset length is 5, the type of target string is address name, the user obtained in user identifier Name is " zhangsan ", and obtaining preceding 5 characters in " zhangsan " and obtaining target string is " zhangs ".
S302, it is inquired in the buffer according to user name.
Wherein, the element stored in caching is index with address name, is existed with the address name obtained in S301 for index It is inquired in caching, an address name is that the quantity of the element of index is one, corresponding inquiring address name for the first time Element when, stop inquiry operation, return to the element inquired, do not need carry out traversal queries.
In one embodiment, caching is used to store the corresponding recommendation code of address name being newly generated, such as: assuming that slow It deposits middle presence and recommends code " jenni003 ", then the recommendation code is the newest recommendation code generated according to address name " jenni ".It is slow Each cache lines are stored with address name and recommend code in depositing, and address name is the index for recommending code, such as: caching is such as 1 institute of table Show:
Cache lines serial number Address name Recommend code
1 jenni jenni003
2 tom tom005
3 sam sam020
Table 1
In one embodiment, each cache lines can only storage sequence number, the index of sequence number be user's surname in caching Name, such as: caching includes 3 cache lines, stores the corresponding recommendation code of the address name being newly generated, such as table in each cache lines Shown in 2:
Cache lines serial number Address name Sequence number
1 jenni 003
2 tom 005
3 sam 020
Table 2
S303, the associated recommendation code of user name whether is inquired.
Wherein, if inquiring the associated recommendation code of user name in the buffer, S304 is executed;If not inquiring in the buffer The associated recommendation code of user name executes S308.
Such as: address name is " tom ", is inquired in table 1 according to " tom ", finds there is " tom " in cache lines 3 For the element " tom005 " of index, S304 is executed.Or inquired in table 2, it is found that there is " tom " in cache lines 3 is index Element " 005 ", execute S304.
Another example is: address name is " jim ", is inquired in table 1 according to " jim ", do not inquire " jim " in the buffer Corresponding element, then execute S308.
S304, the associated sequence number increase preset value recommended in code of user name is obtained into target sequence number.
In general, preset value is pre-stored or is pre-configured that preset value is the integer greater than 0, and size can be according to reality Border demand is determined, and the embodiment of the present application is with no restriction.
Such as: preset value 1, according to the example of S303, the associated recommendation code of " tom " inquired in the buffer is " tom005 ", the Serial No. 5 of the recommendation code, it is 6 that target sequence number is obtained after sequence number is increased by 1.
S305, user name and target sequence number are spliced to obtain the first recommendation code.
In general, using user name as prefix, target sequence number is used as suffix, prefix and suffix is spliced to obtain First recommends code.
In one or more embodiments, recommending the length of code can be fixed, can be by mending 0 before sequence number Mode obtain the recommendation code of regular length.
Such as: regular length 9 is spliced address name " tom " and target sequence number 6 to obtain the first recommendation code “tom000006”。
Another example is: regular length is 9, spliced address name " jenni " and target sequence number 6 to obtain the first recommendation Code " jenni0006 ".
S306, the associated recommendation code of user name in caching is removed.
Wherein, the associated recommendation code of the address name that cache user storage is newly generated, the user that will be inquired in S303 The recommendation code of name key is removed.Such as: it will be removed from caching in the recommendation code " tom005 " inquired.
S307, the first recommendation code is written in caching.
In general, the first recommendation code covering to be written to the associated caching for recommending code of user name inquired in S303 In row.
S308, it is inquired in the database according to user name.
In general, being index in number with user name when not inquiring the associated recommendation code of address name in the buffer According to traversal queries are carried out in library, inquiring all in database with user name be the recommendation code indexed, the recommendation code inquired Quantity be 0, it is also possible to for one or more.Being stored in a manner of persistence in database with user name is index Recommend code, some user name is that the quantity of the recommendation code of index may be one or more.
Such as: the recommendation code stored in database is as shown in table 3:
List item serial number Address name Recommend code
1 jenni Jenni0001
2 jenni Jenni0002
3 jenni Jenni0003
4 tom tom000001
5 tom tom000002
6 sam sam000001
7 sam sam000002
8 sam sam000003
Table 3
S309, the associated recommendation code of user name whether is inquired.
Wherein, by user name be index in the database using being inquired in a manner of traversal, if inquiring in the database To the associated recommendation code of user name, S310 is executed;If not inquiring the associated recommendation code of user name in the database, execute S314。
Such as: address name is " jenni ", carries out traversal queries in table 3 according to " jenni ", exists in discovery table 3 " jenni " is that the recommendation code of index is 3: jenni0001, jenni0002 and jenni0003.
Another example is: address name is " lily ", it is that index is indicating to carry out traversal queries in 3 according to " lily ", does not inquire Indicate there is the recommendation code that " lily " is index in 3.
S310, maximum in database in sequence number corresponding with the associated one or more recommendations code of user name is determined Sequence number.
It for example, is that index inquires 3 recommendation codes in table 3 with " jenni " according to the query result of S309 are as follows: Jenni0001, jenni0002 and jenni0003,3 maximum sequence numbers recommended in code are 4.
S311, target sequence number is obtained after maximum sequence number is increased preset value.
In general, preset value is pre-stored or is pre-configured that preset value is the integer greater than 0, and size can be according to reality Border demand is determined, and the embodiment of the present application is with no restriction.
Such as: preset value 1, according to the example of S310, maximum sequence number 3 obtains target sequence after sequence number is increased by 1 Row number is 4.
S312, user name and target sequence number are spliced to obtain the first recommendation code.
In general, using user name as prefix, target sequence number is used as suffix, prefix and suffix is spliced to obtain First recommends code.
In one or more embodiments, recommending the length of code can be fixed, can be by mending 0 before sequence number Mode obtain the recommendation code of regular length.
Such as: regular length 9 is spliced address name " jenni " and target sequence number 4 to obtain the first recommendation code “jenni0004”。
S313, the first recommendation code is written in caching.
Wherein, caching is used to temporarily store the corresponding recommendation code of address name or sequence number being newly generated, such as: it will The first recommendation code " jenni0004 " that S312 is generated is written in cache lines idle in caching.
S314, user name and preset initial sequence number are spliced to obtain the second recommendation code.
Such as: for example: being that index is inquired in table 3 with " lily ", query result is not look into according to the example of S309 " lily " associated recommendation code is ask, preset initial sequence number is pre-stored or is pre-configured that the value of initial sequence number is available Determine according to actual needs, the embodiment of the present application is for 1, by " lily " and initiation sequence with initial sequence number with no restriction Number " 1 " is spliced, and recommending the regular length of code is 9, and the second recommendation code " lily00001 " is obtained after splicing.
S315, the second recommendation code is written in caching.
Wherein, cache user temporarily stores the corresponding recommendation code of the user identifier being newly generated or sequence number, such as: it will The second recommendation code " lily00001 " that S314 is generated is written in cache lines idle in caching.
S316, the recommendation code persistence in caching is written in database.
Wherein, the recommendation code in caching is written in database according to preset consumption rate persistence, time slot is recommended The asynchronous write operation of code, can mitigate the load in database.Caching can be redis caching, and database can be mysql data Library.
Implement embodiments herein, the target string of specified format is obtained from user identifier, using caching addend Generated recommendation code is stored according to the mode in library, successively inquiry target string is the recommendation code indexed in caching and database Sequence number, with the Serial No. basis carry out from increase, by target string and from increase after sequence number spliced after obtain Target recommends code, in the storage system for recommending code storage to storage that code collection is recommended to close the target of production, avoids in the prior art It is produced using random fashion and recommends the problem of there may be repetitions of code, the embodiment of the present application provides readable higher recommendation Code, avoids generating duplicate recommendation code, does not need to generate every time and code is recommended to require to carry out repeated verifying, reduce to generate and recommend The complexity of code.Recommendation code is written by way of caching with database in the embodiment of the present application simultaneously, this to pass through asynchronous system The mode of write-in recommendation code can be reduced the concurrency of database.
Above-mentioned Fig. 1 to Fig. 3 illustrates the generation method for recommending code.A kind of recommendation code of corresponding the embodiment of the present application Generating means (abbreviation device) structural schematic diagram.
Fig. 4 is referred to, Fig. 4 is a kind of structural schematic diagram of device 4 provided by the embodiments of the present application, which can wrap Include acquiring unit 401, query unit 402, concatenation unit 403 and storage unit 404.
Acquiring unit 401, for obtaining target string in user identifier;
Query unit 402, for being looked into the storage system that storage recommends code collection to close according to the target string It askes, if being inquired and the associated one or more recommendations of the target string in the storage system that storage recommends code collection to close Code obtains target sequence after the maximum sequence number in the corresponding sequence number of one or more of recommendation codes is increased preset value Number;Wherein, each recommendation code in storage system that the storage recommends code collection to close includes sequence number;
Concatenation unit 403, for being spliced the target string and the target sequence number to obtain the first recommendation Code;
Storage unit 404, for recommending code storage into the storage system of the storage recommendation code collection conjunction for described first.
In one or more embodiments, storage unit 404 is also used to: if not pushed away in the storage according to the character string It recommends in the storage system of code collection conjunction and inquires associated one or more recommendations code, by the target string and preset initial Sequence number is spliced to obtain the second recommendation code;
The second recommendation code is stored in the storage system that the storage recommends code collection to close.
In one or more embodiments, the storage system that the storage recommends code collection to close includes caching and database;
Query unit 402 is used for:
It is inquired in the caching according to the target string;
If being inquired in the caching and the associated recommendation code of the target string, it is determined that recommend in the storage It is inquired and the associated one or more recommendations code of the target string in the storage system that code collection is closed.
In one or more embodiments, storage unit 404 is used for: being removed in the caching and is closed with the target string The recommendation code of connection, and the first recommendation code is written in the caching, indicate that the caching holds the recommendation code of storage Longization is into the database.
In one or more embodiments, query unit 402 is also used to:
If not inquired in the caching and the associated recommendation code of the target string;
It is inquired in the database according to the target string;
If inquiring in the database and the associated one or more recommendations code of the target string, it is determined that It is inquired and the associated one or more recommendations code of the target string in the storage system that the storage recommends code collection to close.
In one or more embodiments, storage unit 404 is used for:
The first recommendation code is written in the caching, and indicates the caching by the recommendation code persistence of storage It is written in the database.
In one or more embodiments, query unit 402 is also used to:
If not inquiring in the database and the associated one or more recommendations code of the target string, it is determined that It is not inquired and the associated one or more recommendations of the target string in the storage system that the storage recommends code collection to close Code.
Device 4 can be electronic equipment, device 4 or the field programmable gate array for realizing correlation function (field-programmable gate array, FPGA), special integrated chip, System on Chip/SoC (system on chip, SoC), central processing unit (central processor unit, CPU), network processing unit (network processor, NP), Digital signal processing circuit, microcontroller (micro controller unit, MCU), can also use programmable controller (programmable logic device, PLD) or other integrated chips.
Fig. 5 is a kind of structural schematic diagram of generating means for recommending code provided by the embodiments of the present application, hereinafter referred to as device 5, device 5 can integrate in electronic equipment above-mentioned, as shown in figure 5, the device includes: memory 502, processor 501 and receives Send out device 503.
Memory 502 can be independent physical unit, can be connect by bus with processor 501 and transceiver 503. Memory 502, processor 501 pass through hardware realization etc. together with also can integrate with transceiver 503.
Memory 502 is used to store the program for realizing above method embodiment or Installation practice modules, processing Device 501 calls the program, executes following operation:
Target string is obtained in user identifier;
It is inquired in the storage system that storage recommends code collection to close according to the target string, if recommending code in storage Inquired in the storage system of set with the associated one or more recommendations code of the target string, will be one or more of Target sequence number is obtained after recommending the maximum sequence number in the corresponding sequence number of code to increase preset value;Wherein, the storage is recommended Each recommendation code in storage system that code collection is closed includes sequence number;
The target string and the target sequence number are spliced to obtain the first recommendation code;
Indicate that memory 502 recommends code storage into the storage system for storing and code collection being recommended to close for described first.
In one or more embodiments, processor 501 is also used to:
If according to the character string it is described storage recommend code collection close storage system in do not inquire associated one or Multiple recommendation codes are spliced the target string and preset initial sequence number to obtain the second recommendation code;
Indicate that the second recommendation code is stored in the storage system that the storage recommends code collection to close by memory 502.
In one or more embodiments, the storage system that the storage recommends code collection to close includes caching and database;
Wherein, processor 501 execute it is described according to the target string storage recommend code collection close storage system in It is inquired, comprising:
It is inquired in the caching according to the target string;
If being inquired in the caching and the associated recommendation code of the target string, it is determined that recommend in the storage It is inquired and the associated one or more recommendations code of the target string in the storage system that code collection is closed.
In one or more embodiments, processor 501 execute it is described by it is described first recommendation code be stored in the storage In the storage system for recommending code collection to close, comprising:
Remove in the caching with the associated recommendation code of the target string, and by it is described first recommendation code be written to In the caching, indicate that the recommendation code of storage is persisted in the database by the caching.
In one or more embodiments, processor 501 is also used to execute:
If not inquired in the caching and the associated recommendation code of the target string;
It is inquired in the database according to the target string;
If inquiring in the database and the associated one or more recommendations code of the target string, it is determined that It is inquired and the associated one or more recommendations code of the target string in the storage system that the storage recommends code collection to close.
In one or more embodiments, processor 501 execute it is described by it is described first recommendation code be stored in the storage In the storage system for recommending code collection to close, comprising:
The first recommendation code is written in the caching, and indicates the caching by the recommendation code persistence of storage It is written in the database.
In one or more embodiments, processor 501 is also used to execute:
If not inquiring in the database and the associated one or more recommendations code of the target string, it is determined that It is not inquired and the associated one or more recommendations of the target string in the storage system that the storage recommends code collection to close Code.
In one or more embodiments, device 5 further includes input unit and output device.
Wherein, input unit includes but is not limited to keyboard, mouse, touch panel, camera and microphone;Output device packet It includes but is limited to display screen.
In one or more embodiments, when logical some or all of in the processing method of the business datum of above-described embodiment When crossing software realization, device can also only include processor.Memory for storing program is located at except device, and processor is logical Oversampling circuit/electric wire is connect with memory, for reading and executing the program stored in memory.
Processor can be central processing unit (central processing unit, CPU), network processing unit The combination of (network processor, NP) or CPU and NP.
Processor can further include hardware chip.Above-mentioned hardware chip can be specific integrated circuit (application-specific integrated circuit, ASIC), programmable logic device (programmable Logic device, PLD) or combinations thereof.Above-mentioned PLD can be Complex Programmable Logic Devices (complex Programmable logic device, CPLD), field programmable gate array (field-programmable gate Array, FPGA), Universal Array Logic (generic array logic, GAL) or any combination thereof.
Memory may include volatile memory (volatile memory), such as access memory (random- Access memory, RAM);Memory also may include nonvolatile memory (non-volatile memory), such as fastly Flash memory (flash memory), hard disk (hard disk drive, HDD) or solid state hard disk (solid-state drive, SSD);Memory can also include the combination of the memory of mentioned kind.
The embodiment of the present application also provides a kind of computer storage mediums, are stored with computer program, the computer program For executing the generation method provided by the above embodiment for recommending code.
The embodiment of the present application also provides a kind of computer program products comprising instruction, when it runs on computers When, so that computer executes the generation method provided by the above embodiment for recommending code.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.

Claims (10)

1. a kind of generation method for recommending code characterized by comprising
Target string is obtained in user identifier;
It is inquired in the storage system that storage recommends code collection to close according to the target string, if recommending code collection to close in storage Storage system in inquire with the associated one or more recommendations code of the target string, by one or more of recommendations Maximum sequence number in the corresponding sequence number of code obtains target sequence number after increasing preset value;Wherein, code collection is recommended in the storage Each recommendation code in the storage system of conjunction includes sequence number;
The target string and the target sequence number are spliced to obtain the first recommendation code;
In the storage system for recommending code storage to recommend code collection to close to the storage for described first.
2. the method according to claim 1, wherein further include:
If not inquiring associated one or more in the storage system that the storage recommends code collection to close according to the character string Recommend code, the target string and preset initial sequence number are spliced to obtain the second recommendation code;
The second recommendation code is stored in the storage system that the storage recommends code collection to close.
3. method according to claim 1 or 2, which is characterized in that it is described storage recommend code collection close storage system include Caching and database;
It is wherein, described to be inquired in the storage system that storage recommends code collection to close according to the target string, comprising:
It is inquired in the caching according to the target string;
If being inquired in the caching and the associated recommendation code of the target string, it is determined that recommend code collection in the storage It is inquired in the storage system of conjunction and the associated one or more recommendations code of the target string.
4. according to the method described in claim 3, it is characterized in that, it is described by it is described first recommendation code be stored in it is described storage push away In the storage system for recommending code collection conjunction, comprising:
It removes in the caching with the associated recommendation code of the target string, and the first recommendation code is written to described In caching, indicate that the recommendation code of storage is persisted in the database by the caching.
5. according to the method described in claim 3, it is characterized in that, described recommend code collection to close according to target string in storage It is inquired in storage system, further includes:
If not inquired in the caching and the associated recommendation code of the target string;
It is inquired in the database according to the target string;
If inquiring in the database and the associated one or more recommendations code of the target string, it is determined that described It is inquired and the associated one or more recommendations code of the target string in the storage system that storage recommends code collection to close.
6. according to the method described in claim 5, it is characterized in that, it is described by it is described first recommendation code be stored in it is described storage push away In the storage system for recommending code collection conjunction, comprising:
The first recommendation code is written in the caching, and the recommendation code persistence of storage is written the instruction caching Into the database.
7. method according to claim 5 or 6, which is characterized in that described to recommend code collection to close in storage according to character string It is inquired in storage system, further includes:
If not inquiring in the database and the associated one or more recommendations code of the target string, it is determined that do not exist It is inquired and the associated one or more recommendations code of the target string in the storage system that the storage recommends code collection to close.
8. a kind of generating means for recommending code characterized by comprising
Acquiring unit, for obtaining target string in user identifier;
Query unit, for being inquired in the storage system that storage recommends code collection to close according to the target string, if Inquired in the storage system that storage recommends code collection to close with the associated one or more recommendations code of the target string, will be described Maximum sequence number in the corresponding sequence number of one or more recommendations code obtains target sequence number after increasing preset value;Wherein, institute The each recommendation code stated in the storage system that storage recommends code collection to close includes sequence number;
Concatenation unit obtains the first recommendation code for being spliced the target string and the target sequence number;
Storage unit, for recommending code storage into the storage system of the storage recommendation code collection conjunction for described first.
9. a kind of electronic equipment, which is characterized in that including processor and memory, wherein the memory is calculated for storing Machine program, the computer program include program instruction, and the processor is executed for calling described program to instruct as right is wanted Seek the described in any item methods of 1-7.
10. a kind of computer readable storage medium, which is characterized in that the computer storage medium is stored with computer program, The computer program includes program instruction, and described program instruction makes the processor execute such as right when being executed by a processor It is required that the described in any item methods of 1-7.
CN201910565671.5A 2019-06-27 2019-06-27 Recommend generation method, device, electronic equipment and the storage medium of code Pending CN110362573A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910565671.5A CN110362573A (en) 2019-06-27 2019-06-27 Recommend generation method, device, electronic equipment and the storage medium of code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910565671.5A CN110362573A (en) 2019-06-27 2019-06-27 Recommend generation method, device, electronic equipment and the storage medium of code

Publications (1)

Publication Number Publication Date
CN110362573A true CN110362573A (en) 2019-10-22

Family

ID=68217130

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910565671.5A Pending CN110362573A (en) 2019-06-27 2019-06-27 Recommend generation method, device, electronic equipment and the storage medium of code

Country Status (1)

Country Link
CN (1) CN110362573A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106657216A (en) * 2016-09-19 2017-05-10 腾讯征信有限公司 Serial number generation method and serial number generation device
CN107454203A (en) * 2017-07-19 2017-12-08 成都数联铭品科技有限公司 The method for generating unique ID in a distributed system
US10003603B1 (en) * 2016-04-26 2018-06-19 Ca, Inc. Computer security based on hierarchical cache latency signature authentication
CN108681528A (en) * 2018-04-03 2018-10-19 卓望数码技术(深圳)有限公司 A kind of sequence number generation method and system
CN109597853A (en) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 Business scenario element sequence generation method, device, medium and computer equipment
CN109933574A (en) * 2019-02-27 2019-06-25 常州猛犸电动科技有限公司 A kind of unique key generation method, device and terminal device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10003603B1 (en) * 2016-04-26 2018-06-19 Ca, Inc. Computer security based on hierarchical cache latency signature authentication
CN106657216A (en) * 2016-09-19 2017-05-10 腾讯征信有限公司 Serial number generation method and serial number generation device
CN107454203A (en) * 2017-07-19 2017-12-08 成都数联铭品科技有限公司 The method for generating unique ID in a distributed system
CN108681528A (en) * 2018-04-03 2018-10-19 卓望数码技术(深圳)有限公司 A kind of sequence number generation method and system
CN109597853A (en) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 Business scenario element sequence generation method, device, medium and computer equipment
CN109933574A (en) * 2019-02-27 2019-06-25 常州猛犸电动科技有限公司 A kind of unique key generation method, device and terminal device

Similar Documents

Publication Publication Date Title
US10237295B2 (en) Automated event ID field analysis on heterogeneous logs
CN110019211A (en) The methods, devices and systems of association index
WO2019040235A1 (en) Method, system and non-transitory computer readable recording medium for review verification and trustworthiness scoring via blockchain
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN111247518A (en) Database sharding
CN111125496B (en) Price query method, device and system
CN110737682A (en) cache operation method, device, storage medium and electronic equipment
CN109388626A (en) Method and apparatus for being numbered to traffic assignments
EP3887969A1 (en) Systems and methods for storing object state on hash chains
CN113076729B (en) Method and system for importing report, readable storage medium and electronic equipment
CN111639027A (en) Test method and device and electronic equipment
CN109672722B (en) Data deployment method and device, computer storage medium and electronic equipment
CN104881454A (en) Updating method and system of parameter
CN112269706A (en) Interface parameter checking method and device, electronic equipment and computer readable medium
CN109858285B (en) Block chain data processing method, device, equipment and medium
CN115016978A (en) Data verification method and device, computer storage medium and electronic equipment
CN108845892A (en) Data processing method, device, equipment and the computer storage medium of distributed data base
CN108959294A (en) A kind of method and apparatus accessing search engine
CN116662302A (en) Data processing method, device, electronic equipment and storage medium
CN110362573A (en) Recommend generation method, device, electronic equipment and the storage medium of code
CN111949648A (en) Memory cache data system and data indexing method
TWI580217B (en) Management server and the operation method thereof and server system
CN113393288A (en) Order processing information generation method, device, equipment and computer readable medium
CN112069071A (en) Method and device for determining program suitability
CN114528444B (en) Graph data processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20191022

RJ01 Rejection of invention patent application after publication