Offline static resource file updating method and related device
By detecting and updating static resource files on the client, the problem of unavailability of page functions when static resource files are updated is solved, and the page functions are kept in normal use during the update process and waiting time is reduced.
Patent Information
- Application Number
- CN202410973122.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-15
AI Technical Summary
When static resource files are updated, the client's page function cannot be used normally, which affects the user experience. You need to wait until the update is completed before restarting the client to use the updated page function.
When the client switches to the active state of the foreground, it detects whether the offline static resource file needs to be updated, and obtains the required static resource data from the latest version of the online static resource file to update the current page, thereby ensuring the normal use of the page function until it is Get the latest version of the online static resource file as offline static resource file.
Maintain the normal use of the current page function during the update process, reduce user waiting time, avoid problems with the page function due to version inconsistency, and improve user experience.
Smart Images

Figure CN118963813A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of service update, and in particular to an offline static resource file update method and related devices. Background Art
[0002] Static resource files define the display mode of the client page and the corresponding function entrance, such as page icons, buttons, backgrounds, fonts, etc. When a user opens a client page, he can download the static resource data corresponding to the current page from the online static resource file stored on the server, or obtain the static resource data corresponding to the current page from the offline static resource file pre-downloaded and stored on the client.
[0003] In the related art, when the online static resource files on the server are updated, in order to prevent the problem of unavailable page functions caused by the inconsistency between the offline static resource files and the online static resource files, the offline static resource files stored on the client also need to be updated synchronously. At this time, when the user opens the client, he needs to download the new version of the online static resource files from the server first, and after the download is complete, use the new version of the online static resource files as the updated offline static resource files, and then restart the client to load the client page according to the static resource data in the new version of the offline static resource files. After the update is completed, the page functions of the client can be used normally.
[0004] That is to say, during the above process of updating the offline static resource files, the page functions of the client cannot be used normally, and the page functions can only be used normally after the update is completed, which affects the user experience. Summary of the invention
[0005] In view of the above problems, the present application provides an offline static resource file updating method and related devices to solve the problem that the client functions cannot be used normally during the offline static resource file updating process.
[0006] Based on this, the embodiments of the present application disclose the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a method for updating an offline static resource file, wherein the offline static resource file is a static resource file stored on a client, and the method comprises:
[0008] When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, the online static resource file is a static resource file stored in the server, the client includes multiple pages, the current page of the client is a page currently opened among the multiple pages, and the online static resource file includes the static resource data required for each of the multiple pages;
[0009] Update the current page of the client according to the static resource data required by the current page of the client;
[0010] The latest version of the online static resource file is obtained, and the latest version of the online static resource file is used as the latest version of the offline static resource file.
[0011] In some implementations, when the client switches to the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required for the current page of the client is obtained from the latest version of the online static resource file, specifically:
[0012] Sending a request to the server to obtain the latest version of the online static resource file;
[0013] Receive the latest version number of the online static resource file returned by the server;
[0014] If the latest version number of the online static resource file is inconsistent with the version number of the offline static resource file, the offline static resource file needs to be updated, and the static resource data required for the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
[0015] In some implementations, when the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, specifically:
[0016] In response to a function trigger on the current page of the client, a function interface call request message is sent to a server gateway, wherein the function interface call request message includes a version number of the offline static resource file;
[0017] Receive a response message sent by the server gateway. If the response message includes the latest version number of the online static resource file, the offline static resource file needs to be updated, and the static resource data required for the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
[0018] In some implementations, when the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required for the current page of the client is obtained from the latest version of the online static resource file, specifically:
[0019] When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, detecting the acquisition progress of the latest version of the online static resource file;
[0020] If it is detected that the latest version of the online static resource file has not started to be obtained, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file;
[0021] If it is detected that the latest version of the online static resource file is being obtained, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, and the subsequent step of obtaining the latest version of the online static resource file is no longer performed;
[0022] If it is detected that the latest version of the online static resource file has been acquired, the latest version of the online static resource file is used as the latest version of the offline static resource file, and the static resource data required for the current page of the client is obtained from the latest version of the offline static resource file, and the subsequent step of acquiring the latest version of the online static resource file is no longer executed.
[0023] In some implementations, an offline static resource file updating method provided by an embodiment of the present application further includes:
[0024] If it is detected that the latest version of the online static resource file has been obtained, an update prompt is displayed on the current page of the client;
[0025] In response to a selection operation for the update prompt, using the latest version of the online static resource file as the latest version of the offline static resource file, and acquiring static resource data required for the current page of the client from the latest version of the offline static resource file;
[0026] In response to a cancel operation on the update prompt, static resource data required by the current page of the client is obtained from the online static resource file of the latest version.
[0027] In some implementations, an offline static resource file updating method provided by an embodiment of the present application further includes:
[0028] If it is detected that the online static resource file is acquired completely, in response to the startup operation of the client, the static resource data required for the current page of the client is acquired from the offline static resource file of the latest version.
[0029] In some implementations, obtaining the latest version of the online static resource file and using the latest version of the online static resource file as the latest version of the offline static resource file includes:
[0030] When the client switches from the foreground active state to the foreground inactive state or the background active state to the background active state, if it is detected that the latest version of the online static resource file is being acquired, the latest version of the online static resource file continues to be acquired until it is detected that the acquisition of the latest version of the online static resource file is completed.
[0031] In a second aspect, an embodiment of the present application provides a method for updating an offline static resource file, wherein the offline static resource file is a static resource file stored on a client, and the method comprises:
[0032] The server gateway receives the function interface call request message sent by the client, wherein the function interface call request message includes the version number of the offline static resource file;
[0033] If the version number of the offline static resource file is inconsistent with the latest version number of the online static resource file stored on the server, the server gateway sends a response message to the client, and the response message includes the latest version number of the online static resource file stored on the server.
[0034] In a third aspect, an embodiment of the present application provides a computer device, the device comprising a processor and a memory:
[0035] The memory is used to store program code and transmit the program code to the processor;
[0036] The processor is used to execute the method described in the first aspect of the present application according to the instructions in the program code, or to execute the method described in the second aspect of the present application.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the first aspect of the present application, or to execute the method described in the second aspect of the present application.
[0038] The advantages of the above technical solution of this application are:
[0039] The present application proposes an offline static resource file update method, which includes: when the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, at this time, if the offline static resource file is not updated, the static resource file versions stored by the server and the client are inconsistent, and the client function will be unavailable. Based on this, if it is detected that the offline static resource file needs to be updated, the static resource data required by the client's current page is obtained from the latest version of the online static resource file, and the client's current page is updated according to the static resource data required by the client's current page, so that when the online static resource file is updated, the function of the current page can still be used normally, and there is no need to wait for the entire offline static resource file to be updated before restarting the client to use the page function. Get the latest version of the online static resource file, and use the latest version of the online static resource file as the latest version of the offline static resource file to ensure that when switching to other pages or restarting the client, the latest version of the offline static resource file can be directly used to update the page, reducing the time the user waits for the update. The above technical solution of the present application can ensure that during the process of updating offline static resource files, the functions of the current page can be used normally without affecting the user's operations on the current page. It can solve the problem that the client's page functions cannot be used normally during the process of updating offline static resource files. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 A flowchart of an offline static resource file updating method provided in an embodiment of the present application;
[0042] Figure 2 A flow chart of a method for detecting whether an offline static resource file needs to be updated provided by the present application;
[0043] Figure 3 A flowchart of another method for detecting whether an offline static resource file needs to be updated provided by the present application;
[0044] Figure 4 A schematic diagram of an update prompt provided in an embodiment of the present application;
[0045] Figure 5 A structural diagram of a computer device provided for this application. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] Static resource files define the display mode of the client page and the corresponding function entrance, such as the page icon, button, background, font, etc. The static resource files stored on the server are online static resource files. When the client page is opened, the static resource data corresponding to the client's current page can be downloaded from the online static resource files stored on the server, and these static resource data can be used to load the client's current page so that the client's current page can be displayed normally.
[0048] In the related art, the online static resource files stored in the server can be pre-downloaded and stored in the client. The static resource files stored in the client are offline static resource files. When the client page is opened, it is not necessary to access the server every time. The static resource data corresponding to the current page can be directly obtained from the offline static resource files stored in the client, and the current page of the client is loaded according to the obtained static resource data, which improves the loading speed of the current page of the client, and the current page of the client can be loaded in an offline state.
[0049] In the case of frequent updates and iterations of client functions, each time the online static resource files stored on the server are updated, the offline static resource files stored on the client will lag behind the online static resource files stored on the server, resulting in problems such as the client page functions not being able to be used normally. For example:
[0050] 1. Functional incompatibility: The new version of the online static resource file introduces new functions or modifies existing functions. If the offline static resource file is not updated, there will be incompatibility between the old functions and the new code. The client still uses the old version of the API (Application Programming Interface), which may cause request failures or data parsing errors, resulting in client crashes or abnormal behavior.
[0051] 2. Client page display issues: The update of online static resource files usually involves the layout and style of the client page. If the version of the offline static resource file is not synchronized with the version of the online static resource file stored on the server, the client page will be displayed incorrectly, such as layout misalignment, style loss, etc.
[0052] 3. Missing resources: If the updated online static resource file contains new resources, such as pictures, audio, etc., and the offline static resource file is not updated synchronously, the client will have an error because it cannot find these resources.
[0053] To avoid these problems, when the online static resource files stored on the server are updated, the offline static resource files stored on the client need to be updated in time to ensure that the versions of the online and offline static resource files are consistent.
[0054] In the related art, during the synchronous update of offline static resource files stored in the client, the user needs to download the new version of the online static resource files from the server when opening the client page, and after the download is completed, the new version of the online static resource files is stored in the client as the updated offline static resource files, and then the client is restarted to load the client page according to the static resource data in the new version of the offline static resource files. The user can also reinstall the entire client to update all resource files stored in the client, and all resource files also include offline static resource files. After the above-mentioned offline static resource file update process is completed, the page function of the client can be used normally. If the client is used during the above-mentioned offline static resource file update process, the client page function will cause the offline static resource file and the server-provided API to not match because the offline static resource file and the online static resource file version do not match, and then there will be problems such as functional incompatibility, incorrect display of the client page, and missing resources, and the client page function cannot be used normally.
[0055] That is to say, during the above process of updating offline static resource files, the page function of the client cannot be used normally, and the page function can only be used normally after the update is completed. In this way, the user waits for a long time for the update, which affects the user experience.
[0056] The offline static resource file update method provided in this application can be applied to computer devices with offline static resource file update capabilities, such as terminal devices and servers. Specifically, the terminal device can be a desktop computer, a laptop computer, a mobile phone, and a tablet computer, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, etc. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0057] In order to solve the problem that the client page function cannot be used normally during the offline static resource file update process, the embodiment of the present application provides an offline static resource file update method. Figure 1 , which introduces this method. Figure 1 , this figure is a flowchart of an offline static resource file updating method provided in an embodiment of the present application, and the method may include S101-S103.
[0058] S101: When the client switches to the foreground active state or is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file.
[0059] The client in this application can be a client (application) installed in a terminal device with offline static resource file update capability as described above, for example, an application installed on the terminal device, or an application installed on the operating system of the terminal device, such as a mail client, instant messaging software, etc. The client is used to provide users with various types of functional services, such as information acquisition services, communication services, and other personalized services.
[0060] The server in this application can be a server installed in a server with offline static resource file update capability as described above. The server corresponds to the aforementioned client. The server responds to the client's request and provides services such as data storage, processing and access to the client, such as file transfer service, mail service, database service, etc. The server provides an API interface, allowing the client to call the server's functions and data through the API interface.
[0061] The interaction between the server and the client usually follows the client-server model, where the client sends requests and the server responds to those requests. This model allows clients and servers to run in different geographical locations and environments and communicate over the network.
[0062] When a user uses the client, the client is responsible for sending requests to the server and receiving responses from the server. The client includes multiple pages, allowing users to operate on the pages and call the functions and data of the server. The server is responsible for processing requests, executing business logic, storing data, and returning results to the client.
[0063] The running status of the client is divided into active status and inactive status. According to whether the client is used in the foreground or the background, the running status of the client can be divided into foreground active status, foreground inactive status, background active status, and background inactive status.
[0064] The following uses the app (Application) installed on a mobile device as an example to explain the running status of the client. The running status of the App can be divided into the following four types:
[0065] (1) Foreground active state: When the app page is fully displayed on the screen and the user is interacting with it, the application is in the foreground active state. In this state, the app can receive touch events or listen to input events such as keyboard or mouse, perform various tasks based on the input events, and have higher system resource allocation permissions.
[0066] (2) Foreground Inactive State: When the app's page is visible on the screen but the user is not directly interacting with it, the app is in the foreground inactive state. For example, when a phone call comes in or the user switches to another application but does not close the current application, the app is in the foreground inactive state. In this state, the app usually does not receive touch events, but is still visible on the screen.
[0067] (3) Background active state: When the app page is not visible on the screen but is still performing certain tasks, such as downloading files, playing music, etc., the app is in the background active state. In this state, the app can still use some system resources, but they will be restricted.
[0068] (4) Background inactive state: When the app page is not visible on the screen and is no longer performing tasks, the app is in the background inactive state.
[0069] It should be noted that when the app is not running in the background and the user clicks the app icon to start the app, the running state of the app switches to the foreground active state.
[0070] Static resource files define the display mode of the client page and the corresponding function entrance, such as page icons, buttons, backgrounds, fonts, etc. Static resource files include online static resource files and offline static resource files. Offline static resource files are static resource files stored on the client, and online static resource files are static resource files stored on the server.
[0071] Static resource files such as online static resource files and offline static resource files are usually folders including multiple sub-files, or compressed packages including multiple sub-files. Static resource data can be a single or multiple sub-files in the entire static resource file, or specific data included in the sub-files.
[0072] The client includes multiple pages, and the current page of the client is the page currently opened on the screen of the terminal device on which the client is installed. The static resource file includes the static resource data required for each of the multiple pages of the client. When each page of the client is loaded or updated, the static resource data corresponding to each page needs to be used.
[0073] The number of client pages and the number of sub-files in the static resource file do not necessarily correspond one to one. A page may use only one sub-file or multiple sub-files. Similarly, a sub-file may be shared by multiple pages. Therefore, the relationship between the client page and the sub-files in the static resource file is many-to-many. When each page of the client calls the static resource data required by the page, the data identifier of the page can be used to match the required static resource data in the static resource file.
[0074] Commonly used static resource files include:
[0075] (1) HTML file: An HTML file is a file written in HTML (HyperText Markup Language) and contains markup tags used to describe the content and structure of a page. These tags define various elements on a page, such as titles, paragraphs, lists, links, images, forms, etc.
[0076] (2) CSS file (Cascading Style Sheets): The CSS file defines the visual presentation of the page, including layout, color, font size, and other style information.
[0077] (3) JavaScript file: A JavaScript file is a text file that contains JavaScript (client-side script) code, which includes the interactive logic of the page, such as the response after the user clicks a button, dynamic content updates, form validation, etc.
[0078] In addition to the above three types, static resource files also include image files, font files, video and audio files, etc. When the client page is opened, the corresponding CSS, JavaScript, image and other static resource files will be downloaded from the server according to the references in the HTML file, and the data in these static resource files will be used to render the current page of the client, ensuring that the current page of the client can be displayed normally and has the expected interactive functions.
[0079] When the client switches from other states to the foreground active state, or when the client is always in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the client's current page is obtained from the latest version of the online static resource file.
[0080] Before obtaining the static resource data required by the current page of the client, in order to avoid conflicts between the new and old versions of the static resource data when loading the current page of the client, the old version of the offline static resource file stored locally on the client can be deleted first.
[0081] When obtaining the static resource data required by the current page of the client from the latest version of the online static resource file, a dynamic acquisition method can be adopted. In response to the user operation on the current page of the client, the static resource data required by the current page is obtained according to the user operation on the current page of the client. According to the user operation on the current page of the client, the user's subsequent operation is predicted, and the static resource data required by the client page corresponding to the user's subsequent operation is obtained according to the user's subsequent operation.
[0082] Among them, one implementation method of obtaining the static resource data required by the client page corresponding to the user's subsequent operation according to the user's subsequent operation is: after the client receives the user's subsequent operation request, it can jump the current page to the next page or jump to the corresponding position of the current page according to the user's subsequent operation request. Obtain the static resource data required for the next page relative to the current page or the corresponding position of the current page.
[0083] For example, when the user slides up and down on the current page, the static resource data required for the corresponding position on the current page that the user slides through is obtained during the sliding process, so that the pictures and data at the corresponding position of the current page are displayed normally as the user slides. When the user triggers a function on the page, it will jump to other pages. At this time, the static resource data required for the page after the jump is obtained, so that the page after the jump can be displayed in time after the user triggers the function.
[0084] S102: Update the current page of the client according to the static resource data required by the current page of the client.
[0085] If it is detected that the offline static resource files need to be updated, the static resource data required by the client's current page is obtained from the latest version of the online static resource files, and the obtained static resource data is used to render the client's current page and load the corresponding functions of the client's current page, so as to update the client's current page. In this way, it can be guaranteed that the user can use the functions of the client's current page normally when the full amount of offline static resource files have not been updated. The user no longer needs to wait for the full amount of online static resource files to be downloaded and the offline static resource files to be updated, and then restart the client to use the client's page functions normally, which reduces the time the user waits for updates.
[0086] In some embodiments, the backend multi-center switching publishing solution can also be used to achieve the goal of allowing users to use the client page functions normally during the update process. This application does not limit the backend multi-center switching publishing solution.
[0087] The back-end multi-center switching release solution is a high availability and disaster recovery strategy, specifically: deploying and managing the server in multiple data centers to ensure that when a data center fails, it can quickly switch to another data center, so that the server function failure can be quickly repaired. When a data center fails, the static resource data required for the client's current page can be obtained from the latest version of the online static resource file stored by the server in the data center that has not failed, and the client's current page can be updated based on the static resource data. The back-end multi-center switching release solution can improve the reliability and availability of the system, reduce the risk of server unavailability due to failure of a single data center, and can quickly restore server functions in the event of a disaster.
[0088] S103: Obtain the latest version of the online static resource file, and use the latest version of the online static resource file as the latest version of the offline static resource file.
[0089] This application does not specifically limit the specific implementation method of S103, that is, obtaining the latest version of the online static resource file and using the latest version of the online static resource file as the latest version of the offline static resource file. The following two methods are used as examples for explanation.
[0090] Method 1: First obtain the static resource data required by the client's current page, and then obtain the latest version of the online static resource file from the server after a preset time. For example: After waiting for the static resource data required by the client's current page to be obtained, obtain the latest version of the online static resource file from the server, or the preset time is 3s, start timing from the beginning of obtaining the static resource data required by the client's current page, and start obtaining the latest version of the online static resource file from the server after 3s. After the acquisition is completed, the latest version of the online static resource file obtained is stored in the client's local hard disk as the latest version of the offline static resource file.
[0091] Method 2: While obtaining the static resource data required by the current page of the client, immediately download the latest version of the online static resource file from the server. After downloading and decompressing, store the latest version of the online static resource file in the client's local hard disk as the latest version of the offline static resource file, so that the version of the offline static resource file stored locally on the client is updated to the same version as the online static resource file stored on the server.
[0092] This ensures that during the process of downloading the latest version of the online static resource file, the user can still use the functions of the current page of the client normally. When the user operates on the current page, he does not need to worry about whether the online static resource file has been downloaded or whether the offline static resource file has been updated, so that the offline static resource file can be updated without the user's awareness.
[0093] It should be noted that the latest version of the online static resource file obtained in S103 is a full static resource file, which includes the static resource data required for all pages of the client. In S101, after the static resource data of the current page of the client is obtained, if it is directly saved in the client hard disk, the index mismatch problem of the client hard disk storage space will occur. Therefore, the static resource data of the current page of the client obtained is first saved in the client cache. If the cache is cleared, the static resource data of the current page of the client will be lost. Therefore, in S103, it is necessary to obtain the static resource data required for all pages of the client, including the static resource data of the current page that has been obtained.
[0094] Under the grayscale release system, differentiated versions of online static resource files can be downloaded for different types of users. The grayscale release system is a software release strategy that allows developers to gradually push the functions of the new version to users instead of releasing them all at once. Under the grayscale release system, users can be divided into different groups. When the offline static resource files need to be updated, the versions of the online static resource files downloaded by each group of users are different. For example, the version number of the offline static resource files stored by the client is 1.0, and the version number of the online static resource files has been updated to 2.0. The client used by 5% of the users can download the online static resource files with version number 2.0 as the latest version of the offline static resource files, while the remaining 95% of the users do not update, or the client used by the remaining 95% of the users can download the online static resource files with version number 1.9 as the latest version of the offline static resource files. In this way, the probability of the client page function being unavailable due to errors in the content of the new version of the offline static resource files can be reduced.
[0095] An embodiment of the present application provides an offline static resource file updating method. When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the client's current page is obtained from the latest version of the online static resource file, and the client's current page is updated according to the static resource data required by the client's current page. At the same time, the latest version of the online static resource file is obtained to ensure that during the process of updating the offline static resource file, the user can still use the functions of the client's current page normally. The latest version of the online static resource file is used as the latest version of the offline static resource file to ensure that when the client subsequently switches to other pages or restarts the client, the latest version of the offline static resource file can be used directly to update the page.
[0096] Therefore, whether during the use of the client or when the client is restarted, when the offline static resource file needs to be updated, the user does not need to wait until the entire offline static resource file is updated before restarting the client to use the updated page function, which reduces the time the user waits for the update. During the update of the offline static resource file, the user's operation on the current page of the client is not affected, which can solve the problem that the current page function of the client cannot be used normally during the update of the offline static resource file.
[0097] The embodiment of the present application does not specifically limit the method of detecting whether an offline static resource file needs to be updated. Two methods are used as examples for explanation below.
[0098] Method 1: When the client switches to the foreground active state, the specific implementation method is as follows:
[0099] S201: When the client switches to the foreground active state, the client sends a request to the server.
[0100] The client can detect changes in the running state. When the client switches from other states to the foreground active state, it sends a request to the server to obtain the latest version number of the online static resource file stored on the server. For example: when the user clicks the application icon to start the application, the application sends a request to the server to obtain the latest version number of the online static resource file.
[0101] When an online static resource file is updated, the latest version of the online static resource file and its version number will be stored in the server-side database.
[0102] To prevent incompatibility issues after the updated version, the old version of the online static resource file will be deleted after being stored on the server for a period of time. Therefore, the server will store multiple versions of the online static resource file at the same time. When the server receives the acquisition request sent by the client, it will query the latest version number among the multiple version numbers and send the latest version number to the client.
[0103] S202: The server sends the latest version number of the online static resource file to the client.
[0104] When an online static resource file is updated, the latest version of the online static resource file and its version number will be stored in the server-side database.
[0105] To prevent incompatibility issues after the updated version, the old version of the online static resource file will be deleted after being stored on the server for a period of time. Therefore, the server will store multiple versions of the online static resource file at the same time. When the server receives the acquisition request sent by the client, it will query the latest version number among the multiple version numbers and send the latest version number to the client.
[0106] S203: The client receives the latest version number of the online static resource file returned by the server.
[0107] S203: If the latest version number of the online static resource file is inconsistent with the version number of the offline static resource file, the offline static resource file needs to be updated, and the static resource data required by the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
[0108] After the client receives the latest version number returned by the server, it compares it with the version number of the offline static resource file stored locally. If the latest version number returned by the server is inconsistent with the version number of the offline static resource file stored locally, it means that the online static resource file has been updated, so the offline static resource file also needs to be updated. At this time, according to the data identifier of the current page of the client, the static resource data corresponding to the data identifier of the current page is obtained from the online static resource file. Among them, the data identifier of the current page of the client is the page route of the current page of the client. If the latest version number returned by the server is consistent with the version number of the offline static resource file stored locally, it means that the offline static resource file does not need to be updated, and the static resource data corresponding to the data identifier of the current page is directly obtained from the offline static resource file stored locally on the client.
[0109] The client can also determine whether the offline static resource file is the latest version by comparing the MD5 value of the offline static resource file with the online static resource file. Taking an app installed in a Linux environment as an example, S203 is explained.
[0110] The Linux environment refers to an operating system environment based on the Linux kernel, including the Linux kernel and various user space tools and applications running on the kernel. In the Linux environment, the client can obtain the MD5 value of the latest version of the online static resource file stored on the server. The MD5 value refers to a unique string of fixed length calculated using the MD5 (Message Digest Algorithm 5) hash function, which usually consists of 32 hexadecimal digits. The MD5 hash function can convert data of any length (such as file content) into a 128-bit hash value, which can be used to verify the integrity of the data. When the file content is updated, the MD5 value will also change accordingly.
[0111] When the app running state switches from the inactive background state to the active foreground state, or from the active background state to the active foreground state, and when the user clicks the app icon to start the app when the app is not running in the background, the app will automatically trigger the logic to determine whether the offline static resource package needs to be updated, that is, obtain the MD5 value of the latest online static resource file on the server, and compare it with the MD5 value of the offline static resource file in the current app. If the two are the same, the offline static resource file of the current app is the latest version, and the static resource data required for the current page of the client is obtained from the offline static resource file stored locally on the client to load the current page; if the two are different, the offline static resource file in the current app is not the latest version. At this time, the static resource data required for the current page of the client is obtained from the latest online static resource file stored on the server to update the current page. At the same time, the subsequent operation of updating the offline static resource file of the app is triggered.
[0112] In order to make the technical solution provided by the embodiments of the present application clearer, Figure 2 The scenario shown in the figure illustrates the implementation method of detecting whether an offline static resource file needs to be updated. Figure 2 A flow chart of a method for detecting whether an offline static resource file needs to be updated.
[0113] like Figure 2 As shown, the specific implementation is as follows:
[0114] S210: Detect the running status of the client. When the client switches to the foreground active state, execute the following steps S211-S222.
[0115] S211: Obtain the latest version number of the online static resource file.
[0116] S212: Determine whether the version number of the offline static resource file stored in the client is consistent with the version number of the online static resource file stored in the server. If they are consistent, execute S213-S216. If they are inconsistent, execute S217-S222.
[0117] S213: Obtain static resource data required for the current page of the client from the offline static resource file stored in the client.
[0118] S214: Render the current page of the client using the static resource data required by the current page of the client acquired in S213.
[0119] S215: In response to the page jump request from the client, execute S213-S216. If the client does not receive the page jump request, execute S216.
[0120] S216: End the process.
[0121] S217: Delete the offline static resource files stored by the client.
[0122] S218: Download the latest version of the online static resource file from the server.
[0123] S219: After the download is complete, a pop-up window will appear asking "Do you want to update the system?"
[0124] S220: In response to a selection operation on the pop-up window prompt, execute S221. In response to a cancellation operation on the pop-up window prompt, execute S216.
[0125] S221: The latest version of the online static resource file downloaded is stored on the client as the latest version of the offline static resource file, and S213-S216 are executed.
[0126] S222: Obtain static resource data required for the current page of the client from the latest version of the online static resource file stored on the server.
[0127] S223: Render the current page of the client using the static resource data required by the current page of the client acquired in S222.
[0128] S224: In response to the page jump request from the client, execute S222-S224. If the client does not receive the page jump request, execute S216.
[0129] based on Figure 2 In the method shown, when the version number of the offline static resource file in the client is determined to be different from the online static resource file stored on the server, the following three steps can also be triggered in parallel:
[0130] (1) Delete offline static resource files stored on the client.
[0131] (2) Obtain the static resource data required for the client's current page from the latest version of the online static resource file stored on the server, and use the obtained static resource data to render the client's current page, so as to ensure that the user can use the functions of the client's current page normally when the full latest version of the online static resource file has not yet been downloaded.
[0132] (3) Download the latest version of the full online static resource file from the server. After downloading and decompressing, a pop-up window will be displayed to remind the user whether to perform a system update, that is, whether to update the offline static resource file. The user can click Update or Cancel. If the user clicks Update, the downloaded latest version of the full online static resource file will be used as the latest version of the offline static resource file, and the latest version of the offline static resource file will be used to update the current page of the client and other pages of the client that are subsequently jumped to. If the user clicks Cancel, no processing will be performed and the client will remain on the current page.
[0133] In order to speed up the download of online static resource files, after the online static resource file version is updated, the corresponding compressed package of the latest version of the online static resource file can be stored on the server at the same time. To download the latest version of the online static resource file from the server, you can directly download its corresponding compressed package, download it to the client and then decompress it.
[0134] Nginx (Engine-x) is a high-performance HTTP (Hypertext Transfer Protocol) and reverse proxy server. Nginx can be deployed on the Internet to process client requests and forward these requests to other servers (such as application servers) or directly provide online static resource files (such as images, CSS, JavaScript files, etc.).
[0135] When Nginx is used to expose the download address of the server's online static resource files on the Internet, the client can download the online static resource files directly from Nginx through HTTP requests. Set a location block in the Nginx configuration file, which specifies which request paths should be mapped to the file system paths on the server. At the same time, enable Nginx's gzip (GNU zip, file compression program) transmission mode to compress the content of the HTTP response, reduce the bandwidth consumption and response time of the transmitted data, and increase the download speed.
[0136] Method 2: When the client does not switch its running state and is in the foreground active state, the specific implementation method is as follows:
[0137] S301: When the client is in the foreground active state, in response to the function triggering on the current page of the client, a function interface call request message is sent to the server gateway, where the function interface call request message includes the version number of the offline static resource file;
[0138] S302: Receive a response message sent by the server gateway. If the response message includes the latest version number of the online static resource file, the offline static resource file needs to be updated, and the static resource data required by the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
[0139] Corresponding to S301-S302, a server-side implementation method for detecting whether an offline static resource file needs to be updated is as follows:
[0140] The server receives the function interface call request message sent by the client, where the function interface call request message includes the version number of the offline static resource file;
[0141] If the version number of the offline static resource file is inconsistent with the latest version number of the online static resource file stored on the server, the server sends a response message to the client, and the response message includes the latest version number of the online static resource file stored on the server.
[0142] Combine the following Figure 3 The application scenario of S301-S302 and the implementation method of the server detecting whether the offline static resource file needs to be updated are explained. Figure 3 A flow chart of a method for detecting whether an offline static resource file needs to be updated. Figure 2 The method shown and Figure 3 The method shown is just different in the way of detecting whether the offline static resource file needs to be updated. The other steps after detecting whether the offline static resource file needs to be updated are the same.
[0143] like Figure 3 As shown in the figure, when the client on the mobile phone does not switch to a running state, the client page remains open in the foreground, and when it is detected that the user triggers a function on the current page of the client, it is necessary to call the function interface of the server to implement the corresponding function. At this time, the following steps will be executed:
[0144] S310: The mobile client sends a function interface call request message, namely, an API request message, to the server gateway, and adds the version number of the offline static resource file stored in the mobile client to the request header of the API request message.
[0145] S311: If the server gateway receives an API request message with an offline static resource file version number, it forwards the API request message to the server.
[0146] S312: The server compares the latest version number of the online static resource file stored in the database with the offline static resource file version number in the API request message to see if they are consistent. If the two are inconsistent, execute S313 and subsequent steps. If the two are consistent, execute S315 and subsequent steps.
[0147] S313: Add the latest version number of the online static resource file in the response header of the response message.
[0148] S314: End the process.
[0149] S315: The server sends the response message to the mobile client through the server gateway.
[0150] S316: If the response message received by the mobile client includes the latest version number of the online static resource file, the offline static resource file needs to be updated, and S317 and subsequent steps are executed. If the response message received by the mobile client does not include the latest version number of the online static resource file, S314 is executed.
[0151] S317: Obtain static resource data required for the current page of the mobile client from the online static resource file corresponding to the latest version number of the online static resource file.
[0152] S318: The mobile client downloads the latest version of the online static resource file stored on the server.
[0153] S319: After the download is successful, a pop-up window will be displayed to prompt "Do you want to update the system?"
[0154] S320: In response to a selection operation on the pop-up window prompt, execute S321. In response to a cancellation operation on the pop-up window prompt, execute S314.
[0155] S321: The latest version of the online static resource file downloaded is stored in the client as the latest version of the offline static resource file.
[0156] based on Figure 3 According to the method shown, when the mobile client receives the response message, it can also store the latest version number of the online static resource file in the response message in the mobile client, and all subsequent API requests sent by the mobile client will add the latest version number in their request headers.
[0157] In some embodiments, when the mobile client detects that there is a version number in the response header of the response message, it is considered that the online static resource file of the server may be updated. At this time, the mobile client actively triggers the static resource version number comparison. If the comparison shows that the version numbers of the offline static resource file stored in the mobile client and the latest version of the online static resource file stored in the server are different, the offline static resource file stored in the mobile client is deleted, and the static resource data required for the current page of the client is obtained from the online static resource file corresponding to the latest version number.
[0158] The above two implementation methods for detecting whether offline static resource files need to be updated can realize that offline static resource files are updated only when the user uses the client in the foreground. If the user does not use the client in the foreground, no update is performed. This can avoid occupying network bandwidth and system resources during silent updates in the background, affecting other operations of the user. The server does not need to process a large number of background silent update requests, reducing the load on the server. Updating during the active client can better utilize server bandwidth and computing resources, ensure that the client device is in a good network environment, and thus improve the download success rate of online static resource files.
[0159] The above two methods of detecting whether offline static resource files need to be updated fully cover the usage scenarios of all clients, and can ensure that the problem of mismatch of offline static resource file versions stored locally on the client due to online static resource file updates will not occur under any circumstances.
[0160] When the client switches from the foreground active state to the foreground inactive state or the background active state, if it is detected that the latest version of the online static resource file is being obtained, the latest version of the online static resource file continues to be obtained until it is detected that the latest version of the online static resource file is obtained.
[0161] After triggering the update of offline static resource files, even if the user switches the client to the inactive foreground state or the active background state, if the latest version of the online static resource files has not been downloaded, the download task of the latest version of the online static resource files will not stop until the latest version of the online static resource files is obtained. This avoids the problem of interruption of the download of the latest version of the online static resource files due to user misoperation and ensures the success rate of downloading online static resource files.
[0162] Since the amount of data of online static resource files is large, it takes a long time to download. During the download process, the client may switch pages. When the current page of the client switches to other pages, if steps S101-S103 are repeatedly executed, the problem of repeated downloading of online static resource files will occur. In order to avoid repeated downloading of online static resource files, before obtaining the static resource data required by the current page of the client, in addition to detecting whether the offline static resource files need to be updated, it is also necessary to detect the download progress of the online static resource files, obtain the static resource data required by the current page of the client according to the download progress, and determine whether to execute S103. Based on this, another possible implementation of S101 is:
[0163] When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the acquisition progress of the latest version of the online static resource file is further detected.
[0164] Case 1: If it is detected that the latest version of the online static resource file has not started to be obtained, the static resource data required by the client's current page is obtained from the latest version of the online static resource file.
[0165] Case 2: If it is detected that the latest version of the online static resource file is being obtained, the static resource data required by the client's current page is obtained from the latest version of the online static resource file, and the subsequent step of obtaining the latest version of the online static resource file is no longer executed.
[0166] Case 3: If it is detected that the latest version of the online static resource file has been obtained, the latest version of the online static resource file is used as the latest version of the offline static resource file, and the static resource data required for the current page of the client is obtained from the latest version of the offline static resource file, and the subsequent steps of obtaining the latest version of the online static resource file are no longer executed.
[0167] For example, when the client switches to the foreground active state or the client is in the foreground active state, the current page of the client is page A. If it is detected that the offline static resource file needs to be updated, and it is further detected that the latest version of the online static resource file has not started to download, the static resource data required for page A is obtained from the latest version of the online static resource file, and S103 is executed normally. This situation indicates that when page A is opened, the online static resource file happens to be updated, so the offline static resource file needs to be updated synchronously.
[0168] When the client page switches from page A to page B, if it is detected that the offline static resource file needs to be updated, and it is further detected that the latest version of the online static resource file is being downloaded, the static resource data required for page B is obtained from the latest version of the online static resource file, and the step of obtaining the latest version of the online static resource file in S103 is no longer executed.
[0169] When the client page switches from page A to page B, if it is detected that the offline static resource file needs to be updated, and it is further detected that the latest version of the online static resource file has been downloaded, the latest version of the online static resource file is used as the latest version of the offline static resource file, and the static resource data required for page B is obtained from the latest version of the offline static resource file, and the step of obtaining the latest version of the online static resource file in S103 is no longer executed.
[0170] When it is detected that the offline static resource files need to be updated, the progress of obtaining the latest version of the online static resource files is further detected. If the latest version of the online static resource files is being obtained or has been obtained, the step of obtaining the latest version of the online static resource files in S103 is no longer executed, thereby avoiding repeated downloading of online static resource files.
[0171] If the latest version of the online static resource file is directly used as the latest version of the offline static resource file when the latest version of the online static resource file is obtained, the operation data on the current page and the previous page will be lost. To avoid this problem, in some embodiments, if it is detected that the latest version of the online static resource file is obtained, an update prompt can be displayed on the current page of the client. The display method of the update prompt is as follows: Figure 4 shown. Figure 4 A schematic diagram of an update prompt provided in an embodiment of the present application. Figure 4 As shown, S401 is an update prompt in the form of a pop-up window, prompting the user to detect a version resource upgrade and whether to load the upgraded version resource, that is, the latest version of the offline static resource file. Because the latest version of the online static resource file has been downloaded locally, when the update prompt is displayed, if the user chooses to load the upgraded version resource, that is, the latest version of the offline static resource file, the loading process will not consume traffic.
[0172] In the two cases where the user chooses to load or cancel the loading of the updated offline static resource file, the method for obtaining the static resource data required by the current page of the client is as follows:
[0173] B1: in response to the selection operation for the update prompt, the latest version of the online static resource file is used as the latest version of the offline static resource file, and the static resource data required by the current page of the client is obtained from the latest version of the offline static resource file;
[0174] B2: In response to the cancel operation on the update prompt, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file.
[0175] If the user does not need to save the operation data on the current page, he can choose to update. At this time, the static resource data required for the current page of the client will be obtained from the latest version of the offline static resource file, and the current page of the client will be refreshed.
[0176] If the user selects the update operation, the latest version of the online static resource file is used as the latest version of the offline static resource file. The page route saved in the latest version of the offline static resource file will be used to update the route addresses corresponding to all pages in the client page call stack, and then the static resource data required for the client's current page will be obtained from the latest version of the offline static resource file to reload the current page. Since the client's current page is reloaded, the data that the user has filled in on the current page will be cleared or the user's operation on the current page will be interrupted. If the client jumps from the current page to other pages of the client, the other page of the client is used as the client's current page, and the static resources required for the other page of the client are obtained from the latest version of the offline static resource file. When jumping from the current page to other pages, if there is a page route that cannot be found, it means that the page route of the other page has been deleted in the latest version of the offline resource file, then the other page is closed and the client page call stack is cleared.
[0177] If the user wants to save the operation data on the current page or not interrupt the operation on the current page, he can choose to cancel the update. At this time, the static resource data required for the current page of the client is obtained from the latest version of the online static resource file, and the current page of the client is reloaded. The current page of the client can also remain unchanged. If the current page of the client jumps to other pages of the client, the other pages of the client are used as the current page of the client, and the static resources required for other pages of the client are obtained from the latest version of the online static resource file. In this case, because the page route saved in the latest version of the offline static resource file has not been used to update the routing address corresponding to all pages in the client page call stack, when updating the current page of the client, it is still necessary to obtain the static resource data required for the current page of the client from the latest version of the online static resource file, and it cannot be obtained directly from the latest version of the offline static resource file. If the static resource data required for the current page of the client is obtained directly from the latest version of the offline static resource file, the page route of the current page of the client cannot be found.
[0178] When the latest version of the online static resource file is obtained, an update prompt is displayed on the current page of the client, and the source of the static resource data required by the current page of the client is determined based on the user's selection, which can avoid the problem of loss of operation data of the current page caused by page update.
[0179] In some embodiments, if it is detected that the online static resource file has been obtained, in response to the client's startup operation, the static resource data required by the client's current page is obtained from the latest version of the offline static resource file. This ensures that when the client is restarted, the latest version of the offline static resource file can be used directly to update the page, reducing the time the user waits for the update.
[0180] The present application also provides a computer device, see Figure 5 , which shows a structural diagram of a computer device provided in an embodiment of the present application, such as Figure 5 As shown, the device includes a memory 501 and a processor 502:
[0181] The memory 501 is used to store program codes and transmit the program codes to the processor;
[0182] The processor 502 is used to execute any one of the offline static resource file updating methods executed by the client or the offline static resource file updating methods executed by the server provided in the above embodiments according to the instructions in the program code.
[0183] An embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any one of the offline static resource file update methods performed by the client or the offline static resource file update method performed by the server provided in the above embodiments.
[0184] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0185] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0186] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0187] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0188] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An offline static resource file updating method, characterized in that: The offline static resource file is a static resource file stored on the client, and the method includes: When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, the online static resource file is a static resource file stored in the server, the client includes multiple pages, the current page of the client is a page currently opened among the multiple pages, and the online static resource file includes the static resource data required for each of the multiple pages; Update the current page of the client according to the static resource data required by the current page of the client; The latest version of the online static resource file is obtained, and the latest version of the online static resource file is used as the latest version of the offline static resource file.
2. The method according to claim 1, characterized in that When the client switches to the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required for the current page of the client is obtained from the latest version of the online static resource file, including: When the client switches to the foreground active state, a request is sent to the server, where the request is used to obtain the latest version number of the online static resource file; Receive the latest version number of the online static resource file returned by the server; If the latest version number of the online static resource file is inconsistent with the version number of the offline static resource file, the offline static resource file needs to be updated, and the static resource data required for the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
3. The method according to claim 1, characterized in that When the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, including: When the client is in the foreground active state, in response to a function trigger on the current page of the client, a function interface call request message is sent to the server gateway, wherein the function interface call request message includes a version number of the offline static resource file; Receive a response message sent by the server gateway. If the response message includes the latest version number of the online static resource file, the offline static resource file needs to be updated, and the static resource data required for the current page of the client is obtained from the online static resource file corresponding to the latest version number of the online static resource file.
4. The method according to claim 1, characterized in that: When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, the static resource data required for the current page of the client is obtained from the latest version of the online static resource file, including: When the client switches to the foreground active state or the client is in the foreground active state, if it is detected that the offline static resource file needs to be updated, detecting the acquisition progress of the latest version of the online static resource file; If it is detected that the latest version of the online static resource file has not started to be obtained, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file; If it is detected that the latest version of the online static resource file is being obtained, the static resource data required by the current page of the client is obtained from the latest version of the online static resource file, and the subsequent step of obtaining the latest version of the online static resource file is no longer performed; If it is detected that the latest version of the online static resource file has been acquired, the latest version of the online static resource file is used as the latest version of the offline static resource file, and the static resource data required for the current page of the client is obtained from the latest version of the offline static resource file, and the subsequent step of acquiring the latest version of the online static resource file is no longer executed.
5. The method according to claim 1, characterized in that Also includes: If it is detected that the latest version of the online static resource file has been obtained, an update prompt is displayed on the current page of the client; In response to a selection operation for the update prompt, using the latest version of the online static resource file as the latest version of the offline static resource file, and acquiring static resource data required for the current page of the client from the latest version of the offline static resource file; In response to a cancel operation on the update prompt, static resource data required by the current page of the client is obtained from the online static resource file of the latest version.
6. The method according to claim 1, characterized in that Also includes: If it is detected that the online static resource file is acquired completely, in response to the startup operation of the client, the static resource data required for the current page of the client is acquired from the offline static resource file of the latest version.
7. The method according to claim 1, characterized in that The obtaining of the latest version of the online static resource file and using the latest version of the online static resource file as the latest version of the offline static resource file includes: When the client switches from the foreground active state to the foreground inactive state or the background active state, if it is detected that the latest version of the online static resource file is being acquired, the latest version of the online static resource file continues to be acquired until it is detected that the acquisition of the latest version of the online static resource file is completed.
8. An offline static resource file updating method, characterized in that: The offline static resource file is a static resource file stored on the client, and the method includes: The server gateway receives the function interface call request message sent by the client, wherein the function interface call request message includes the version number of the offline static resource file; If the version number of the offline static resource file is inconsistent with the latest version number of the online static resource file stored on the server, the server gateway sends a response message to the client, and the response message includes the latest version number of the online static resource file stored on the server.
9. A computer device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the method of any one of claims 1 to 7 or the method of claim 8 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7, or execute the method according to claim 8.
Citation Information
Patent Citations
Method and system for updating multi-source software
CN106933625A
Page display method and apparatus, storage medium and electronic device
CN108280125A
Loading method, system, computer device and storage medium for client H5 page
CN108520059A
Static network resource preloading method and data model training method and device
CN111881391A
HTML5 page resource loading method and device, equipment and storage medium
CN112905939A
