A resource management method and related apparatus
By recording the balance and changes of the total resource account and sub-resource accounts in a single account details table, the problems of slow update speed and high failure rate of virtual resource accounts are solved, thus achieving efficient resource management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-12-18
- Publication Date
- 2026-06-19
AI Technical Summary
In existing technologies, updating virtual resource accounts is slow and has a high failure rate, requiring the updating of multiple tables, which leads to inefficiency.
A single account details table is used to record the balance and changes of the total resource account and sub-resource accounts through structured balance and change information, reducing the number of updates, improving update speed and reducing failure rate.
A single account details table enables unified management of the main resource account and sub-resource accounts, improving update speed and reducing update failure rate.
Smart Images

Figure CN122243568A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a resource management method and related apparatus. Background Technology
[0002] Nowadays, some applications provide users with virtual resources for specific purposes in order to enrich the user experience, such as virtual coins and points for redeeming prizes.
[0003] In related technologies, the application's backend creates resource accounts for users to manage the virtual resources owned by those users. Specifically, for each user, a master resource account can be created, and several sub-resource accounts can be created under this master resource account as needed. Two tables need to be configured for the master resource account to record the total amount of resources and resource changes, respectively. Similarly, two tables need to be configured for each sub-resource account to record the total amount of resources and resource changes, respectively.
[0004] In the above scheme, if the virtual resources of the object change, in addition to updating the relevant sub-resource accounts and the total resource account, it is also necessary to update the tables associated with the relevant sub-resource accounts and the total resource account. Since there are many tables to be updated, there are problems of slow update speed and high update failure rate. Summary of the Invention
[0005] This application provides a resource management method and related apparatus that can improve the update speed of detailed information of resource accounts and reduce the update failure rate.
[0006] In view of the above, the first aspect of this application provides a resource management method, the method comprising:
[0007] Receive resource update requests for the target object;
[0008] Based on the resource update request, determine the resource change information of the target object;
[0009] Based on the balance information in the basic detailed record and the resource change information, an updated balance information is generated; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance information and the updated balance information are used to represent structured balance information, which includes the total resource account of the target object and the resource balance of each sub-resource account;
[0010] Based on the resource change information, account change content is generated; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information;
[0011] Add a new record to the account details table, and write the updated balance and account change information into the new record.
[0012] A second aspect of this application provides a resource management apparatus, the apparatus comprising:
[0013] The request receiving module is used to receive resource update requests for the target object;
[0014] The information determination module is used to determine the resource change information of the target object based on the resource update request;
[0015] The balance content generation module is used to generate updated balance content based on the balance content in the basic detailed record and the resource change information; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance content and the updated balance content are used to represent structured balance information, which includes the total resource account of the target object and the resource balance of each sub-resource account;
[0016] The change content generation module is used to generate account change content based on the resource change information; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information;
[0017] The account update module is used to add a new detail record in the account details table, and to write the updated balance content and the account change content into the new detail record.
[0018] Optionally, the balance content generation module is specifically used for:
[0019] Determine the total resource change corresponding to the resource change information, and determine the resource change of the target sub-resource account involved in the resource change information;
[0020] Based on the basic total resource balance and the change in total resources, the updated total resource balance is determined; the basic total resource balance is the resource balance of the total resource account in the structured balance information represented by the balance content;
[0021] Based on the basic resource balance of the target sub-resource account and the resource change of the target sub-resource account, the updated resource balance of the target sub-resource account is determined; the basic resource balance is the resource balance of the target sub-resource account in the structured balance information represented by the balance content;
[0022] Based on the total updated resource balance and the updated resource balance of the target sub-resource account, the structured balance information represented by the updated balance content is determined; the structured balance information represented by the updated balance content is serialized to obtain the updated balance content.
[0023] Optionally, the structured balance information further includes a resource identifier list corresponding to each of the sub-resource accounts, the resource identifier list including the identifier of each unit resource in the corresponding sub-resource account; the balance content generation module is further configured to:
[0024] Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account;
[0025] Based on the basic resource identifier list of the target sub-resource account and the changed resource identifier of the target sub-resource account, an updated resource identifier list of the target sub-resource account is determined; the basic resource identifier list is the resource identifier list of the target sub-resource account in the structured balance information represented by the balance content.
[0026] Based on the total updated resource balance, the updated resource balance of each target sub-resource account, and the updated resource identifier list of the target sub-resource accounts, the structured balance information represented by the updated balance content is determined.
[0027] Optionally, the change content generation module is specifically used for:
[0028] Determine the resource change type corresponding to the resource change information; the resource change type is used to indicate whether resources in the total resource account are increased or decreased.
[0029] Determine the amount of resource changes involved in the target sub-resource account related to the resource change information;
[0030] Based on the resource change type and the resource change amount of the target sub-resource account, structured change information representing the account change content is generated; the structured change information representing the account change content is serialized to obtain the account change content.
[0031] Optionally, the change content generation module is further configured to:
[0032] Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account;
[0033] Using the changed resource identifiers, a list of changed resource identifiers for the target sub-resource account is constructed;
[0034] Based on the resource change type, the resource change amount of the target sub-resource account, and the list of changed resource identifiers of the target sub-resource account, a structured change information representing the account change content is generated.
[0035] Optionally, the resource update request is generated in response to the completion of a resource acquisition task; the resource update request includes the resource acquisition type and the resource acquisition identifier list corresponding to the resource acquisition task, wherein the resource acquisition type is used to indicate the type of resource acquired, and the resource acquisition identifier list includes the identifiers of each unit resource acquired;
[0036] The information determination module is specifically used for:
[0037] The resource type and the list of resource identifiers included in the resource update request shall be used as the resource change information.
[0038] Optionally, the resource update request is generated in response to triggering a resource deduction task; the resource update request includes the task resource deduction amount corresponding to the resource deduction task;
[0039] The information determination module is specifically used for:
[0040] The type of resource to be deducted is determined based on the trigger time of the resource deduction task;
[0041] Locate the sub-resource account used to store the resources of the deducted resource type among the various sub-resource accounts of the target object, and use it as the deduction sub-resource account;
[0042] If the remaining resources in the deducted sub-resource account are greater than or equal to the task resource deduction amount, then the deducted sub-resource account will be used as the target sub-resource account.
[0043] If the remaining resources in the deducted sub-resource account are less than the task resource deduction amount, then an auxiliary sub-resource account is determined according to a preset rule, and both the deducted sub-resource account and the auxiliary sub-resource account are used as the target sub-resource account.
[0044] The resource change information is determined based on the account identifier of the target sub-resource account and the identifiers of each unit resource deducted from the target sub-resource account.
[0045] Optionally, the account details table further includes intermediate balance information, which is used to represent structured deduction resource information before the resource deduction task is completed. The structured deduction resource information includes the total resource deduction amount for the target object and the resource deduction amount for each sub-resource account to be deducted. The device further includes:
[0046] The intermediate balance generation module is used to generate updated intermediate balance content based on the intermediate balance content in the basic detailed record and the resource change information.
[0047] Optionally, the intermediate balance generation module is specifically used for:
[0048] Determine the total resource deduction amount corresponding to the resource change information, and determine the resource deduction amount of the target sub-resource account involved in the resource change information;
[0049] Based on the basic total resource deduction amount and the total resource deduction amount, the updated total resource deduction amount is determined; the basic total resource deduction amount is the total resource deduction amount in the structured deduction resource information represented by the intermediate balance content;
[0050] Based on the basic resource deduction amount and the resource deduction amount of the target sub-resource account, the updated resource deduction amount of the target sub-resource account is determined; the basic resource deduction amount is the resource deduction amount of the target sub-resource account in the structured deduction resource information represented by the intermediate balance content.
[0051] Based on the total updated resource deduction amount and the updated resource deduction amount of the target sub-resource account, the structured deduction resource information represented by the updated intermediate balance content is determined; the structured deduction resource information represented by the updated intermediate balance content is serialized to obtain the updated intermediate balance content.
[0052] Optionally, the account update module is also used for:
[0053] When the resource deduction task is successfully completed, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record.
[0054] Based on the account change information in the second reference record, the intermediate balance information in the first reference record is updated to obtain the post-processed intermediate balance information.
[0055] Add a new record to the account details table, and write the post-processing intermediate balance content into the new record.
[0056] Optionally, the account update module is also used for:
[0057] When the resource deduction task fails, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record.
[0058] Based on the account change information in the second reference record, the balance information and intermediate balance information in the first reference record are updated respectively to obtain the post-processed balance information and the post-processed intermediate balance information.
[0059] Add a new record to the account details table, and write the post-processing balance and the post-processing intermediate balance into the new record.
[0060] A third aspect of this application provides a computer device, the device comprising a processor and a memory:
[0061] The memory is used to store computer programs;
[0062] The processor is configured to execute the resource management method as described in the first aspect above, according to the computer program.
[0063] A fourth aspect of this application provides a computer-readable storage medium for storing a computer program that, when executed by a computer device, implements the resource management method described in the first aspect.
[0064] The fifth aspect of this application provides a computer program product comprising a computer program that, when executed by a processor, implements the resource management method described in the first aspect above.
[0065] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0066] This application provides a resource management method that uses an account detail table to achieve comprehensive management of the total resource account and various sub-resource accounts of a target object. Specifically, upon receiving a resource update request for the target object, the method first determines the resource change information of the target object, i.e., the method of changing the target object's resources, based on the resource update request. Then, the latest detail record in the target object's account detail table is obtained as the basic detail record. Based on the balance content in the basic detail record and the aforementioned resource change information, updated balance content is generated. Here, both the balance content in the basic detail record and the generated updated balance content are used to represent structured balance information. The structured balance information may specifically include the resource balance of the target object's total resource account and the resource balance of each sub-resource account of the target object. That is, the detail record stored in the account detail table includes a balance item, which can record both the resource balance of the total resource account and the resource balance of each sub-resource account through structured balance information, thereby achieving unified management of the resource balance of the target object's total resource account and various sub-resource accounts. In addition, account change information needs to be generated based on the aforementioned resource change information. This account change information represents structured change information, which specifically includes the type of resource change for the target object's total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts involved in this resource change. That is, the detailed record stored in the account details table also includes an account change item. The account change item records the type of resource change for the total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts that have undergone the change, through structured change information. This achieves unified management of the resource changes of the target object's total resource account and sub-resource accounts in a single resource change. Finally, a new detailed record is added to the account details table, which includes the updated balance information and account change information generated above. This completes the update of the target object's account details table in response to a resource update request for the target object. This application embodiment uses an account detail table to record content representing structured information, so that the detailed information of the target object's total resource account and each sub-resource account can be summarized and recorded in a single account detail table. When the resources of the target object change, the account detail table can be updated in the above manner, without having to update a large number of tables, thus improving the update speed of account detail content and reducing the update failure rate. Attached Figure Description
[0067] Figure 1 This is a schematic diagram of the tables configured for the main resource account and sub-resource accounts in related technologies;
[0068] Figure 2This is a schematic diagram illustrating an application scenario of the resource management method provided in the embodiments of this application;
[0069] Figure 3 A flowchart illustrating the resource management method provided in an embodiment of this application;
[0070] Figure 4 A schematic diagram of an account details table provided for an embodiment of this application;
[0071] Figure 5 This is a schematic diagram of structured balance information provided in an embodiment of this application;
[0072] Figure 6 This is a schematic diagram illustrating a method for describing structured balance information provided in an embodiment of this application;
[0073] Figure 7 This is a schematic diagram of structured change information provided in an embodiment of this application;
[0074] Figure 8 This is a schematic diagram illustrating a structured change information description method provided in an embodiment of this application;
[0075] Figure 9 A schematic diagram of another account statement provided for an embodiment of this application;
[0076] Figure 10 This is a schematic diagram of the structure of the resource management device provided in the embodiments of this application;
[0077] Figure 11 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application;
[0078] Figure 12 This is a schematic diagram of the server structure provided in an embodiment of this application. Detailed Implementation
[0079] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0080] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0081] In related technologies, when managing the virtual resources of an object, a master resource account and several sub-resource accounts are created for that object. The virtual resources in the sub-resource accounts constitute the master resource account; these sub-resource accounts can be divided according to the type of virtual resource, that is, different sub-resource accounts are used for different types of virtual resources.
[0082] Two tables can be configured for the overall resource account mentioned above, one to record the total resource amount and the other to record resource changes. Similarly, two tables can be configured for each sub-resource account, one to record the total resource amount and the other to record resource changes. See also... Figure 1 , Figure 1 This is a schematic diagram of the tables configured for the main resource account and sub-resource accounts in related technologies. Table a records the balance of the main resource account, table b records the changes in the balance of the main resource account, table c records the balance of a sub-resource account (Year of the Rabbit account), and table d records the changes in the balance of the sub-resource account. Tables a, b, c, and d can be linked by account IDs, and each time the balance of a resource account (including the main resource account and sub-resource accounts) changes in tables a, b, c, and d, the account version number of that resource account will increment by one.
[0083] In the above scheme, when the virtual resources of an object change, the relevant tables for the sub-resource accounts involved in the resource change, as well as the relevant tables for the overall resource account, need to be updated. (Continuing with...) Figure 1Taking the example shown, when the balance of the Year of the Rabbit account changes, a new record for the Year of the Rabbit account balance needs to be added to table c, a record showing the change in the Year of the Rabbit account balance during this change needs to be added to table d, a new record for the total resource account balance needs to be added to table a, and a record showing the change in the total resource account balance during this change needs to be added to table b. It is evident that when the virtual resources of an object change, the solutions in related technologies require updating a large number of tables, and the number of tables to be updated increases linearly with the increase in the number of sub-resource accounts involved in the resource change. This results in problems such as slow update speed for detailed information on resource accounts and a high failure rate.
[0084] To address the aforementioned issues, this application provides a resource management method. This method can achieve comprehensive management of the total resource account and various sub-resource accounts of a target object through a single account detail table. When the resources of the target object change, only the account detail table needs to be updated, eliminating the need to update numerous tables, thus improving the speed of updating account details and reducing the update failure rate.
[0085] It should be noted that the resource management method provided in this application embodiment can be executed by a computer device, which can be a terminal device or a server. Terminal devices include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The server can be an independent physical server, a server cluster composed of multiple physical servers, a distributed system, or a cloud server.
[0086] Furthermore, the information, data, and signals involved in the embodiments of this application are all authorized by the relevant parties or fully authorized by all parties, and the collection, use, and processing of the relevant data comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0087] To facilitate understanding of the resource management method provided in the embodiments of this application, the following example uses a server as the execution subject of the resource management method to illustrate the application scenarios of the resource management method.
[0088] See Figure 2 , Figure 2 This is a schematic diagram illustrating an application scenario of the resource management method provided in an embodiment of this application. For example... Figure 2As shown, this application scenario includes a terminal device 210 and a server 220. The terminal device 210 and the server 220 can communicate directly or indirectly via wired or wireless networks. The terminal device 210 is oriented towards a target object, and a target application runs on the terminal device 210. The target object possesses virtual resources with specific purposes within the target application, such as virtual coins or points. The server 220 is the backend server for the target application, used to execute the resource management method provided in this embodiment.
[0089] In practical applications, the target object can trigger operations to update its own virtual resources through the target application running on the terminal device 210. Examples of such operations include acquiring virtual resources, redeeming prizes using virtual resources, and gifting virtual resources. In response to these operations, the terminal device 210 can generate a resource update request for the target object and send it to the server 220.
[0090] After receiving a resource update request for the target object, server 220 can first determine the resource change information of the target object based on the resource update request, that is, determine the method of changing the resources of the target object.
[0091] Then, server 220 can obtain the latest detailed record in the target object's account details table as the basic detailed record. Based on the balance content in this basic detailed record and the aforementioned resource change information, updated balance content is generated. Here, both the balance content in the basic detailed record and the generated updated balance content are used to represent structured balance information. Specifically, the structured balance information may include the resource balance of the target object's total resource account and the resource balance of each sub-resource account of the target object. That is, the detailed record stored in the account details table includes a balance item. The balance content can record the resource balance of the total resource account and the resource balance of each sub-resource account simultaneously through structured balance information, thereby achieving unified management of the resource balance of the target object's total resource account and each sub-resource account.
[0092] Furthermore, server 220 can also generate account change content based on the aforementioned resource change information. This account change content represents structured change information, which specifically includes the type of resource change for the target object's total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts involved in this resource change. That is, the detailed record stored in the account details table also includes an account change item. This account change content, through structured change information, records the type of resource change for the total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts that have undergone the change. This achieves unified management of the resource changes for the target object's total resource account and sub-resource accounts in a single resource change.
[0093] Finally, server 220 can add a new record to the account details table, which includes the updated balance and account change information generated above. This completes the update of the account details table of the target object in response to the resource update request for the target object.
[0094] It should be understood that Figure 1 The application scenarios shown are merely examples. In practical applications, the resource management method provided in this application embodiment can also be applied to other scenarios. No limitations are made here on the application scenarios of the resource management method provided in this application embodiment.
[0095] The resource management method provided in this application will be described in detail below through method embodiments.
[0096] See Figure 3 , Figure 3 This is a flowchart illustrating the resource management method provided in an embodiment of this application. Figure 3 As shown, this resource management method includes the following steps:
[0097] Step 301: Receive a resource update request for the target object.
[0098] In this embodiment, the target object can be any user of the target application. The target application is an application that provides virtual resources with a specific purpose to the user; such applications include social applications, shopping applications, game applications, media playback applications, office applications, etc. The virtual resources provided by the target application have a specific purpose, such as redeeming prizes or providing shopping discounts; these virtual resources can be, for example, virtual coins or points.
[0099] For example, the target application mentioned above can be a social application with online payment functionality. Each time a user completes an online payment through the target application, the background of the target application can issue a specific number of virtual resources to the user. The user can accumulate virtual resources, and after accumulating a certain number, the user can use the accumulated virtual resources to redeem prizes through the target application, or the user can use the accumulated virtual resources to offset the amount when making online payments through the target application.
[0100] A resource update request is a request message used to instruct changes to the virtual resources of a target object. This resource update request can be generated in response to a resource change operation triggered by the target object; for example, the target object can trigger a resource change operation through a target application, such as triggering an operation to acquire virtual resources, triggering an operation to redeem prizes using virtual resources, triggering an operation to gift virtual resources to other objects, etc. In response to this resource change operation, the target application can directly generate a corresponding resource update request, or it can notify the relevant background service to generate the corresponding resource update request. The resource update request can also be automatically generated by the relevant background service; for example, in a scenario where a validity period is set for virtual resources, when the background service detects that a virtual resource of the target object has reached its validity period, it can automatically generate the corresponding resource update request. It should be understood that the above methods of generating resource update requests are merely examples, and this application embodiment does not limit the method of generating resource update requests in any way.
[0101] Resource update requests typically carry indications related to resource changes. For example, they may carry a resource change quantity indicating the number of virtual resources to be changed. This quantity can specifically indicate the number of virtual resources to be changed in the total resource account or in a specific sub-resource account. Another example is the carrying of a changed resource type and a changed resource identifier. The changed resource type indicates the type of virtual resource to be changed, and the changed resource identifier is the unique code (IdentityDocument, ID) of the unit resource (i.e., a single virtual resource) to be changed. Of course, in practical applications, resource update requests may also carry other information; this embodiment does not limit the information carried in the resource update request.
[0102] As an example, when the resource management method in this embodiment is executed by a target server providing resource management services, the target server can receive a resource update request for a target object sent by a terminal device. Specifically, the target object can trigger a resource change operation through a target application running on the terminal device to change its virtual resources in the target application; in response to the resource change operation, the terminal device can generate a resource update request based on the amount of resource change corresponding to the resource change operation and send the resource update request to the target server.
[0103] As another example, when the resource management method in this embodiment is executed by a target server providing resource management services, the target server can receive resource update requests for the target object sent by other servers. Specifically, after the target object triggers a resource change operation through a target application running on a terminal device, the terminal device can first generate a resource change request and send it to other servers; for example, after the target object triggers a resource acquisition operation through a target application on the terminal device, it can first generate a resource change request indicating the quantity of virtual resources to be acquired and send it to the server providing resource allocation services. After receiving the resource change request, other servers can generate more specific indication information related to this resource change, add this indication information to the resource update request, and send the resource update request to the target server; for example, after receiving the resource change request sent by the terminal device, the server providing resource allocation services can determine the changed resource type and changed resource identifier corresponding to this resource change, add the changed resource type and changed resource identifier to the resource update request, and send the resource update request to the target server.
[0104] Step 302: Based on the resource update request, determine the resource change information of the target object.
[0105] Resource change information is used to indicate how changes are made to the resource accounts of a target object. In other words, resource change information can indicate how to change the total resource account of the target object and how to change the sub-resource accounts of the target object.
[0106] In one possible implementation, when determining resource change information based on a resource update request, the indication information carried in the resource update request can be directly used as the resource change information. For example, if the indication information carried in the resource update request is a change in resource type and a change in resource identifier, these can be directly used as the resource change information. The reason for this is that, typically, sub-resource accounts are divided based on resource type; different sub-resource accounts are used to store virtual resources of different types. For instance, when the virtual resource is virtual coins, the resource type can be divided by the Chinese zodiac, and different sub-resource accounts can be used to store virtual coins corresponding to different zodiac signs. Therefore, when the resource update request carries a change in resource type, the sub-resource account that needs to undergo resource change can be directly identified. Furthermore, the change in resource identifier indicates the unique identifier of each unit resource that needs to be changed, such as the unique identifier of each virtual coin that needs to be changed. Therefore, when the resource update request carries a change in resource identifier, the unit resource that needs to be changed and the corresponding amount of resource change can be directly identified. Since the above content can be clearly identified through the instruction information carried in the resource update request, and the above content clearly indicates the method of changing the resource account of the target object, the instruction information carried in the resource update request can be directly used as the resource change information.
[0107] In another possible implementation, when determining resource change information based on a resource update request, a resource change plan for the target object's resource account can be determined based on the indication information carried in the resource update request. Then, information indicating this resource change plan is generated as the resource change information. For example, if the indication information carried in the resource update request is the amount of resource change, a resource change plan for the target object's resource account can be formulated first based on this amount. This plan clarifies the sub-resource accounts that need resource changes and the virtual resources within those sub-resource accounts that need to be changed. Then, resource change information indicating this plan is generated. For example, the resource type of the virtual resources stored in the sub-resource accounts that need resource changes can be used as the changed resource type, and the identifier of the unit resource in the sub-resource accounts that needs to be changed can be used as the changed resource identifier. This changed resource type and changed resource identifier are then used as the resource change information.
[0108] Step 303: Generate updated balance information based on the balance information in the basic detailed record and the resource change information; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance information and the updated balance information are used to represent structured balance information, which includes the total resource account and the resource balance of each sub-resource account of the target object.
[0109] The basic detailed record is the latest record in the target object's account detailed table. The target object's account detailed table records detailed information related to the target object's resource accounts. Specifically, it records the detailed information of the target object's total resource account and the detailed information of each of the target object's sub-resource accounts. The detailed information of resource accounts (including the total resource account and each sub-resource account) can include the remaining resource balance in the resource account, changes in the resource account, etc. Each time a resource account of the target object undergoes a resource change, a new detailed record corresponding to this resource change will be added to the account detailed table. This detailed record records the detailed information related to this resource change, such as the remaining resource balance in the resource account after the change, and the changes in the resource account during the change.
[0110] The detailed records in the aforementioned account statement can record balance information. This balance information can represent structured balance information. Specifically, the balance information can be serialized to obtain the balance information used to represent it. The balance information can be represented as a string corresponding to the structured balance information. The structured balance information includes at least the resource balance of the target object's total resource account and the resource balance of each sub-resource account of the target object. Optionally, the structured balance information may also include the account type corresponding to each sub-resource account and the resource identifier list corresponding to each sub-resource account. The account type corresponding to a sub-resource account can indicate the resource type of the virtual resources stored in that sub-resource account, and the resource identifier list corresponding to a sub-resource account can include the identifiers of each unit resource in that sub-resource account.
[0111] Figure 4 This is a schematic diagram of an account details table provided in an embodiment of this application. Figure 4As shown, the account details table includes several detailed records for the target object (account ID: Alice). Each detailed record corresponds to an account serial number. Each time a new detailed record is added to the table, the account serial number corresponding to the previous record is incremented by one to obtain the new account serial number. This account serial number is used to represent the number of times the detailed record table has been updated. Each detailed record includes a column for available balance, which records the balance information mentioned above, i.e., the serialized content corresponding to the structured balance information.
[0112] Figure 5 This is a schematic diagram illustrating structured balance information provided in an embodiment of this application. Figure 5 As shown, the structured balance information includes the total resource balance of the target object's resource account, as well as a list of sub-resource accounts. The list of sub-resource accounts includes relevant information about each sub-resource account of the target object. Specifically, the relevant information about each sub-resource account includes the account type corresponding to the sub-resource account, the resource balance of the sub-resource account, and the resource identifier list corresponding to the sub-resource account. The resource identifier list corresponding to the sub-resource account includes the identifiers of each unit of resource in the sub-resource account.
[0113] Using the data structure serialization tool (Protocol Buffer, Protobuf) to describe the above structured balance information, we can obtain... Figure 6 The diagram illustrates a method for describing structured balance information. In this method, the sub_acct_type field records the account type corresponding to the sub-resource account, the sub_balance field records the resource balance of the sub-resource account, the coin_ids field records the list of resource identifiers corresponding to the sub-resource account, the balance field records the resource balance of the total resource account, and the sub_accounts field records the list of sub-resource accounts.
[0114] Based on the update rules for the detailed records in the aforementioned account details table, the basic detailed record corresponds to the most recent resource change of the target object's resource account. Accordingly, the balance information recorded in this basic detailed record can represent the current resource balance of the target object's resource account, that is, the current resource balance of the target object's total resource account and the current resource balance of each of the target object's sub-resource accounts. Therefore, the updated balance information can be determined based on the balance information in this basic detailed record and the resource change information used to represent this resource change. This updated balance information indicates the resource balance of the target object's resource account after this resource change, that is, the resource balance of the target object's total resource account and the resource balance of each of the target object's sub-resource accounts after this resource change.
[0115] It should be understood that the aforementioned updated balance content is essentially the balance content in the detailed records to be added to the account details table. That is, this updated balance content also represents structured balance information; however, it represents the structured balance information after this resource change. Specifically, the structured balance information represented by this updated balance content may include: the total resource balance of the target object's total resource account after this resource change, the resource balance of each sub-resource account of the target object after this resource change, and optionally, the account type corresponding to each sub-resource account of the target object, and the resource identifier list corresponding to each sub-resource account after this resource change. For details of the structured balance information represented by this updated balance content, please refer to [link to relevant documentation]. Figure 5 and Figure 6 The content indicated.
[0116] In one possible implementation, step 303 above, "generating updated balance content based on the balance content in the basic detailed record and the resource change information," may specifically include the following steps 3031 to 3034 (not shown in the figure):
[0117] Step 3031: Determine the total resource change corresponding to the resource change information, and determine the resource change of the target sub-resource account involved in the resource change information.
[0118] Specifically, based on the resource change information, the total resource change corresponding to this resource change can be determined; this total resource change refers to the resource change of the target object's total resource accounts. Furthermore, based on the resource change information, the target sub-resource accounts involved in this resource change, and the resource change of those target sub-resource accounts, can also be determined; these target sub-resource accounts are the sub-resource accounts whose resources have changed in this resource change, and they are at least one of the target object's various sub-resource accounts. The resource change of these target sub-resource accounts refers to the resource change of those target sub-resource accounts in this resource change.
[0119] For example, when the resource change information includes a changed resource type and a changed resource identifier, for each changed resource type, a sub-resource account for storing virtual resources of that changed resource type can be determined as the target sub-resource account; and the resource change amount of the target sub-resource account can be determined based on the number of changed resource identifiers belonging to the unit resource of that changed resource type in each changed resource identifier. Furthermore, the total number of changed resource identifiers in the resource change information indicates the total resource change amount.
[0120] Step 3032: Determine the updated total resource balance based on the basic total resource balance and the total resource change; the basic total resource balance is the resource balance of the total resource account in the structured balance information represented by the balance content.
[0121] After obtaining the basic detailed record, the structured balance information represented by the balance content in the basic detailed record can be further determined, and the resource balance of the total resource account can be obtained from the structured balance information, and the resource balance is used as the basic total resource balance.
[0122] Then, the basic total resource balance and the total resource change determined in step 3031 above are summed to obtain the updated total resource balance. This updated total resource balance is the resource balance of the total resource account in the structured balance information represented by the updated balance content. In other words, this updated total resource balance represents the resource balance of the target object's total resource account after this resource change. It should be understood that the total resource change determined in step 3031 above can be a positive value (indicating an increase in resources in the total resource account) or a negative value (indicating a decrease in resources in the total resource account).
[0123] Step 3033: Based on the basic resource balance of the target sub-resource account and the resource change of the target sub-resource account, determine the updated resource balance of the target sub-resource account; the basic resource balance is the resource balance of the target sub-resource account in the structured balance information represented by the balance content.
[0124] After obtaining the basic detailed records, the structured balance information represented by the balance content in the basic detailed records can be further determined, and the resource balance of each target sub-resource account can be obtained from the structured balance information as the basic resource balance of each target sub-resource account.
[0125] Furthermore, for each target sub-resource account, the basic resource balance of that target sub-resource account and the resource change determined in step 3031 above are summed to obtain the updated resource balance of that target sub-resource account. This updated resource balance is the resource balance of that target sub-resource account in the structured balance information represented by the updated balance content; that is, the updated resource balance represents the resource balance of the target sub-resource account after this resource change. It should be understood that the resource change of the target sub-resource account determined in step 3031 above can be a positive value (indicating an increase in resources in the target sub-resource account) or a negative value (indicating a decrease in resources in the target sub-resource account).
[0126] It should be understood that in practical applications, step 3032 can be executed first and then step 3033, or step 3033 can be executed first and then step 3032, or steps 3032 and 3033 can be executed simultaneously. This application embodiment does not impose any limitation on the execution order of steps 3032 and 3033.
[0127] Step 3034: Based on the total updated resource balance and the updated resource balance of the target sub-resource account, determine the structured balance information represented by the updated balance content; perform serialization processing on the structured balance information represented by the updated balance content to obtain the updated balance content.
[0128] After determining the total updated resource balance corresponding to the total resource account and the updated resource balance corresponding to each target sub-resource account, structured balance information representing the updated balance content can be generated based on the total updated resource balance corresponding to the total resource account, the updated resource balance corresponding to each target sub-resource account, and the resource balance corresponding to each non-target sub-resource account. Here, non-target sub-resource accounts refer to other sub-resource accounts among the target object's sub-resource accounts besides the target sub-resource account. Since these sub-resource accounts have not undergone resource changes in this resource change, the resource balance of these sub-resource accounts recorded in the balance content of the basic detailed record can be directly used to participate in generating the structured balance information representing the updated balance content.
[0129] When generating structured balance information representing the updated balance content, the total updated resource balance corresponding to the total resource account, the updated resource balance corresponding to each target sub-resource account, and the resource balance corresponding to each non-target sub-resource account can be filled into a preset balance information structure. This balance information structure can be, for example, […]. Figure 6 The description method shown.
[0130] Furthermore, a serialization tool can be used to serialize the structured balance information represented by the updated balance content to obtain the corresponding serialized content, which is the updated balance content.
[0131] Thus, by determining the balance content in the detailed records using the above method, it can be ensured that the structured balance information represented by this balance content can comprehensively reflect the resource balance of the total resource account and the resource balance of each sub-resource account. Furthermore, the resource balance of the total resource account and the resource balance of each sub-resource account reflected in the structured balance information can accurately change with resource changes. When resource changes occur, updating the account detailed records by generating structured balance information can also avoid the problems caused by updating multiple tables in related technologies, helping to improve the efficiency and success rate of detailed record updates.
[0132] Optionally, if the structured balance information also includes a list of resource identifiers corresponding to each sub-resource account of the target object, and the list of resource identifiers includes the identifiers of each unit resource in the corresponding sub-resource account (the identifier of a unit resource can be, for example, the coin ID of a single virtual coin), the method provided in this application embodiment may further include the following steps 11 and 12:
[0133] Step 11: Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account.
[0134] Specifically, as described above, when the resource change information includes the changed resource type and the changed resource identifier, for each changed resource type, a sub-resource account for storing the virtual resources of that changed resource type can be identified as the target sub-resource account; and the changed resource identifier of the unit resource belonging to that changed resource type can be identified from each changed resource identifier as the changed resource identifier corresponding to the target sub-resource account.
[0135] Step 12: Based on the basic resource identifier list of the target sub-resource account and the changed resource identifier of the target sub-resource account, determine the updated resource identifier list of the target sub-resource account; the basic resource identifier list is the resource identifier list of the target sub-resource account in the structured balance information represented by the balance content.
[0136] When the structured balance information represented by the balance content also includes a list of resource identifiers corresponding to each sub-resource account, after obtaining the basic detailed record, the structured balance information represented by the balance content in the basic detailed record can be further determined, and the list of resource identifiers for each target sub-resource account can be obtained from the structured balance information as the basic resource identifier list for each target sub-resource account.
[0137] Furthermore, for each target sub-resource account, the corresponding change resource identifier is added to or removed from the basic resource identifier list of that target sub-resource account, resulting in an updated resource identifier list for that target sub-resource account. This updated resource identifier list is the list of resource identifiers corresponding to that target sub-resource account in the structured balance information represented by the updated balance content; that is, this updated resource identifier list represents the specific unit resources included in that target sub-resource account after this resource change. It should be understood that when resources in a target sub-resource account increase, the corresponding change resource identifier should be added to the basic resource identifier list of that target sub-resource account; conversely, when resources in a target sub-resource account decrease, the corresponding change resource identifier should be removed from the basic resource identifier list of that target sub-resource account.
[0138] When performing steps 11 and 12 above, step 3034 specifically includes:
[0139] Based on the total updated resource balance, the updated resource balance of each target sub-resource account, and the updated resource identifier list of the target sub-resource accounts, the structured balance information represented by the updated balance content is determined.
[0140] That is, after determining the total update resource balance corresponding to the total resource account, and the update resource balance and update resource identifier list corresponding to each target sub-resource account, a structured balance information representing the update balance content can be generated based on the total update resource balance corresponding to the total resource account, the update resource balance and update resource identifier list corresponding to each target sub-resource account, and the resource balance and resource identifier list corresponding to each non-target sub-resource account.
[0141] When generating structured balance information representing updated balance content, the total updated resource balance corresponding to the total resource account, the updated resource balance and updated resource identifier list corresponding to each target sub-resource account, and the resource balance and resource identifier list corresponding to each non-target sub-resource account can be filled into a preset balance information structure. This balance information structure can be, for example, […]. Figure 6 The description method shown.
[0142] Furthermore, a serialization tool can be used to serialize the structured balance information represented by the updated balance content to obtain the corresponding serialized content, which is the updated balance content.
[0143] Thus, by recording the identifiers of the unit resources stored by each sub-resource account in the balance details as described above, the virtual resources stored in each sub-resource account can be further clarified in greater detail. Furthermore, by recording the resource identifier list corresponding to each sub-resource account in the balance details, the source and destination of each unit resource can be better traced, making the transfer of virtual resources more easily traceable.
[0144] Step 304: Generate account change content based on the resource change information; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information.
[0145] In this embodiment, the detailed records in the account details table can also record account change content. This account change content is used to represent structured change information. Specifically, the account change content representing the structured change information can be obtained by serializing the structured change information. This account change content can be specifically represented as a string corresponding to the structured change information. The structured change information includes at least the resource change type of the target object's total resource account and the resource change amount of the target sub-resource accounts involved in this resource change. The resource change type of the total resource account indicates whether the resources in the total resource account have increased or decreased in this resource change, and the resource change amount of the target sub-resource account refers to the amount of resource change in the target sub-resource account in this resource change. Optionally, the structured change information can also include the account type corresponding to the target sub-resource account and a list of changed resource identifiers corresponding to the target sub-resource account. The account type corresponding to the target sub-resource account can indicate the resource type of the virtual resources stored in the target sub-resource account, and the list of changed resource identifiers corresponding to the target sub-resource account includes the identifiers of each unit resource that has changed in the target sub-resource account.
[0146] like Figure 4 As shown in the account details table, each record in the account details table includes a column for account change information, which is the serialized content used to represent the structured change information mentioned above.
[0147] Figure 7 This is a schematic diagram illustrating a structured change information provided in an embodiment of this application. For example... Figure 7As shown, the structured change information includes the resource change type of the target object's total resource account, and also includes a list of target sub-resource accounts. The list of target sub-resource accounts includes the relevant change information of each sub-resource account involved in this resource change, that is, the relevant change information of each target sub-resource account. The relevant change information of each target sub-resource account specifically includes the account type corresponding to the target sub-resource account, the amount of resource change of the target sub-resource account in this resource change, and the list of changed resource identifiers corresponding to the target sub-resource in this resource change. The list of changed resource identifiers includes the identifiers of the unit resources that have changed in the target sub-resource account.
[0148] Using the data structure serialization tool Protobuf to describe the above structured change information, we can obtain... Figure 8 The diagram illustrates a method for describing structured change information. In this method, the `coin_op_type` field records the resource change type of the total resource account, the `coin_package` field records the list of target sub-resource accounts, the `need_return` field records whether the virtual resources involved in this resource change need to be returned, the `coin_type_id` field records the account type of the target sub-resource account, the `coin_cnt` field records the amount of resource change for the target sub-resource account in this resource change, and the `coinid_package` field records the list of changed resource identifiers corresponding to the target sub-resource account in this resource change.
[0149] Since the resource change information itself indicates the specific method of this resource change, account change content indicating the specific changes corresponding to this resource change can be directly generated based on this resource change information. It should be understood that the account change content generated here is the account change content to be added to the detailed records of the account details table. The structured change information represented by this account change content is used to indicate the specific changes involved in this resource change, that is, to indicate whether the total resource account of the target object has experienced an increase or decrease in resources (resource change type), and the amount of resource change in the target sub-resource accounts involved in this resource change; optionally, the structured change information represented by this account change content can also indicate the list of changed resource identifiers of the target sub-resource accounts, that is, to indicate the unit resources that have changed in the target sub-resource accounts.
[0150] In one possible implementation, step 304, "generating account change content based on the resource change information," may specifically include steps 3041 to 3043 (not shown in the figure):
[0151] Step 3041: Determine the resource change type corresponding to the resource change information; the resource change type is used to indicate whether resources in the total resource account are increased or decreased.
[0152] Specifically, resource change information is determined based on resource update requests, which are generated within resource change tasks. These tasks typically specify whether the change involves increasing or decreasing resources in the total resource account. For example, a resource acquisition task might require increasing resources in the total account, while tasks involving redeeming prizes or gifting resources might require decreasing them. Therefore, resource update requests carry the resource change type corresponding to the task (indicating whether resources in the total resource account are increased or decreased), and the resource change information determined based on this update request will also indicate this change type.
[0153] Step 3042: Determine the amount of resource changes involved in the target sub-resource account related to the resource change information.
[0154] In addition, based on the resource change information, the target sub-resource accounts involved in this resource change and the amount of resource change of the target sub-resource accounts can also be determined. The target sub-resource account is the sub-resource account whose resources have changed in this resource change. The target sub-resource account is at least one of the sub-resource accounts of the target object. The amount of resource change of the target sub-resource account refers to the amount of resource change of the target sub-resource account in this resource change.
[0155] For example, when the resource change information includes a changed resource type and a changed resource identifier, for each changed resource type, a sub-resource account for storing the virtual resources of that changed resource type can be determined as the target sub-resource account; and the resource change amount of the target sub-resource account can be determined based on the number of changed resource identifiers belonging to the unit resources of that changed resource type in each changed resource identifier.
[0156] It should be understood that the specific implementation of step 3042 here is the same as part of the implementation of step 3031 above. Therefore, steps 3031 and 3042 can be executed together. That is, when executing step 3031, the resource change amount of the target sub-resource account is directly obtained as the execution result of step 3042, without having to execute step 3042 here.
[0157] Step 3043: Generate structured change information representing the account change content based on the resource change type and the resource change amount of the target sub-resource account; perform serialization processing on the structured change information representing the account change content to obtain the account change content.
[0158] After determining the resource change types for the total resource account and the corresponding resource change amounts for each target sub-resource account, structured change information representing the account change content can be generated based on these parameters. Specifically, the resource change types for the total resource account and the corresponding resource change amounts for each target sub-resource account can be filled into a preset balance information structure. This balance information structure could be, for example, […]. Figure 8 The description method shown.
[0159] Furthermore, a serialization tool can be used to serialize the structured change information represented by the account change content to obtain the corresponding serialized content, which is the account change content.
[0160] Therefore, by determining the account change content in the detailed records using the above method, it can be ensured that the structured change information represented by the account change content can comprehensively reflect the resource changes of the total resource account and the resource changes of each target sub-resource account in this resource change. That is, the specific resource changes corresponding to this resource change are reflected through the change content. When a resource change occurs, updating the account detailed records by generating structured change information can also avoid the problems caused by updating multiple tables in related technologies, which helps to improve the update efficiency and success rate of detailed records.
[0161] Optionally, if the structured change information also includes a list of changed resource identifiers for the target sub-resource account, and the list of changed resource identifiers includes the identifiers of the changed unit resources in the target sub-resource account (the identifier of a unit resource can be, for example, the coin ID of a single virtual coin), the method provided in this application embodiment may further include the following steps 21 and 22:
[0162] Step 21: Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account.
[0163] Specifically, as described above, when resource change information includes changed resource type and changed resource identifier, for each changed resource type, a sub-resource account for storing the virtual resources of that changed resource type can be identified as the target sub-resource account; and the changed resource identifier belonging to the unit resource of that changed resource type can be identified from each changed resource identifier as the changed resource identifier corresponding to the target sub-resource account. Thus, the changed resource identifier corresponding to each target sub-resource account is obtained.
[0164] Step 22: Use the changed resource identifier to form a list of changed resource identifiers for the target sub-resource account.
[0165] Then, for each target sub-resource account, a list of changed resource identifiers for that target sub-resource account is formed using the changed resource identifiers corresponding to that target sub-resource account.
[0166] It should be understood that the changed unit resources indicated in the changed resource identifier list of the target sub-resource account can be either virtual resources that need to be added to the target sub-resource account or virtual resources that need to be removed from the target sub-resource account. If a unit resource in the changed resource identifier list of the target sub-resource account needs to be added to the target sub-resource account, then the resource identifier list corresponding to the target sub-resource account in the structured balance information represented by the balance content in the basic details record will not include each identifier in the changed resource identifier list, while in the structured balance information represented by the updated balance content, the resource identifier list corresponding to the target sub-resource account will include each identifier in the changed resource identifier list. Conversely, if a unit resource in the changed resource identifier list of the target sub-resource account needs to be removed from the target sub-resource account, then the resource identifier list corresponding to the target sub-resource account in the structured balance information represented by the balance content in the basic details record will include each identifier in the changed resource identifier list, while in the structured balance information represented by the updated balance content, the resource identifier list corresponding to the target sub-resource account will not include each identifier in the changed resource identifier list.
[0167] When performing steps 21 and 22 above, step 3043 specifically includes:
[0168] Based on the resource change type, the resource change amount of the target sub-resource account, and the list of changed resource identifiers of the target sub-resource account, a structured change information representing the account change content is generated.
[0169] In other words, after determining the resource change type of the total resource account, the resource change amount corresponding to each target sub-resource account, and the list of changed resource identifiers corresponding to each target sub-resource account, structured change information representing the account change content can be generated based on these parameters. Specifically, the resource change type of the total resource account, the resource change amount corresponding to each target sub-resource account, and the list of changed resource identifiers corresponding to each target sub-resource account can be filled into a preset balance information structure. This balance information structure could be, for example, […]. Figure 8 The description method shown.
[0170] Furthermore, a serialization tool can be used to serialize the structured change information represented by the account change content to obtain the corresponding serialized content, which is the account change content.
[0171] Thus, by further recording the identifiers of the changed unit resources in each target sub-resource account within the detailed account change records, the resource changes for each target sub-resource account in this resource change can be further clarified in greater detail, specifying exactly which unit resource changed. Furthermore, by recording the list of changed resource identifiers for each target sub-resource account within the account change details, it is possible to better trace in which resource change each unit resource changed, making the tracking of virtual resource changes more convenient.
[0172] Step 305: Add a new record to the account details table, and write the updated balance and the account change information into the new record.
[0173] After determining the updated balance and account change details corresponding to this resource change, a new record can be added to the target object's account details table. The updated balance details are written to the column for recording balance details in this record, and the account change details are written to the column for recording account change details in this record. This achieves the goal of updating the target object's account details table in response to this resource change for the target object.
[0174] like Figure 4 As shown, if the account sequence number corresponding to the basic detail record is 3, a new detail record can be added after the basic detail record in the account detail table to represent this resource change. The account sequence number corresponding to this new detail record is 4, and the account ID in the new detail record is still the target object's ID "Alice". In this new detail record, the available balance column records the updated balance content obtained through step 303 above, and the account change content column records the account change content obtained through step 304 above.
[0175] The resource management method provided in this application embodiment achieves comprehensive management of the total resource account and various sub-resource accounts of a target object through an account detail table. Specifically, in this method, upon receiving a resource update request for the target object, the resource change information of the target object can be determined first based on the resource update request, that is, the method of changing the resources of the target object can be determined. Then, the latest detail record in the target object's account detail table is obtained as the basic detail record. Based on the balance content in the basic detail record and the aforementioned resource change information, updated balance content is generated. Here, both the balance content in the basic detail record and the generated updated balance content are used to represent structured balance information. The structured balance information can specifically include the resource balance of the target object's total resource account and the resource balance of each sub-resource account of the target object. That is, the detail record stored in the account detail table includes a balance content, which can record the resource balance of the total resource account and the resource balance of each sub-resource account simultaneously through structured balance information, thereby achieving unified management of the resource balance of the target object's total resource account and each sub-resource account. In addition, account change information needs to be generated based on the aforementioned resource change information. This account change information represents structured change information, which specifically includes the type of resource change for the target object's total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts involved in this resource change. That is, the detailed record stored in the account details table also includes an account change item. The account change item records the type of resource change for the total resource account in this resource change, as well as the amount of resource change for the target sub-resource accounts that have undergone the change, through structured change information. This achieves unified management of the resource changes of the target object's total resource account and sub-resource accounts in a single resource change. Finally, a new detailed record is added to the account details table, which includes the updated balance information and account change information generated above. This completes the update of the target object's account details table in response to a resource update request for the target object. This application embodiment uses an account detail table to record content representing structured information, so that the detailed information of the target object's total resource account and each sub-resource account can be summarized and recorded in a single account detail table. When the resources of the target object change, the account detail table can be updated in the above manner, without having to update a large number of tables, thus improving the update speed of account detail content and reducing the update failure rate.
[0176] In one possible implementation, the resource update request in step 301 above may be generated in response to the completion of a resource acquisition task. The resource update request includes the resource acquisition type and the resource identification list corresponding to the resource acquisition task. The resource acquisition type is used to indicate the type of resource acquired, and the resource identification list includes the identification of each unit resource acquired.
[0177] Accordingly, step 302 above, "determining the resource change information of the target object based on the resource update request," may include:
[0178] The resource type and the list of resource identifiers included in the resource update request shall be used as the resource change information.
[0179] A resource acquisition task refers to any task in the target application that can acquire virtual resources. For example, if the virtual resource is virtual coins, the resource acquisition task can be a task triggered by the target object to collect virtual coins. After the resource acquisition task is completed, a resource update request can be generated to indicate that the task has been completed. This resource update request includes the type of virtual resource acquired in the resource acquisition task, i.e., the acquired resource type mentioned above. This acquired resource type can be determined by the server responsible for providing background support for the resource acquisition task, for example, it can be determined by the server based on the completion time of the resource acquisition task. The resource update request also includes the identifiers of each unit resource acquired in the resource acquisition task. These unit resource identifiers constitute the acquired resource identifier list mentioned above. This acquired resource identifier list can also be determined by the server responsible for providing background support for the resource acquisition task. For example, the server can configure a unique identifier for each unit resource acquired through this resource acquisition task and use the identifiers of each unit resource to form the acquired resource identifier list.
[0180] As described in step 302 above, when a resource update request includes changes to resource type and resource identifiers, these can be directly used as resource change information. Similarly, in this implementation, obtaining the resource type is equivalent to changing the resource type, and obtaining the resource identifier list is equivalent to a list of changed resource identifiers. Therefore, obtaining the resource type and obtaining the resource identifier list can be directly used as resource change information. In other words, based directly on obtaining the resource type and obtaining the resource identifier list, the impact of this resource acquisition task on the target object's resource account can be clearly determined, i.e., the changes caused to the target object's resource account by this resource acquisition task.
[0181] It should be understood that the resource change information described above, used to characterize the resource change method corresponding to the resource acquisition task, is typically used to indicate the addition of virtual resources to the resource account of the target object. Accordingly, when determining the updated balance content corresponding to the resource acquisition task, based on the structured balance information represented by the balance content in the basic detailed record, the total resource balance of the total resource account and the resource balance of each target sub-resource account need to be increased accordingly, and an identifier corresponding to the same resource type from the resource acquisition identifier list needs to be added to the resource identifier list of each target sub-resource account. When determining the account change content corresponding to the resource acquisition task, the resource change type of the total resource account needs to be set to resource increase in the structured change information representing the account change content, and an identifier corresponding to the same resource type from the resource acquisition identifier list needs to be filled in the change resource identifier list of each target sub-resource account.
[0182] In this way, by responding to the completion of the resource acquisition task, the account details table of the target object is updated. This ensures that the account details table of the target object is accurately updated as the resource acquisition task is completed. That is, the updated account details table can reflect the total resource account and the resource balance of each sub-resource account of the target object after the completion of the resource acquisition task, and it can also reflect the specific resource changes corresponding to the resource acquisition task.
[0183] To facilitate understanding of how the account details table is updated during resource acquisition tasks, the following example uses virtual coins provided by the target application as a case study to illustrate this update method.
[0184] For example, in the target application, users can earn virtual coins by completing payment tasks using the target application. The amount of virtual coins a user can earn as a reward varies depending on the payment task. When a user triggers a coin-collecting operation through the target application, it can be considered that a coin-collecting task has been initiated. The process of distributing virtual coins is as follows:
[0185] 1. The target application sends task instruction information (e.g., task ID) for the gold coin collection task to the first server responsible for distributing gold coins;
[0186] 2. The first server retrieves the corresponding task details based on the task instruction information;
[0187] 3. The first server determines the amount of virtual coins to reward the user based on the task details;
[0188] 4. The first server determines the type of virtual coins required as a reward based on the initiation time of the coin collection task. Specifically, the type of virtual coins can be the zodiac animal corresponding to the virtual coins.
[0189] 5. The first server configures a unique ID for each virtual coin that is required to be rewarded;
[0190] 6. The first server adds the types of virtual coins mentioned above, as well as a list of coin IDs consisting of the IDs of each virtual coin to be rewarded, to the resource update request, and sends the resource update request to the second server that provides coin management services (i.e., the target server mentioned above).
[0191] 7. The second server retrieves the latest detailed record from the account details table of the user who triggered the gold coin collection operation, and uses it as the basic detailed record;
[0192] 8. The second server generates updated balance information based on the balance information in the basic details record and the information carried in the above resource update request; and generates account change information corresponding to this gold coin collection task based on the information carried in the above resource update request.
[0193] 9. Create a new transaction record with an account sequence number equal to the account sequence number of the base transaction record plus 1; write the updated balance and account change information into this transaction record.
[0194] 10. The second server adds the new detail record to the account details table.
[0195] In one possible implementation, the resource update request in step 301 above may be generated in response to triggering a resource deduction task, and the resource update request includes the task resource deduction amount corresponding to the resource deduction task.
[0196] A resource deduction task refers to any task in the target application that can deduct virtual resources from a resource account. Specifically, it can deduct all or part of the virtual resources from any one or more sub-resource accounts of the target object. For example, if the virtual resource is virtual coins, a resource deduction task could be a triggered task to redeem prizes using virtual coins, or a triggered task to gift virtual coins to other objects. After a resource deduction task is triggered, a resource update request can be generated accordingly to indicate the amount of resource deduction for the task. This resource deduction amount refers to the total amount of unit resources to be deducted in this resource deduction task. For example, the task resource deduction amount could be the number of virtual coins required to redeem prizes in this task to redeem virtual coins, or the number of virtual coins to be gifted to other objects in this task to gift virtual coins.
[0197] In the above situation, step 302, "determining the resource change information of the target object based on the resource update request," may include steps 3021 to 3025 (not shown in the figure):
[0198] Step 3021: Determine the type of resource to be deducted based on the trigger time of the resource deduction task.
[0199] Based on the resource update request for the resource deduction amount corresponding to the resource deduction task, when determining the resource change information, the type of deducted resource can be determined first. This type of deducted resource is the type of virtual resource that needs to be deducted in the resource deduction task.
[0200] Specifically, the type of resource to be deducted can be determined based on the trigger time of the resource deduction task. For example, taking virtual resources as virtual coins, and virtual coins including the twelve zodiac animals as examples, a time-type mapping table can be pre-built. This table records the correspondence between the trigger time of relevant tasks and the type of virtual coins. For instance, a task triggered between 10:00 AM and 11:00 AM corresponds to a virtual coin type of "rabbit." Accordingly, when determining the type of resource to be deducted, the zodiac animal corresponding to the trigger time of the resource deduction task can be found in this time-type mapping table and used as the type of resource to be deducted.
[0201] Step 3022: Locate the sub-resource account used to store the resources of the deducted resource type in each sub-resource account of the target object, and use it as the deducted sub-resource account.
[0202] Once the type of resource to be deducted is determined, the sub-resource account used to store virtual resources of that type can be located among the various sub-resource accounts of the target object. This sub-resource account is then used as the deduction sub-resource account, providing the required virtual resources for this resource deduction task. As mentioned above, sub-resource accounts are typically categorized according to the type of virtual resources they store. Different sub-resource accounts are used to store different types of virtual resources. Therefore, a sub-resource account specifically designed to store virtual resources of the deduction type can be found and used as the basis for resource deduction, i.e., as the deduction sub-resource account.
[0203] For example, taking virtual resources as virtual coins, and the types of virtual coins including the twelve zodiac animals as an example, if it is determined that the deducted resource type is "rabbit", then the sub-resource account used to store the "rabbit" type virtual coins is found in each sub-resource account of the target object, and used as the deducted sub-resource account.
[0204] Step 3023: If the remaining resource amount in the deducted sub-resource account is greater than or equal to the task resource deduction amount, then the deducted sub-resource account is used as the target sub-resource account.
[0205] Then, it is determined whether the remaining resource in the determined deduction sub-resource account is greater than or equal to the task resource deduction amount corresponding to this resource deduction task. If the remaining resource in the deduction sub-resource account is greater than or equal to the task resource deduction amount, it means that the virtual resources in the deduction sub-resource account can be used to complete this resource deduction task. Therefore, the deduction sub-resource account can be directly used as the target sub-resource account involved in this resource deduction task.
[0206] Step 3024: If the remaining resources in the deducted sub-resource account are less than the task resource deduction amount, then an auxiliary sub-resource account is determined according to a preset rule, and both the deducted sub-resource account and the auxiliary sub-resource account are used as the target sub-resource account.
[0207] Conversely, if the remaining resources in the deduction sub-resource account are less than the resource deduction amount for this task, it indicates that the virtual resources in the deduction sub-resource account alone are insufficient to complete the resource deduction task. Therefore, it is necessary to further identify an auxiliary sub-resource account to assist the deduction sub-resource account in completing this resource deduction task; that is, the auxiliary sub-resource account is also used to provide the required virtual resources for deduction in this resource deduction task. Accordingly, both the aforementioned deduction sub-resource account and the auxiliary sub-resource account can be considered as the target sub-resource accounts involved in this resource deduction task.
[0208] When determining the auxiliary sub-resource accounts, they can be determined according to preset rules. For example, they can be traversed from back to front, taking the sub-resource accounts in the target object's sub-resource account list before the deducted sub-resource account, until the sum of the resource balance in each traversed sub-resource account and the resource balance in the deducted sub-resource account is greater than or equal to the task resource deduction amount. At this point, each traversed sub-resource account is an auxiliary sub-resource account.
[0209] For example, still using virtual resources as virtual coins, and the types of virtual coins including the twelve zodiac animals, if it is determined that the resource type to be deducted is "Rabbit," and the sub-resource account used to store the "Rabbit" type virtual coins is the deduction sub-resource account, then if the resource balance in the "Rabbit" type sub-resource account is less than the task resource deduction amount, a sub-resource account used to store the "Tiger" type virtual coins can be further determined as an auxiliary sub-resource account, and it is checked whether the sum of the resource balances of the "Tiger" type sub-resource account and the "Rabbit" type sub-resource account is greater than or equal to the task resource deduction amount; if the sum of the resource balances of the "Tiger" type sub-resource account and the "Rabbit" type sub-resource account is greater than or equal to the task resource deduction amount, then... Instead of iterating through the next sub-resource account, both the "Tiger" type sub-resource account and the "Rabbit" type sub-resource account can be directly used as target sub-resource accounts to provide the required virtual coins for this resource deduction task. Conversely, if the sum of the resource balances of the "Tiger" type sub-resource account and the "Rabbit" type sub-resource account is less than the task resource deduction amount, the sub-resource account used to store the "Ox" type virtual coins needs to be used as an auxiliary sub-resource account. The above detection process is then performed based on each auxiliary sub-resource account and the deduction sub-resource account until the sum of the resource balances of each of the determined auxiliary sub-resource accounts and the deduction sub-resource account is greater than or equal to the task resource deduction amount.
[0210] Step 3025: Determine the resource change information based on the account identifier of the target sub-resource account and the identifiers of each unit resource deducted from the target sub-resource account.
[0211] Finally, based on the account identifier of the target sub-resource account and the identifiers of each unit resource deducted from the target sub-resource account, the resource change information used to characterize this resource deduction task can be determined. The account identifier of the target sub-resource account typically indicates the type of virtual resource stored in that target sub-resource account; therefore, the account identifier of the target sub-resource account is essentially the changed resource type in step 302. The identifiers of each unit resource deducted from the target sub-resource account are essentially the changed resource identifiers in step 302.
[0212] It should be understood that the resource change information described above, used to characterize the resource change method corresponding to the resource deduction task, is used to indicate the deduction of virtual resources from the resource account of the target object. Accordingly, when determining the updated balance content corresponding to the resource deduction task, based on the structured balance information represented by the balance content in the basic detailed record, the total resource balance of the total resource account and the resource balance of each target sub-resource account need to be reduced accordingly, and the corresponding changed resource identifier needs to be removed from the resource identifier list of each target sub-resource account. When determining the account change content corresponding to the resource deduction task, the resource change type of the total resource account needs to be set to resource reduction in the structured change information represented by the account change content, and the aforementioned changed resource identifier needs to be filled in the changed resource identifier list of each target sub-resource account to indicate that the corresponding unit resources are deducted from the target sub-resource account.
[0213] In this way, by responding to the triggering of a resource deduction task, the account details table of the target object is updated. This ensures that the account details table of the target object is accurately updated as the resource deduction task is triggered. That is, the updated account details table can reflect the resource balance of the target object's total resource account and each sub-resource account after the resource deduction task is triggered, and it can also reflect the specific resource changes corresponding to the resource deduction task.
[0214] It should be noted that in practical applications, many resource deduction tasks are completed in stages. For example, after a target object triggers a resource deduction task, it needs to wait for the recipient to successfully receive the virtual resources deducted through the task before the task can be considered successfully completed. If the recipient does not successfully receive the virtual resources deducted through the task, the task can be considered to have failed. Taking the task of redeeming prizes using virtual coins as an example, after a target object triggers the prize redemption operation, it needs to wait for the backend prize redemption service to receive the virtual coins paid by the target object and successfully issue the corresponding prize to the target object before the task can be considered successfully completed. If the backend prize redemption service does not receive the virtual coins paid by the target object, the task can be considered to have failed. Taking the task of gifting virtual coins as an example, after the target object triggers the operation of gifting virtual coins to the recipient object, it needs to wait for the recipient object to receive the virtual coins gifted by the target object before the task of gifting virtual coins can be considered to be successfully completed. If the recipient object does not receive the virtual coins gifted by the target object or refuses to receive the virtual coins gifted by the target object, the task of gifting virtual coins can be considered to have failed.
[0215] It should be understood that in practical applications, the resource deduction task can be considered complete whether it is successfully completed or fails to complete.
[0216] To accommodate the resource deduction task completed in stages as described above, the account details table in this application embodiment may also include intermediate balance content. This intermediate balance content is used to represent the structured deduction resource information before the resource deduction task is completed. This structured deduction resource information includes the total resource deduction amount of the target object and the resource deduction amount of each sub-resource account to be deducted.
[0217] Accordingly, the method provided in the embodiments of this application may further include:
[0218] Based on the intermediate balance content in the basic detailed record and the resource change information, generate updated intermediate balance content.
[0219] Specifically, the account details table can also record intermediate balance information. This intermediate balance information can represent structured deduction resource information. Specifically, by serializing the structured deduction resource information, the intermediate balance information used to represent this structured deduction resource information can be obtained. The intermediate balance information can be represented as a string corresponding to the structured deduction resource information.
[0220] The structured resource deduction information includes at least the total resource deduction amount for the target object and the individual resource deduction amounts for each of the target object's pending deduction sub-resource accounts. The total resource deduction amount refers to the sum of the task resource deduction amounts corresponding to each incomplete resource deduction task triggered by the target object. The pending deduction sub-resource accounts are the target sub-resource accounts in the incomplete resource deduction tasks triggered by the target object, and the resource deduction amount for each pending sub-resource account is the total amount of unit resources to be deducted from that pending sub-resource account in each incomplete resource deduction task. Optionally, the structured resource deduction information may also include the account type corresponding to each pending deduction sub-resource account and a list of deduction resource identifiers corresponding to each pending deduction sub-resource account. The account type corresponding to a pending deduction sub-resource account can indicate the resource type of the virtual resources in that pending deduction sub-resource account, and the list of deduction resource identifiers corresponding to a pending deduction sub-resource account can include the identifiers of each unit resource to be deducted from that pending deduction sub-resource account.
[0221] Figure 9 This is a schematic diagram of another account detail table provided in an embodiment of this application, which is different from... Figure 4The account details table shown now includes two new entries: Pre-deducted Balance and In-Transit Balance. Both Pre-deducted Balance and In-Transit Balance are used to record the aforementioned intermediate balance information. They are applied to different resource deduction tasks. Specifically, the Pre-deducted Balance is used to record the intermediate balance in tasks involving redeeming prizes using virtual resources, while the In-Transit Balance is used to record the intermediate balance in tasks involving gifting virtual resources to other recipients. That is, when the resource deduction task is for redeeming prizes using virtual resources, the intermediate balance information needs to be updated based on the intermediate balance information in the Pre-deducted Balance section of the basic details record, and this updated intermediate balance information should be entered into the newly added details record. When the resource deduction task is for gifting virtual resources to other recipients, the intermediate balance information needs to be updated based on the intermediate balance information in the In-Transit Balance section of the basic details record, and this updated intermediate balance information should be entered into the newly added details record.
[0222] It should be noted that the specific structure of structured deduction resource information is similar to that of structured balance information. Specifically, the resource balance of the total resource account in the structured balance information is replaced with the total resource deduction amount, and the list of sub-resource accounts in the structured balance information is replaced with a list of sub-resource accounts to be deducted (including relevant information for each sub-resource account). The relevant information for each sub-resource account to be deducted specifically includes the account type, the resource deduction amount, and the list of deduction resource identifiers. For more details, please refer to [link / reference]. Figure 5 and Figure 6 The structured balance information shown helps to understand the structured deduction of resource information.
[0223] Since the basic detailed record corresponds to the most recent resource change of the target object's resource account, the intermediate balance recorded in this basic detailed record can represent the resource deduction amount involved in each incomplete resource deduction task currently triggered by the target object. That is, it can represent the target object's current total resource deduction amount and the current resource deduction amount of each of the target object's pending sub-resource accounts. Based on this, the intermediate balance content can be updated based on the intermediate balance content in the basic detailed record and the resource change information used to represent this resource change. This updated intermediate balance content is used to indicate the resource deduction amount involved in each incomplete resource deduction task triggered by the target object after this resource change, that is, the target object's total resource deduction amount and the resource deduction amount of each of the target object's pending sub-resource accounts after this resource change.
[0224] It should be understood that the aforementioned updated intermediate balance content is essentially the intermediate balance content in the detailed records to be added to the account details table. That is, the updated intermediate balance content is also used to represent the structured deduction resource information, except that the updated balance content represents the structured deduction resource information after this resource change.
[0225] In one possible implementation, the above-mentioned "generating updated intermediate balance content based on the intermediate balance content in the basic detailed record and the resource change information" may include steps 31 to 34:
[0226] Step 31: Determine the total resource deduction amount corresponding to the resource change information, and determine the resource deduction amount of the target sub-resource account involved in the resource change information.
[0227] Specifically, based on the resource change information, the total resource deduction amount corresponding to this resource change can be determined; this total resource deduction amount refers to the resource deduction amount of the target object's total resource accounts. Furthermore, based on the resource change information, the target sub-resource accounts involved in this resource deduction task, and the resource deduction amount of each target sub-resource account, can also be determined; each target sub-resource account is the sub-resource account for which virtual resources need to be deducted in this resource deduction task, and is at least one of the target object's various sub-resource accounts. The resource deduction amount of each target sub-resource account refers to the total amount of unit resources that need to be deducted from that target sub-resource account in this resource deduction task.
[0228] Step 32: Determine the updated total resource deduction based on the basic total resource deduction and the total resource deduction; the basic total resource deduction is the total resource deduction in the structured deduction resource information represented by the intermediate balance content.
[0229] After obtaining the basic detailed record, the structured deduction resource information represented by the intermediate balance content in the basic detailed record can be further determined, and the total resource deduction amount can be obtained from the structured deduction resource information, and the total resource deduction amount can be used as the basic total resource deduction amount.
[0230] Then, the basic total resource deduction amount and the total resource deduction amount determined through step 31 above are summed to obtain the updated total resource deduction amount. This updated total resource deduction amount is the total resource deduction amount in the structured deduction resource information represented by the updated intermediate balance content. In other words, this updated total resource deduction amount represents the total resource deduction amount of the target object after this resource deduction task. It should be understood that the total resource deduction amount determined through step 31 above can only be a positive value.
[0231] Step 33: Based on the basic resource deduction amount of the target sub-resource account and the resource deduction amount of the target sub-resource account, determine the updated resource deduction amount of the target sub-resource account; the basic resource deduction amount is the resource deduction amount of the target sub-resource account in the structured deduction resource information represented by the intermediate balance content.
[0232] After obtaining the basic detailed records, the structured deduction resource information represented by the intermediate balance content in these records can be further determined. The resource deduction amount for each target sub-resource account in this resource deduction task can then be obtained from this structured deduction resource information, serving as the basic resource deduction amount for each target sub-resource account. It should be understood that if a target sub-resource account is not included in the structured deduction resource information, it can be created within the structured deduction resource information. This means creating a sub-resource account to store the resource type corresponding to that target sub-resource account and setting an initial resource deduction amount (e.g., 0) for it.
[0233] Furthermore, for each target sub-resource account, the basic resource deduction amount for that target sub-resource account and the resource deduction amount determined in step 31 above are summed to obtain the updated resource deduction amount for that target sub-resource account. This updated resource deduction amount is the resource deduction amount for that target sub-resource account in the structured resource deduction information represented by the updated intermediate balance content; that is, the updated resource deduction amount represents the resource deduction amount for that target sub-resource account after this resource deduction task. It should be understood that the resource deduction amount for the target sub-resource account determined in step 31 above can only be a positive value.
[0234] It should be understood that in practical applications, step 32 can be executed first and then step 33, or step 33 can be executed first and then step 32, or steps 32 and 33 can be executed simultaneously. This application embodiment does not impose any limitation on the execution order of steps 32 and 33.
[0235] Step 34: Based on the total updated resource deduction amount and the updated resource deduction amount of the target sub-resource account, determine the structured deduction resource information represented by the updated intermediate balance content; perform serialization processing on the structured deduction resource information represented by the updated intermediate balance content to obtain the updated intermediate balance content.
[0236] After determining the total updated resource deduction amount and the updated resource deduction amount corresponding to each target sub-resource account, structured deduction resource information representing the updated intermediate balance can be generated based on the total updated resource deduction amount, the updated resource deduction amount corresponding to each target sub-resource account, and the resource deduction amount corresponding to each non-target sub-resource account. Here, non-target sub-resource accounts refer to other sub-resource accounts to be deducted besides the target sub-resource accounts. Since these sub-resource accounts have not undergone resource changes in this resource deduction task, the resource deduction amounts of these sub-resource accounts recorded in the intermediate balance content of the basic detailed record can be directly used to participate in generating the structured deduction resource information representing the updated intermediate balance.
[0237] When generating structured deduction resource information that represents the updated intermediate balance, the total updated resource deduction amount, the updated resource deduction amount corresponding to each target sub-resource account, and the resource deduction amount corresponding to each non-target sub-resource account can be filled into the preset deduction resource information structure.
[0238] Furthermore, a serialization tool can be used to serialize the structured deduction resource information represented by the updated intermediate balance content to obtain the corresponding serialized content, which is the updated intermediate balance content.
[0239] In this way, by determining the intermediate balance content in the detailed record in the above manner, it can be ensured that the structured deduction resource information represented by the intermediate balance content can fully reflect the total resource deduction amount corresponding to each incomplete resource deduction task, as well as the resource deduction amount of each sub-resource account to be deducted. Furthermore, the total resource deduction amount reflected by the structured deduction resource information, as well as the resource deduction amount of each sub-resource account to be deducted, can change accurately as the resource change task is triggered.
[0240] Optionally, if the structured deduction resource information also includes a resource identifier list corresponding to each sub-resource account to be deducted, and the resource identifier list includes the identifier of each unit resource in the corresponding sub-resource account to be deducted (the identifier of a unit resource can be, for example, the gold coin ID of a single virtual gold coin), the method provided in this application embodiment may further include the following steps 41 and 42:
[0241] Step 41: Determine the deduction resource identifier of the target sub-resource account involved in the resource change information; the deduction resource identifier is the identifier of the unit resource to be deducted in the target sub-resource account.
[0242] Step 42: Based on the basic deduction resource identifier list of the target sub-resource account and the deduction resource identifier of the target sub-resource account, determine the updated deduction resource identifier list of the target sub-resource account; the basic resource identifier list is the deduction resource identifier list of the target sub-resource account in the structured deduction resource information represented by the intermediate balance content.
[0243] It should be understood that the implementation of steps 41 and 42 above is similar to the implementation of steps 11 and 12 above. For details, please refer to the relevant introduction of steps 11 and 12 above.
[0244] When performing steps 41 and 42 above, step 34 specifically includes:
[0245] Based on the total updated resource deduction amount, the updated resource deduction amount of each target sub-resource account, and the updated deduction resource identifier list of the target sub-resource accounts, the structured deduction resource information represented by the updated intermediate balance content is determined.
[0246] In other words, the structured deduction resource information also includes a list of deduction resource identifiers corresponding to each sub-resource account to be deducted. Furthermore, based on resource change information, the list of deduction resource identifiers corresponding to each target sub-resource account can be updated to obtain an updated list of deduction resource identifiers for each target sub-resource account. Then, based on the aforementioned updated total resource deduction amount, the updated resource deduction amount for each target sub-resource account, the updated list of deduction resource identifiers for each target sub-resource account, the resource deduction amount for each non-target sub-resource account, and the deduction resource identifiers for each non-target sub-resource account, structured deduction resource information representing the updated intermediate balance content is generated. This structured deduction resource information is then serialized to obtain the updated intermediate balance content.
[0247] In this way, by further recording the identifiers of the unit resources that have changed in this resource deduction task for each target sub-resource account in the intermediate balance of the detailed record, the resource deduction situation of each target sub-resource account in this resource deduction task can be further clarified in detail, that is, to specify which unit resource needs to be deducted.
[0248] To facilitate understanding of how the account details are updated in resource deduction tasks, the following example will still use virtual coins provided by the target application as an example to illustrate this update method.
[0249] As an example, in the target application, users can use their earned virtual coins to redeem prizes. When a user triggers the action of redeeming a prize with coins through the target application, it can be considered that a prize redemption task has been initiated. The implementation process of this prize redemption task is as follows:
[0250] 1. The target application sends a redemption request to the third server responsible for the prize redemption service. The third server generates an order corresponding to this prize redemption task, which includes the order time and the amount of virtual coins to be deducted. The order is then sent to the second server that provides the coin management service (i.e., the target server mentioned above).
[0251] 2. The second server retrieves the latest detailed record from the account details table of the user who triggered the operation of redeeming prizes with gold coins, and uses it as the basic detailed record;
[0252] 3. The second server generates a gold coin deduction plan (i.e., resource change information) based on the received orders. The generation method for this gold coin deduction plan is as follows:
[0253] i. Determine the type of virtual coins to be deducted based on the order placement time in the order. The specific type of virtual coins can be the zodiac animal corresponding to the virtual coins.
[0254] ii. Locate the sub-resource account corresponding to the zodiac sign from the user's various sub-resource accounts, deduct the virtual coins from the sub-resource account accordingly, and determine the ID of each deducted virtual coin;
[0255] iii. If the amount of virtual coins in the above sub-resource account is less than the amount of virtual coins to be deducted, then find the sub-resource account corresponding to the previous zodiac sign, deduct the virtual coins from that sub-resource account accordingly, and determine the ID of each virtual coin deducted. Repeat the above operation until the amount of virtual coins deducted reaches the amount of virtual coins to be deducted.
[0256] 4. Based on the above gold coin deduction plan, generate the contents of the new detailed record, as follows:
[0257] i. Determine the updated total amount of virtual coins based on the total amount of virtual coins recorded in the balance information in the basic details record, and the amount of virtual coins to be deducted in this prize redemption task;
[0258] ii. In the balance information of the basic details record, find the sub-resource accounts that had virtual coins deducted in this prize redemption task; for each sub-resource account, update the virtual coin amount of the sub-resource account according to the amount of virtual coins deducted, and update the list of coin IDs of the sub-resource account according to the ID of the deducted virtual coins; thus, the updated balance information is obtained.
[0259] iii. For the intermediate balance entered in the pre-deducted balance column of the basic details record, add the amount of virtual coins to be deducted in this prize redemption task to the total amount of virtual coins to be deducted recorded in the intermediate balance to obtain the updated total amount of virtual coins to be deducted.
[0260] iv. In the above intermediate balance content, find the sub-resource accounts whose virtual coins were deducted in this prize redemption task; for each sub-resource account, update the amount of virtual coins to be deducted for that sub-resource account according to the amount of virtual coins deducted from it, and update the list of virtual coin IDs to be deducted for that sub-resource account according to the ID of the deducted virtual coins; thus, the updated intermediate balance content is obtained.
[0261] v. Based on the above gold coin deduction plan, generate corresponding account change information, which indicates the details of the pre-deduction phase in this prize redemption task;
[0262] 5. Create a new detail record with an account sequence number equal to the account sequence number of the base detail record plus 1; write the updated balance, updated intermediate balance, and account change information into this detail record.
[0263] 6. The second server adds the new detail record to the account details table.
[0264] As another example, in the target application, users can gift their virtual coins to other users. When a user triggers a coin gifting operation through the target application, it can be considered that a coin gifting task has been initiated. The implementation process of this coin gifting task is as follows:
[0265] 1. The target application sends a gift request to the fourth server responsible for the gold coin gifting service. The fourth server creates a gold coin gifting document accordingly, which includes the order time and the amount of virtual gold coins to be deducted. Then, the gold coin gifting document is sent to the second server that provides gold coin management services (i.e., the target server mentioned above).
[0266] 2. The second server retrieves the latest record from the account details table of the user who triggered the gold coin gifting operation, and uses it as the base record;
[0267] 3. The second server generates a gold coin deduction plan (i.e., resource change information) based on the received gold coin gift slips. The generation method for this gold coin deduction plan is as follows:
[0268] i. Determine the type of virtual coins to be deducted based on the order time in the coin gift receipt. The specific type of virtual coins can be the zodiac animal corresponding to the virtual coins.
[0269] ii. Locate the sub-resource account corresponding to the zodiac sign from the user's various sub-resource accounts, deduct the virtual coins from the sub-resource account accordingly, and determine the ID of each deducted virtual coin;
[0270] iii. If the amount of virtual coins in the above sub-resource account is less than the amount of virtual coins to be deducted, then find the sub-resource account corresponding to the previous zodiac sign, deduct the virtual coins from that sub-resource account accordingly, and determine the ID of each virtual coin deducted. Repeat the above operation until the amount of virtual coins deducted reaches the amount of virtual coins to be deducted.
[0271] 4. Based on the above gold coin deduction plan, generate the contents of the new detailed record, as follows:
[0272] i. Determine the updated total amount of virtual coins based on the total amount of virtual coins recorded in the balance information in the basic details record, and the amount of virtual coins to be deducted in this coin gifting task;
[0273] ii. In the balance information of the basic details record, find the sub-resource accounts whose virtual coins were deducted in this gold coin gifting task; for each sub-resource account, update the virtual coin amount of the sub-resource account according to the amount of virtual coins deducted, and update the gold coin ID list of the sub-resource account according to the ID of the deducted virtual coins; thus, the updated balance information is obtained.
[0274] iii. For the intermediate balance entered in the "In-transit Balance" column of the basic details record, add the amount of virtual coins to be deducted in this coin gifting task to the total amount of virtual coins to be deducted recorded in the intermediate balance to obtain the updated total amount of virtual coins to be deducted.
[0275] iv. In the above intermediate balance content, find the sub-resource accounts whose virtual coins were deducted in this prize redemption task; for each sub-resource account, update the amount of virtual coins to be deducted for that sub-resource account according to the amount of virtual coins deducted from it, and update the list of virtual coin IDs to be deducted for that sub-resource account according to the ID of the deducted virtual coins; thus, the updated intermediate balance content is obtained.
[0276] v. Based on the above gold coin deduction plan, generate corresponding account change information, which indicates the details of the pre-deduction phase in this gold coin gifting task;
[0277] 5. Create a new detail record with an account sequence number equal to the account sequence number of the base detail record plus 1; write the updated balance, updated intermediate balance, and account change information into this detail record.
[0278] 6. The second server adds the new record to the account details table;
[0279] 7. After the second server adds detailed records to the user's account details table to indicate the pre-deduction stage of this gold coin gifting task, it can send relevant notification messages to the fourth server.
[0280] 8. After receiving the notification message, the fourth server creates the gold coin gift details (indicating the gold coin gift entities, such as the giver and the receiver), updates the status of the gold coin gift document to pending receipt, and registers the gold coin gift timeout return event so that the virtual gold coins gifted by the receiver will be automatically returned to the giver if the receiver does not receive the gifted virtual gold coins for a long time.
[0281] In one possible implementation, after the resource deduction task is successfully completed, the method provided in this application embodiment may further include the following steps 51 to 53:
[0282] Step 51: When the resource deduction task is successfully completed, obtain the latest detailed record in the account details table as the first reference record; obtain the detailed record created in response to triggering the resource deduction task as the second reference record.
[0283] Once the resource deduction task is successfully completed, the latest detailed record can be retrieved from the target object's account details table as the first reference record. This first reference record will serve as the base detailed record for generating new detailed records in response to the successful completion of the resource deduction task, providing basic information for the new detailed records to be generated.
[0284] In addition, it is necessary to obtain the detailed record created in response to triggering the resource deduction task as the second reference record. For example, each detailed record in the account details table is associated with a corresponding task identifier. That is, if a detailed record is created in response to a task, the correspondence between that detailed record and the task identifier is recorded. Accordingly, when obtaining the second reference record, the detailed record corresponding to the task identifier of the resource deduction task can be found in the target object's account details table and used as the second reference record.
[0285] Step 52: Based on the account change information in the second reference record, update the intermediate balance information in the first reference record to obtain the post-processed intermediate balance information.
[0286] Since the account change information in the second reference record records the resource deduction status of the target object's resource account during the pre-deduction phase of the resource deduction task, the intermediate balance information in the first reference record can be updated accordingly based on the account change information in the second reference record. After the resource deduction task is completed, the structured change information represented by the intermediate balance information in the first reference record can be adjusted. The currently completed resource deduction task is removed from the various incomplete resource deduction tasks originally represented by the structured change information. In other words, the incomplete resource deduction tasks represented by the structured change information are updated so that they no longer represent completed resource deduction tasks.
[0287] Updating the intermediate balance in the first reference record yields the post-processed intermediate balance. This post-processed intermediate balance is the same as the intermediate balance mentioned above, and it also represents the structured deduction resource information. However, the structured deduction resource information represented by this post-processed intermediate balance has had information related to the completed resource deduction task removed.
[0288] When updating the intermediate balance in the first reference record, the following steps can be taken: First, based on the account change information in the second reference record, determine the target sub-resource accounts involved in this resource deduction task and the corresponding resource deduction amount for each target sub-resource account, and then determine the total resource deduction amount for this resource deduction task. Next, determine the total resource deduction amount from the structured deduction resource information represented by the intermediate balance in the first reference record, and subtract the total resource deduction amount of the completed resource deduction task from this total resource deduction amount to obtain the updated total resource deduction amount. Furthermore, locate each target sub-resource account in the structured deduction resource information, and for each target sub-resource account, subtract the resource deduction amount of that target sub-resource account in the completed resource deduction task from its resource deduction amount to obtain the updated resource deduction amount corresponding to that target sub-resource account.
[0289] Optionally, if the structured deduction resource information represented by the intermediate balance content also includes a list of deduction resource identifiers corresponding to each sub-resource account to be deducted, then in the structured deduction resource information represented by the intermediate balance content of the first reference record, for each target sub-resource account, the identifier of the unit resource to be deducted by the target sub-resource account in the completed resource deduction task can be removed from the list of deduction resource identifiers corresponding to the target sub-resource account to obtain the updated list of deduction resource identifiers corresponding to the target sub-resource account.
[0290] Therefore, by using the aforementioned updated total resource deduction amount, the updated resource deduction amount and updated deduction resource identifier list corresponding to each of the aforementioned target sub-resource accounts, and the resource deduction amount and deduction resource identifier list corresponding to each of the non-target sub-resource accounts (i.e., other sub-resource accounts besides the target sub-resource accounts among the sub-resource accounts to be deducted), the updated structured deduction resource information can be determined; and then, the corresponding post-processing intermediate balance content can be obtained from the updated structured deduction resource information.
[0291] Step 53: Add a new record to the account details table and write the post-processing intermediate balance content into the new record.
[0292] Then, a new record is added to the target's account details table, which will include the aforementioned post-processing intermediate balance.
[0293] It should be noted that the newly added detailed record may also include balance information, which is identical to the balance information in the first reference record. This means that since the virtual resources corresponding to the resource deduction task have already been deducted from the balance during the pre-deduction phase, no further adjustment to the balance is needed when the actual deduction phase of the resource deduction task is completed. Furthermore, the newly added detailed record may also include account change information, which can be identical to the account change information in the second reference record, to indicate any account changes related to the resource deduction task.
[0294] Thus, by using the above method, after successfully completing the resource deduction task, the intermediate balance content in the latest detailed record in the account details table is updated so that the information represented by the intermediate balance content corresponds to the incomplete resource deduction task, and no longer represents the completed resource deduction task, thereby ensuring the accuracy of the intermediate balance content and improving the intermediate balance content update mechanism.
[0295] To facilitate understanding of how the account details are updated when a resource deduction task is successfully completed, the following example will still use virtual coins provided by the target application as an example to illustrate this update method.
[0296] As an example, in the target application, after a user successfully redeems a prize using their virtual coins, a process for deducting virtual coins from the user's account can be initiated for the prize redemption task. The implementation process of this virtual coin deduction process is as follows:
[0297] 1. After the third server responsible for prize redemption service completes the prize redemption task, it requests the second server providing gold coin management service (i.e., the target server mentioned above) to execute the corresponding gold coin deduction process based on the order number corresponding to the prize redemption task.
[0298] 2. The second server retrieves the latest record from the account details table of the user who triggered the operation of redeeming prizes with gold coins, and uses it as the first reference record;
[0299] 3. Based on the order number, the second server finds the detailed record representing the pre-deduction stage of the prize redemption task in the account details table of the user who triggered the operation of redeeming prizes with gold coins, and uses it as a second reference record;
[0300] 4. From the account change content field of the second reference record, find the gold coin deduction details of the pre-deduction stage of the prize redemption task. The gold coin deduction details can specifically indicate the sub-resource account from which the virtual gold coins were deducted, and the virtual gold coins deducted from the sub-resource account;
[0301] 5. For the intermediate balance entered in the pre-deducted balance column of the first reference record, deduct the information indicated by the above gold coin deduction details to obtain the corresponding post-processing intermediate balance. The balance in the first reference record does not need to be adjusted.
[0302] 6. Create a new detailed record with an account sequence number equal to the account sequence number of the first reference record plus 1; write the above-mentioned post-processing intermediate balance content into the pre-deducted balance in the detailed record, and write the same balance content as the first reference record;
[0303] 7. Update the status of the second reference record to "Completed", indicating that the prize redemption task corresponding to the second reference record has been completed.
[0304] As another example, in the target application, a donor user can gift their virtual coins to a recipient user. Once the recipient user successfully receives the virtual coins, the gifting task is considered successfully completed, and the corresponding coin deduction process can be initiated. The implementation process of this coin deduction process is as follows:
[0305] 1. After receiving a gold coin claim request from the recipient user, the fourth server responsible for the gold coin gifting service generates a gold coin claim document (the entity of the gold coin claim document is the recipient user) and sets the status of the document to claiming.
[0306] 2. The fourth server queries the corresponding gold coin gift details and modifies the gold coin gift details, recording the recipient user and the time of receipt;
[0307] 3. The fourth server requests the second server (i.e., the target server mentioned above) that provides gold coin management services to add the corresponding gold coins to the recipient user. This process is similar to the process of completing tasks and receiving virtual gold coins described above.
[0308] 4. The fourth server requests the second server to update the intermediate balance content for the giver user, that is, to update the intermediate balance content in the "In Transit Balance" field of the details record. This process is similar to the process of updating the details record after completing the prize collection task described above, except that the updated field is changed to "In Transit Balance".
[0309] 5. The fourth server updates the status of the gold coin collection slip to "completed".
[0310] In one possible implementation, after the above-mentioned resource deduction task fails, the method provided in this application embodiment may further include the following steps 61 to 63:
[0311] Step 61: When the resource deduction task fails, obtain the latest detailed record in the account details table as the first reference record; obtain the detailed record created in response to triggering the resource deduction task as the second reference record.
[0312] When a resource deduction task fails to execute, the latest detailed record can be retrieved from the target object's account details table as the first reference record. This first reference record will serve as the base record for generating a new detailed record in response to the failure of the resource deduction task, thus providing basic information for the new detailed record to be generated.
[0313] In addition, it is necessary to obtain the detailed record created in response to triggering the resource deduction task as the second reference record. For example, each detailed record in the account details table is associated with a corresponding task identifier. That is, if a detailed record is created in response to a task, the correspondence between that detailed record and the task identifier is recorded. Accordingly, when obtaining the second reference record, the detailed record corresponding to the task identifier of the resource deduction task can be found in the target object's account details table and used as the second reference record.
[0314] Step 62: Based on the account change information in the second reference record, update the balance information and intermediate balance information in the first reference record respectively to obtain the post-processed balance information and the post-processed intermediate balance information.
[0315] Since the account change information in the second reference record records the resource deduction status of the target object's resource account during the pre-deduction phase of the resource deduction task, the intermediate balance information in the first reference record can be updated accordingly based on the account change information in the second reference record. This allows for adjustments to the structured change information represented by the intermediate balance information in the first reference record after a resource deduction fails. The failed resource deduction task is removed from the original representation of each incomplete resource deduction task in the structured change information, thus updating the incomplete resource deduction tasks represented by the structured change information so that it no longer represents the failed resource deduction task.
[0316] Updating the balance content in the first reference record yields the post-processed balance content. This post-processed balance content is the same as the balance content mentioned above, and it also represents structured balance information. However, the structured balance information represented by this post-processed balance content is the balance information after rolling back the virtual resources related to the resource deduction task that failed to execute.
[0317] Updating the intermediate balance in the first reference record yields the post-processed intermediate balance. This post-processed intermediate balance is the same as the intermediate balance mentioned above, also used to represent structured resource deduction information; however, the structured resource deduction information represented by this post-processed intermediate balance has had information related to the failed resource deduction task removed.
[0318] When updating the balance in the first reference record, the following steps can be taken: First, based on the account change information in the second reference record, determine the target sub-resource accounts involved in this resource deduction task and the corresponding resource deduction amount for each target sub-resource account. Then, determine the total resource deduction amount for this resource deduction task. Next, in the structured balance information represented by the balance content in the first reference record, determine the total resource balance. Add the total resource deduction amount (positive value) of this resource deduction task to this total resource balance to obtain the updated total resource balance. Furthermore, locate each of the aforementioned target sub-resource accounts in the structured balance information. For each target sub-resource account, add the resource deduction amount (positive value) of that target sub-resource account in the failed resource deduction task to the target sub-resource account's resource balance to obtain the updated resource balance corresponding to that target sub-resource account. If the structured balance information representing the balance content also includes a list of resource identifiers corresponding to each sub-resource account, then for each target sub-resource account, the identifier of the unit resource to be deducted in the failed resource deduction task can be added to the resource identifier list corresponding to that target sub-resource account, resulting in an updated resource identifier list for that target sub-resource account. Thus, for a failed resource deduction task, the virtual resources that were originally to be deducted can be rolled back.
[0319] Therefore, by utilizing the aforementioned total updated resource balance, the updated resource balance and updated resource identifier list corresponding to each of the aforementioned target sub-resource accounts, and the resource balance and resource identifier list corresponding to each of the non-target sub-resource accounts (i.e., other sub-resource accounts besides the target sub-resource accounts), the updated structured balance information can be determined; subsequently, the corresponding post-processed balance content can be obtained from the updated structured balance information.
[0320] When updating the intermediate balance content in the first reference record, the total resource deduction amount can be determined from the structured deduction resource information represented by the intermediate balance content of the first reference record. This total resource deduction amount is then subtracted from the total resource deduction amount of the failed resource deduction task to obtain the updated total resource deduction amount. Furthermore, each target sub-resource account is located within this structured deduction resource information. For each target sub-resource account, the resource deduction amount in the failed resource deduction task is subtracted from its resource deduction amount to obtain the updated resource deduction amount for that target sub-resource account. Optionally, if the structured deduction resource information represented by the intermediate balance content also includes a list of deduction resource identifiers corresponding to each sub-resource account to be deducted, the identifiers of the unit resources to be deducted by the target sub-resource account in the failed resource deduction task can be removed from the list of deduction resource identifiers corresponding to the target sub-resource account in the structured deduction resource information represented by the intermediate balance content of the first reference record, to obtain the updated deduction resource identifier list for that target sub-resource account.
[0321] Therefore, by using the aforementioned updated total resource deduction amount, the updated resource deduction amount and updated deduction resource identifier list corresponding to each of the aforementioned target sub-resource accounts, and the resource deduction amount and deduction resource identifier list corresponding to each of the non-target sub-resource accounts (i.e., other sub-resource accounts besides the target sub-resource accounts among the sub-resource accounts to be deducted), the updated structured deduction resource information can be determined; and then, the corresponding post-processing intermediate balance content can be obtained from the updated structured deduction resource information.
[0322] Step 63: Add a new detail record to the account details table, and write the post-processing balance content and the post-processing intermediate balance content into the new detail record.
[0323] Then, a new record will be added to the target's account details table. This new record will include the post-processing balance and post-processing intermediate balance.
[0324] It should be noted that the newly added detailed record may also include account change information, which may be the same as the account change information in the second reference record, to indicate the account change situation corresponding to the resource deduction task.
[0325] Thus, by using the above method, after a resource deduction task fails, the balance and intermediate balance content in the latest detailed record in the account details table are updated so that the balance content represents the remaining resource after the virtual resources involved in the failed resource deduction task are rolled back, and the information represented by the intermediate balance content corresponds to the incomplete resource deduction task, rather than representing the failed resource deduction task. This ensures the accuracy of the intermediate balance content and improves the intermediate balance content update mechanism.
[0326] To facilitate understanding of how the account details are updated when a resource deduction task fails, the following example will still use virtual coins provided by the target application as an example to illustrate this update method.
[0327] As an example, in the target application, if a user's virtual coins fail to redeem a prize, a coin rollback process corresponding to the prize redemption task can be initiated. The implementation process of this coin rollback process is as follows:
[0328] 1. The third server responsible for prize redemption service requests the second server (i.e., the target server mentioned above) that provides gold coin management service to execute the corresponding gold coin rollback process based on the order number corresponding to the prize redemption task;
[0329] 2. The second server retrieves the latest record from the account details table of the user who triggered the operation of redeeming prizes with gold coins, and uses it as the first reference record;
[0330] 3. Based on the order number, the second server finds the detailed record representing the pre-deduction stage of the prize redemption task in the account details table of the user who triggered the operation of redeeming prizes with gold coins, and uses it as a second reference record;
[0331] 4. From the account change content field of the second reference record, find the gold coin deduction details of the pre-deduction stage of the prize redemption task. The gold coin deduction details can specifically indicate the sub-resource account from which the virtual gold coins were deducted, and the virtual gold coins deducted from the sub-resource account;
[0332] 5. For the intermediate balance entered in the pre-deducted balance column of the first reference record, deduct the information indicated by the above gold coin deduction details to obtain the corresponding post-processing intermediate balance;
[0333] 6. For the balance information entered in the "Available Balance" column of the first reference record, add the information indicated by the above-mentioned gold coin deduction details to obtain the corresponding post-processing balance information; it should be understood that in this process, if the corresponding target sub-resource account is not found in the balance information of the first reference record, a new target sub-resource account can be created;
[0334] 7. Create a new detailed record with the account sequence number equal to the account sequence number of the first reference record plus 1; write the above-mentioned post-processing intermediate balance content into the pre-deducted balance in the detailed record, and write the above-mentioned post-processing balance content into the available balance in the detailed record.
[0335] 8. Update the status of the second reference record to "Completed", indicating that the prize redemption task corresponding to the second reference record has been completed.
[0336] As another example, in the target application, a donor user can gift their virtual coins to a recipient user. If the recipient user fails to receive the gift within the specified time or chooses to refuse to receive the virtual coins, the gift gift task can be considered to have failed. This allows for the initiation of a coin rollback process, the implementation of which is as follows:
[0337] 1. The fourth server responsible for the gold coin gifting service requests the second server (i.e., the target server mentioned above) that provides gold coin management services to execute the corresponding gold coin rollback process based on the order number corresponding to the gold coin gifting document;
[0338] 2. The second server retrieves the latest record from the account details table of the user who triggered the coin gifting operation, and uses it as the first reference record;
[0339] 3. The second server finds the detailed record representing the pre-deduction stage of the gold coin gifting task in the account details table of the gifting user who triggered the gold coin gifting operation based on the order number corresponding to the gold coin gifting document, and uses it as the second reference record.
[0340] 4. From the account change content field of the second reference record, find the gold coin deduction details of the pre-deduction stage of the gold coin gifting task. The gold coin deduction details can specifically indicate the sub-resource account from which the virtual gold coins were deducted, and the virtual gold coins deducted from the sub-resource account;
[0341] 5. For the intermediate balance entered in the "In Transit Balance" column of the first reference record, deduct the information indicated by the above gold coin deduction details to obtain the corresponding post-processing intermediate balance;
[0342] 6. For the balance information entered in the "Available Balance" column of the first reference record, add the information indicated by the above-mentioned gold coin deduction details to obtain the corresponding post-processing balance information; it should be understood that in this process, if the corresponding target sub-resource account is not found in the balance information of the first reference record, a new target sub-resource account can be created;
[0343] 7. Create a new detail record with an account sequence number equal to the account sequence number of the first reference record plus 1; write the above-mentioned post-processing intermediate balance content into the in-transit balance in the detail record, and write the above-mentioned post-processing balance content into the available balance in the detail record.
[0344] 8. Update the status of the second reference record to "Completed", indicating that the gold coin gifting task corresponding to the second reference record has been completed;
[0345] 9. The status of the gold coin gift voucher on the fourth server has been updated to "refunded".
[0346] In conjunction with the resource management method described above, this application also provides a corresponding resource management device to enable the application and implementation of the above resource management method in practice. See [link to related document]. Figure 10 , Figure 10 This is a schematic diagram of the structure of the resource management device 1000 provided in an embodiment of this application. For example... Figure 10 As shown, the resource management device 1000 includes:
[0347] The request receiving module 1001 is used to receive resource update requests for the target object;
[0348] The information determination module 1002 is used to determine the resource change information of the target object based on the resource update request;
[0349] The balance content generation module 1003 is used to generate updated balance content based on the balance content in the basic detailed record and the resource change information; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance content and the updated balance content are used to represent structured balance information, which includes the total resource account of the target object and the resource balance of each sub-resource account;
[0350] The change content generation module 1004 is used to generate account change content based on the resource change information; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information;
[0351] The account update module 1005 is used to add a new detail record in the account details table, and to write the updated balance content and the account change content into the new detail record.
[0352] Optionally, the balance content generation module 1003 is specifically used for:
[0353] Determine the total resource change corresponding to the resource change information, and determine the resource change of the target sub-resource account involved in the resource change information;
[0354] Based on the basic total resource balance and the change in total resources, the updated total resource balance is determined; the basic total resource balance is the resource balance of the total resource account in the structured balance information represented by the balance content;
[0355] Based on the basic resource balance of the target sub-resource account and the resource change of the target sub-resource account, the updated resource balance of the target sub-resource account is determined; the basic resource balance is the resource balance of the target sub-resource account in the structured balance information represented by the balance content;
[0356] Based on the total updated resource balance and the updated resource balance of the target sub-resource account, the structured balance information represented by the updated balance content is determined; the structured balance information represented by the updated balance content is serialized to obtain the updated balance content.
[0357] Optionally, the structured balance information further includes a resource identifier list corresponding to each of the sub-resource accounts, the resource identifier list including the identifier of each unit resource in the corresponding sub-resource account; the balance content generation module 1003 is further configured to:
[0358] Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account;
[0359] Based on the basic resource identifier list of the target sub-resource account and the changed resource identifier of the target sub-resource account, an updated resource identifier list of the target sub-resource account is determined; the basic resource identifier list is the resource identifier list of the target sub-resource account in the structured balance information represented by the balance content.
[0360] Based on the total updated resource balance, the updated resource balance of each target sub-resource account, and the updated resource identifier list of the target sub-resource accounts, the structured balance information represented by the updated balance content is determined.
[0361] Optionally, the change content generation module 1004 is specifically used for:
[0362] Determine the resource change type corresponding to the resource change information; the resource change type is used to indicate whether resources in the total resource account are increased or decreased.
[0363] Determine the amount of resource changes involved in the target sub-resource account related to the resource change information;
[0364] Based on the resource change type and the resource change amount of the target sub-resource account, structured change information representing the account change content is generated; the structured change information representing the account change content is serialized to obtain the account change content.
[0365] Optionally, the change content generation module 1004 is further configured to:
[0366] Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account;
[0367] Using the changed resource identifiers, a list of changed resource identifiers for the target sub-resource account is constructed;
[0368] Based on the resource change type, the resource change amount of the target sub-resource account, and the list of changed resource identifiers of the target sub-resource account, a structured change information representing the account change content is generated.
[0369] Optionally, the resource update request is generated in response to the completion of a resource acquisition task; the resource update request includes the resource acquisition type and a list of resource identifiers corresponding to the resource acquisition task, wherein the resource acquisition type indicates the type of resource acquired, and the list of resource identifiers includes the identifiers of each unit resource acquired; then the information determination module 1002 is specifically used for:
[0370] The resource type and the list of resource identifiers included in the resource update request shall be used as the resource change information.
[0371] Optionally, the resource update request is generated in response to triggering a resource deduction task; the resource update request includes the task resource deduction amount corresponding to the resource deduction task; then the information determination module 1002 is specifically used for:
[0372] The type of resource to be deducted is determined based on the trigger time of the resource deduction task;
[0373] Locate the sub-resource account used to store the resources of the deducted resource type among the various sub-resource accounts of the target object, and use it as the deduction sub-resource account;
[0374] If the remaining resources in the deducted sub-resource account are greater than or equal to the task resource deduction amount, then the deducted sub-resource account will be used as the target sub-resource account.
[0375] If the remaining resources in the deducted sub-resource account are less than the task resource deduction amount, then an auxiliary sub-resource account is determined according to a preset rule, and both the deducted sub-resource account and the auxiliary sub-resource account are used as the target sub-resource account.
[0376] The resource change information is determined based on the account identifier of the target sub-resource account and the identifiers of each unit resource deducted from the target sub-resource account.
[0377] Optionally, the account details table further includes intermediate balance information, which is used to represent structured deduction resource information before the resource deduction task is completed. The structured deduction resource information includes the total resource deduction amount for the target object and the resource deduction amount for each sub-resource account to be deducted. The device further includes:
[0378] The intermediate balance generation module is used to generate updated intermediate balance content based on the intermediate balance content in the basic detailed record and the resource change information.
[0379] Optionally, the intermediate balance generation module is specifically used for:
[0380] Determine the total resource deduction amount corresponding to the resource change information, and determine the resource deduction amount of the target sub-resource account involved in the resource change information;
[0381] Based on the basic total resource deduction amount and the total resource deduction amount, the updated total resource deduction amount is determined; the basic total resource deduction amount is the total resource deduction amount in the structured deduction resource information represented by the intermediate balance content;
[0382] Based on the basic resource deduction amount and the resource deduction amount of the target sub-resource account, the updated resource deduction amount of the target sub-resource account is determined; the basic resource deduction amount is the resource deduction amount of the target sub-resource account in the structured deduction resource information represented by the intermediate balance content.
[0383] Based on the total updated resource deduction amount and the updated resource deduction amount of the target sub-resource account, the structured deduction resource information represented by the updated intermediate balance content is determined; the structured deduction resource information represented by the updated intermediate balance content is serialized to obtain the updated intermediate balance content.
[0384] Optionally, the account update module 1005 is further configured to:
[0385] When the resource deduction task is successfully completed, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record.
[0386] Based on the account change information in the second reference record, the intermediate balance information in the first reference record is updated to obtain the post-processed intermediate balance information.
[0387] Add a new record to the account details table, and write the post-processing intermediate balance content into the new record.
[0388] Optionally, the account update module 1005 is further configured to:
[0389] When the resource deduction task fails, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record.
[0390] Based on the account change information in the second reference record, the balance information and intermediate balance information in the first reference record are updated respectively to obtain the post-processed balance information and the post-processed intermediate balance information.
[0391] Add a new record to the account details table, and write the post-processing balance and the post-processing intermediate balance into the new record.
[0392] This application also provides a computer device for managing resources. Specifically, the computer device may be a terminal device or a server. The terminal device and server provided in this application will be described below from the perspective of hardware implementation.
[0393] See Figure 11 , Figure 11 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 11 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a computer as an example:
[0394] Figure 11 This is a block diagram illustrating a portion of the structure of a computer associated with the terminal provided in an embodiment of this application. (Reference) Figure 11The computer includes: a radio frequency (RF) circuit 1110, a memory 1120, an input unit 1130 (including a touch panel 1131 and other input devices 1132), a display unit 1140 (including a display panel 1141), a sensor 1150, an audio circuit 1160 (which can connect to a speaker 1161 and a microphone 1162), a wireless fidelity (WiFi) module 1170, a processor 1180, and a power supply 1190, etc. Those skilled in the art will understand that... Figure 11 The computer architecture shown does not constitute a limitation on the computer and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0395] The memory 1120 can be used to store software programs and modules. The processor 1180 executes various computer functions and data processing by running the software programs and modules stored in the memory 1120. The memory 1120 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer (such as audio data, telephone directory, etc.). In addition, the memory 1120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0396] The processor 1180 is the control center of the computer, connecting various parts of the computer through various interfaces and lines. It performs various computer functions and processes data by running or executing software programs and / or modules stored in the memory 1120, and by calling data stored in the memory 1120. Optionally, the processor 1180 may include one or more processing units; preferably, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1180.
[0397] In this embodiment of the application, the processor 1180 included in the terminal is also used to execute the steps of any implementation of the resource management method provided in this embodiment of the application.
[0398] See Figure 12 , Figure 12This is a schematic diagram of the structure of a server 1200 provided in an embodiment of this application. The server 1200 can vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 1222 (e.g., one or more processors) and memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) for storing application programs 1242 or data 1244. The memory 1232 and storage media 1230 can be temporary or persistent storage. The program stored in the storage media 1230 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1222 may be configured to communicate with the storage media 1230 and execute the series of instruction operations in the storage media 1230 on the server 1200.
[0399] Server 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1258, and / or one or more operating systems, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0400] The steps performed by the server in the above embodiments can be based on this Figure 12 The server structure shown is illustrated. The CPU 1222 can also be used to execute steps of any implementation of the resource management method provided in the embodiments of this application.
[0401] This application also provides a computer-readable storage medium for storing a computer program that executes any one of the resource management methods described in the foregoing embodiments.
[0402] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the implementation methods of the resource management method described in the foregoing embodiments.
[0403] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0404] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0405] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0406] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0407] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0408] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0409] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A resource management method, characterized in that, The method includes: Receive resource update requests for the target object; Based on the resource update request, determine the resource change information of the target object; Based on the balance information in the basic detailed record and the resource change information, an updated balance information is generated; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance information and the updated balance information are used to represent structured balance information, which includes the total resource account of the target object and the resource balance of each sub-resource account; Based on the resource change information, account change content is generated; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information; Add a new record to the account details table, and write the updated balance and account change information into the new record.
2. The method according to claim 1, characterized in that, The step of generating updated balance information based on the balance information in the basic detailed records and the resource change information includes: Determine the total resource change corresponding to the resource change information, and determine the resource change of the target sub-resource account involved in the resource change information; Based on the basic total resource balance and the change in total resources, the updated total resource balance is determined; the basic total resource balance is the resource balance of the total resource account in the structured balance information represented by the balance content; Based on the basic resource balance of the target sub-resource account and the resource change of the target sub-resource account, the updated resource balance of the target sub-resource account is determined; the basic resource balance is the resource balance of the target sub-resource account in the structured balance information represented by the balance content; Based on the total updated resource balance and the updated resource balance of the target sub-resource account, the structured balance information represented by the updated balance content is determined; the structured balance information represented by the updated balance content is serialized to obtain the updated balance content.
3. The method according to claim 2, characterized in that, The structured balance information also includes a resource identifier list corresponding to each of the sub-resource accounts, the resource identifier list including the identifier of each unit resource in the corresponding sub-resource account; the method further includes: Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account; Based on the basic resource identifier list of the target sub-resource account and the changed resource identifier of the target sub-resource account, an updated resource identifier list of the target sub-resource account is determined; the basic resource identifier list is the resource identifier list of the target sub-resource account in the structured balance information represented by the balance content. The step of determining the structured balance information represented by the updated balance content based on the updated total resource balance and the updated resource balance of the target sub-resource account includes: Based on the total updated resource balance, the updated resource balance of each target sub-resource account, and the updated resource identifier list of the target sub-resource accounts, the structured balance information represented by the updated balance content is determined.
4. The method according to any one of claims 1 to 3, characterized in that, The step of generating account change content based on the resource change information includes: Determine the resource change type corresponding to the resource change information; the resource change type is used to indicate whether resources in the total resource account are increased or decreased. Determine the amount of resource changes involved in the target sub-resource account related to the resource change information; Based on the resource change type and the resource change amount of the target sub-resource account, a structured change information representing the account change content is generated; the structured change information representing the account change content is serialized to obtain the account change content.
5. The method according to claim 4, characterized in that, The method further includes: Determine the changed resource identifier of the target sub-resource account involved in the resource change information; the changed resource identifier is the identifier of the unit resource that has changed in the target sub-resource account; Using the changed resource identifiers, a list of changed resource identifiers for the target sub-resource account is constructed; The step of generating structured change information representing the account change content based on the resource change type and the resource change amount of the target sub-resource account includes: Based on the resource change type, the resource change amount of the target sub-resource account, and the list of changed resource identifiers of the target sub-resource account, a structured change information representing the account change content is generated.
6. The method according to any one of claims 1 to 5, characterized in that, The resource update request is generated in response to the completion of the resource acquisition task; the resource update request includes the resource acquisition type and the resource acquisition identifier list corresponding to the resource acquisition task, the resource acquisition type is used to indicate the type of resource acquired, and the resource acquisition identifier list includes the identifiers of each unit resource acquired; The step of determining the resource change information of the target object based on the resource update request includes: The resource type and the list of resource identifiers included in the resource update request shall be used as the resource change information.
7. The method according to any one of claims 1 to 5, characterized in that, The resource update request is generated in response to triggering a resource deduction task; the resource update request includes the task resource deduction amount corresponding to the resource deduction task; The step of determining the resource change information of the target object based on the resource update request includes: The type of resource to be deducted is determined based on the trigger time of the resource deduction task; Locate the sub-resource account used to store the resources of the deducted resource type among the various sub-resource accounts of the target object, and use it as the deduction sub-resource account; If the remaining resources in the deducted sub-resource account are greater than or equal to the task resource deduction amount, then the deducted sub-resource account will be used as the target sub-resource account. If the remaining resources in the deducted sub-resource account are less than the task resource deduction amount, then an auxiliary sub-resource account is determined according to a preset rule, and both the deducted sub-resource account and the auxiliary sub-resource account are used as the target sub-resource account. The resource change information is determined based on the account identifier of the target sub-resource account and the identifiers of each unit resource deducted from the target sub-resource account.
8. The method according to claim 7, characterized in that, The account details table also includes intermediate balance information, which represents the structured resource deduction information before the resource deduction task is completed. The structured resource deduction information includes the total resource deduction amount for the target object and the resource deduction amount for each sub-account to be deducted. The method further includes: Based on the intermediate balance content in the basic detailed record and the resource change information, an updated intermediate balance content is generated.
9. The method according to claim 8, characterized in that, The step of generating updated intermediate balance content based on the intermediate balance content in the basic detailed record and the resource change information includes: Determine the total resource deduction amount corresponding to the resource change information, and determine the resource deduction amount of the target sub-resource account involved in the resource change information; Based on the basic total resource deduction amount and the total resource deduction amount, the updated total resource deduction amount is determined; the basic total resource deduction amount is the total resource deduction amount in the structured deduction resource information represented by the intermediate balance content; Based on the basic resource deduction amount and the resource deduction amount of the target sub-resource account, the updated resource deduction amount of the target sub-resource account is determined; the basic resource deduction amount is the resource deduction amount of the target sub-resource account in the structured deduction resource information represented by the intermediate balance content. Based on the total updated resource deduction amount and the updated resource deduction amount of the target sub-resource account, the structured deduction resource information represented by the updated intermediate balance content is determined; the structured deduction resource information represented by the updated intermediate balance content is serialized to obtain the updated intermediate balance content.
10. The method according to claim 8 or 9, characterized in that, The method further includes: When the resource deduction task is successfully completed, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record. Based on the account change information in the second reference record, the intermediate balance information in the first reference record is updated to obtain the post-processed intermediate balance information. Add a new record to the account details table, and write the post-processing intermediate balance content into the new record.
11. The method according to claim 8 or 9, characterized in that, The method further includes: When the resource deduction task fails, the latest detailed record in the account details table is obtained as the first reference record; the detailed record created in response to triggering the resource deduction task is obtained as the second reference record. Based on the account change information in the second reference record, the balance information and intermediate balance information in the first reference record are updated respectively to obtain the post-processed balance information and the post-processed intermediate balance information. Add a new record to the account details table, and write the post-processing balance and the post-processing intermediate balance into the new record.
12. A resource management device, characterized in that, The device includes: The request receiving module is used to receive resource update requests for the target object; The information determination module is used to determine the resource change information of the target object based on the resource update request; The balance content generation module is used to generate updated balance content based on the balance content in the basic detailed record and the resource change information; the basic detailed record is the latest detailed record in the account details table of the target object; both the balance content and the updated balance content are used to represent structured balance information, which includes the total resource account of the target object and the resource balance of each sub-resource account; The change content generation module is used to generate account change content based on the resource change information; the account change content is used to represent structured change information, which includes the resource change type of the total resource account and the resource change amount of the target sub-resource account involved in the resource change information; The account update module is used to add a new detail record in the account details table, and to write the updated balance content and the account change content into the new detail record.
13. A computer device, characterized in that, The device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the resource management method according to any one of claims 1 to 11 according to the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a computer device, implements the resource management method according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the resource management method according to any one of claims 1 to 11.