Summary of the invention
The technical issues that need to address of the present invention are to provide a kind of medium browsing time digital control method and device, can overcome the dependence of conventional method to cookie, determine the number of visits of user's browsing media resource exactly, avoid the waste to media resource injected volume.
In order to solve the problems of the technologies described above, the invention provides a kind of medium browsing time digital control method, be applied to Media Resource Server, described method comprises:
Receive the browse request to a certain media resource that user sends, in described browse request, carry the cookie of user terminal;
From described cookie, extract described media resource by actual the first number of visits browsed of described user, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user;
According to described first number of visits and the second number of visits, described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user.
Further, described according to described first number of visits and the second number of visits, described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, comprises:
Select number of visits larger in described first number of visits and the second number of visits, as as described in larger number of visits be less than as described in the number of visits higher limit of media resource, then described larger number of visits is added 1, as described 3rd number of visits, otherwise, using described number of visits higher limit as described 3rd number of visits.
Further, from described cookie, extract described media resource by actual the first number of visits browsed of described user, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user, comprising:
As browse request as described in determining be as described in user to as described in the first time browse request of media resource, described first number of visits is set to 0, the second number of visits is set to 0 simultaneously, and described 3rd number of visits is set to 1.
Further, after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, also comprise:
As described in do not exist in cookie as described in the first number of visits as described in the first number of visits or existence be not equal to as described in the 3rd number of visits, described 3rd number of visits is write described cookie or the first number of visits in described cookie is updated to the 3rd number of visits, then cookie described in write-back is to the client of described user.
Further, after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, also comprise:
As described in do not have in Media Resource Server the second number of visits as described in record second number of visits or record be not equal to as described in the 3rd number of visits, then described 3rd number of visits is recorded as the second new number of visits.
In order to solve the problems of the technologies described above, present invention also offers a kind of medium browsing time number control device, comprising:
Receiver module, for receiving the browse request to a certain media resource that user sends, carries the cookie of user terminal in described browse request;
Number of visits acquisition module, for extracting described media resource by actual the first number of visits browsed of described user from described cookie, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user;
Number of visits update module, for according to described first number of visits and the second number of visits, is updated to the 3rd number of visits by described media resource by the actual number of visits browsed of described user.
Further, described number of visits update module, for according to described first number of visits and the second number of visits, is updated to the 3rd number of visits by described media resource by the actual number of visits browsed of described user, comprises:
Select number of visits larger in described first number of visits and the second number of visits, as as described in larger number of visits be less than as described in the number of visits higher limit of media resource, then described larger number of visits is added 1, as described 3rd number of visits, otherwise, using described number of visits higher limit as described 3rd number of visits.
Further, described number of visits acquisition module, for extracting described media resource by actual the first number of visits browsed of described user from described cookie, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user, comprising:
As browse request as described in determining be as described in user to as described in the first time browse request of media resource, described first number of visits is set to 0, the second number of visits is set to 0 simultaneously, and described 3rd number of visits is set to 1.
Further, described number of visits update module, also for after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, as as described in do not exist in cookie as described in the first number of visits as described in the first number of visits or existence be not equal to as described in the 3rd number of visits, described 3rd number of visits is write described cookie or the first number of visits in described cookie is updated to the 3rd number of visits, then cookie described in write-back is to the client of described user.
Further, described number of visits update module, also for after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, as as described in do not have in Media Resource Server the second number of visits as described in record second number of visits or record be not equal to as described in the 3rd number of visits, then described 3rd number of visits is recorded as the second new number of visits.
Compared with prior art, medium browsing provided by the invention time digital control method and device, preserve media resource by the actual number of visits data browsed in server end and user terminal cookie simultaneously, on the basis that single cookie number of visits controls, increase server number of visits control logic, framework is controlled with the number of visits forming stable dual-active, compensate for the dependence of conventional method to cookie, simultaneously, if cause the number of visits data distortion of server end due to cause specific, also the number of visits data can extracted in user terminal cookie browse number of visits as the actual of media resource, improve the accuracy of the number of visits of user's browsing media resource, the number of visits achieved more accurately and effectively specific user browses particular media asset controls, avoid the waste to media resource injected volume.
Embodiment:
As shown in Figure 1, present embodiments provide a kind of medium browsing time number control device, comprising:
Receiver module, for receiving the browse request to a certain media resource that user sends, carries the cookie of user terminal in described browse request;
Number of visits acquisition module, for extracting described media resource by actual the first number of visits browsed of described user from described cookie, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user;
Number of visits update module, for according to described first number of visits and the second number of visits, is updated to the 3rd number of visits by described media resource by the actual number of visits browsed of described user.
Wherein, described number of visits update module, for according to described first number of visits and the second number of visits, is updated to the 3rd number of visits by described media resource by the actual number of visits browsed of described user, comprises:
Select number of visits larger in described first number of visits and the second number of visits, as as described in larger number of visits be less than as described in the number of visits higher limit of media resource, then described larger number of visits is added 1, as described 3rd number of visits, otherwise, using described number of visits higher limit as described 3rd number of visits.
Described number of visits update module, also for after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, as as described in do not exist in cookie as described in the first number of visits as described in the first number of visits or existence be not equal to as described in the 3rd number of visits, described 3rd number of visits is write described cookie or the first number of visits in described cookie is updated to the 3rd number of visits, then cookie described in write-back is to the client of described user.
Described number of visits update module, also for after described media resource is updated to the 3rd number of visits by the actual number of visits browsed of described user, as as described in do not have in Media Resource Server the second number of visits as described in record second number of visits or record be not equal to as described in the 3rd number of visits, then described 3rd number of visits is recorded as the second new number of visits.
Described number of visits acquisition module, for extracting described media resource by actual the first number of visits browsed of described user from described cookie, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user, comprising:
As browse request as described in determining be as described in user to as described in the first time browse request of media resource, described first number of visits is set to 0, the second number of visits is set to 0 simultaneously, and described 3rd number of visits is set to 1.
As shown in Figure 2, present embodiments provide a kind of medium browsing time digital control method, comprise the following steps:
S101: Media Resource Server receives the browse request to a certain media resource that user sends, carries user terminal cookie in described browse request;
Wherein, user terminal cookie browses number of visits to the actual of described media resource carrying this user.
S102: extract described media resource by actual the first number of visits browsed of described user from described cookie, and find in described Media Resource Server the described media resource that records by actual the second number of visits browsed of described user;
S103: according to described first number of visits and the second number of visits, is updated to the 3rd number of visits by described media resource by the actual number of visits browsed of described user.
Wherein, step S103 specifically comprises:
Select number of visits larger in described first number of visits and the second number of visits, as as described in larger number of visits be less than as described in the number of visits higher limit of media resource, then described larger number of visits is added 1, as described 3rd number of visits, otherwise, using described number of visits higher limit as described 3rd number of visits.
That is, first number of visits be preserve in user terminal cookie browse number of visits, second number of visits be record in Media Resource Server browse number of visits, after user browses this media resource, if do not exceeded, number of visits larger in both is added 1 as media resource in cookie and Media Resource Server by the actual unified number of visits browsed of described user, the 3rd number of visits is the renewal to the first number of visits and the second number of visits.
Or step S103 also specifically comprises:
Select number of visits larger in described first number of visits and the second number of visits, after then described larger number of visits being added 1, as described 3rd number of visits, as as described in the 3rd number of visits be less than as described in the number of visits higher limit of media resource, then the 3rd number of visits is attached in user terminal cookie, write-back user terminal cookie is to subscription client, and play this media resource for this user, upgrade simultaneously this user in described media server browse number of visits otherwise, no longer the 3rd number of visits is attached in user terminal cookie, write-back user terminal cookie is to subscription client, terminate this solicit operation, the number of visits of browsing of this user in described media server is updated to the 3rd number of visits.
As the preferred mode of one, in step s 102,
As browse request as described in determining be as described in user to as described in the first time browse request of media resource, described first number of visits is set to 0, the second number of visits is set to 0 simultaneously, and described 3rd number of visits is set to 1.
Preferably, if this user browses this media resource first time, unique identification can also be set for this user, then in the cookie of user terminal, write this user unique identification and the number of visits of browsing of this user to this media resource are 0, namely, described first number of visits is set to 0, in described Media Resource Server, preserve the number of visits of browsing that the unique identification of this user and described user browse this media resource is 0 simultaneously, namely, described second number of visits is set to 0, after user browses this media resource, the browse number of visits of this user to this media resource is designated as 1.
After described step S103, the present embodiment is further comprising the steps of:
As described in do not exist in cookie as described in the first number of visits as described in the first number of visits or existence be not equal to as described in the 3rd number of visits, described 3rd number of visits is write described cookie or the first number of visits in described cookie is updated to the 3rd number of visits, then cookie described in write-back is to the client of described user.
As described in do not have in Media Resource Server the second number of visits as described in record second number of visits or record be not equal to as described in the 3rd number of visits, then described 3rd number of visits is recorded as the second new number of visits.
In an application example, suppose that user A browses on online media sites, click media resource advertisement B, presetting the media resource number of visits upper limit is: fx=4.
As shown in Figure 3, this medium browsing number of times control flow is as follows:
Media resource request is sent to multimedia resource server by the terminal equipment of S201: user A, and carries the cookie data of user A, supposes that user A accesses this advertisement first;
S202: multimedia resource server obtains the cookie information of user A and arranges unique identification to user A, and extracts the number of visits record fa in the cookie information of user A; Meanwhile, the data fb that multimedia resource collects user A retains in number of visits database, because user A accesses advertisement B first, therefore fa=fb=0;
S203: the actual number of visits fc of setting user A, the rule according to " to be as the criterion greatly " draws fc=fa=fb=0;
S204: the size comparing fc and number of visits upper limit fx;
S205: owing to setting number of visits upper limit fx=4 in advance, then fc < fx, therefore write-back number of visits fc+1 is to Media Resource Server, and return media resource B to user A;
S206: the number of visits fc+1 after renewal is returned user A terminal and number of visits database by Media Resource Server respectively, the value upgrading fa and fb is 1, and program completes.
Further the present embodiment is described in following scene below.
Scene 1: number of visits information back user terminal failure
User A is access medium resource B again, repeats above step S201 to step S206, now fc=2.When the number of visits after renewal is returned user terminal by Media Resource Server.Because network reason causes the failure of cookie number of visits information back.Actual number of visits fa so on user terminal is still 1.In number of visits database, number of visits information fb is then updated to 2.
As user A third time access resources B, the cookie number of visits information fa=1 that Media Resource Server is collected from user terminal, from the number of visits information fb=2 that number of visits database is collected.The relatively size of fa and fb, by judging fc=fb=2 with the concept be as the criterion greatly.Due to fc < fx, write-back number of visits fc+1=3 is to user terminal and number of visits database and return media resource.
Scene 2: number of visits database write back information failure
When supposing multimedia resource server write-back number of visits information to number of visits database, database machine room has a power failure, the failure of number of visits write-back.Number of visits information fb so on number of visits database is still 2.And the actual number of visits value fa of user terminal is updated to 3.
When user A again access resources B time, repeat above step S201 to step S206, draw fc=fa=3.Because fc is still less than fx, write-back number of visits fc+1=4 return media resource then, upgrading fa and fb is 4.
Scene 3: number of visits reaches the number of visits upper limit, returns other media resources
As user A the 4th access resources B, repeat above step S201 to step S206.Due to fa=fb=4=fc=fx.Historical facts or anecdotes border number of visits reaches the preset browsing number of times upper limit.Retain every number of visits data, Media Resource Server is write-back and renewal number of visits data no longer, and return the media resource that other do not reach discreet value.
As can be seen from above-described embodiment, relative to prior art, the medium browsing provided in above-described embodiment time digital control method, device and Media Resource Server, preserve media resource by the actual number of visits data browsed in server end and user terminal cookie simultaneously, on the basis that single cookie number of visits controls, increase server number of visits control logic, framework is controlled with the number of visits forming stable dual-active, compensate for the dependence of conventional method to cookie, simultaneously, if cause the number of visits data distortion of server end due to cause specific, also the actual number of visits of the number of visits data in user terminal cookie as media resource can be extracted, improve the accuracy of the number of visits of user's browsing media resource, the number of visits achieved more accurately and effectively specific user browses particular media asset controls, avoid the waste to media resource injected volume.
The all or part of step that one of ordinary skill in the art will appreciate that in said method is carried out instruction related hardware by program and is completed, and described program can be stored in computer-readable recording medium, as read-only memory, disk or CD etc.Alternatively, all or part of step of above-described embodiment also can use one or more integrated circuit to realize.Correspondingly, each module/unit in above-described embodiment can adopt the form of hardware to realize, and the form of software function module also can be adopted to realize.The present invention is not restricted to the combination of the hardware and software of any particular form.
The foregoing is only the preferred embodiments of the present invention, be not intended to limit protection scope of the present invention.According to summary of the invention of the present invention; also can there be other various embodiments; when not deviating from the present invention's spirit and essence thereof; those of ordinary skill in the art are when making various corresponding change and distortion according to the present invention; within the spirit and principles in the present invention all; any amendment of doing, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.