Virtual resource control method, device, computer equipment and storage medium
By obtaining the expiration time of virtual resources after they are deposited into the account and automatically deleting them using timeout tasks, the problem of high server computing pressure when virtual resources expire is solved, and real-time expiration processing of virtual resources and server load reduction are achieved.
Patent Information
- Application Number
- CN202010983731.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-09-18
AI Technical Summary
In the existing technology, when virtual resources expire, the server needs to perform summary analysis and deletion operations on each user's issuance history data, which results in heavy computing pressure and may affect the normal business operation of the server.
By obtaining the expiration time of virtual resources after they are stored in the target account, searching and updating expiration records, and using timeout tasks to automatically delete virtual resources when the expiration time is reached, thereby reducing the computing pressure on the server.
It realizes real-time expiration detection and deletion of virtual resources, avoids setting expiration time and summary analysis in advance, reduces the load on the server, and ensures normal business operation.
Smart Images

Figure CN112100204B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a virtual resource control method, device, computer equipment and storage medium. Background Art
[0002] With the development of computer technology, more and more applications have emerged. In order to increase the stickiness of applications to users, virtual resources can usually be issued to users. For example, in e-commerce platforms, the virtual resources issued can be points, skins, virtual gifts or gold coins. In actual applications, the virtual resources issued to users usually have a validity period. After the validity period ends, the virtual resources need to be expired.
[0003] In the related technology, after reaching the preset expiration time, the server can summarize and analyze the historical data of virtual resource issuance for each user. After the summary analysis, the server can obtain the virtual resources that need to be expired for each user, and then the server can delete the virtual resources that need to be expired from the user's account.
[0004] However, in the related art, after reaching a preset expiration time, the server needs to simultaneously summarize and analyze the historical data of virtual resource issuance for each user, and simultaneously delete the virtual resources to be expired from the user's account. Therefore, the computing pressure on the server is relatively high, and in some cases, it may even affect the normal business operation of the server. Summary of the invention
[0005] Based on this, it is necessary to provide a virtual resource control method, device, computer equipment and storage medium to address the above technical problems, which can effectively solve the problem of excessive server operating pressure.
[0006] In a first aspect, a virtual resource control method is provided, the method comprising:
[0007] After the target virtual resource is deposited into the target account, a target expiration time of the target virtual resource is obtained; a target expiration record is searched according to the target expiration time and the identifier of the target account, the target expiration record including the identifier of the target account, the target expiration time and the first attribute information of the virtual resource that needs to be expired at the target expiration time; if the target expiration record is found, the first attribute information in the target expiration record is updated according to the second attribute information of the target virtual resource; when the target expiration time is reached, a timeout task corresponding to the target expiration record is executed, and through the timeout task, the virtual resource corresponding to the second attribute information in the target expiration record is deleted from the target account.
[0008] In one of the embodiments, the method further includes: if the target expiration record is not found, creating a target expiration record according to the target expiration time, the identifier of the target account and the second attribute information, and creating a timeout task corresponding to the target expiration record according to the target expiration time.
[0009] In one of the embodiments, obtaining a target expiration time of a target virtual resource includes: determining a target expiration rule according to at least one of an identifier of a target account and the second attribute information; and calculating the target expiration time based on the target expiration rule.
[0010] In one of the embodiments, a target expiration rule is determined based on at least one of an identifier of a target account and attribute information of a target virtual resource, including: searching a rule database for a candidate expiration rule that matches the identifier of the target account and at least one of the second attribute information, wherein a plurality of expiration rules are stored in the rule database; if the number of candidate expiration rules found is 1, the found candidate expiration rule is used as the target expiration rule; if the number of candidate expiration rules found is greater than 1, the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule.
[0011] In one of the embodiments, each expiration rule includes a list of users to which the rule applies, and searching a rule database for a candidate expiration rule that matches at least one of an identifier of a target account and second attribute information includes: searching the rule database for an expiration rule whose user list includes an identifier of the target account among multiple expiration rules included in the rule database, and using the found expiration rule as a candidate expiration rule.
[0012] In one of the embodiments, each expiration rule includes a threshold value for the number of virtual resources, and the second attribute information includes the number of target virtual resources. Searching a rule database for a candidate expiration rule that matches an identifier of the target account and at least one of the second attribute information includes: searching the rule database for an expiration rule whose threshold value for the number of virtual resources is less than the number of target virtual resources among multiple expiration rules included in the rule database, and using the found expiration rule as a candidate expiration rule.
[0013] In one embodiment, the target expiration rule includes an expiration time calculation method, and calculating the target expiration time based on the target expiration rule includes: calculating the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0014] In one of the embodiments, the above-mentioned virtual resource regulation method also includes: after receiving a virtual resource usage request for a target account, searching for each expired record corresponding to the identifier of the target account; respectively obtaining the expiration time corresponding to each expired record; sorting the virtual resources in the target account according to the expiration time corresponding to each expired record; and deleting the virtual resources from the target account according to the sorting according to the virtual resource usage request.
[0015] In one of the embodiments, after deleting the virtual resources from the target account in order according to the virtual resource usage request, the method further includes: obtaining third attribute information of the deleted virtual resources; and updating the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resources according to the third attribute information.
[0016] In a second aspect, a virtual resource control device is provided, the device comprising:
[0017] A first acquisition module, used for acquiring a target expiration time of the target virtual resource after the target virtual resource is deposited into the target account;
[0018] A first search module, in which a user searches for a target expiration record according to a target expiration time and an identifier of a target account, wherein the target expiration record includes the identifier of the target account, the target expiration time, and first attribute information of a virtual resource that needs to be expired at the target expiration time;
[0019] A first updating module, configured to update the first attribute information in the target expiration record according to the second attribute information of the target virtual resource when a target expiration record is found;
[0020] The first deletion module is used to execute a timeout task corresponding to the target expiration record when the target expiration time is reached, and delete the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task.
[0021] In one embodiment, the virtual resource control device further includes:
[0022] A creation module is used to create a target expiration record according to the target expiration time, the identifier of the target account and the second attribute information when no target expiration record is found, and to create a timeout task corresponding to the target expiration record according to the target expiration time.
[0023] In one embodiment, the first acquisition module includes:
[0024] A determination unit is used to determine a target expiration rule according to at least one of the identifier of the target account and the second attribute information.
[0025] A calculation unit is used to calculate the target expiration time based on the target expiration rule.
[0026] In one of the embodiments, the above-mentioned determination unit is specifically used to: search for a candidate expiration rule that matches at least one of the identification and the second attribute information of the target account in a rule database, wherein a plurality of expiration rules are stored in the rule database; if the number of the candidate expiration rules found is 1, then the candidate expiration rule found is used as the target expiration rule; if the number of the candidate expiration rules found is greater than 1, then obtain the weight of each candidate expiration rule, and use the candidate expiration rule with the highest weight as the target expiration rule.
[0027] In one embodiment, each expiration rule includes a user list to which the rule applies, and the above-mentioned determination unit is specifically used to: search for an expiration rule whose user list includes an identifier of the target account among multiple expiration rules included in the rule database, and use the found expiration rule as a candidate expiration rule.
[0028] In one of the embodiments, each expiration rule includes a virtual resource quantity threshold, and the above-mentioned determination unit is specifically used to: search for an expiration rule whose virtual resource quantity threshold is less than the target virtual resource quantity among multiple expiration rules included in the rule database, and use the found expiration rule as a candidate expiration rule.
[0029] In one of the embodiments, the target expiration rule includes an expiration time calculation method, and the above-mentioned calculation unit is specifically used to calculate the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0030] In one embodiment, the virtual resource control device further includes:
[0031] The second search module is used to search for each expired record corresponding to the identifier of the target account after receiving the virtual resource use request for the target account.
[0032] The second acquisition module is used to respectively acquire the expiration time corresponding to each expired record.
[0033] The sorting module is used to sort the virtual resources in the target account according to the expiration time corresponding to each expiration record.
[0034] The second deleting module is used to delete the virtual resources from the target account in order according to the virtual resource usage request.
[0035] In one embodiment, the virtual resource control device further includes:
[0036] The third acquisition module is used to acquire the third attribute information of the deleted virtual resource.
[0037] The second updating module is used to update the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource according to the third attribute information.
[0038] In a third aspect, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the virtual resource control method as described in any one of the first aspects is implemented.
[0039] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the virtual resource adjustment method described in any one of the first aspects is performed.
[0040] The above virtual resource control method, device, computer equipment and storage medium have at least the following beneficial effects:
[0041] After the target virtual resource is deposited into the target account, the target expiration time of the target virtual resource is obtained; and the target expiration record is searched according to the target expiration time and the identifier of the target account. When the target expiration record is found, the first attribute information in the target expiration record is updated according to the second attribute information of the target virtual resource. When the target expiration time is reached, the timeout task corresponding to the target expiration record is executed, and the virtual resource corresponding to the second attribute information in the target expiration record is deleted from the target account through the timeout task. The above-mentioned virtual resource control method obtains the target expiration time of the target virtual resource after the target virtual resource is deposited into the target account, and searches for the target expiration record. When the target expiration time is reached, the virtual resource to be deleted is deleted from the target account by executing the timeout task. In this way, there is no need to set the expiration time of the virtual resource in advance, and there is no need to summarize and analyze the historical data of virtual resource issuance of each user after reaching the set expiration time, and delete the virtual resources of all users who need to be expired from the account. Instead, the expiration time of the virtual resource is obtained after the virtual resource is stored in the user account, so that the expiration time of the virtual resource is different, and the expiration of the virtual resource can be detected in real time through the timeout task. When the virtual resource reaches the expiration time, the virtual resource that needs to be expired is deleted from the account by executing the timeout task. Therefore, the above method can disperse the work of the server deleting the virtual resources that need to be expired from the user's account, thereby reducing the computing pressure of the server and ensuring the normal business operation of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 An application environment diagram of a virtual resource control method in an embodiment;
[0043] Figure 2 A schematic diagram of a flow chart of a virtual resource control method in an embodiment;
[0044] Figure 3 A schematic diagram of a flow chart of virtual resource control steps in an embodiment;
[0045] Figure 4 A schematic diagram of virtual resource expiration rules in a virtual resource control method in an embodiment;
[0046] Figure 5 A schematic diagram of a flow chart of a virtual resource control method in another embodiment;
[0047] Figure 6 A schematic diagram showing the accumulation of virtual resource expiration in a virtual resource control method in one embodiment;
[0048] Figure 7 A schematic diagram of a flow chart of a virtual resource control method in another embodiment;
[0049] Figure 8 A schematic diagram of a flow chart of a virtual resource control method in another embodiment;
[0050] Fig. 9 is a structural block diagram of a virtual resource control device in another embodiment;
[0051] Fig.10 is a structural block diagram of a virtual resource control device in another embodiment;
[0052] Fig.11 is a structural block diagram of a virtual resource control device in another embodiment;
[0053] Fig.12 is a structural block diagram of a virtual resource control device in another embodiment;
[0054] Fig.13 FIG. 4 is a structural block diagram of a virtual resource control device in another embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] With the development of computer technology, more and more applications have emerged. In order to increase the stickiness of applications to users, virtual resources can usually be distributed to users, where the distributed virtual resources can be points, skins, virtual gifts or gold coins, etc. Users can use the distributed virtual resources to purchase virtual goods in the application or change the skin in the application. For example, in a live broadcast application, some virtual resources such as points, flowers, gold coins or virtual gifts can be distributed to users. Users can use the distributed virtual resources to give gifts to the anchor, or give the distributed virtual resources to other users to achieve connections between users.
[0057] The issuance and use of virtual resources increase users' interest in applications. In order to further increase the attractiveness of applications to users and the rate of users' use of applications, a validity period can be set for virtual resources so that users can use virtual resources as soon as possible within the specified validity period, increasing the stickiness of applications to users. Generally, the validity period of virtual resources can be one week, one month, or one year. During the validity period, users can use the virtual resources in their accounts. For example, during a live broadcast, users can use virtual resources in their accounts that are still valid to give gifts to the anchor, thereby increasing the interaction between users and the anchor. However, when the virtual resources in a user's account exceed the validity period, the user will no longer be able to use the virtual resources in the account.
[0058] For virtual resources that have exceeded their validity period, they need to be processed for expiration in a timely manner. In the prior art, after reaching the pre-set expiration time of the virtual resources, the server can summarize and analyze the historical data of virtual resource issuance for each user. After the summary analysis, the server can obtain the virtual resources that need to be processed for expiration for each user, and then the server can delete the virtual resources that need to be processed for expiration from the user's account. Since the expiration time set by the technician is relatively fixed, the server must analyze the historical data of virtual resource issuance for all users using the application at the fixed expiration time and delete the virtual resources that need to be processed for expiration. This is undoubtedly a huge workload, and therefore will cause a large computing pressure on the server. In some cases, it may even affect the normal business operation of the server.
[0059] Taking the above situation into consideration, an embodiment of the present application provides a virtual resource control method, in which, after the target virtual resource is deposited into the target account, the target expiration time of the target virtual resource is obtained; and the target expiration record is searched for according to the target expiration time and the identifier of the target account, and when the target expiration record is found, the first attribute information in the target expiration record is updated according to the second attribute information of the target virtual resource, and when the target expiration time is reached, the timeout task corresponding to the target expiration record is executed, and the virtual resource corresponding to the second attribute information in the target expiration record is deleted from the target account through the timeout task. The above-mentioned virtual resource control method, after the target virtual resource is deposited into the target account, obtains the target expiration time of the target virtual resource, and searches for the target expiration record, and when the target expiration time is reached, the virtual resource to be deleted is deleted from the target account by executing the timeout task. In this way, there is no need to set the expiration time of the virtual resources in advance, and there is no need to summarize and analyze the historical data of virtual resource issuance for each user after the set expiration time is reached, and delete the virtual resources of all users who need to be expired from the account. Instead, the expiration time of the virtual resources is obtained after the virtual resources are stored in the user account. Thus, the expiration time of the virtual resources is different, and the expiration of the virtual resources can be detected in real time through the timeout task. When the virtual resources reach the expiration time, the virtual resources that need to be expired are deleted from the target account by executing the timeout task. Therefore, the above method can disperse the work of the server deleting the virtual resources that need to be expired from the user's account, thereby reducing the computing pressure of the server and ensuring the normal business operation of the server.
[0060] The following briefly describes the application environment involved in the virtual resource control method provided in the embodiment of the present application.
[0061] The virtual resource control method provided in this application can be applied to Figure 1 The application environment is shown in the figure. The application environment provides a computer device, which can be a server, and its internal structure diagram can be as shown in the figure. Figure 1 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store virtual resource control data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a virtual resource control method is implemented.
[0062] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0063] Please refer to Figure 2 , which shows a flowchart of a virtual resource control method provided by an embodiment of the present application, the virtual resource control method can be applied to Figure 1 In the computer device in the implementation environment shown, the present application embodiment is only described with the computer device as a server. Figure 2 As shown, the virtual resource control method may include the following steps:
[0064] Step 201, after the target virtual resource is deposited into the target account, the server obtains the target expiration time of the target virtual resource.
[0065] The target account refers to an account of a user of an application in the application, and the target account is used to store virtual resources related to the application.
[0066] The target virtual resources refer to the virtual resources currently deposited in the target account. The target virtual resources may include at least one of points, skins, virtual gifts or gold coins. In the embodiment of the present application, the type of the target virtual resources is not specifically limited.
[0067] The target expiration time of the target virtual resource refers to the time when the target virtual resource needs to expire, which can be a certain time of a certain day, or a few days or months after the target virtual resource is deposited into the target account. In the embodiment of the present application, the target expiration time of the target virtual resource is not specifically limited.
[0068] In the embodiment of the present application, the user can obtain virtual resources in certain ways, for example, the user can obtain virtual resources by shopping in the application, signing in, answering questions, planting plants or raising animals in at least one way, and the embodiment of the present application does not specifically limit the way in which the user obtains virtual resources. After the user obtains the virtual resources, the server can deposit the obtained virtual resources into the user's corresponding account and calculate the expiration time of the obtained virtual resources.
[0069] Step 202: The server searches for a target expiration record according to the target expiration time and the identifier of the target account.
[0070] Among them, the identifier of the target account can be used to uniquely identify the target account.
[0071] In actual applications, the identifier of the target account can correspond to at least one expiration record, wherein different expiration records are used to record the attribute information of virtual resources in the target account that need to be expired at different expiration times. Each expiration record corresponding to the identifier of the target account can include the identifier of the target account, the expiration time, and the attribute information of the virtual resources that need to be expired at the expiration time.
[0072] In an embodiment of the present application, the server can search for at least one expiration record corresponding to the identifier of the target account in the server database based on the identifier of the target account, and then the server can search for the target expiration record in at least one expiration record corresponding to the identifier of the target account based on the target expiration time of the target virtual resource, wherein the target expiration record includes the identifier of the target account, the target expiration time, and first attribute information of the virtual resource that needs to be expired at the target expiration time. In an optional embodiment of the present application, the first attribute information may include at least one of the number of virtual resources and the type of virtual resources.
[0073] Step 203: If the target expiration record is found, the server updates the first attribute information in the target expiration record according to the second attribute information of the target virtual resource.
[0074] The second attribute information of the target virtual resource may include at least one of the quantity of the target virtual resource and the type of the target virtual resource. As described above, the first attribute information in the target expiration record may include at least one of the quantity of the virtual resource and the type of the virtual resource.
[0075] In an embodiment of the present application, when a target expiration record is found, the server can obtain the second attribute information of the target virtual resource by reading data, and update the first attribute information in the target expiration record according to the obtained second attribute information of the target virtual resource.
[0076] For example, the target expiration time of the target virtual resource is 16:00 on December 7, 2020. In the expiration record corresponding to the identifier of the target account, the expiration record with the expiration time recorded as 16:00 on December 7, 2020 is found as the target expiration record. The server reads the second attribute information of the target virtual resource, which may be 30 gold coins and 27 flowers. Then the server may increase the number of gold coins in the target expiration record by 30 and the number of flowers by 27. If the number of gold coins or flowers is not recorded in the target expiration record, the type of virtual resource corresponding to the gold coins or flowers is created in the target expiration record, and the number of the type of virtual resource corresponding to the gold coins or flowers is updated.
[0077] Step 204, when the target expiration time is reached, the server executes the timeout task corresponding to the target expiration record, and deletes the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task.
[0078] In an embodiment of the present application, when the target expiration time is reached, the server may execute a timeout task corresponding to the target expiration record. The timeout task corresponding to the target expiration record may be established by using the delay queue of the message middleware when the target expiration record is first created, and the execution time of the timeout task corresponding to the target expiration record is the target expiration time. The message middleware utilizes an efficient and reliable message passing mechanism to exchange data independently of the platform, and integrates distributed systems based on data communication. By providing a message passing and message queuing model, the message middleware can expand communication between processes in a distributed environment. A delay queue is a message queue with a delay function.
[0079] In an embodiment of the present application, when the target expiration time is reached, the timeout task corresponding to the target expiration record is triggered, and the server executes the timeout task corresponding to the target expiration task to delete the virtual resources corresponding to the second attribute information in the target expiration record in the target account.
[0080] In an embodiment of the present application, in the above-mentioned virtual resource control method, after the target virtual resource is deposited into the target account, the server obtains the target expiration time of the target virtual resource; and searches for the target expiration record according to the target expiration time and the identifier of the target account. In the case of finding the target expiration record, the server updates the first attribute information in the target expiration record according to the second attribute information of the target virtual resource. When the target expiration time is reached, the server executes the timeout task corresponding to the target expiration record, and deletes the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task. In the above-mentioned virtual resource control method, after the target virtual resource is deposited into the target account, the server obtains the target expiration time of the target virtual resource, and searches for the target expiration record. When the target expiration time is reached, the server deletes the virtual resource to be deleted from the target account by executing the timeout task. In this way, there is no need to set the expiration time of the virtual resource in advance, and the server does not need to summarize and analyze the historical data of virtual resource issuance of each user after reaching the set expiration time, and delete the virtual resources of all users who need to be expired from the account. Instead, the expiration time of the virtual resource is obtained after the virtual resource is stored in the user account, so that the expiration time of the virtual resource is different, and the expiration of the virtual resource can be detected in real time through the timeout task. When the virtual resource reaches the expiration time, the virtual resource that needs to be expired is deleted from the target account by executing the timeout task. The above method can disperse the work of the server deleting the virtual resources that need to be expired from the user's account, thereby reducing the computing pressure of the server and ensuring the normal business operation of the server.
[0081] As described above, the server can search for the target expiration record according to the target expiration time and the identifier of the target account. On this basis, the embodiment of the present application also includes the following situations:
[0082] If no target expiration record is found, a target expiration record is created according to the target expiration time, the identifier of the target account and the second attribute information, and a timeout task corresponding to the target expiration record is created according to the target expiration time.
[0083] In an embodiment of the present application, when the target expiration record is not found, the server creates a target expiration record according to the target expiration time, the identifier of the target account and the second attribute information, and creates a timeout task corresponding to the target expiration record according to the target expiration time. When the target expiration record is not found, it means that the target account has not previously deposited any virtual resources that need to be expired at the target expiration time. Therefore, it is necessary to create a target expiration record for the target expiration time, the identifier of the target account and the second attribute information, and create a timeout task corresponding to the target expiration record according to the target expiration time. The timeout task can delete the virtual resources in the target account that need to be expired at the target expiration time at the target expiration time. In this way, when other virtual resources that need to be expired at the same target expiration time are deposited in the subsequent target account, the attribute information of the virtual resources newly deposited in the target account can be recorded in the target expiration record by updating the attribute information in the target expiration record according to the attribute information of the virtual resources newly deposited in the target account, and all virtual resources that expire at the above target expiration time can be expired through the created timeout task. Therefore, the server can update the attribute information of the corresponding virtual resource in the expiration record through the corresponding timeout task at different expiration times, thereby reducing the operation pressure of the server.
[0084] Please refer to Figure 3 , which shows an exemplary technical process of "obtaining the target expiration time of the target virtual resource" provided by an embodiment of the present application, such as Figure 3 As shown, the technical process may include the following steps:
[0085] Step 301: The server determines a target expiration rule according to at least one of the identifier of the target account and the second attribute information.
[0086] In an embodiment of the present application, the server may determine the target expiration rule based on at least one of the target account identifier and the second attribute information. Figure 4 As shown, the expiration rule may include rule identification, rule status, rule effective time range, rule weight, rule applicable user list, rule action threshold, rule effective result, and extended fields, etc. The target expiration rule is an expiration rule that matches at least one of the identification and the second attribute information of the target account.
[0087] In the embodiment of the present application, the server may match the target expiration rule in the rule database according to the identifier of the target account, or may match the target expiration rule in the rule database according to the second attribute information of the target virtual resource, or may match the target expiration rule that matches the target virtual resource in the rule database according to both the identifier of the target account and the second attribute information of the target virtual resource. In the embodiment of the present application, how the server determines the target expiration rule is not specifically limited.
[0088] Step 302: The server calculates the target expiration time based on the target expiration rule.
[0089] This step can be achieved by the following method:
[0090] The server calculates the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0091] Optionally, the calculation method may be the time when the target virtual resource is deposited into the target account plus a period of time, which may be 7 days, 30 days or one year. In the embodiment of the present application, the calculation method of the expiration time included in the target expiration rule is not specifically limited.
[0092] In an embodiment of the present application, the server determines the target expiration rule according to at least one of the identifier of the target account and the second attribute information, and calculates the target expiration time based on the target expiration rule. Different target account identifiers and different second attribute information correspond to different expiration rules. The server determines the target expiration rule according to at least one of the identifier of the target account and the second attribute information, so that the target expiration rule is more applicable to the target virtual resource, and calculates the target expiration time of the target virtual resource based on the target expiration rule, so that the expiration time of the target virtual resource is more accurate, and ensures that the expiration time corresponding to different virtual resources is different, therefore, the server is implemented to delete different virtual resources in different user accounts at different times, which reduces the operating pressure of the server. In addition, in an embodiment of the present application, the server calculates the target expiration time of the target virtual resource based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule. Therefore, the specific expiration time of the target virtual resource can be clarified, and the server can delete the target virtual resource according to the specific expiration time of the target virtual resource. The server is clear about each time node of the virtual resource.
[0093] As described above, the server may determine the target expiration rule based on at least one of the identifier of the target account and the second attribute information. Figure 5As shown, the following embodiment of the present application will briefly describe an exemplary technical process of "determining a target expiration rule according to at least one of the identifier of the target account and the second attribute information", and the technical process may include the following steps:
[0094] Step 501: The server searches a rule database for a candidate expiration rule that matches at least one of the identifier and the second attribute information of the target account.
[0095] This step may include the following:
[0096] In one case, each expiration rule includes a user list to which the rule applies. An expiration rule whose user list includes the identifier of the target account is searched among multiple expiration rules included in the rule database, and the found expiration rule is used as a candidate expiration rule.
[0097] The rule database contains multiple expiration rules, and the rule database is stored in the server so that the server can obtain the rule database when needed. Optionally, an expiration rule can be applicable to multiple user accounts, so a user list applicable to a rule can include multiple account identifiers. Optionally, multiple user lists applicable to rules can be applicable to the same user account, so multiple user lists applicable to rules can include the same account identifier.
[0098] In an embodiment of the present application, the server can read the target account identifier, use the target account identifier to search the rule database for an expiration rule that includes the target account identifier in a user list to which the rule applies by screening, and use the found expiration rule as a candidate expiration rule.
[0099] In another case, each expiration rule includes a virtual resource quantity threshold, and the second attribute information includes the quantity of target virtual resources. An expiration rule whose virtual resource quantity threshold is less than the quantity of target virtual resources is searched among multiple expiration rules included in the rule database, and the searched expiration rule is used as a candidate expiration rule.
[0100] In an embodiment of the present application, each expiration rule includes a virtual resource quantity threshold, and the second attribute information of the virtual resource includes the quantity of the target virtual resource. Different expiration rules match different virtual resource quantity thresholds. Optionally, some expiration rules are applicable to a larger number of virtual resources, and some expiration rules are applicable to a smaller number of virtual resources.
[0101] In an embodiment of the present application, the server can read the quantity information of the target virtual resources, and use the quantity information of the target virtual resources to search the rule database for expiration rules whose virtual resource quantity threshold is less than the target virtual resource quantity by screening, and use the found expiration rules as candidate expiration rules.
[0102] Step 502 , detecting the number of candidate expiration rules found, if the number of candidate expiration rules found is 1, executing step 503 ; if the number of candidate expiration rules found is greater than 1, executing step 504 .
[0103] In step 503, the server uses the found candidate expiration rule as the target expiration rule and exits the process.
[0104] In step 504 , the server obtains the weight of each candidate expiration rule and executes step 505 .
[0105] Step 505: The server uses the candidate expiration rule with the highest weight as the target expiration rule.
[0106] In the embodiment of the present application, since different expiration rules have different scopes of application, the number of candidate expiration rules found by the server in the rule database based on at least one of the identification of the target account and the second attribute information is not fixed. The server can read the number of candidate expiration rules found by means of data reading and calculation. When the number of candidate expiration rules found is 1, the server uses the found candidate expiration rule as the target expiration rule; when the number of candidate expiration rules found is greater than 1, the server can read the rule weights in the candidate rules one by one, and arrange the candidate expiration rules in order from small to large or from large to small according to the rule weight, and select the candidate expiration rule with the largest weight as the target expiration rule. And a virtual resource expiration accumulation table can be generated according to the target expiration rule. Figure 6 As shown, the virtual resource expiration accumulation table may include information such as the expiration accumulation table identifier, account identifier, virtual resource expiration time, virtual resource cumulative balance, virtual resource remaining balance, and extended fields. Among them, the expiration rule weight may indicate the importance of the expiration rule. The greater the expiration rule weight, the more important the expiration rule.
[0107] In the embodiment of the present application, the server can search for an expiration rule whose user list includes the identifier of the target account among multiple expiration rules included in the rule database according to the user list to which the rules in each expiration rule apply, and use the found expiration rule as a candidate expiration rule. In addition, the server can also search for an expiration rule whose virtual resource quantity threshold is less than the number of target virtual resources among multiple expiration rules included in the rule database according to the virtual resource quantity threshold included in each expiration rule and the number of target virtual resources included in the second attribute information, and use the found expiration rule as a candidate expiration rule.
[0108] When the number of candidate expiration rules found is 1, the server uses the found candidate expiration rules as target expiration rules; when the number of candidate expiration rules found is greater than 1, the server obtains the weight of each candidate expiration rule, and uses the candidate expiration rule with the highest weight as the target expiration rule. In this way, after the target account deposits the target virtual resource, the server does not need to search the rule database one by one for the expiration rules that match the target virtual resource. Instead, the server accurately and quickly finds the candidate expiration rules applicable to the current user in the rule database based on at least one of the identification and the second attribute information of the target account, and determines the target expiration rule from a few candidate expiration rules based on the rule weight. Therefore, the server's computing workload is reduced, the server operation steps are simplified, and the pressure on the server operation is relieved. In addition, the target expiration rules selected by this method are more important and more matched with the virtual resources deposited in the user account, making the regulation of virtual resources more reasonable.
[0109] Please see Figure 7 , with respect to the virtual resource control method described in the above embodiment of the present application, it shows an exemplary technical process that the above virtual resource control method provided by the embodiment of the present application may also include, such as Figure 7 As shown, the technical process may include the following steps:
[0110] Step 701: After receiving a virtual resource use request for a target account, the server searches for each expired record corresponding to the identifier of the target account.
[0111] The use request of the virtual resource may be a user purchasing a commodity in an application, or a user giving a virtual resource to another user. In the embodiment of the present application, the use request of the virtual resource is not specifically limited. The virtual resource request may include a target account identifier, attribute information of the virtual resource, etc.
[0112] In an embodiment of the present application, after receiving a virtual resource use request for a target account, the server obtains the target account identifier and searches the server database for each expiration record of all virtual resources corresponding to the target account identifier based on the target account identifier.
[0113] Step 702: The server obtains the expiration time corresponding to each expiration record.
[0114] In an embodiment of the present application, after the server finds the expiration records of all virtual resources corresponding to the target account identifier in the database, it obtains the expiration time corresponding to the virtual resources in each expiration record by reading the attribute information of each expiration record.
[0115] Step 703: The server sorts the virtual resources in the target account according to the expiration time corresponding to each expiration record.
[0116] In an embodiment of the present application, after obtaining the expiration time corresponding to the virtual resources in each expiration record, the server sorts all virtual resources in the target account according to the expiration time corresponding to the virtual resources in each expiration record obtained. Optionally, the virtual resources can be sorted from early to late according to the expiration time of the virtual resources, or from late to early according to the expiration time of the virtual resources. In this embodiment of the present application, there is no specific limitation on the sorting of virtual resources.
[0117] Step 704: According to the virtual resource usage request, the server deletes the virtual resources from the target account in order. Optionally, after step 704 is completed, steps 705 and 706 may be performed.
[0118] In an embodiment of the present application, the server can delete the virtual resources with the earliest expiration time in the target account according to the order of the virtual resources in the target account. If the number of virtual resources with the earliest expiration time cannot meet the virtual resource usage request, the server will continue to delete the virtual resources with the second earliest expiration time, and so on, so that the server can delete the virtual resources from the target account according to the order.
[0119] Step 705: The server obtains the third attribute information of the deleted virtual resource.
[0120] In the embodiment of the present application, the server needs to obtain the third attribute information of the deleted virtual resource by data reading. The third attribute information of the virtual resource may include the account identification, quantity, type and expiration time of the deleted virtual resource. In the embodiment of the present application, the third attribute information of the virtual resource is not specifically limited.
[0121] Step 706: Based on the third attribute information, the server updates the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource.
[0122] In an embodiment of the present application, the server can update the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource according to the third attribute information of the deleted virtual resource. For example, the third attribute information of the deleted virtual resource is that the account identifier is A, the quantity is 50, the type is gold coins, and the expiration time is B. The server finds all the expiration records corresponding to the account identifier A, and finds the virtual resources corresponding to the expiration time B in the expiration record according to the expiration time of B, and reduces the number of virtual resources of the gold coin type by 50, thereby completing the update of the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource.
[0123] In an embodiment of the present application, after receiving a virtual resource use request for a target account, the server searches for each expiration record corresponding to the identifier of the target account, obtains the expiration time corresponding to each expiration record, and sorts the virtual resources in the target account according to the expiration time corresponding to each expiration record. According to the virtual resource use request, the server deletes the virtual resource from the target account according to the sorting. And obtains the third attribute information of the deleted virtual resource, and updates the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource according to the third attribute information. In the above method, the virtual resources to be deleted from the target account are sorted according to the expiration time, and the virtual resources with the earliest expiration time are used preferentially, rather than the virtual resources in the target account are deducted at will when the user uses the virtual resource. In this way, for virtual resources with a later expiration time, the user is left with enough time to use. In addition, the server promptly updates the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource according to the third attribute information of the deleted virtual resource. Thereby, the rationality of the user's use of virtual resources and the timeliness of deducting virtual resources are guaranteed, and the problem of large delay in virtual resource deduction is avoided.
[0124] Please refer to Figure 8 , which shows a flowchart of an exemplary virtual resource control method provided by an embodiment of the present application, which can be applied to Figure 1 In the computer device in the implementation environment shown. Figure 8 As shown, the method may include the following steps:
[0125] Step 801, after the target virtual resource is deposited into the target account, the computer device obtains the second attribute information of the target virtual resource and the identifier of the target account, wherein the second attribute information includes the quantity of the target virtual resource, and executes step 802 or / and step 803.
[0126] Step 802 , each expiration rule includes a user list to which the rule applies, and an expiration rule whose user list includes the identifier of the target account is searched among multiple expiration rules included in the rule database, and the found expiration rule is used as a candidate expiration rule, and step 804 is executed.
[0127] Step 803, each expiration rule includes a virtual resource quantity threshold, and an expiration rule whose virtual resource quantity threshold is less than the target virtual resource quantity is searched among the multiple expiration rules included in the rule database, and the found expiration rule is used as a candidate expiration rule, and step 804 is executed.
[0128] Step 804 , detecting the number of candidate expiration rules found, if the number of candidate expiration rules found is 1, executing step 805 ; if the number of candidate expiration rules found is greater than 1, executing step 806 .
[0129] In step 805, the server uses the found candidate expiration rule as the target expiration rule.
[0130] In step 806 , the server obtains the weight of each candidate expiration rule and executes step 807 .
[0131] In step 807 , the server uses the candidate expiration rule with the highest weight as the target expiration rule and executes step 808 .
[0132] Step 808: The server calculates the target expiration time based on the target expiration rule.
[0133] In step 809 , the server detects whether the target expiration record can be found according to the target expiration time and the detection identifier of the target account. If the target expiration record is found, step 810 is executed; if the target expiration record is not found, step 811 is executed.
[0134] Step 810 , the server updates the first attribute information in the target expiration record according to the second attribute information of the target virtual resource, and executes step 812 .
[0135] Step 811, the server creates a target expiration record according to the target expiration time, the identifier of the target account and the second attribute information, and creates a timeout task corresponding to the target expiration record according to the target expiration time, and executes step 812.
[0136] Step 812, when the target expiration time is reached, the server executes the timeout task corresponding to the target expiration record, and deletes the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task.
[0137] It should be understood that although Figure 2 , 3 The steps in the flowcharts of , 5, and 7 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , 3 At least part of the steps in , 5, and 7 may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these steps or stages does not necessarily have to be sequential, but can be executed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0138] In one embodiment of the present application, Figure 7As shown, a virtual resource control device 900 is provided, comprising: a first acquisition module 901, a first search module 902, a first update module 903 and a first deletion module 904, wherein:
[0139] The first acquisition module 901 is used to acquire a target expiration time of the target virtual resource after the target virtual resource is deposited into the target account.
[0140] In the first search module 902, the user searches for a target expiration record according to the target expiration time and the identifier of the target account. The target expiration record includes the identifier of the target account, the target expiration time, and the first attribute information of the virtual resource that needs to be expired at the target expiration time.
[0141] The first updating module 903 is used to update the first attribute information in the target expiration record according to the second attribute information of the target virtual resource when the target expiration record is found.
[0142] The first deletion module 904 is used to execute a timeout task corresponding to the target expiration record when the target expiration time is reached, and delete the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task.
[0143] Please refer to Fig.10 , which shows a block diagram of another virtual resource control device 1000 provided in an embodiment of the present application. In addition to the modules included in the virtual resource control device 900, the virtual resource control device 1000 may optionally further include a creation module 905:
[0144] A creation module is used to create a target expiration record according to the target expiration time, the identifier of the target account and the second attribute information when no target expiration record is found, and to create a timeout task corresponding to the target expiration record according to the target expiration time.
[0145] In an optional embodiment of the present application, Fig.11 As shown, the first acquisition module 901 in the virtual resource control provided in the above embodiment of the present application may include a determination unit 9011 and a calculation unit 9012:
[0146] The determination unit 9011 is used to determine a target expiration rule according to at least one of the identifier of the target account and the second attribute information.
[0147] The calculation unit 9012 is used to calculate the target expiration time based on the target expiration rule.
[0148] In an optional embodiment of the present application, the above-mentioned determination unit 7011 is specifically used to: search for a candidate expiration rule that matches at least one of the identification and the second attribute information of the target account in a rule database, wherein a plurality of expiration rules are stored in the rule database; if the number of the candidate expiration rules found is 1, the candidate expiration rule found is used as the target expiration rule; if the number of the candidate expiration rules found is greater than 1, the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule.
[0149] In an optional embodiment of the present application, each expiration rule includes a user list to which the rule applies, and the above-mentioned determination unit 9011 is specifically used to: search for an expiration rule whose user list includes an identifier of a target account among multiple expiration rules included in the rule database, and use the found expiration rule as a candidate expiration rule.
[0150] In an optional embodiment of the present application, each expiration rule includes a virtual resource quantity threshold, and the above-mentioned determination unit 9011 is specifically used to: search for an expiration rule whose virtual resource quantity threshold is less than the number of target virtual resources among the multiple expiration rules included in the rule database, and use the found expiration rule as a candidate expiration rule.
[0151] In an optional embodiment of the present application, the target expiration rule includes an expiration time calculation method, and the above-mentioned calculation unit 9012 is specifically used to calculate the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0152] Please refer to Fig.12 , which shows a block diagram of another virtual resource control device 1200 provided in an embodiment of the present application. In addition to the modules included in the resource control device 1000, the resource control device 1200 may also optionally include a second search module 906, a second acquisition module 907, a sorting module 908, and a deletion module 909:
[0153] The second search module 906 is used to search for each expired record corresponding to the identifier of the target account after receiving the virtual resource use request for the target account.
[0154] The second acquisition module 907 is used to respectively acquire the expiration time corresponding to each expiration record.
[0155] The sorting module 908 is used to sort the virtual resources in the target account according to the expiration time corresponding to each expiration record.
[0156] The second deleting module 909 is used to delete virtual resources from the target account in order according to the virtual resource usage request.
[0157] Please refer to Fig.13 , which shows a block diagram of another virtual resource control device 1300 provided in an embodiment of the present application. In addition to the modules included in the resource control device 1200, the resource control device 1300 may optionally further include a third acquisition module 910 and a second update module 911:
[0158] The third acquisition module 910 is used to acquire third attribute information of the deleted virtual resource.
[0159] The second updating module 911 is used to update the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource according to the third attribute information.
[0160] For the specific definition of the virtual resource control device, please refer to the definition of the virtual resource control method in the above text, which will not be repeated here. Each module in the above virtual resource control device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0161] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0162] After the target virtual resource is deposited into the target account, the target expiration time of the target virtual resource is obtained; the target expiration record is searched according to the target expiration time and the identifier of the target account, the target expiration record including the identifier of the target account, the target expiration time and the first attribute information of the virtual resource that needs to be expired at the target expiration time; if the target expiration record is found, the first attribute information in the target expiration record is updated according to the second attribute information of the target virtual resource; when the target expiration time is reached, the timeout task corresponding to the target expiration record is executed, and the virtual resource corresponding to the second attribute information in the target expiration record is deleted from the target account through the timeout task.
[0163] In one embodiment of the present application, the processor further implements the following steps when executing the computer program: if no target expiration record is found, a target expiration record is created based on the target expiration time, the identifier of the target account, and the second attribute information, and a timeout task corresponding to the target expiration record is created based on the target expiration time.
[0164] In one embodiment of the present application, when the processor executes the computer program, the following steps are also implemented: determining a target expiration rule based on the identifier of the target account and at least one of the second attribute information; and calculating the target expiration time based on the target expiration rule.
[0165] In one embodiment of the present application, when the processor executes the computer program, the following steps are also implemented: searching a rule database for a candidate expiration rule that matches at least one of the identifier and the second attribute information of the target account, wherein a plurality of expiration rules are stored in the rule database; if the number of candidate expiration rules found is 1, the candidate expiration rule found is used as the target expiration rule; if the number of candidate expiration rules found is greater than 1, the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule.
[0166] In one embodiment of the present application, each expiration rule includes a list of users to which the rule applies, and the processor further implements the following steps when executing the computer program: searching for an expiration rule whose user list includes an identifier of a target account among multiple expiration rules included in a rule database, and using the found expiration rule as a candidate expiration rule.
[0167] In one embodiment of the present application, each expiration rule includes a threshold value for the number of virtual resources, and the second attribute information includes the number of target virtual resources. When the processor executes the computer program, the following steps are also implemented: searching for an expiration rule whose threshold value for the number of virtual resources is less than the number of target virtual resources among multiple expiration rules included in the rule database, and using the found expiration rule as a candidate expiration rule.
[0168] In one embodiment of the present application, the target expiration rule includes an expiration time calculation method, and the processor also implements the following steps when executing the computer program: calculate the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0169] In one embodiment of the present application, the processor further implements the following steps when executing the computer program: after receiving a virtual resource usage request for a target account, searching for each expired record corresponding to the identifier of the target account; obtaining the expiration time corresponding to each expired record respectively; sorting the virtual resources in the target account according to the expiration time corresponding to each expired record; and deleting the virtual resources from the target account according to the sorting according to the virtual resource usage request.
[0170] In one embodiment of the present application, when the processor executes the computer program, it also implements the following steps: obtaining third attribute information of the deleted virtual resource; and updating the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource based on the third attribute information.
[0171] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0172] After the target virtual resource is deposited into the target account, the target expiration time of the target virtual resource is obtained; the target expiration record is searched according to the target expiration time and the identifier of the target account, the target expiration record including the identifier of the target account, the target expiration time and the first attribute information of the virtual resource that needs to be expired at the target expiration time; if the target expiration record is found, the first attribute information in the target expiration record is updated according to the second attribute information of the target virtual resource; when the target expiration time is reached, the timeout task corresponding to the target expiration record is executed, and the virtual resource corresponding to the second attribute information in the target expiration record is deleted from the target account through the timeout task.
[0173] In one embodiment of the present application, when the computer program is executed by the processor, the following steps are also implemented: if the target expiration record is not found, a target expiration record is created according to the target expiration time, the identifier of the target account and the second attribute information, and a timeout task corresponding to the target expiration record is created according to the target expiration time.
[0174] In one embodiment of the present application, when the computer program is executed by the processor, the following steps are also implemented: determining a target expiration rule based on the identifier of the target account and at least one of the second attribute information; and calculating the target expiration time based on the target expiration rule.
[0175] In one embodiment of the present application, when the computer program is executed by the processor, the following steps are also implemented: searching a rule database for a candidate expiration rule that matches at least one of the identifier and the second attribute information of the target account, wherein a plurality of expiration rules are stored in the rule database; if the number of candidate expiration rules found is 1, the candidate expiration rule found is used as the target expiration rule; if the number of candidate expiration rules found is greater than 1, the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule.
[0176] In one embodiment of the present application, each expiration rule includes a list of users to which the rule applies, and when the computer program is executed by the processor, the following steps are also implemented: searching for an expiration rule whose user list includes an identifier of a target account among multiple expiration rules included in a rule database, and using the found expiration rule as a candidate expiration rule.
[0177] In one embodiment of the present application, each expiration rule includes a threshold value for the number of virtual resources, and the second attribute information includes the number of target virtual resources. When the computer program is executed by the processor, the following steps are also implemented: searching for an expiration rule whose threshold value for the number of virtual resources is less than the number of target virtual resources among multiple expiration rules included in the rule database, and using the found expiration rule as a candidate expiration rule.
[0178] In one embodiment of the present application, the target expiration rule includes an expiration time calculation method, and the computer program, when executed by the processor, also implements the following steps: calculating the target expiration time based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
[0179] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are also implemented: after receiving a virtual resource usage request for a target account, searching for each expired record corresponding to the identifier of the target account; obtaining the expiration time corresponding to each expired record respectively; sorting the virtual resources in the target account according to the expiration time corresponding to each expired record; and deleting the virtual resources from the target account according to the sorting according to the virtual resource usage request.
[0180] In one embodiment of the present application, when the computer program is executed by the processor, the following steps are also implemented: obtaining third attribute information of the deleted virtual resource; and updating the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource based on the third attribute information.
[0181] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the embodiments of the above-mentioned methods when executed. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0182] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0183] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A virtual resource control method, characterized in that: The method comprises: After the target virtual resource is deposited into the target account, a target expiration time of the target virtual resource is obtained; Searching for a target expiration record according to the target expiration time and the identifier of the target account, wherein the target expiration record includes the identifier of the target account, the target expiration time, and first attribute information of a virtual resource that needs to be expired at the target expiration time; If the target expiration record is found, updating the first attribute information in the target expiration record according to the second attribute information of the target virtual resource, wherein the second attribute information includes the quantity of the target virtual resource and the type of the target virtual resource; When the target expiration time is reached, executing the timeout task corresponding to the target expiration record, deleting the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task, the timeout task is established when the target expiration record is created for the first time, and the execution time of the timeout task corresponding to the target expiration record is the target expiration time; The step of obtaining a target expiration time of the target virtual resource includes: Searching a rule database for a candidate expiration rule that matches at least one of the identifier of the target account and the second attribute information, wherein the rule database stores a plurality of expiration rules, and the expiration rules include a rule identifier, a rule status, a rule effective time range, a rule weight, a rule applicable user list, a rule action threshold, a rule effective result, and an extended field; If the number of the candidate expiration rules found is 1, the candidate expiration rules found are used as target expiration rules; If the number of the candidate expiration rules found is greater than 1, the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule; The target expiration time is calculated based on the target expiration rule.
2. The method according to claim 1, characterized in that: The method further comprises: If the target expiration record is not found, the target expiration record is created according to the target expiration time, the identifier of the target account and the second attribute information, and a timeout task corresponding to the target expiration record is created according to the target expiration time.
3. The method according to claim 1, characterized in that Each of the expiration rules includes a list of users to which the rule applies, and searching the rule database for a candidate expiration rule that matches at least one of the identifier of the target account and the second attribute information includes: The expiration rule whose user list includes the identifier of the target account is searched among the multiple expiration rules included in the rule database, and the found expiration rule is used as the candidate expiration rule.
4. The method according to claim 1, characterized in that: Each of the expiration rules includes a virtual resource quantity threshold, the second attribute information includes the quantity of the target virtual resource, and searching the rule database for a candidate expiration rule that matches at least one of the identifier of the target account and the second attribute information includes: An expiration rule whose virtual resource quantity threshold is less than the quantity of the target virtual resource is searched among the multiple expiration rules included in the rule database, and the searched expiration rule is used as the candidate expiration rule.
5. The method according to claim 1, characterized in that The method further comprises: A virtual resource expiration accumulation table is generated according to the target expiration rule, wherein the virtual resource expiration accumulation table includes an expiration accumulation table identifier, an account identifier, a virtual resource expiration time, a virtual resource accumulation balance, and a virtual resource remaining balance.
6. The method according to claim 1, characterized in that The target expiration rule includes an expiration time calculation method, and the calculation of the target expiration time based on the target expiration rule includes: The target expiration time is calculated based on the time when the target virtual resource is deposited into the target account and the expiration time calculation method included in the target expiration rule.
7. The method according to claim 1, characterized in that The method further comprises: After receiving the virtual resource use request for the target account, searching for each expired record corresponding to the identifier of the target account; Obtaining the expiration time corresponding to each of the expired records respectively; sorting the virtual resources in the target account according to the expiration times corresponding to the expiration records; According to the virtual resource use request, virtual resources are deleted from the target account according to the order.
8. The method according to claim 7, characterized in that After deleting the virtual resources from the target account according to the virtual resource use request and in accordance with the order, the method further includes: Obtaining the third attribute information of the deleted virtual resource; According to the third attribute information, the attribute information in the expiration record corresponding to the expiration time of the deleted virtual resource is updated.
9. A virtual resource control device, characterized in that: The device comprises: A first acquisition module, configured to acquire a target expiration time of the target virtual resource after the target virtual resource is deposited into the target account; A first search module is used to search for a target expiration record according to the target expiration time and the identifier of the target account, wherein the target expiration record includes the identifier of the target account, the target expiration time, and first attribute information of a virtual resource that needs to be expired at the target expiration time; A first updating module, configured to update the first attribute information in the target expiration record according to the second attribute information of the target virtual resource when the target expiration record is found, wherein the second attribute information includes the quantity of the target virtual resource and the type of the target virtual resource; A first deletion module, configured to execute a timeout task corresponding to the target expiration record when the target expiration time is reached, and to delete the virtual resource corresponding to the second attribute information in the target expiration record from the target account through the timeout task, wherein the timeout task is established when the target expiration record is created for the first time, and the execution time of the timeout task corresponding to the target expiration record is the target expiration time; Wherein, the first acquisition module includes: a determination unit, configured to search a rule database for a candidate expiration rule that matches the identifier of the target account and at least one of the second attribute information, wherein the rule database stores a plurality of expiration rules, wherein the expiration rule includes a rule identifier, a rule status, a rule effective time range, a rule weight, a rule applicable user list, a rule action threshold, a rule effective result, and an extension field; if the number of the candidate expiration rules found is 1, then the candidate expiration rule found is used as a target expiration rule; if the number of the candidate expiration rules found is greater than 1, then the weight of each candidate expiration rule is obtained, and the candidate expiration rule with the highest weight is used as the target expiration rule; A calculation unit is used to calculate the target expiration time based on the target expiration rule.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
