Data updating method and device, computer device, readable storage medium and product
Patent Information
- Application Number
- CN202210147431.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-17
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2042-02-17
AI Technical Summary
当有新增业务时,开发人员需要针对新增业务设计对应的存储结构,才能更新新增业务的配置数据,扩展性差,且游戏侧需要获取全量数据,数据量大引起传输时间长且浪费网络资源,导致数据更新效率低
[0014]本申请实施例通过获取待更新业务包含的任务对应的任务更新版本号以及当前任务版本号;将任务对应的任务更新版本号与当前任务版本号进行版本差异对比,得到待更新业务中需要进行数据更新的目标任务;获取目标任务的序列化更新数据;根据目标任务的任务类型构建对应的数据转化程序;通过数据转化程序对序列化更新数据进行反序列化处理,得到目标任务的任务更新数据,以供终端获取任务更新数据并基于任务更新数据对待更新业务的目标任务进行数据更新,本方案通过任务更新版本号和当前任务版本号进行对比,确定需要进行数据更新的目标任务,只需获取待更新业务中的目标任务的序列化更新数据,不需要获取待更新业务的全量更新数据,数据获取速度快,且由于数据会被序列化处理为相同数据格式的序列化更新数据,当新增业务或者任务时,不需要针对新增的业务或者任务设计对应的存储结构,扩展性强,新增的业务或者任务也能快速进行数据更新,因此,本方案可以提高业务的数据更新效率。
Smart Images

Figure CN116661834B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to a data update method, apparatus, computer equipment, readable storage medium, and product, wherein the readable storage medium is a computer-readable storage medium, and the product is a computer program product. Background Technology
[0002] The application provides services to users through multiple different services, such as Spring Festival event services and regular services. Each service offers different functionalities and corresponding configuration data, typically requiring a separate storage structure for each service. Operations personnel can update the service configuration data as needed for events. Regardless of whether the service configuration data is updated, the game side periodically retrieves the service configuration data from the database, obtaining all service-related configuration data. When a new service is added, developers need to design a corresponding storage structure to update its configuration data, resulting in poor scalability. Furthermore, the game side needs to retrieve the entire dataset, leading to long transmission times and wasted network resources, ultimately resulting in low data update efficiency. Summary of the Invention This application provides a data update method, apparatus, computer equipment, readable storage medium, and product to improve the efficiency of data update in business operations.
[0003] This application provides a data update method, including: Get the task update version number and the current task version number of the tasks included in the business to be updated; Compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated. Obtain the serialized update data of the target task; Build a corresponding data transformation program based on the task type of the target task; The serialized update data is deserialized using the data conversion program to obtain the task update data for the target task, which is then used by the terminal to update the target task of the service to be updated.
[0004] Accordingly, this application also provides a data update device, comprising: The version acquisition unit is used to obtain the task update version number and the current task version number of the tasks included in the business to be updated. The comparison unit is used to compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the service to be updated. A data acquisition unit is used to acquire the serialized update data of the target task, wherein the serialized update data is data obtained by serializing the update data of the target task; The construction unit is used to construct a corresponding data conversion program according to the task type of the target task; The data processing unit is used to deserialize the serialized update data through the data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the service to be updated based on the task update data.
[0005] In one embodiment, the version acquisition unit includes: The first acquisition subunit is used to periodically acquire the service update version number and the current service version number of the service to be updated. The second acquisition subunit is used to acquire the task update version number and the current task version number corresponding to the task included in the service to be updated if the service update version number of the service to be updated does not match the current service version number.
[0006] In one embodiment, the data update device further includes: A business version update unit is used to update the current business version number of the business to be updated according to the business update version number; The task version update unit is used to update the current task version number of the target task in the service to be updated according to the task update version number.
[0007] In one embodiment, the data update device further includes: The request acquisition unit is used to acquire a data update request for the target task of the service to be updated, wherein the data update request carries the update data of the target task; The task type determination unit is used to determine the task type of the target task based on the data update request, and to construct a corresponding serialization program based on the task type. A serialization unit is used to serialize the updated data based on the serialization program to obtain serialized updated data. The update unit is used to update the service version number of the service to be updated, the service update version number, and the task version number of the target task to obtain the task update version number.
[0008] In one embodiment, the serialization unit includes: A reflection processing subunit is used to perform reflection processing on the updated data according to the serialization program to obtain the reflected updated data. The serialization processing subunit is used to serialize the reflected update data to obtain the serialized update data.
[0009] In one embodiment, the update unit includes: The information acquisition subunit is used to acquire the timestamp information corresponding to the current time. The version update subunit is used to use the timestamp information as the service update version number of the service to be updated, and to use the timestamp information as the task update version number of the target task.
[0010] In one embodiment, the target task includes a target type task, and the data processing unit includes: The deserialization subunit is used to deserialize the serialized update data through the data conversion program to obtain the processed update data of the target task. The resource acquisition subunit is used to acquire the task resources of the target type task if the target task is a target type task. The data determination subunit is used to use the task resources and the processed update data as the task update data for the target type task.
[0011] Accordingly, this application also provides a computer device including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any of the data update methods provided in this application.
[0012] Accordingly, embodiments of this application also provide a computer-readable storage medium for storing a computer program, which is loaded by a processor to execute any of the data update methods provided in embodiments of this application.
[0013] Accordingly, this application also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the data update methods provided in this application.
[0014] This application embodiment obtains the task update version number and the current task version number corresponding to the tasks included in the service to be updated; compares the version difference between the task update version number and the current task version number to obtain the target task in the service to be updated that needs data update; obtains the serialized update data of the target task; constructs a corresponding data conversion program according to the task type of the target task; and performs deserialization processing on the serialized update data through the data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the service to be updated based on the task update data. This solution determines the target task that needs data update by comparing the task update version number and the current task version number. It only needs to obtain the serialized update data of the target task in the service to be updated, and does not need to obtain the full update data of the service to be updated. The data acquisition speed is fast, and since the data is serialized into serialized update data of the same data format, when a new service or task is added, there is no need to design a corresponding storage structure for the new service or task. It has strong scalability, and the new service or task can also be updated quickly. Therefore, this solution can improve the data update efficiency of the service. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a scenario diagram of the data update method provided in the embodiments of this application; Figure 2 This is a flowchart of the data update method provided in the embodiments of this application; Figure 3 This is another flowchart of the data update method provided in the embodiments of this application; Figure 4 This is the data update method provided in the embodiments of this application; Figure 5 This is a schematic diagram of a data update device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the terminal structure provided in the embodiments of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] This application provides a data update method, apparatus, computer device, and computer-readable storage medium. The data update apparatus can be integrated into a computer device, which may be a server or a terminal, etc.
[0019] The terminal may include mobile phones, wearable smart devices, tablets, laptops, personal computers (PCs), and in-vehicle computers, etc.
[0020] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0021] For example, such as Figure 1 As shown, the data update server 10 of the server cluster stores the serialized update data of the target task of the business to be updated and the task update version number in the cloud database 20.
[0022] The business server 30 in the server cluster retrieves the task update version number corresponding to the task in the business to be updated from the cloud database, as well as the current task version number stored locally on the business server; it compares the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task in the business to be updated that needs to be updated.
[0023] The business server 30 retrieves the serialized update data of the target task from the cloud database; constructs a corresponding data conversion program based on the task type of the target task; and performs deserialization processing on the serialized update data through the data conversion program to obtain the task update data of the target task.
[0024] Terminal 40 obtains task update data from the business server and updates the target task of the business to be updated based on the task update data.
[0025] This solution compares the task update version number with the current task version number to determine the target task that needs data updating. It only needs to obtain the serialized update data of the target task in the business to be updated, without needing to obtain the full update data of the business to be updated. The data acquisition speed is fast, and since the data is serialized into serialized update data of the same data format, when adding new businesses or tasks, there is no need to design a corresponding storage structure for the new businesses or tasks. It has strong scalability, and new businesses or tasks can also be updated quickly. Therefore, this solution can improve the data update efficiency of the business.
[0026] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0027] This embodiment will be described from the perspective of a data update device, which can be integrated into a computer device, such as a server or a terminal.
[0028] This application provides a data update method, such as... Figure 2 As shown, the specific process of this data update method can be as follows: 101. Obtain the task update version number and the current task version number corresponding to the tasks included in the business to be updated.
[0029] The services to be updated may include those provided to users on the application software, such as lucky draws, New Year's events, and in-game stores, or product categories in in-game stores, with each category corresponding to one service, such as fashion, equipment, pets, and props.
[0030] Tasks can include those used to support the business in providing services to users. For example, when the business is an online store, tasks could include products; when the business is a lottery activity, tasks could include prizes and lottery rules. Tasks can also include characters. Tasks can be configured according to the services provided by the business. Each task has corresponding configuration data, which can include data corresponding to task attributes, such as product price, name, activity time, and product ID.
[0031] Among them, the task update version number is the latest task version number of the task included in the service to be updated stored in the cloud database, and the current task version is the version number stored locally on the computer device, which represents the task version number of the task included in the service to be updated of the application software installed on the current terminal.
[0032] For example, it could involve retrieving the task update version number corresponding to the task included in the business to be updated from the cloud database, and retrieving the current task version number corresponding to the task from the local database.
[0033] Since a business function can include multiple tasks, when the configuration data of a task is updated, it means that the corresponding business function also needs to be updated. Therefore, we can first determine whether the business function has been updated, and when the business function is updated, then obtain the task update version number and the current task version number of the tasks it contains to determine the tasks that need to be updated. That is, the step "obtain the task update version number and the current task version number of the tasks contained in the business function to be updated" can specifically include: Periodically retrieve the business update version number of the service to be updated and the current business version number; If the business update version number of the business to be updated does not match the current business version number, then obtain the task update version number corresponding to the task included in the business to be updated and the current task version number.
[0034] The service update version number can be the latest service version number of the service to be updated stored in the cloud database, while the current service version number can be the service version number of the application software on the current terminal to be updated stored in the local database.
[0035] For example, it could periodically retrieve the business update version number of the service to be updated from the cloud database, and retrieve the current business version number from the local database. The task update version number and the current task version number are then compared. If the business update version number and the current version number are inconsistent, it means that the tasks contained in the service to be updated have been updated. In this case, the task update version number and the current task version number corresponding to the tasks contained in the service are retrieved from the database.
[0036] The timing can be a preset frequency, such as every minute, every second, or at a preset time, to retrieve the business update version number and the current business version number from the database.
[0037] By first determining whether the business to be updated has been updated, and if the business has not been updated, it is not necessary to traverse all the tasks included in the business to be updated to determine whether the tasks have been updated, thus improving the speed of data update.
[0038] The business version number and task version number in the cloud database are updated when the configuration data corresponding to the task is updated. By comparing the business version number and the task version number, it can be determined whether the business and the task have been updated.
[0039] 102. Compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated.
[0040] For example, it can be done by comparing the update version number of each task in the business to be updated with the current task version number to determine whether the update version number and the current task version number are the same. If the update version number of the task is different from the current task version number, it means that the task configuration data of the task needs to be updated, and the task is identified as the target task.
[0041] 103. Obtain the serialized update data of the target task.
[0042] The serialized update data may include data obtained by serializing the task update data of the target task.
[0043] For example, it could be to retrieve the serialized update data of the target task from the database based on the target task's task ID.
[0044] The configuration data corresponding to the task in the database will change as it is updated. The process of updating the configuration data of the task can be as follows, that is, before the step "obtaining the serialized update data of the target task", the data update method provided in this application embodiment may further include: Get the data update request for the target task of the business to be updated. The data update request carries the task update data of the target task. The task type of the target task is determined based on the data update request, and the corresponding serialization program is built based on the task type; The task update data is serialized using a serialization program to obtain serialized update data. Update the business version number of the business to be updated to obtain the business update version number, and update the task version number of the target task to obtain the task update version number.
[0045] The task update data may include data obtained by updating the task's configuration data.
[0046] The task type represents the configuration data required for the task. Different task types correspond to different configuration data. For example, the configuration data for fashion items in the store may include the item's price, name, event time, and product ID, while the configuration data for equipment items may include the item's price, name, item level, attack power, defense power, and product ID.
[0047] Serialization is the process of converting task information (including task update data) into a form that can be stored or transmitted.
[0048] For example, the terminal could display a data update page where users can log in to a specified account to obtain permission to modify task configuration data. On the data update page, users can add tasks, set corresponding configuration data, and modify the configuration data of existing tasks, and then confirm. The terminal responds to the user's confirmation by packaging the relevant data on the data update page and sending it to the server as a data update request via a network protocol, such as Hypertext Transfer Protocol (HTTP).
[0049] The server receives a data update request, parses it to obtain the task type. Since different task types have different configuration data, converting the task update data into the same data structure requires a serialization program corresponding to the configuration data. For example, if the configuration data can include the item's price, name, event time, and product ID, then the corresponding serialization program is one that can serialize the above configuration data. If it includes the item's price, name, item level, attack power, defense power, and product ID, then the corresponding serialization program is one that can serialize the configuration data.
[0050] Taking the data serialization protocol Protocol Buffer (also known as protobuf) as an example, for instance, if the configuration data for item A includes item ID, item name, and item price, then its corresponding task update data includes item A's item ID, item name, and the corresponding item price. The serialization code is shown below: option java_outer_classname = "Aproduct Entity"; message Apoduct { required int32 id = 1; Required string name = 2; Required string price = 3; ...} The item ID, item name, and item price of item A in the task update data can be set as the values of the fields id, name, and price, respectively. The task update data can then be serialized into bytes using a serialization program to obtain serialized update data, which is binary data.
[0051] The step "serializing the task update data based on the serialization procedure to obtain serialized update data" can specifically include: The update data is processed by reflection according to the serialization procedure to obtain the reflected update data; The updated data after reflection is serialized to obtain serialized updated data.
[0052] For example, one could use protobuf's reflection mechanism to convert the values related to item A in the task update data into the values of the corresponding fields in the serializer, and then perform serialization processing through the serializer to obtain the serialized update data.
[0053] If item B's configuration data includes item ID, item name, health points, and item price, then its corresponding task update data includes item A's item ID, item name, and item price. The serialization code is as follows: option java_outer_classname = "Aproduct Entity"; message Apoduct { required int32 id = 1; Required string name = 2; Required string health = 3; Required string price = 4; ...} Referring to the above process of serializing the task update data of item A to obtain serialized update data, the serialized update data corresponding to item B can be obtained.
[0054] Because different tasks require different configuration data, the fields in the data tables storing this configuration data differ, meaning the data structures of the data tables are different. For example, for a clothing store, the configuration data for each garment might include garment ID, garment name, garment category, price, and material. Therefore, the corresponding data table would need to include these fields. Similarly, for gaming devices, the configuration data for each device might include device ID, defense value, attack value, and level. Thus, the corresponding data table would need to include these fields as well. Therefore, when adding a new task or business, a data table with a corresponding storage structure for its configuration data needs to be designed. This application serializes the task update data, converting it into a unified data type. This allows configuration data for different tasks within different businesses to be stored in a data table with the same data structure. When a new business or task is added, it's not necessary to design a separate data table; the corresponding configuration data can still be stored in the existing data table. The solution provided in this application has good scalability.
[0055] When the configuration data of a task is updated, the version number of the task and the version number of the corresponding business need to be updated. The version number can be identified by strings such as numbers. For example, the initial task version number can be 0, and the initial business version number can also be 0. After the first update of the task configuration data, its task version number can be updated to 1, and the business version number of the business to be updated can also be updated to 1, and so on.
[0056] In addition, time can be used to identify the business version number of the service and the task version number corresponding to the tasks included in the service. That is, in one embodiment, the step "to obtain the business update version number of the business version number of the service to be updated and to update the task version number of the target task to obtain the task update version number" may specifically include: Get the timestamp information corresponding to the current time; Use timestamp information as the business update version number of the service to be updated, and use timestamp information as the task update version number of the target task.
[0057] The timestamp information may include a sequence of characters or encoded information used to identify when a specific event occurred.
[0058] For example, it could involve obtaining timestamp information based on the current time, using the timestamp information as the task update version number of the target task, updating the task version number of the target task in the cloud database, or using the timestamp information as the business update version number of the business to be updated, and updating the business version number of the business to be updated in the cloud database.
[0059] Since timestamp information can identify the time when the configuration data of the target task is updated, and the timestamp information is different each time the configuration data is modified, the timestamp information can be used as a version number to identify the version of the configuration data corresponding to the target task in the database, as well as the version of the business to be updated. By comparing the timestamp information, it can be determined whether the business and the tasks contained in the business have been updated.
[0060] 104. Build the corresponding data conversion program according to the task type of the target task.
[0061] The data conversion program is a program that converts serialized update data into task update data. The data conversion program can be the same as the serialization program mentioned in step 102.
[0062] For example, the required data conversion program can be determined based on the task type, and a corresponding data conversion program can be built to convert serialized update data into task update data.
[0063] 105. The serialized update data is deserialized through a data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the business to be updated based on the task update data.
[0064] Deserialization is the process relative to serialization, which can convert serialized update data into task update data so that the terminal can recognize it.
[0065] For example, the serialized update data can be deserialized according to the data conversion program to obtain the task update data of the target task. The task update data can be cached. When a data acquisition request is received from the terminal, the task update data can be sent to the terminal, so that the terminal can refresh the page based on the task update data, and the configuration data corresponding to the task on the page can be updated.
[0066] After deserializing the serialized update data to obtain the task update data of the target task, the task version number of the target task and the service version number of the service to be updated containing the target task can also be updated. That is, in one embodiment, after the step "deserializing the serialized update data through a data conversion program to obtain the task update data of the target task", the data update method provided in this application embodiment may further include: Update the current business version number of the business to be updated based on the business update version number; Update the current task version number of the target task in the business to be updated based on the task update version number.
[0067] For example, the service update version number can be used as the current service version number of the service to be updated, so as to update the service version number of the service to be updated, and the task update version number can be used as the current task version number of the target task in the service to be updated, so as to update the task version number of the target task.
[0068] The updated current business version number and current task version number, along with the corresponding task update data, are cached for comparison with the business update version number and task update version number in the cloud database in the next update. This allows for timely updates to the task configuration data, quickly resolving issues caused by data errors, reducing losses, and enabling rapid adjustments to the configuration data as needed.
[0069] Optionally, if the task requiring data updates is a newly added task, the terminal needs not only the task's configuration data but also the task's corresponding resources, such as images, audio, and tags for displaying the task. Therefore, in one embodiment, when the target task includes a target type task, the step "deserializing the serialized update data using a data conversion program to obtain the target task's task update data" may specifically include: The serialized update data is deserialized using a data conversion program to obtain the processed update data for the target task. If the target task is a target type task, then obtain the task resources for the target type task; The task resources and the updated data after processing are used as the task update data for the target type task.
[0070] For example, it can be done by comparing the task IDs of the tasks in the business to be updated in the cloud database with the task IDs of the business to be updated in the local cache. If the task IDs exist in the cloud database but not in the local cache, it means that the task is a new task, which is the target type task. The corresponding task resources are obtained according to the task IDs. The task resources and the processed update data obtained through deserialization are used as the task update data of the target type task. The terminal can display the new task and the corresponding configuration data based on the task update data.
[0071] As can be seen from the above, this embodiment of the application obtains the task update version number and the current task version number corresponding to the task included in the service to be updated; compares the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task in the service to be updated that needs to be updated; obtains the serialized update data of the target task; constructs a corresponding data conversion program according to the task type of the target task; and performs deserialization processing on the serialized update data through the data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the service to be updated based on the task update data.
[0072] This solution compares the task update version number with the current task version number to determine the target task that needs data updating. It only needs to obtain the serialized update data of the target task in the business to be updated, without needing to obtain the full update data of the business to be updated. The data acquisition speed is fast, and since the data is serialized into serialized update data of the same data format, when adding new businesses or tasks, there is no need to design a corresponding storage structure for the new businesses or tasks. It has strong scalability, and new businesses or tasks can also be updated quickly. Therefore, this solution can improve the data update efficiency of the business.
[0073] Based on the above embodiments, the following examples will provide further detailed explanations.
[0074] This embodiment will be described from the perspective of a data update system, which includes a server cluster, a remote database, an operation client, and an application client. The server cluster may include a data update server and a business server. The data update server is used to write the task update data of a task to the cloud server. The business server is used to determine the target task that needs to be updated by version number and to pull the task update data of the target task from the cloud server. The operation client can be used to add, delete, and modify tasks. The application client can display tasks to provide corresponding services to users.
[0075] This application provides a data update method, such as... Figure 3 As shown, the specific process of this data update method can be as follows: 2101. The operation client responds to the edit operation, obtains the task update data for the target task, and sends a data update request to the data update server.
[0076] Taking the business category as the product category of the mall on the application client and the task category as the product under the product category of the mall as an example, the mall has three businesses: fashion, props, and equipment. Each business has corresponding products. The configuration data of products under different product categories are different. For example, under the fashion category, the configuration data of each garment can include ID, name, price, and color. Under the prop category, the configuration data of each prop can include ID, name, price, discount, capacity, effect, quantity, purchase start time, and purchase end time. Under the equipment category, the configuration data of each piece of equipment can include ID, name, price, energy value, defense value, purchase start time, and purchase end time.
[0077] like Figure 4 As shown, the client displays a task configuration page. Operations personnel can add, delete, and modify items on this page, such as changing the price of an item, deleting an outfit, or adding equipment. The client responds to these edits on the task configuration page, retrieves the task update data entered by the operator for the target task, and packages this data into a JSON string.
[0078] The client sends the task update data, packaged as a JSON string, to the data update server via the HTTP protocol.
[0079] 2201. The data update server determines the task type of the target task based on the data update request and constructs the corresponding serialization program based on the task type.
[0080] For example, the data update server parses the task update data packaged as a JSON string to determine the task type of the target task.
[0081] Since different task types have different configuration data, converting task update data into the same data structure requires a serialization program corresponding to the configuration data. The task type can be used to determine the serialization program that should be used to serialize the task update data of the target task.
[0082] 2202. The data update server serializes the task update data based on the serialization program to obtain serialized update data.
[0083] For example, the data update server can use the reflection mechanism of protobuf to convert the JSON string data into the value of the corresponding field in the serializer, and then perform serialization processing through the serializer to obtain binary serialized update data. Through steps 2102 and 2103, the task type of the target task, the binary data of the target task, and the length of the binary data can be obtained.
[0084] 2203. The data update server obtains the business update version number of the business to be updated business and the task version number of the target task, and updates the data to obtain the task update version number.
[0085] For example, when the configuration data of a task is updated, the data update server needs to update the version number of the task and the version number of the corresponding business. The version number can be identified by strings such as numbers. For example, the initial task version number can be 0, and the initial business version number can also be 0. After the first update of the configuration data of the task, its task version number can be updated to 1, and the business version number of the business to be updated can also be updated to 1, and so on.
[0086] Optionally, when the target task is a new task, the version number corresponding to the new task can be updated to the current business version number + 1, so that the node added to the target task can be determined through the version number record.
[0087] 2204. The data update server updates the business update version number, the corresponding task update version number, and the serialized update data of the business to be updated to the cloud database.
[0088] For example, the data update server updates the business update version number, the corresponding task update version number, and the serialized update data of the business to be updated to the cloud database.
[0089] 2301. The business server periodically retrieves the business update version number of the business to be updated from the cloud database, as well as the current business version number locally.
[0090] For example, the business server could periodically retrieve the business update version number of the business to be updated from the cloud database, and retrieve the current business version number from the local database.
[0091] 2302. If the business update version number of the business to be updated does not match the current business version number, the business server will retrieve the task update version number corresponding to the task included in the business to be updated and the current task version number from the cloud database.
[0092] For example, the business server compares the task update version number with the current task version number. If the business update version number and the current version number are inconsistent, it means that the task contained in the business to be updated has been updated. Then, it retrieves the task update version number corresponding to the task contained in the cloud database, and retrieves the current task version number locally.
[0093] 2303. The business server compares the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated.
[0094] For example, the business server can compare the update version number of each task in the business to be updated with the current task version number to determine whether the update version number and the current task version number are the same. If the update version number of the task is different from the current task version number, it means that the task configuration data of the task needs to be updated, and the task is identified as the target task.
[0095] If a task only has an updated version number obtained from the cloud database and no current task version number, then the task is determined to be a new task. The business updates the database to obtain the task resources and configuration data of the new task and instructs the client to display the task. If a task only has a current task version number and no updated task version number, then the task is determined to be a deleted task. The business server instructs the client not to display the task.
[0096] 2304. The business server retrieves the serialized update data of the target task from the cloud database.
[0097] For example, the business server could retrieve the serialized update data of the target task from the database based on the task ID of the target task.
[0098] 2305. The business server constructs the corresponding data conversion program based on the task type of the target task.
[0099] For example, the business server can determine the required data transformation program based on the task type and build the corresponding data transformation program to transform serialized update data into task update data.
[0100] 2306. The business server deserializes the serialized update data through a data conversion program to obtain the task update data of the target task, so that the client can obtain the task update data and update the target task of the business to be updated based on the task update data.
[0101] For example, the business server can deserialize the serialized update data according to the data conversion program to obtain the task update data of the target task, cache the task update data, and when it receives a data acquisition request from the terminal, send the task update data to the terminal so that the application client can refresh the page based on the task update data, thereby updating the configuration data corresponding to the task contained on the page.
[0102] 2307. The business server updates the current business version number of the business to be updated, as well as the current task version number and task update data of the target task in the business to be updated.
[0103] For example, the business server can use the business update version number as the current business version number of the business to be updated, in order to update the business version number of the business to be updated, and use the task update version number as the current task version number of the target task in the business to be updated, in order to update the task version number of the target task.
[0104] The updated current business version number and current task version number, along with the corresponding task update data, are cached for comparison with the business update version number and task update version number in the cloud database in the next update. This allows for timely updates to the task configuration data, quickly resolving issues caused by data errors, reducing losses, and enabling rapid adjustments to the configuration data as needed.
[0105] Optionally, if the task requiring data updates is a newly added task, the terminal needs not only the task's configuration data, but also the task's corresponding resources, such as images, audio, and tags used to display the task.
[0106] As can be seen from the above, in this embodiment of the application, the client responds to the editing operation, obtains the task update data for the target task, and sends a data update request to the data update server. The data update server determines the task type of the target task based on the data update request and constructs a corresponding serialization program based on the task type; the data update server performs serialization processing on the task update data based on the serialization program to obtain serialized update data; the data update server obtains the business update version number of the business to be updated and the task version number of the target task, and updates the business update version number of the business to be updated, the corresponding task update version number, and the serialized update data to the cloud database. The business server periodically retrieves the business update version number of the business to be updated from the cloud database, as well as the current business version number locally. If the business update version number of the business to be updated does not match the current business version number, the business server retrieves the task update version number corresponding to the task included in the business to be updated and the current task version number from the cloud database. The business server compares the version difference between the task update version number and the current task version number to determine the target task in the business to be updated that needs data updating. The business server retrieves the serialized update data of the target task from the cloud database. The business server constructs a corresponding data conversion program based on the task type of the target task. The business server deserializes the serialized update data using the data conversion program to obtain the task update data of the target task, which is then provided to the application client to obtain the task update data and update the target task of the business to be updated based on the task update data. The business server updates the current business version number of the business to be updated, as well as the current task version number and task update data of the target task in the business to be updated.
[0107] This solution compares the task update version number with the current task version number to determine the target task that needs data updating. It only needs to obtain the serialized update data of the target task in the business to be updated, without needing to obtain the full update data of the business to be updated. The data acquisition speed is fast, and since the data is serialized into serialized update data of the same data format, when adding new businesses or tasks, there is no need to design a corresponding storage structure for the new businesses or tasks. It has strong scalability, and new businesses or tasks can also be updated quickly. Therefore, this solution can improve the data update efficiency of the business.
[0108] To facilitate better implementation of the data update method provided in the embodiments of this application, a data update apparatus is also provided in one embodiment. The meanings of the terms used are the same as in the data update method described above, and specific implementation details can be found in the description of the method embodiments.
[0109] This data update device can be integrated into a computer device, such as... Figure 5 As shown, the data update device may include: a version acquisition unit 301, a comparison unit 302, a data acquisition unit 303, a construction unit 304, and a data processing unit 305, as detailed below: (1) Version acquisition unit 301 is used to acquire the task update version number and the current task version number of the task included in the business to be updated.
[0110] In one embodiment, the version acquisition unit 301 includes a first acquisition subunit and a second acquisition subunit, specifically: The first acquisition subunit is used to periodically acquire the business update version number of the business to be updated and the current business version number. The second acquisition subunit is used to acquire the task update version number corresponding to the task included in the service to be updated and the current task version number if the service update version number of the service to be updated does not match the current service version number.
[0111] (2) Comparison unit 302 is used to compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated.
[0112] (3) Data acquisition unit 303 is used to acquire serialized update data of the target task. The serialized update data is the data obtained by serializing the update data of the target task.
[0113] (4) Construction unit 304 is used to construct the corresponding data conversion program according to the task type of the target task.
[0114] (5) Data processing unit 305 is used to deserialize serialized update data through data conversion program to obtain task update data of target task, so that the terminal can obtain task update data and update the target task of the business to be updated based on task update data.
[0115] In one embodiment, the target task includes a target type task, and the data processing unit 305 includes a deserialization subunit, a resource acquisition subunit, and a data determination subunit, specifically: The deserialization subunit is used to deserialize serialized update data through a data conversion program to obtain the processed update data of the target task. The resource acquisition subunit is used to acquire the task resources of the target type task if the target task is a target type task. The data determination subunit is used to use task resources and processed updated data as task update data for the target type task.
[0116] In one embodiment, the data update device may further include a service version update unit and a task version update unit, specifically: The business version update unit is used to update the current business version number of the business to be updated based on the business update version number; The task version update unit is used to update the current task version number of the target task in the business to be updated according to the task update version number.
[0117] In one embodiment, the data update apparatus may further include a request acquisition unit, a task type determination unit, a serialization unit, and an update unit, specifically: The request acquisition unit is used to acquire data update requests for the target task of the business to be updated. The data update requests carry the updated data of the target task. The task type determination unit is used to determine the task type of the target task based on the data update request, and to build the corresponding serialization program based on the task type; The serialization unit is used to serialize the updated data based on the serialization program to obtain serialized updated data; The update unit is used to obtain the business update version number from the business version number of the business to be updated and the task version number of the target task, and then update the task update version number.
[0118] In one embodiment, the serialization unit may include a reflection processing subunit and a serialization processing subunit, specifically: The reflection processing subunit is used to perform reflection processing on the updated data according to the serialization program to obtain the reflected updated data. The serialization processing subunit is used to serialize the updated data after reflection to obtain serialized updated data.
[0119] In one embodiment, the update unit includes an information acquisition subunit and a version update subunit, specifically: The information acquisition subunit is used to acquire the timestamp information corresponding to the current time. The version update subunit is used to use timestamp information as the business update version number of the service to be updated, and to use timestamp information as the task update version number of the target task.
[0120] As can be seen from the above, the data update device in this embodiment of the application obtains the task update version number and the current task version number corresponding to the task included in the service to be updated through the version acquisition unit 301; the comparison unit 302 compares the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task in the service to be updated that needs to be updated; the data acquisition unit 303 obtains the serialized update data of the target task; the construction unit 304 constructs the corresponding data conversion program according to the task type of the target task; finally, the data processing unit 305 performs deserialization processing on the serialized update data through the data conversion program to obtain the task update data of the target task for the terminal. This solution acquires task update data and updates the target task of the business to be updated based on the task update data. It determines the target task that needs to be updated by comparing the task update version number with the current task version number. It only needs to acquire the serialized update data of the target task in the business to be updated, without acquiring the full update data of the business to be updated. The data acquisition speed is fast, and since the data is serialized into serialized update data of the same data format, when adding new businesses or tasks, there is no need to design a corresponding storage structure for the new businesses or tasks. It has strong scalability, and new businesses or tasks can also be updated quickly. Therefore, this solution can improve the data update efficiency of the business.
[0121] This application also provides a computer device, which can be a terminal or a server, such as... Figure 6 As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically: The computer device may include components such as a processor 1001 with one or more processing cores, a memory 1002 with one or more computer-readable storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will understand that... Figure 6 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 1001 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 1002, and by calling data stored in the memory 1002, it performs various functions of the computer device and processes data, thereby performing overall detection of the computer device. Optionally, the processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and computer programs, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1001.
[0122] The memory 1002 can be used to store software programs and modules. The processor 1001 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, computer 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 device, etc. In addition, the memory 1002 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. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 with access to the memory 1002.
[0123] The computer equipment also includes a power supply 1003 that supplies power to the various components. Preferably, the power supply 1003 can be logically connected to the processor 1001 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 1003 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0124] The computer device may also include an input unit 1004, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0125] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 1001 in the computer device loads the executable files corresponding to the processes of one or more computer programs into the memory 1002 according to the following instructions, and the processor 1001 runs the computer programs stored in the memory 1002 to realize various functions, as follows: Get the task update version number and the current task version number of the tasks included in the business to be updated; Compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated. Obtain the serialized update data of the target task; construct the corresponding data transformation program based on the task type of the target task; The serialized update data is deserialized through a data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the business to be updated based on the task update data.
[0126] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0127] As can be seen from the above, the computer device in this application embodiment can obtain the task update version number and the current task version number corresponding to the task included in the service to be updated; compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task in the service to be updated that needs to be updated; obtain the serialized update data of the target task; construct a corresponding data conversion program according to the task type of the target task; and perform deserialization processing on the serialized update data through the data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the service to be updated based on the task update data. This solution determines the target task that needs to be updated by comparing the task update version number and the current task version number. It only needs to obtain the serialized update data of the target task in the service to be updated, and does not need to obtain the full update data of the service to be updated. The data acquisition speed is fast, and since the data will be serialized into serialized update data of the same data format, when a new service or task is added, there is no need to design a corresponding storage structure for the new service or task. It has strong scalability, and the new service or task can also be updated quickly. Therefore, this solution can improve the data update efficiency of the service.
[0128] According to one aspect of this application, a computer program product is provided, comprising a computer program containing 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 the methods provided in the various optional implementations of the above embodiments.
[0129] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0130] Therefore, embodiments of this application provide a computer-readable storage medium storing a computer program that can be loaded by a processor to execute any of the data update methods provided in embodiments of this application.
[0131] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0132] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0133] Since the computer program stored in the computer-readable storage medium can execute any of the data update methods provided in the embodiments of this application, the beneficial effects that any of the data update methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0134] The above provides a detailed description of a data update method, apparatus, computer device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A data update method, characterized in that, include: Periodically retrieve the business update version number of the business to be updated and the current business version number; If the service update version number of the service to be updated does not match the current service version number, then obtain the task update version number and the current task version number corresponding to the task included in the service to be updated. Compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the business to be updated. The serialized update data of the target task is obtained in advance according to the following method: obtaining a data update request for the target task of the service to be updated, the data update request carrying the task update data of the target task; determining the task type of the target task according to the data update request, and constructing a corresponding serialization program based on the task type; performing serialization processing on the task update data based on the serialization program to obtain the serialized update data; wherein, the data structure of the configuration data of tasks of different task types is different, and a corresponding serialization program is constructed based on the task type to convert the task update data of different tasks into a unified data type, so that the configuration data of different tasks of different services are stored in the same data structure table; Build a corresponding data transformation program based on the task type of the target task; The serialized update data is deserialized using the data conversion program to obtain the task update data for the target task, which is then used by the terminal to update the target task of the service to be updated.
2. The method according to claim 1, characterized in that, After deserializing the serialized update data using the data conversion program to obtain the task update data for the target task, the method further includes: Update the current service version number of the service to be updated according to the service update version number; Update the current task version number of the target task in the service to be updated according to the task update version number.
3. The method according to claim 1, characterized in that, Before obtaining the serialized update data of the target task, the method further includes: The service version number of the service to be updated is updated to obtain the service update version number, and the task version number of the target task is updated to obtain the task update version number.
4. The method according to claim 3, characterized in that, The step of serializing the task update data based on the serialization program to obtain serialized update data includes: The task update data is processed by reflection according to the serialization procedure to obtain the reflected update data. The reflected update data is serialized to obtain the serialized update data.
5. The method according to claim 3, characterized in that, The process of obtaining the service update version number from the service version number of the service to be updated and updating the task version number of the target task to obtain the task update version number includes: Get the timestamp information corresponding to the current time; The timestamp information is used as the service update version number of the service to be updated, and the timestamp information is used as the task update version number of the target task.
6. The method according to any one of claims 1-5, characterized in that, The target task includes target type tasks. The process of deserializing the serialized update data using the data conversion program to obtain the task update data for the target task includes: The serialized update data is deserialized using the data conversion program to obtain the processed update data for the target task. If the target task is a target type task, then obtain the task resources for the target type task; The task resources and the processed update data are used as the task update data for the target type task.
7. A data update device, characterized in that, include: The version acquisition unit includes: a first acquisition subunit, used to periodically acquire the service update version number and the current service version number of the service to be updated; and a second acquisition subunit, used to acquire the task update version number and the current task version number corresponding to the task included in the service to be updated if the service update version number of the service to be updated does not match the current service version number. The comparison unit is used to compare the version difference between the task update version number corresponding to the task and the current task version number to obtain the target task that needs to be updated in the service to be updated. The request acquisition unit is used to acquire a data update request for the target task of the service to be updated, wherein the data update request carries the task update data of the target task. The task type determination unit is used to determine the task type of the target task based on the data update request, and to construct a corresponding serialization program based on the task type. A serialization unit is used to serialize the task update data based on the serialization program to obtain serialized update data. The configuration data of tasks of different task types have different data structures. A corresponding serialization program is built based on the task type to convert the task update data of different tasks into a unified data type, so that the configuration data of different tasks of different services are stored in the same data structure table. A data acquisition unit is used to acquire the serialized update data of the target task; The construction unit is used to construct a corresponding data conversion program according to the task type of the target task; The data processing unit is used to deserialize the serialized update data through the data conversion program to obtain the task update data of the target task, so that the terminal can obtain the task update data and update the target task of the service to be updated based on the task update data.
8. A computer device, characterized in that, It includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the data update method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which is loaded by a processor to perform the data update method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the data update method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Table data update method and device in game client
CN110585724A
Software project continuous integration method and device, terminal equipment and storage medium
CN112068874A