Resource loading method, apparatus and electronic device
By obtaining user affinity statistics to calculate affinity values and selecting appropriate resource loading methods, the negative impact caused by the single loading method in existing technologies is resolved, achieving efficient resource loading and improved user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIVIEW TECH CO LTD
- Filing Date
- 2024-12-06
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies cannot rationally integrate multiple loading methods when loading resources in web applications, resulting in excessively long loading times or excessive local memory usage, which affects user experience.
By obtaining statistical information on user affinity towards target functional modules, the affinity value is calculated, and the resource loading method is determined based on the affinity value, selecting local loading or remote loading to rationalize the resource loading process.
It achieves a flexible and efficient resource loading method, improves loading efficiency, enhances user experience, and avoids negative impacts during the loading process.
Smart Images

Figure CN122173162A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a resource loading method, apparatus, and electronic device. Background Technology
[0002] Currently, there are two common methods for loading resources in web applications. The first method involves deploying the relevant resources in the web application on a server, downloading them from the server to the client (e.g., a mobile phone) each time, and then loading and displaying the resources on the client. The second method involves embedding the web application within a native application, such as in the form of a mini-program. In this case, the native application first downloads the relevant resources from the web application to the client's local machine, and then loads the relevant resources from the local machine when the client needs to display the page containing those resources.
[0003] In practice, the two loading methods described above have the following problems: The first method requires downloading resources from the server, and the entire loading process involves many influencing factors, such as network conditions, server status, and client performance, often resulting in excessively long loading times. The second method downloads the relevant resources locally, thus avoiding many influencing factors. However, these resources consume local memory, which can significantly impact the normal operation of the client, especially when the amount of data is large, potentially causing slower client performance or even lag. Furthermore, the downloaded resources in the second method are offline resources and do not dynamically update with online resources. Therefore, the second method also suffers from the inability to hot-update resources. Summary of the Invention
[0004] This invention provides a resource loading method, apparatus, and electronic device to solve the problem in the prior art that when loading related resources in web applications, it is impossible to rationally integrate the advantages of various loading methods to avoid many negative impacts during the loading process.
[0005] This invention provides a resource loading method, comprising the following steps.
[0006] Obtain the affinity statistics of the first user for the target functional module in the web application; calculate the affinity value of the first user for the target functional module based on the affinity statistics; determine the resource loading method for the target functional module based on the affinity value; and load the resources of the target functional module according to the resource loading method.
[0007] According to a resource loading method provided by the present invention, the resource loading mode of a target functional module is determined based on a proximity value, including: determining the resource loading mode as local loading when the proximity value is greater than a set threshold; and determining the resource loading mode as remote loading when the proximity value is less than or equal to the set threshold.
[0008] According to a resource loading method provided by the present invention, the method calculates the affinity value of the first user to the target functional module based on the affinity statistics of the first user, including: taking the first user as the target user, calculating the affinity rate of the target user to the target functional module based on the affinity statistics of the target user, obtaining the first user affinity rate of the target functional module of the first user; and determining the first user affinity rate as the usage affinity value.
[0009] According to a resource loading method provided by the present invention, after obtaining the affinity statistics of a first user of a target functional module in a web application, the method further includes: sending the affinity statistics of the first user to a server; receiving affinity statistics of all users from the server; calculating the affinity value of the first user for the target functional module based on the affinity statistics of the first user, including: calculating the affinity rate of the target user for the target functional module based on the affinity statistics of the target user; the affinity rate includes the affinity rate of the first user and the affinity rate of all users; when the target user is the first user, the affinity rate is the affinity rate of the first user; when the target user is all users, the affinity rate is the affinity rate of all users; weighting the affinity rate of the first user and the affinity rate of all users according to a first weight and a second weight, respectively, to obtain a first weighted result for the affinity rate of the first user and a second weighted result for the affinity rate of all users; summing the first weighted result and the second weighted result, and determining the obtained first summation result as the affinity value.
[0010] According to a resource loading method provided by the present invention, after loading the resources of a target functional module according to the resource loading method, the method further includes: requesting a first loading duration and a second loading duration from a server; wherein, the first loading duration is the duration for a first user to remotely load the target functional module, and the second duration is the average duration for all users to remotely load the target functional module; if the first loading duration is greater than the second loading duration, increasing the ratio of the first weight to the second weight; if the first loading duration is less than the second loading duration, decreasing the ratio of the first weight to the second weight.
[0011] According to a resource loading method provided by the present invention, after determining the resource loading method of the target functional module based on the proximity value, the method further includes: if the first resource loading method determined this time is remote loading and the second resource loading method determined last time is local loading, deleting the resources loaded locally based on the second resource loading method.
[0012] According to a resource loading method provided by the present invention, the affinity statistics information includes: multiple time period affinity statistics information corresponding one-to-one; calculating the affinity rate of the target user's target functional module based on the affinity statistics information of the target user, including: obtaining multiple affinity parameter values under the target time period based on the time period affinity statistics information corresponding to the target time period; wherein, the target time period is any one of the multiple time periods; obtaining the affinity rate based on the multiple affinity parameter values under each of the multiple time periods.
[0013] According to a resource loading method provided by the present invention, the time-period proximity statistics corresponding to the target time period include: the total number of first page exposures of all pages in the target functional module within the target time period, the total number of first launches of the target functional module within the target time period, the total number of second page exposures of the native application where the web application resides within the target time period, and the total number of second launches of the native application within the target time period; multiple proximity parameter values under the target time period include: the module exposure rate and the module utilization rate under the target time period; based on the time-period proximity statistics corresponding to the target time period, multiple proximity parameter values under the target time period are obtained, including: based on the total number of first page exposures and the total number of second page exposures, Obtain the module exposure rate for the target time period; and, based on the first total number of launches and the second total number of launches, obtain the module usage rate for the target time period; obtain the affinity rate based on multiple affinity parameter values for each of the multiple time periods, including: obtaining the module exposure rate for the target time period based on the module exposure rate and its corresponding exposure rate weight, thus obtaining multiple time period module exposure rates corresponding to each time period; and obtaining the module usage rate for the target time period based on the module usage rate and its corresponding usage rate weight, thus obtaining multiple time period module usage rates corresponding to each time period; summing the module exposure rates and module usage rates for the multiple time periods, and determining the second summation result as the affinity rate.
[0014] The present invention also provides a resource loading device, comprising the following modules: an acquisition module, a calculation module, a determination module, and a loading module.
[0015] The acquisition module is used to obtain the affinity statistics of the first user of the target functional module in the web application.
[0016] The calculation module is used to calculate the first user's affinity value for the target functional module based on the first user's affinity statistics.
[0017] The determination module is used to determine the resource loading method of the target functional module based on the usage affinity value.
[0018] The loading module is used to load the resources of the target functional module according to the resource loading method.
[0019] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements any of the resource loading methods described above when executing the computer program.
[0020] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the resource loading methods described above.
[0021] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the resource loading methods described above.
[0022] The resource loading method, apparatus, and electronic device provided by this invention obtain the affinity statistics of a first user for a target functional module in a web application, calculate the user's affinity value for the target functional module based on the first user's affinity statistics, then determine the resource loading method for the target functional module based on the affinity value, and finally load the resources of the target functional module according to the resource loading method. Therefore, the embodiments of this invention can determine the resource loading method for a target functional module based on the user's affinity for the target functional module in the web application. The entire loading process is no longer based on only one loading method. In this case, inappropriate loading methods can be reasonably avoided based on the different affinity levels of users for various functional modules in the web application. Furthermore, for different functional modules in the same web application, different loading methods can be selected based on their different affinity levels with the user. The loading method is no longer singular and rigid, and the entire resource loading process is more flexible and efficient. This effectively solves the problem in the prior art that it is impossible to rationally integrate the advantages of multiple loading methods to avoid many negative impacts during the loading process when loading related resources in a web application, thereby improving loading efficiency and enhancing user experience. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is one of the flowcharts illustrating the resource loading method provided in this embodiment of the invention.
[0025] Figure 2 This is a schematic diagram illustrating a relevant example of the process of obtaining affinity statistics in the resource loading method provided in this embodiment of the invention.
[0026] Figure 3 This is the second flowchart of the resource loading method provided in this embodiment of the invention.
[0027] Figure 4 This is the third flowchart of the resource loading method provided in this embodiment of the invention.
[0028] Figure 5A This is one of the schematic diagrams of information interaction between the client and the server in the resource loading method provided in the embodiments of the present invention.
[0029] Figure 5B This is the second schematic diagram of information interaction between the client and the server in the resource loading method provided in this embodiment of the invention.
[0030] Figure 6 This is the fourth flowchart of the resource loading method provided in the embodiments of the present invention.
[0031] Figure 7 This is the fifth flowchart of the resource loading method provided in the embodiments of the present invention.
[0032] Figure 8 This is the sixth flowchart of the resource loading method provided in this embodiment of the invention.
[0033] Figure 9 This is a schematic diagram of the resource loading device provided in an embodiment of the present invention.
[0034] Figure 10 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0036] The following is combined Figures 1-8 The resource loading method of the present invention is described.
[0037] Figure 1This is one of the flowcharts illustrating the resource loading method provided in this embodiment of the invention. This resource loading method is applied to the client, such as... Figure 1 As shown, the method includes the following steps S110~S140.
[0038] S110: Obtain the affinity statistics of the first user of the target functional module in the web application.
[0039] A web application can be a logically connected collection of multiple web pages. Typically, a website or a native application can embed multiple web applications.
[0040] In a web application, among the multiple web pages linked by the web application, one web page can correspond to one functional module. In this case, multiple web pages in a web application correspond one-to-one with multiple functional modules.
[0041] Web pages can be, for example, H5 pages (HyperText Markup Language, HTML5 pages), Vue pages, PHP (Hypertext Preprocessor) pages, JSP (Java Server Pages), HTML pages, etc.
[0042] It's important to note that each of the multiple functional modules corresponds to a specific function within the web page, and this function is related to the content displayed on the web page. In practice, users tend to show affinity towards content that is highly relevant to their needs. For example, they may view or repeatedly view content that is highly relevant to their requirements. In such cases, the web page corresponding to that content will be frequently accessed by the user, thus demonstrating affinity towards the functional module of that web page.
[0043] Affinity statistics can be statistical information that reflects how close users are to a functional module. Such affinity information could include, for example, the number of times a page corresponding to a functional module is exposed (indicating how frequently users view that page), the number of times a functional module is launched (indicating how frequently users view a specific page within that functional module), and so on.
[0044] The statistical information mentioned above can be statistics on relevant information from all time periods prior to the current time.
[0045] Because the statistical information of the above-mentioned related information is time-sensitive—for example, a user may like a certain feature module at a certain time, but dislike it at a later time—the statistical information of related information can be the statistics of relevant information within a certain time period before the current time.
[0046] In some embodiments, in order to obtain more accurate data, relevant information in multiple time periods can be statistically analyzed. In this case, the affinity statistics may include multiple time period affinity statistics corresponding one-to-one.
[0047] For example, in the proximity statistics of the target functional module, for any target time period among multiple time periods, the proximity statistics corresponding to the target time period may include: the total number of first page exposures of all pages in the target functional module within the target time period, the total number of first launches of the target functional module within the target time period, the total number of second page exposures of the native application where the web application is located within the target time period, and the total number of second launches of the native application within the target time period.
[0048] It should be noted that a target functional module can correspond to one page or multiple pages. See also Figure 2 Page 30 is a page in the native application. This page contains multiple functional modules 301, and each functional module 301 corresponds to at least one H5 page. For example, functional module 3011 corresponds to only one H5 page, which is H5 page 30111; functional module 3012 corresponds to two H5 pages, which are H5 page 30121 and H5 page 30122.
[0049] The following describes the rules for calculating the total first-page exposure count for all pages within the target functional module during the target time period. For the case where a functional module corresponds to only one web page, see [link to relevant documentation]. Figure 2 During the target time period, the H5 page 30111 corresponding to functional module 3011 was exposed once (i.e., opened once). The total exposure count of H5 page 30111 was 1. The total exposure count of the first page of all pages of functional module 3011 during the target time period was 1. For cases where one functional module corresponds to multiple web pages, please refer to [link / reference]. Figure 2 During the target time period, the exposure count of H5 page 30121 corresponding to functional module 3012 is 2, and the exposure count of H5 page 30122 is 1. The total exposure count of the first page of all pages in functional module 3012 during the target time period is 3 (that is, the sum of the exposure counts of H5 page 30121 and H5 page 30122).
[0050] The rules for counting the total number of times a target functional module is launched within the target time period can be as follows: Each time a target functional module is launched within the target time period, the total launch count is accumulated to 1. Launching a target functional module is considered complete if, for example, clicking on the target functional module causes the corresponding web page to pop up.
[0051] The rules for calculating the total number of impressions of the second page of the native application containing the web application within the target time period can be as follows: Count the sum of the number of times all pages of the native application containing the web application are exposed (each page pop-up after clicking the corresponding area counts as one page exposure).
[0052] The rules for counting the total number of second launches of the native application within the target time period can be as follows: Each time the native application is launched within the target time period, the total launch count is accumulated to 1. For example, a native application going from closed to open counts as one launch, and a native application going from background to foreground also counts as one launch.
[0053] In practice, multiple time periods can be set by those skilled in the art according to the actual situation. For example, multiple time periods may include: the time period within 7 days before the current time, and the time period within 15 days before the current time, etc.
[0054] In practice, proximity statistics can be obtained by setting up data tracking points.
[0055] It should be noted that the shopping applications and their functional modules listed above are merely illustrative examples of functional modules in this embodiment of the invention. In specific implementations, web applications include, but are not limited to, shopping applications; for example, they can also be video applications, social applications, lifestyle service applications, educational applications, etc. The configuration of functional modules varies depending on the website or native application on which the web application resides.
[0056] S120: Calculate the first user's affinity value for the target functional module based on the first user's affinity statistics.
[0057] The methods for obtaining the affinity value may include: obtaining the affinity value based solely on the affinity statistics of the first user, or obtaining the affinity value based on the affinity statistics of the first user and the affinity statistics of all users.
[0058] The two acquisition methods mentioned above will be described in detail below. First, the specific process of the first method (that is, obtaining the usage affinity value based solely on the affinity statistics of the first user) will be introduced.
[0059] Specifically, such as Figure 3As shown, the process of obtaining the affinity value based on the affinity statistics of the first user may include the following steps S310~S320.
[0060] S310: Taking the first user as the target user, calculate the affinity rate of the target user's target functional module based on the affinity statistics of the target user, and obtain the first user affinity rate of the target functional module of the first user.
[0061] Taking the case where the intimacy statistics include multiple time periods corresponding one-to-one as an example, such as... Figure 4 As shown, the process of calculating the affinity rate of the target user's target functional module based on the affinity statistics of the target user may include S410~S420.
[0062] S410: Based on the time period proximity statistics corresponding to the target time period, obtain multiple proximity parameter values under the target time period; where the target time period is any one of the multiple time periods.
[0063] In some embodiments, multiple proximity parameter values for the target time period may include: module exposure rate and module utilization rate for the target time period.
[0064] If the proximity statistics for the target time period include: the total number of first-page exposures of all pages in the target functional module within the target time period, the total number of first-page launches of the target functional module within the target time period, the total number of second-page exposures of the native application where the web application resides within the target time period, and the total number of second-page launches of the native application within the target time period, then the module exposure rate for the target time period is obtained based on the total number of first-page exposures and the total number of second-page exposures, and the module usage rate for the target time period is obtained based on the total number of first-page launches and the total number of second-page launches.
[0065] Specifically, the first ratio of the total number of exposures on the first page to the total number of exposures on the second page can be obtained, and this first ratio can be determined as the module exposure rate.
[0066] Specifically, a second ratio of the first number of startups to the second number of startups can be obtained, and this second ratio can be determined as the module utilization rate.
[0067] The following example illustrates this point. Multiple time periods include, for instance, the first time period encompassing all times preceding the current time period, and the second time period covering the seven days preceding the current time period. Based on this, when the target time period is the first time period, the module exposure rate and module usage rate for the first time period can be calculated using the following corresponding formulas.
[0068] E total1 =ME total1 / AE total1Among them, E total1 ME is the module exposure rate for the first time period. total1 This represents the total number of impressions on the first page during the first time period, according to AE. total1 This represents the total number of impressions of the second page during the first time period.
[0069] U total1 =MU total1 / AU total1 Among them, U total1 For the first period of module utilization, MU total1 For the first total number of starts in the first time period, AU total1 This represents the total number of second starts during the first time period.
[0070] Similarly, when the target time period is the second time period, the module exposure rate and module usage rate of the second time period can be calculated using the following corresponding formulas.
[0071] E total2 =ME total2 / AE total2 Among them, E total2 For the module exposure rate in the second time period, ME total2 This represents the total number of impressions on the first page during the second time period, according to AE. total2 This represents the total number of times the second page was displayed during the second time period.
[0072] U total2 =MU total2 / AU total2 Among them, U total2 For the module utilization rate in the second time period, MU total2 For the first total number of starts in the second time period, AU total2 This represents the total number of starts during the second time period.
[0073] S420: Obtain the affinity rate based on multiple affinity parameter values for each of the multiple time periods.
[0074] First, based on the module exposure rate and its corresponding exposure rate weight under the target time period, the module exposure rate under the target time period can be obtained, resulting in multiple time period module exposure rates corresponding to multiple time periods; and second, based on the module usage rate and its corresponding usage rate weight under the target time period, the module usage rate under the target time period can be obtained, resulting in multiple time period module usage rates corresponding to multiple time periods.
[0075] The exposure rate weight corresponding to the module exposure rate in each time period can be set by those skilled in the art according to the actual situation, and this embodiment of the invention does not limit this. The usage rate weight corresponding to the module usage rate in each time period can be set by those skilled in the art according to the actual situation, and this embodiment of the invention does not limit this.
[0076] It should be noted that the sum of the exposure rate weight corresponding to the module exposure rate in all time periods and the usage rate weight corresponding to the module usage rate in all time periods is 1.
[0077] In practice, the exposure rate of a module during the target time period can be obtained by multiplying the exposure rate of that module by its corresponding exposure weight, and this product can be determined as the exposure rate of the module during the target time period. Similarly, the usage rate of a module during the target time period can be obtained by multiplying the usage rate of that module by its corresponding usage weight, and this product can be determined as the usage rate of the module during the target time period.
[0078] Continuing with the example in S410, if E total1 The corresponding exposure weights are W1 and U. total1 The corresponding exposure weights are W2 and E. total2 The corresponding exposure weights are W3 and U. total2 The corresponding exposure rate weight is W4. Under this condition, the module exposure rate, module usage rate, module exposure rate, and module usage rate in the first time period can be calculated using the following corresponding formulas.
[0079] Module exposure rate in the first period = E total1 ×W1.
[0080] Module utilization rate in the first period = U total1 ×W2.
[0081] The module exposure rate in the second time period = E total2 ×W3.
[0082] Module utilization rate in the second period = U total2 ×W4.
[0083] The above W1, W2, W3 and W4 satisfy: W1+W2+W3+W4=1.
[0084] After obtaining the module exposure rate and module usage rate for multiple time periods, the module exposure rate and module usage rate for multiple time periods are summed, and the resulting second summation result is determined as the affinity rate.
[0085] Continuing with the example above, the module exposure rate in the first time period, the module usage rate in the first time period, the module exposure rate in the second time period, and the module usage rate in the second time period can be used to calculate the affinity rate P1 using the following formula.
[0086] P1=E total1 ×W1+U total1 ×W2+E total2 ×W3+U total2×W4.
[0087] After obtaining the affinity rate P1, the affinity rate P1 is determined as the first user affinity rate of the target functional module of the first user.
[0088] S320: Determine the first user affinity rate as the user affinity value.
[0089] For example, the affinity rate P1 obtained above is used as the first user affinity rate, and P1 is directly determined as the affinity value.
[0090] The following describes the specific process of the second method (i.e., obtaining the usage affinity value based on the affinity statistics of the first user and all users).
[0091] For the method of obtaining the affinity value based on the affinity statistics of the first user and the affinity statistics of all users, it is necessary to obtain the affinity statistics of all users from the server. Therefore, after executing S110, this embodiment of the invention can also perform the following process: sending the affinity statistics of the first user to the server; receiving the affinity statistics of all users from the server.
[0092] Specifically, in the embodiments of the present invention, such as Figure 5A As shown, after the client logs in, the client side obtains the affinity statistics of the first user of the target functional module in the web application, and then reports the affinity statistics of the first user to the server. The server can receive affinity statistics sent by the clients of all users, so the server side can obtain the affinity statistics of all users and send the affinity statistics of all users to the client of the first user.
[0093] In some embodiments, such as Figure 5B As shown, after the client logs in, the client side obtains the affinity statistics of the first user of the target functional module in the web application, and then reports the affinity statistics of the first user to the server. The server can obtain the usage affinity value based on the affinity statistics sent by all users' clients and the preset calculation rules (such as the calculation rules in S610~S630 below). Then, based on the usage affinity value and the set threshold (set by those skilled in the art according to the actual situation), the server determines the resource loading method and returns the configuration information of the resource loading method to the first user's client.
[0094] The affinity statistics for all users are similar to those for the first user, except that the base data is all users. For example, in the affinity statistics for all users, the total first-page exposure count of all pages in the target functional module within the target time period is specifically: the total page exposure count of all pages in the target functional module for all users within the target time period. The total first launch count of the target functional module within the affinity statistics for all users within the target time period is specifically: the total launch count of the target functional module for all users within the target time period. The total second-page exposure count of the native application containing the web application within the affinity statistics for all users within the target time period is specifically: the total page exposure count of the native application containing the web application for all users within the target time period. The total second launch count of the native application within the affinity statistics for all users within the target time period is specifically: the total launch count of the native application for all users within the target time period.
[0095] Since the server has all relevant data for all users, it retrieves the affinity statistics for all users based on the affinity statistics reported by each user and sends them to the client that reported the affinity statistics. After this, as... Figure 6 As shown, the process of obtaining the affinity value based on the affinity statistics of the first user may include the following steps S610 to S630.
[0096] S610: Calculate the affinity rate of the target user's target functional module based on the affinity statistics of the target user; the affinity rate includes the affinity rate of the first user and the affinity rate of all users; when the target user is the first user, the affinity rate is the affinity rate of the first user; when the target user is all users, the affinity rate is the affinity rate of all users.
[0097] The calculation method for the first user affinity rate can be found in the description of the calculation process of the first user affinity rate in S310 of the above embodiment, and will not be repeated here.
[0098] The calculation method for the affinity rate of all users can be found in the description of the affinity rate calculation process of the target user's target functional module in S410~S420 of the above embodiments, and will not be repeated here.
[0099] S620: Based on the first weight of the first user affinity rate and the second weight of the all user affinity rate, perform weighted processing on the first user affinity rate and the all user affinity rate respectively to obtain the first weighted processing result of the first user affinity rate and the second weighted processing result of the all user affinity rate.
[0100] For example, if the affinity rate of the first user is P1, the affinity rate of all users is P2, the first weight is W5, and the second weight is W6, then the first weighted processing result and the second weighted processing result can be calculated using the following formula.
[0101] The first weighted result = P1 × W5.
[0102] The second weighted result = P2 × W6.
[0103] The first weight and the second weight satisfy the following condition: the sum of the first weight and the second weight is 1, that is, W5 + W6 = 1.
[0104] S630: Summing the first weighted processing result and the second weighted processing result, the first summation result is determined as the proximity value.
[0105] Taking the example in S620, the affinity value is P1×W5+P2×W6.
[0106] S130: Determine the resource loading method for the target functional module based on the affinity value.
[0107] If the affinity value is greater than the set threshold, the resource loading method is determined to be local loading; if the affinity value is less than or equal to the set threshold, the resource loading method is determined to be remote loading.
[0108] The threshold can be set by those skilled in the art according to the actual situation, and the embodiments of the present invention do not limit this.
[0109] It should be noted that, in specific implementations, the affinity mentioned in the above embodiments can also be understood as alienation. The embodiments of the present invention include, but are not limited to, various transformations made on the basis of affinity.
[0110] S140: Load the resources of the target functional module according to the resource loading method.
[0111] Finally, the resources of the target functional module are loaded according to the resource loading method of the target functional module determined in S130.
[0112] In some embodiments, after performing S140, the affinity value can also be dynamically updated. Specifically, as... Figure 7 As shown, S710~S740 can be executed after S140.
[0113] S710: Request a first loading duration and a second loading duration from the server; wherein, the first loading duration is the duration for the first user to remotely load the target functional module, and the second duration is the average duration for all users to remotely load the target functional module.
[0114] S720: Determine whether the first loading time is greater than the second loading time.
[0115] If the judgment result is yes, that is, the first loading time is greater than the second loading time, execute S730; if the judgment result is no, that is, the first loading time is less than the second loading time, execute S740.
[0116] S730: Increase the ratio of the first weight to the second weight.
[0117] If the first loading time is longer than the second loading time, the weight corresponding to the first loading time (first weight) can be increased adaptively so that the final user affinity value is more in line with the actual situation.
[0118] Increasing the ratio of the first weight to the second weight can be achieved by, for example, increasing the first weight while keeping the second weight constant, or decreasing the second weight while keeping the first weight constant.
[0119] S740: Reduce the ratio of the first weight to the second weight.
[0120] If the first loading time is less than the second loading time, the weight corresponding to the first loading time (first weight) can be adaptively reduced so that the final usage affinity value is more in line with the actual situation.
[0121] Decreasing the ratio of the first weight to the second weight can be achieved by, for example, increasing the second weight while keeping the first weight constant, or decreasing the first weight while keeping the second weight constant.
[0122] In some embodiments, to further reduce the amount of data occupying invalid resources in local memory, after executing S130, as follows: Figure 8 As shown, S810~S830 can also be executed.
[0123] S810: Determine whether the first resource loading method determined this time is remote loading.
[0124] If yes, meaning the first resource loading method determined this time is remote loading, then execute S820; if no, meaning the first resource loading method determined this time is not remote loading, then end this process.
[0125] S820: Determine whether the previously determined second resource loading method was local loading.
[0126] If yes, meaning the previously determined second resource loading method was local loading, then execute S830; if no, meaning the previously determined second resource loading method was not local loading, then end the current process.
[0127] S830: Delete the resource loaded locally using the second resource loading method.
[0128] In the case of remote loading as the first resource loading method determined this time, the resources downloaded locally last time are actually invalid resources. In order to reduce the amount of invalid resource data occupying local memory, the resources downloaded locally last time based on the second resource loading method are deleted.
[0129] The resource loading method provided by this invention obtains the affinity statistics of a first user for a target functional module in a web application, calculates the user's affinity value for the target functional module based on the user's affinity statistics, determines the resource loading method for the target functional module based on the affinity value, and finally loads the resources of the target functional module according to the resource loading method. Therefore, this invention can determine the resource loading method for a target functional module based on the user's affinity for the target functional module in the web application. The entire loading process is no longer based on only one loading method. In this case, inappropriate loading methods can be reasonably avoided based on the different affinity of the user for each functional module in the web application. Furthermore, for different functional modules in the same web application, different loading methods can be selected based on their different affinity with the user. The loading method is no longer singular and rigid, and the entire resource loading process is more flexible and efficient. This effectively solves the problem in the prior art that it is impossible to rationally integrate the advantages of multiple loading methods to avoid many negative impacts during the loading process when loading related resources in a web application, thereby improving loading efficiency and enhancing user experience.
[0130] The resource loading apparatus provided by the present invention will be described below. The resource loading apparatus described below and the resource loading method described above can be referred to in correspondence.
[0131] Figure 9 This is a schematic diagram of the resource loading device provided in an embodiment of the present invention. Figure 9 As shown, the resource loading device 900 includes the following modules: acquisition module 901, calculation module 902, determination module 903 and loading module 904.
[0132] Module 901 is used to obtain the affinity statistics of the first user of the target functional module in the web application.
[0133] The calculation module 902 is used to calculate the first user's affinity value for the target functional module based on the first user's affinity statistics.
[0134] Module 903 is used to determine the resource loading method of the target functional module based on the usage affinity value.
[0135] Load module 904 is used to load the resources of the target functional module according to the resource loading method.
[0136] The resource loading device provided by this invention obtains the affinity statistics of a first user for a target functional module in a web application, calculates the user's affinity value for the target functional module based on the user's affinity statistics, determines the resource loading method for the target functional module based on the affinity value, and finally loads the resources of the target functional module according to the resource loading method. Therefore, this invention can determine the resource loading method for a target functional module based on the user's affinity for the target functional module in a web application. The entire loading process is no longer based on only one loading method. In this case, inappropriate loading methods can be reasonably avoided based on the different affinity levels of users for various functional modules in the web application. Furthermore, for different functional modules in the same web application, different loading methods can be selected based on their different affinity levels with the user. The loading method is no longer singular and rigid, and the entire resource loading process is more flexible and efficient. This effectively solves the problem in the prior art that it is impossible to rationally integrate the advantages of multiple loading methods to avoid many negative impacts during the loading process when loading related resources in a web application, thereby improving loading efficiency and enhancing user experience.
[0137] Figure 10 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 10 As shown, the electronic device may include a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040, wherein the processor 1010, the communications interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. The processor 1010 can call logical instructions in the memory 1030 to execute a resource loading method, which includes: obtaining affinity statistics of a first user of a target functional module in a web application; calculating the affinity value of the first user for the target functional module based on the affinity statistics; determining the resource loading method of the target functional module based on the affinity value; and finally loading the resources of the target functional module according to the resource loading method.
[0138] Furthermore, the logical instructions in the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0139] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the resource loading method provided by the above methods, the method comprising: obtaining affinity statistics of a first user of a target functional module in a web application; calculating an affinity value of the first user for the target functional module based on the affinity statistics; then determining a resource loading method for the target functional module based on the affinity value; and finally loading the resources of the target functional module according to the resource loading method.
[0140] In another aspect, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the resource loading method provided by the methods described above. The method includes: obtaining affinity statistics of a first user of a target functional module in a web application; calculating a usage affinity value of the first user for the target functional module based on the affinity statistics; then determining a resource loading method for the target functional module based on the usage affinity value; and finally loading the resources of the target functional module according to the resource loading method.
[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A resource loading method, characterized in that, include: Obtain the affinity statistics of the first user of the target functional module in the web application; Based on the affinity statistics of the first user, calculate the affinity value of the first user for the target functional module. Based on the aforementioned affinity value, determine the resource loading method for the target functional module; The resources of the target functional module are loaded according to the resource loading method described above.
2. The resource loading method according to claim 1, characterized in that, The step of determining the resource loading method of the target functional module based on the affinity value includes: If the affinity value is greater than a set threshold, the resource loading method is determined to be local loading; If the affinity value is less than or equal to the set threshold, the resource loading method is determined to be remote loading.
3. The resource loading method according to claim 1, characterized in that, The step of calculating the first user's affinity value for the target functional module based on the first user's affinity statistics includes: Taking the first user as the target user, and based on the proximity statistics of the target user, calculate the proximity rate of the target user's target functional module to obtain the first user proximity rate of the target functional module of the first user; The first user affinity rate is determined as the user affinity value.
4. The resource loading method according to claim 1, characterized in that, After obtaining the affinity statistics of the first user of the target functional module in the web application, the method further includes: Send the affinity statistics of the first user to the server; Receive the affinity statistics from all users of the server; The step of calculating the first user's affinity value for the target functional module based on the first user's affinity statistics includes: Based on the affinity statistics of the target user, the affinity rate of the target user for the target functional module is calculated; the affinity rate includes the affinity rate of the first user and the affinity rate of all users; when the target user is the first user, the affinity rate is the affinity rate of the first user; when the target user is all users, the affinity rate is the affinity rate of all users. Based on the first weight of the first user affinity rate and the second weight of the all user affinity rate, the first user affinity rate and the all user affinity rate are weighted respectively to obtain the first weighted result of the first user affinity rate and the second weighted result of the all user affinity rate; The first weighted processing result and the second weighted processing result are summed, and the resulting first summation result is determined as the affinity value.
5. The resource loading method according to claim 4, characterized in that, After loading the resources of the target functional module according to the resource loading method, the method further includes: The server is requested to specify a first loading time and a second loading time; wherein the first loading time is the time it takes for the first user to remotely load the target functional module, and the second loading time is the average time it takes for all users to remotely load the target functional module. If the first loading time is greater than the second loading time, increase the ratio of the first weight to the second weight; if the first loading time is less than the second loading time, decrease the ratio of the first weight to the second weight.
6. The resource loading method according to claim 1, characterized in that, After determining the resource loading method of the target functional module based on the affinity value, the method further includes: If the first resource loading method determined this time is remote loading and the second resource loading method determined last time is local loading, delete the resources loaded locally based on the second resource loading method.
7. The resource loading method according to claim 3 or 4, characterized in that, The affinity statistics include: affinity statistics for multiple time periods that correspond one-to-one; The step of calculating the affinity rate of the target functional module of the target user based on the affinity statistics of the target user includes: Based on the time period proximity statistics corresponding to the target time period, multiple proximity parameter values are obtained for the target time period; wherein, the target time period is any one of the multiple time periods; The affinity rate is obtained based on the affinity parameter values for each of the multiple time periods.
8. The resource loading method according to claim 7, characterized in that, The time-period proximity statistics corresponding to the target time period include: the total number of first page exposures of all pages in the target functional module within the target time period, the total number of first launches of the target functional module within the target time period, the total number of second page exposures of the native application where the web application is located within the target time period, and the total number of second launches of the native application within the target time period; the multiple proximity parameter values under the target time period include: the module exposure rate under the target time period and the module usage rate under the target time period; The step of obtaining multiple proximity parameter values for the target time period based on the proximity statistics corresponding to the target time period includes: Based on the total number of exposures of the first page and the total number of exposures of the second page, the exposure rate of the module during the target time period is obtained; and based on the total number of launches of the first page and the total number of launches of the second page, the usage rate of the module during the target time period is obtained. The step of obtaining the intimacy rate based on the multiple intimacy parameter values for each of the multiple time periods includes: Based on the exposure rate of the module during the target time period and its corresponding exposure rate weight, the module exposure rate during the target time period is obtained, resulting in multiple time period module exposure rates corresponding to multiple time periods; and based on the module usage rate during the target time period and its corresponding usage rate weight, the module usage rate during the target time period is obtained, resulting in multiple time period module usage rates corresponding to multiple time periods. The exposure rate and usage rate of the multiple time period modules are summed, and the resulting second summation result is determined as the affinity rate.
9. A resource loading device, characterized in that, include: The acquisition module is used to obtain the affinity statistics of the first user of the target functional module in the web application; The calculation module is used to calculate the first user's affinity value for the target functional module based on the affinity statistics of the first user; The determination module is used to determine the resource loading method of the target functional module based on the usage affinity value; The loading module is used to load the resources of the target functional module according to the resource loading method.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the resource loading method as described in any one of claims 1-8.