Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
With reference to Fig. 2, the flow chart of the application information processing method embodiment 1 is shown, may comprise steps of:
Step 101, the corresponding hot spot account of generation activity, the hot spot account include the detail record of default number of branches, institute
Stating detail record includes the movable mark, the mark of the detail record, the state of the detail record and subject matter ginseng
Number.
The embodiment of the present application scheme can generate the detail record of default indifference, detail record according to movable needs
It may include movable mark, the mark of detail record, detail record state and subject matter parameter.Specifically, movable mark
It can be activity name and/or activity ID;The mark of detail record can be detail record title and/or detail record ID;It is bright
Thin recording status can be idle or occupancy, wherein if user has been distributed in detail record, status and appearance is to occupy, no
Then status and appearance is the free time, and the original state of usual detail record is idle state;Subject matter parameter can be the number of subject matter
Amount, generally directed to different activities, subject matter parameter can behave as different form, for example, if activity is to rob red packet, target
Object parameter can be the red packet amount of money, e.g., 5 yuan, 10 yuan etc.;If activity is robs commodity, subject matter parameter can limit for commodity
Quantity is purchased, if commodity are mobile phone, subject matter parameter can be 1,2 etc..In practical applications, the embodiment of the present application pair
The specific manifestation form for the every terms of information that detail record includes can be not specifically limited.As an example, detail record can body
It is now schematic diagram shown in Fig. 3.
It should be noted that subject matter parameter can be arranged in application server according to default configuration, alternatively, application service
Subject matter parameter can be arranged in device according to the manual configuration of operator, and the embodiment of the present application can be not specifically limited this,
Subject matter parameter will not be arranged in real time according to the information that client user inputs in commonly used server.For example, using clothes
Business device can set 5 yuan for the red packet amount of money of all detail records, alternatively, the red packet amount of money of all detail records can be set
It is set to 10 yuan;Alternatively, 5 yuan can also be set by the red packet amount of money of a part of detail record, by another part detail record
The red packet amount of money is set as 10 yuan;But commonly used server will not real-time response client user, according to user input number
The value setting red packet amount of money.
In addition, it is necessary to explanation, movable mark is for indicating which specific activity detail record corresponds to, using clothes
Business device can pass through movable mark when being routed to hot spot account by user and distribute detail record for user in subsequent processes
Know the accuracy for further examining application server routing.As an example, if it is not high to routing accuracy requirement, or
Unique activity is currently only carried out, also may not include movable mark in detail record, certainly, in order to guarantee the road of application server
By accuracy, or in detail record include it is movable be identified as it is optimal.
The detail record that the embodiment of the present application generates default indifference refers to the area Bu Zuo between each detail record
Point, as long as detail record is in idle condition, user can be distributed to.Default number of branches can specify number to be preset,
Such as, it specifies and generates 10,000 detail records;Alternatively, default number of branches total allocation number, the generation factor and subject matter can join according to
The calculating number that number obtains, e.g., total allocation number are 1,000,000 yuan of red packets, and generating the factor is 0.8, and subject matter parameter is 5 yuan, then count
Calculation knows ten thousand detail records of 100*0.8/5=16 to be generated.It should be noted that it can be randomly provided the generation factor, alternatively,
It can also be arranged according to the experience of other correlated activations and generate the factor, furthermore, it can also be set according to movable former years historical data
The generation factor is set, the embodiment of the present application can be not specifically limited this.
In summary, account configuration phase of the embodiment of the present application before activity starts does not need application server progress
Account is split, and carries out action message configuration without for each sub- account, correct also without carrying out between each sub- account
Property inspection, it is only necessary to generate the detail record of default indifference, generating process is simply easily achieved, and can be saved using clothes
The process resource of business device.In this way, largely disappearing caused by just solving the second grade concurrency that the prior art is reduction hot spot account
The technical issues of consuming application server processes resource.
Step 102, the access request sent in response to user for the activity is each from the hot spot account
User searches a corresponding current detail record, and the state of the current detail record is the free time.
Step 101 is mainly for the account configuration phase before activity starts, once account configuration is completed, activity starting
Afterwards, application server can directly execute the access request of step 102 response user.
For example, client user checks loose-leaf, can be sent out by modes such as click or touch-controls to application server
Access request is sent, application server receives the access request of user's transmission, can carry out letter according to the embodiment of the present application scheme
Breath processing.By taking double 11 provide the scene of red packet as an example, loose-leaf can show that 5 yuan of red packets get button and 10 yuan of red packets are got and pressed
Button, user A click 10 yuan of red packets and get button, i.e., access request can be sent to application server, the access request is for indicating
Double 11 movable 10 yuan of red packets are got in user A request.
Optionally, after application server receives access request, first the identity to user A, user A the row of red packet can be got
The amount of money etc. for getting red packet for, user A request authenticates, and after the authentication is passed, application server is according still further to the application reality
It applies a scheme and carries out information processing.
Specifically, in the embodiment of the present application, the information process of application server can embody are as follows: determine what user participated in
Hot spot account corresponding to activity is that each user searches the detail a being in idle condition note from the hot spot account
Record, as the current detail record for distributing to user.
As an example, if only one current user sends access request, application server to application server
A current detail record can be determined from all detail records that hot spot account is in idle condition for the user.
For example, what application server can be random, it is determined from all detail records being in idle condition current
Detail record, e.g., the detail record that ID is 10~20 are in idle state, application server can at random by ID be 12 it is bright
Thin record is determined as current detail record.Alternatively, application server can be by all detail records being in idle condition, ID
The maximum or the smallest detail record of ID is determined as current detail record, and e.g., the detail record that ID is 10~20 is in idle shape
The minimum ID detail record for being 10 can be determined as current detail record by state, application server.Alternatively, application server can be with
According to preset matching rule, from all detail records being in idle condition, determine one with User ID it is matched currently it is bright
Thin record, e.g., User ID 123456, and the detail record that ID is 10~20 is in idle state, if matching rule is bright
Last is identical with User ID for thin last position of Record ID, and the ID detail record for being 16 can be determined as currently by application server
Detail record.Specifically, the embodiment of the present application application server determine the mode of current detail record, each way it is specific
Realization rate etc., can be without limitation.
As an example, if currently there is multiple users concurrently to send access request, application service to application server
Device can be at least each use by three kinds of modes being introduced below, from all detail records that hot spot account is in idle condition
Family determines a current detail record.Herein wouldn't application server determine that three kinds of modes of current detail record are explained
Bright, for details, reference can be made to hereafter introduce.
Step 103, corresponding user is distributed into the current detail record, and updates the shape of the current detail record
State is to occupy.
Either single-user access or Multi-Client Concurrency Access, application server can distribute one for each user
Corresponding current detail record.It is to be appreciated that corresponding user is distributed in current detail record refers to that foundation is current bright
It is thin to record and the corresponding relationship between corresponding user.For example, it is sequentially allocated detail record 10,11,12 for user A, B, C,
If detail record 10,11,12 is shown as shown in Fig. 3, current detail record is distributed to corresponding user's table by step 103
Show, user A gets to 5 yuan of red packets, user B to get to 5 yuan of red packets, user C and get to 10 yuan of red packets;If detail record 10,
11, it 12 shows as shown in Fig. 4, then current detail record is distributed to corresponding user and indicated by step 103, user A, B and C difference
It robs and buys 1 mobile phone.
In the embodiment of the present application, every detail record can only be assigned exclusively to a user, therefore establish current detail note
Record can also update the state of current detail record, idle state be revised as occupying with after the corresponding relationship between corresponding user
State indicates that user has been distributed in this detail record with this.
In summary, the behavior that user is got red packet or gone on the razzle-dazzle by the embodiment of the present application is converted to matching detail note
The treatment process of record does not need real time modifying account balance or surplus commodities quantity, both can guarantee the thread-safe concurrently accessed,
The ability that application server responses concurrently access is helped to improve again.
It should be noted that the embodiment of the present application scheme, though it is substantially to utilize mainly in marketing class business
Technological means solves during business realizing.
It is referred to for step 102, application server determines three kinds of modes of current detail record, explains separately below
Explanation.
Implementation one
If the mark for the detail record that hot spot account includes is used from meter is added, application server can in the following manner really
Settled preceding detail record: the detail record mark that cache server is each user distribution, the mark of the detail record are obtained
The timestamp ordering for sending access request according to each user for the cache server, matches according to score is added certainly;According to institute
The mark of detail record is stated, searches corresponding current detail record for each user.
In order to avoid concurrent multiple users seize same detail record, realize that the embodiment of the present application can without lock processing
By cache server, the sequence of access request timestamp is sent according to user, distributes a detail record for each user
It identifies, in this example, the mark of detail record can be embodied as detail record ID.It for example, can be in distributed caching
The current value that a detail record ID is safeguarded in server, when user A and B are concurrently accessed, if user A is first reached with respect to B,
(current value+1) can be distributed to user A, while cache server maintenance (current value+1), it, will be (current when user B is reached
Value+2) user B is distributed to, and continue to safeguard (current value+2).So analogize, is visited when there are other users to send to application server
When asking request, cache server can distribute a corresponding detail record ID for each user, and detailed process is not done superfluous herein
It states.As an example, cache server can be operated by the incr of redis, corresponding bright for each user distribution one
Thin Record ID: redis- > incr (' preRecordNum_activity001 ').It should be noted that above-mentioned example, becomes from increasing
Magnitude is presented as 1, in a particular application, self-setting can increase variate-value certainly as required, the embodiment of the present application can not to this
It is specifically limited.
For example, it is 10 that cache server, which is the detail record ID of user A distribution, for the detail record of user B distribution
ID is 11, application server can accordingly, establish user A and ID be 10 detail record between corresponding relationship, establish user B with
The corresponding relationship between detail record that ID is 11, schematic diagram is it is found that user A can get 5 yuan of red packets, user B as shown in connection with fig. 3
5 yuan of red packets can be got.
Implementation two
Application server can determine in the following manner current detail record: the time of access request is sent according to each user
Stamp sequence is followed successively by each user and searches a correspondence from all detail records that the hot spot account is in idle condition
Current detail record.
In order to avoid concurrent multiple users seize same detail record, realize that the embodiment of the present application can without lock processing
The sequence that access request timestamp is sent according to user is followed successively by each user and distributes a corresponding current detail record.It lifts
For example, the detail record that ID is 10~20 is in idle state, and user A and B are concurrently accessed, and user A is arrived first with respect to B
It reaches, what application server can be random, from all detail records being in idle condition, it is followed successively by each determination one of user A and B
The current detail record of item be the ID of current detail record that user A is determined is e.g. 10, the current detail record determined for user B
ID be 12.Alternatively, application server can sort according to the size of detail record ID, it is followed successively by each determination of user A and B one
Current detail record, e.g., detail record are arranged according to ID ascending order, be the ID of current detail record of user A determination are 10, for
The ID for the current detail record that family B is determined is 11;Alternatively, detail record is arranged according to ID descending, determined for user A current bright
The ID carefully recorded is 20, be the ID of current detail record of user B determination is 19.
Optionally, implementation two can also cooperate with implementation one, for user determine one it is corresponding current bright
Thin record, can embody are as follows: application server can be that user's determination is worked as by cache server first with implementation one
Preceding detail record, when cache server failure, recycling implementation two is that user determines current detail record.Citing
For, application server can determine whether cache server breaks down by way of monitoring cache server heartbeat.
Implementation three
Application server can determine in the following manner current detail record: the institute being in idle condition from the hot spot account
Have in detail record, obtains the detail record of specified item number;Using the identity of each user, from the bright of the specified item number
In thin record, a corresponding current detail record is determined for each user.
In order to avoid concurrent multiple users seize same detail record, realize that the embodiment of the present application can without lock processing
First from all detail records being in idle condition, the detail record of specified item number is grabbed, and then in conjunction with User ID, according to
Certain matching rule is that each user determines a corresponding current detail record from the detail record of specified item number.It lifts
For example, specifying item number is that the detail record that 10, ID is 001~100 is in idle state, and application server grabs bright
The ID carefully recorded is 001~010, if the ID of user A is 123456, the ID of user B is 654321, matching rule are as follows: with user
The specific bit of ID is foundation, determines the corresponding current detail record of user in the position being crawled in detail record.For example,
Specific bit is the penultimate of User ID, then the corresponding current detail record of user A is in the position being crawled in detail record
It is 5, i.e. the detail record that ID is 005;The corresponding current detail record of user B is 2 in the position being crawled in detail record, i.e.,
The detail record that ID is 002.
It should be noted that a plurality of matching rule can be set in sequence in the embodiment of the present application, if can not pass through current
It is that user determines detail record with rule, then sequentially can carries out detail record matching using next matching rule, until to use
Determine corresponding current detail record in family.Alternatively, if being that user determines a plurality of detail record by current matching rule,
Current detail record can be then determined from a plurality of detail record determined at random, or may also be combined with other matching rules to use
Family determines corresponding current detail record.The embodiment of the present application can be not specifically limited this, as long as determining one for each user
The current detail record of item.
For example, the matching rule in the embodiment of the present application may be used also are as follows: matching User ID is specified with detail record ID's
Position keeps the two identical or there is default corresponding relationship, and the application can be not specifically limited this.
With reference to Fig. 5, the flow chart of the application information processing method embodiment 2 is shown, may comprise steps of:
Step 201, the corresponding hot spot account of generation activity, the hot spot account include the detail record of default number of branches, institute
Stating detail record includes the movable mark, the mark of the detail record, the state of the detail record and subject matter ginseng
Number.
The realization process of step 201 can be found in step 101 shown in figure 2 above, and details are not described herein again.
Step 202, the access request sent in response to user for the activity judges that the hot spot account is in the free time
Whether the number of the detail record of state is lower than preset value, if not, thening follow the steps 203.
The embodiment of the present application is distributed not mainly in the second grade very high scene of concurrency in order to avoid there is detail record
Foot phenomenon, that is, the detail record number being in idle condition is less than the number of users concurrently accessed, and application server is being each
User distributes before corresponding current detail record, be currently under can first judging the detail record of idle state number whether
Lower than preset value, if being not below preset value, the step of determining current detail record for user can be continued to execute.
For example, preset value can be preset specified numerical value, and e.g., specifying numerical value is 100, that is, hot spot account
When the number for the detail record that family is in idle condition is greater than 100, it can continue to execute and determine current detail record for user
The step of.Alternatively, preset value can be preset ratio, e.g., ratio 20%, that is, hot spot account is in idle condition
Detail record number be greater than default number of branches 20% when, the step that current detail record is determined for user can be continued to execute
Suddenly.Alternatively, preset value can be the number of users concurrently accessed, e.g., the number of users concurrently accessed is 100, that is, hot spot account
When the number for the detail record being in idle condition is greater than 100, it can continue to execute and determine current detail record for user
Step.
Step 203, from the hot spot account, a corresponding current detail record is searched for each user, it is described to work as
The state of preceding detail record is the free time.
Step 204, corresponding user is distributed into the current detail record, and updates the shape of the current detail record
State is to occupy.
Step 203,204 realization process can be found in step 102 shown in figure 2 above, 103, details are not described herein again.
Optionally, hot spot account further includes predistribution number and/or unallocated number, then judges at hot spot account in step 202
When the number of the detail record of idle state is lower than preset value, application server can also carry out following steps: judgement is described not
Whether distribution number is greater than zero, if it is, generating new detail record using the unallocated number, then executes described for each use
Search a corresponding current detail record in family.
In the embodiment of the present application, predistribution number refers to the sum of subject matter parameter of detail record of default number of branches, does not divide
Total allocation number is referred to number and pre-allocates the difference between number.By it is above lift rob red packet activity for, total allocation number be 100
Ten thousand yuan of red packets, the generation factor are 0.8, the red packet amount of money is 5 yuan, then the corresponding predistribution number of 160,000 detail records is 16*5=80
Wan Yuan, unallocated number are ten thousand yuan of 100-80=20.
If unallocated number is greater than zero, illustrate that red packet or commodity also have a margin at present, in combination with unallocated number, continues to give birth to
The detail record of Cheng Xin is distributed for application server.It should be noted that application server can be first from remaining detail record
Current detail record is determined in (that is, the detail record being in idle condition in the detail record of default number of branches) for user, and
Current detail record is determined for user from new detail record again when insufficient.Alternatively, application server can be first from new bright
Current detail record is determined for user in thin record, and determines current detail from remaining detail record again in deficiency for user
Record.Alternatively, application server can not distinguish remaining detail record and new detail record, it is directly therefrom true for user
Settled preceding detail record.
Optionally, as an example, application server also can determine whether predistribution number is less than total allocation number, if
It is then to generate new detail record using unallocated number, then execute described for each user one corresponding current detail of lookup
Record.Detailed process can refer to the scheme introduced above for unallocated number, and details are not described herein again.
Optionally, if being judged that unallocated number is equal to zero, or predistribution number is equal to total allocation number, in order to improve processing
The speed of user's request, the number of users that application server can also calculate the detail record number being in idle condition and concurrently access
Difference between mesh, and according to the timestamp ordering of concurrent users transmission access request, directly it is consistent to the difference
And the user (that is, the user of distribution less than detail record) of sequence rearward, feedback activity terminates the page.For example, red packet account
Remaining 3 detail records being in idle condition, currently have 5 user concurrents to send access request to application server in family,
And 5 users are followed successively by 1,2,3,4,5 according to timestamp ordering, correspond to this, application server can be distinguished for user 1,2 and 3
Distribute a current detail record, that is, user 1,2 and 3 is got respectively to a red packet, meanwhile, application server can also to
Family 4 and 5 returns and robs the red packet activity end page.In this way, can also shorten the time of application server responses user 4 and 5, improves and use
The user experience at family 4 and 5.
In summary, the embodiment of the present application can generate new detail record, and mistake when distributing insufficient according to the actual situation
It will not relate to Data Migration in journey, it will not be to ongoing activity, already present detail record, established detail record
Corresponding relationship between user etc. has an impact.
Optionally, the embodiment of the present application may also include clearing step after activity end.For example, for robbing red packet
Activity, clearing step refer to calculating red packet remaining sum;For commercial activities are robbed, clearing step refers to calculating surplus commodities number.
Specifically, the embodiment of the present application provides the following two kinds clearing implementation:
Implementation one, application server discharges all detail records being in idle condition in hot spot account, and makees
Following to update: predistribution number is zero, the subject matter ginseng of all detail records in occupied state of unallocated number=total allocation number-
The sum of number.Wherein, unallocated number is clearing value.
Implementation two, application server calculate clearing value=unallocated number+all detail records being in idle condition
The sum of subject matter parameter of quantity.
It is corresponding with method provided by a kind of information processing method embodiment 1 of above-mentioned the application, referring to Fig. 6, the application
A kind of information processing unit embodiment 1 is additionally provided, in the present embodiment, the apparatus may include:
Generation unit 301, for generating the corresponding hot spot account of activity, the hot spot account includes the detail of default number of branches
Record, the detail record includes the movable mark, the mark of the detail record, the state and mark of the detail record
Object parameter;
Searching unit 302, the access request for being sent in response to user for the activity, from the hot spot account
In, a corresponding current detail record is searched for each user, the state of the current detail record is the free time;
Corresponding user is distributed in allocation unit 303, the current detail record for finding the searching unit,
And the state of the current detail record is updated to occupy.
Searching unit can determine a corresponding current detail note according to the scheme of embodiment of the method introduction for each user
Record, details are not described herein again.
For Multi-Client Concurrency Access, the searching unit in the embodiment of the present application can be embodied as following three kinds of realization sides
Formula:
Implementation one, if multiple user concurrents send access request, and the mark of the detail record is used from increasing
Design, the searching unit include:
First obtains unit, for obtaining the detail record mark that cache server is each user distribution, the detail
The timestamp ordering for being identified as the cache server and sending access request according to each user of record, according to adding score certainly
Match;
First searches subelement, for the mark according to the detail record, searches corresponding work as each user
Preceding detail record.
Implementation two, if multiple user concurrents send access request, the searching unit includes:
Second searches subelement, for sending the timestamp ordering of access request according to each user, from the hot spot account
In all detail records that family is in idle condition, it is followed successively by each user and searches a corresponding current detail record.
Implementation three, if multiple user concurrents send access request, the searching unit includes:
Second obtaining unit, for being specified from all detail records that the hot spot account is in idle condition
The detail record of item number;
Third searches subelement, for the identity using each user, from the detail record of the specified item number,
A corresponding current detail record is determined for each user.
Optionally, on the basis of above scheme, described device further include:
First judging unit, for judging the hot spot before the searching unit searches the current detail record
Whether the number for the detail record that account is in idle condition is lower than preset value, if it is not, then the searching unit is notified to search
The current detail record.
Optionally, if the number for the detail record that the hot spot account is in idle condition is lower than the preset value, and
The hot spot account further includes predistribution number and/or unallocated number, and the predistribution number is the detail record of the default number of branches
The sum of subject matter parameter, the unallocated number is the difference of total allocation number and the predistribution number, then described device further include:
Second judgment unit, the number of the detail record for being in idle condition in the hot spot account is lower than described pre-
If judging whether the unallocated number is greater than zero when value, if it is, new detail record is generated using the unallocated number,
And the searching unit is notified to search the current detail record;Alternatively,
Third judging unit, the number of the detail record for being in idle condition in the hot spot account is lower than described pre-
If judging whether the predistribution number is less than the total allocation number when value, if it is, being generated newly using the unallocated number
Detail record, and the searching unit is notified to search the current detail record.
Present invention also provides a kind of smart machine, information processing apparatus above-mentioned is integrated on the processor of the smart machine
It sets.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight
Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
For system class embodiment, since it is basically similar to the method embodiment, so being described relatively simple, related place ginseng
See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that
A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except there is also other identical elements in the process, method, article or apparatus that includes the element.
A kind of information-pushing method provided herein and device are described in detail above, it is used herein
The principle and implementation of this application are described for specific case, and the above embodiments are only used to help understand originally
The method and its core concept of application;At the same time, for those skilled in the art, according to the thought of the application, specific
There will be changes in embodiment and application range, in conclusion the content of the present specification should not be construed as to the application's
Limitation.