A page redrawing method, device, equipment and storage medium
By calculating the hash value of the page data and comparing it with the historical value, the problem of difficulty in judging whether redrawing is needed when the interface data is complex is solved, achieving fast and accurate page redrawing judgment and reducing performance consumption.
Patent Information
- Application Number
- CN202010991888.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-09-18
AI Technical Summary
When the interface data is complex, it is difficult for the existing technology to effectively determine whether the page needs to be redrawn, resulting in high performance consumption or high complexity.
By sending a data acquisition request to the preset page interface, it receives the current page data, calculates its hash value, compares it with the historical hash value, and decides whether to redraw the page based on the comparison result.
It simplifies the process of determining whether the page needs to be redrawn and reduces performance consumption. Especially when the interface data is complex, data changes can be determined quickly and accurately, thereby saving performance.
Smart Images

Figure CN112214270B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of page update, and in particular to a page redrawing method, device, equipment and storage medium. Background Art
[0002] In the scenario of updating the page by periodic polling or querying a single interface or multiple interfaces based on filtering conditions, there will be problems with frequent page redrawing or high redrawing performance consumption. There are two main conventional ways to redraw the page. The first way is to redraw the page directly without comparing the data, but this method consumes a lot of performance and is not suitable for scenarios with high performance requirements; the second way is to obtain the data returned by each interface twice, traverse the various parameters in the data and compare them, and redraw the page when the data changes. However, the complexity of this method is proportional to the complexity of the interface data format and the number of interfaces. When the interface data format is complex and the number of parameters is large, the comparison will be extremely difficult. Moreover, when the data interface format changes, the traversal comparison method also needs to be adjusted accordingly, and it is highly dependent.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a page redrawing method, device, equipment and storage medium, aiming to solve the technical problem in the prior art that it is very difficult to determine whether page redrawing is required when the interface data is very complex.
[0005] To achieve the above object, the present invention provides a method comprising the following steps:
[0006] After sending a data acquisition request to a preset page interface, receiving current page data fed back by the preset page interface;
[0007] Calculate the current hash value corresponding to the current page data;
[0008] Comparing the current hash value with a historical hash value to obtain a comparison result, wherein the historical hash value is generated based on the historical page data fed back by the preset page interface;
[0009] The page is redrawn according to the current page data and the comparison result.
[0010] Preferably, before the step of comparing the current hash value with the historical hash value to obtain a comparison result, the step further includes:
[0011] Determining whether the current page data is page data received from the preset page interface for the first time;
[0012] When the current page data is not the page data received from the preset page interface for the first time, a historical hash value is obtained, and the step of comparing the current hash value with the historical hash value to obtain a comparison result is performed.
[0013] Preferably, the step of determining whether the current page data is page data received from the preset page interface for the first time includes:
[0014] Obtaining the interface identifier of the preset page interface, and searching for the interface identifier in the preset interface identifier set;
[0015] When the interface identifier can be found in the preset interface identifier set, determining that the current page data is not page data received from the preset page interface for the first time;
[0016] When the interface identifier is not found in the preset interface identifier set, it is determined that the current page data is page data received from the preset page interface for the first time and the preset interface identifier set is updated according to the interface identifier.
[0017] Preferably, after the step of determining whether the current page data is page data received from the preset page interface for the first time, the method further includes:
[0018] When the current page data is page data received from the preset page interface for the first time, the page is redrawn according to the current page data.
[0019] Preferably, before the step of calculating the current hash value corresponding to the current page data, the step further includes:
[0020] Performing security verification on the current page data;
[0021] When the current page data passes the security check, the step of calculating the current hash value corresponding to the current page data is performed.
[0022] Preferably, the step of performing security verification on the current page data includes:
[0023] Obtaining verification data and page parameter data in the current page data;
[0024] Securely encrypt the page parameter data according to a preset security verification algorithm to obtain encrypted security verification data;
[0025] Determining whether the security verification data is the same as the verification data;
[0026] When the security verification data is the same as the verification data, determining that the current page data passes the security verification;
[0027] When the security verification data is different from the verification data, it is determined that the current page data has failed the security verification.
[0028] Preferably, the step of obtaining the verification data and page parameter data in the current page data includes:
[0029] Decrypt the current page data according to a preset decryption algorithm to obtain the decrypted page data;
[0030] The verification data and the page parameter data are extracted from the decrypted page data.
[0031] Preferably, the step of redrawing the page according to the current page data and the comparison result includes:
[0032] When the comparison result is that the current hash value is different from the historical hash value, obtaining a target page component corresponding to the current page data;
[0033] Comparing the current page data with the component data of the target page component;
[0034] When the page data is different from the component data, the target page component is redrawn.
[0035] Preferably, when the comparison result is that the current hash value is different from the historical hash value, the step of obtaining the target page component corresponding to the current page data includes:
[0036] When the current hash value is different from the historical hash value, obtaining component identification data in the current page data;
[0037] The component identification data is matched with the component identifications of each component of the page to determine the target page component corresponding to the current page data.
[0038] Preferably, after the step of redrawing the page according to the current page data and the comparison result, the method further includes:
[0039] The historical hash value is updated according to the current hash value.
[0040] Preferably, after the step of updating the historical hash value according to the current hash value, the method further comprises:
[0041] After waiting for a preset time, the method returns to the step of sending a data acquisition request to the preset page interface and receiving the current page data fed back by the preset page interface.
[0042] Preferably, the step of calculating the current hash value corresponding to the current page data includes:
[0043] Extracting characteristic parameters from the current page data;
[0044] Convert the characteristic parameters into a hash parameter.
[0045] Calculate according to the hash parameter to obtain the corresponding current hash value.
[0046] Preferably, after sending a data acquisition request to a preset page interface, the step of receiving current page data fed back by the preset page interface includes:
[0047] Send a data acquisition request to the preset page interface;
[0048] Waiting for a preset time to detect whether the current page data fed back by the preset page interface is received;
[0049] If the current page data fed back by the preset page interface is not received, the process returns to the step of sending a data acquisition request to the preset page interface until the current page data fed back by the preset page interface is received.
[0050] Preferably, after sending a data acquisition request to a preset page interface, the step of receiving current page data fed back by the preset page interface includes:
[0051] After sending data acquisition requests to multiple preset page interfaces respectively, receiving multiple response data fed back by the multiple preset page interfaces;
[0052] Combine the plurality of response data to obtain current page data.
[0053] In addition, to achieve the above object, the present invention also provides a page redrawing device, the page redrawing device comprising:
[0054] A data receiving module, used for receiving the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface;
[0055] A data calculation module, used to calculate the current hash value corresponding to the current page data;
[0056] A data comparison module, used to compare the current hash value with a historical hash value to obtain a comparison result, wherein the historical hash value is generated based on the historical page data fed back by the preset page interface;
[0057] The page redrawing module is used to redraw the page according to the current page data and the comparison result.
[0058] Preferably, the data calculation module is also used to perform security verification on the current page data; when the current page data passes the security verification, the step of calculating the current hash value corresponding to the current page data is executed.
[0059] Preferably, the data comparison module is also used to determine whether the current page data is page data received from the preset page interface for the first time; when the current page data is not page data received from the preset page interface for the first time, obtain the historical hash value, and execute the step of comparing the current hash value with the historical hash value to obtain the comparison result.
[0060] Preferably, the page redrawing module is also used to obtain the target page component corresponding to the current page data when the comparison result is that the current hash value is different from the historical hash value; compare the current page data with the component data of the target page component; and redraw the target page component when the page data is different from the component data.
[0061] In addition, to achieve the above-mentioned purpose, the present invention also proposes a page redrawing device, which includes: a memory, a processor, and a page redrawing program stored in the memory and executable on the processor, and the page redrawing program, when executed by the processor, implements the steps of any of the above-mentioned page redrawing methods.
[0062] In addition, to achieve the above purpose, the present invention also proposes a computer storage medium, on which a page redrawing program is stored, and when the page redrawing program is executed, the steps of any of the above-mentioned page redrawing methods are implemented.
[0063] The present invention receives the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface; calculates the current hash value corresponding to the current page data; compares the current hash value with the historical hash value to obtain a comparison result, and the historical hash value is generated based on the historical page data fed back by the preset page interface; and redraws the page according to the current page data and the comparison result. The present invention compares the current hash value with the historical hash value. Since the hash value can reflect the page data, it can be determined whether the current page data and the historical page data are the same, so that it can be very simple to determine whether the page needs to be redrawn. Therefore, when the interface data is very complex, by calculating the hash value for comparison, it can be quickly determined whether the page needs to be redrawn. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;
[0065] Figure 2 It is a flow chart of the first embodiment of the page redrawing method of the present invention;
[0066] Figure 3 It is a flow chart of the second embodiment of the page redrawing method of the present invention;
[0067] Figure 4 It is a flow chart of the third embodiment of the page redrawing method of the present invention;
[0068] Figure 5 It is a flowchart diagram of a fourth embodiment of the page redrawing method of the present invention;
[0069] Figure 6 It is a structural block diagram of the first embodiment of the page redrawing device of the present invention.
[0070] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0071] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0072] Reference Figure 1 , Figure 1 The schematic diagram is a structural diagram of a page redrawing device in a hardware operating environment according to an embodiment of the present invention.
[0073] like Figure 1 As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0074] Those skilled in the art will understand that Figure 1The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0075] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a page redrawing program.
[0076] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in a page redrawing device, and the electronic device calls the page redrawing program stored in the memory 1005 through the processor 1001, and executes the page redrawing method provided by an embodiment of the present invention.
[0077] The embodiment of the present invention provides a page redrawing method, referring to Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of a page redrawing method according to the present invention.
[0078] In this embodiment, the page redrawing method includes the following steps:
[0079] Step S10: after sending a data acquisition request to the preset page interface, receiving the current page data fed back by the preset page interface;
[0080] It should be noted that the execution subject of this embodiment is the page redrawing device, wherein the page redrawing device can be an electronic device such as a mobile phone, a tablet computer, and a personal computer, and can also be other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the page redrawing method of the present invention is explained by taking the page redrawing device as an example.
[0081] It should be noted that an interface is a reference type that defines a contract. Other types implement interfaces to ensure that they support certain operations. An interface specifies members that must be provided by a class or other interfaces that implement it. Similar to a class, an interface can contain methods, properties, indexers, and events as members.
[0082] It can be understood that the preset page interface may be an interface set on the server to provide services for the page, and the current page data may be data fed back by the preset page interface based on a data acquisition request.
[0083] It should be noted that in complex business scenarios, page redrawing may involve more than one interface, and multiple interface data combinations may be processed in conjunction with an overall data.
[0084] Furthermore, in order to handle the situation of multiple interface data combinations, in this embodiment, after sending a data acquisition request to a preset page interface, the step of receiving the current page data fed back by the preset page interface may be:
[0085] After sending data acquisition requests to multiple preset page interfaces respectively, multiple response data fed back by the multiple preset page interfaces are received; and the multiple response data are combined to obtain current page data.
[0086] It can be understood that a page can correspond to multiple preset page interfaces. After sending data acquisition requests to multiple preset page interfaces respectively, multiple response data fed back by multiple preset page interfaces can be received. At this time, the obtained multiple response data can be matched and calculated and other combined operations to obtain the current page data.
[0087] It should be noted that after the data acquisition request is issued, the preset page interface may not be able to receive the data acquisition request due to factors such as network fluctuations and packet loss. Therefore, the preset page interface cannot feedback the current page data based on the data acquisition request.
[0088] Furthermore, in order to ensure that the current page data can be received, after sending a data acquisition request to the preset page interface, the step of receiving the current page data fed back by the preset page interface can also be:
[0089] Send a data acquisition request to the preset page interface; wait for a preset time to detect whether the current page data fed back by the preset page interface is received; if the current page data fed back by the preset page interface is not received, return to the step of sending a data acquisition request to the preset page interface until the current page data fed back by the preset page interface is received.
[0090] In actual use, a preset time can be set, and the waiting process starts after the data acquisition request is issued. After waiting for the preset time, it is detected whether the current page data fed back by the preset page interface is received. If not, it means that factors such as network fluctuations may have occurred, and the preset page interface failed to receive the data acquisition request. At this time, it can return to the step of sending the data acquisition request to the preset page interface until the current page data fed back by the preset page interface is received.
[0091] For example: set the preset time length to 30 seconds, start timing after sending the data acquisition request, and when the timing reaches 30 seconds, check whether the current page data fed back by the preset page interface is received. If the current page data fed back by the preset page interface is not received, return to the step of sending the data acquisition request to the preset page interface and resend the request.
[0092] Step S20: Calculate the current hash value corresponding to the current page data;
[0093] It should be noted that hash is generally translated as hashing or hashing, which is to transform an input of any length (also called pre-image) into an output of fixed length through a hash algorithm. The output is the hash value. This conversion is a compression mapping, that is, the space of hash values is usually much smaller than the space of input.
[0094] It should be noted that a hash algorithm is a function that maps a binary string of arbitrary length to a binary value string of fixed length. The hash algorithm has the following general characteristics: even if only one bit of the input data is modified, the resulting hash value is completely different; two pieces of information with the same hash value cannot be found; the hash value can be quickly calculated for longer texts; the original information cannot be inferred from the hash result. Commonly used hash algorithms generally include: MD4, MD5, and SHA-1, etc., which are not limited in this embodiment.
[0095] Furthermore, in order to better calculate the hash value, this embodiment further includes, before the step of calculating the current hash value corresponding to the current page data:
[0096] Extract characteristic parameters from the current page data; convert the characteristic parameters into a format to obtain hash parameters; and perform calculations based on the hash parameters to obtain a corresponding current hash value.
[0097] It should be noted that different hash algorithms may have different requirements for input values depending on the specific implementation methods. Before using the hash algorithm to calculate the hash value, the current page data can be processed to extract the required feature parameters, convert the feature parameters into the data format corresponding to the hash algorithm, and then calculate the hash value.
[0098] Step S30: Compare the current hash value with the historical hash value to obtain a comparison result, where the historical hash value is generated based on the historical page data fed back by the preset page interface;
[0099] It should be noted that page redrawing consumes a lot of performance. In complex business scenarios, performance needs to be saved. Before the page is redrawn, the data needs to be compared and judged to determine whether the page needs to be redrawn based on the comparison results. Direct comparison and judgment of the data has poor performance and is very complex and difficult to handle. Therefore, the current hash value calculated from the current page data can be compared with the historical hash value calculated from the historical page data. The hash value comparison results can be used to determine whether the data has changed, and the comparison results can be used to determine whether the page needs to be redrawn.
[0100] Step S40: redrawing the page according to the current page data and the comparison result.
[0101] It should be noted that when the comparison result is that the current hash value is different from the historical hash value, it can be determined that the current page data has changed compared to the historical page data, and the page needs to be redrawn. Directly redrawing the entire page will also waste a lot of performance. Therefore, the target page component whose data has changed in the page can be determined, and only the target page component is redrawn.
[0102] Furthermore, in order to save performance, only the target page component whose data has changed is redrawn. The steps of redrawing the page according to the current page data and the comparison result in this embodiment are specifically as follows:
[0103] When the comparison result is that the current hash value is different from the historical hash value, obtain the target page component corresponding to the current page data; compare the current page data with the component data of the target page component; when the page data and the component data are different, redraw the target page component.
[0104] It can be understood that the current page data can correspond to all components contained in the page or only some components in the page, and not all data needs to be changed when the page needs to be redrawn. Therefore, the target page component corresponding to the current page data can be obtained, and then the target page component can be traversed to obtain the current page component to determine whether the data in the current page component is the same as the corresponding data in the current page data. When the corresponding part of the data in the current page data is different, the current page component can be redrawn according to the corresponding data of the current page component in the current page data.
[0105] In actual use, complex business scenarios, such as big data visualization scenarios, which involve large amounts of data or complex 3D effect drawing, require saving performance consumption and determining whether the page needs to be redrawn. At the same time, it is possible to determine which page components’ data has changed, and only redraw the page components whose data has changed, which can further save performance and optimize the page display effect.
[0106] Further, in order to better obtain the target page component corresponding to the current page data, in this embodiment, when the comparison result is that the current hash value is different from the historical hash value, the steps of obtaining the target page component corresponding to the current page data are specifically as follows:
[0107] When the current hash value is different from the historical hash value, the component identification data in the current page data is obtained; the component identification data is matched with the component identifications of each component of the page to determine the target page component corresponding to the current page data.
[0108] In actual use, a page component can be set with a unique identifier, for example, a unique primary key ID is set for each page component. The current page data can contain the identification data of the corresponding page component, and the corresponding page component can be found by searching the unique identifier according to the identification field, and the found page component is used as the target page component.
[0109] For example: if the current page data contains the identification data values of the corresponding page components: A and B, then the corresponding page component with the unique identification A and the page component with the unique identification B can be found, and the two page components are used as target page components.
[0110] This embodiment receives the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface; calculates the current hash value corresponding to the current page data; compares the current hash value with the historical hash value to obtain a comparison result, and the historical hash value is generated based on the historical page data fed back by the preset page interface; and redraws the page according to the current page data and the comparison result. The present invention compares the current hash value with the historical hash value. Since the hash value can reflect the page data, it can determine whether the current page data and the historical page data are the same, so that it can be very simple to determine whether the page needs to be redrawn. Therefore, when the interface data is very complex, by calculating the hash value for comparison, it can be quickly determined whether the page needs to be redrawn.
[0111] refer to Figure 3 , Figure 3 It is a flow chart of a second embodiment of a page redrawing method of the present invention.
[0112] Based on the first embodiment, the page redrawing method of this embodiment further includes, before step S30:
[0113] Step S201: determining whether the current page data is page data received from the preset page interface for the first time;
[0114] It should be noted that if the current page data is the first page data received from the preset page interface, there is no historical page data. Therefore, before obtaining the historical hash value, the current page data can be confirmed to determine whether the current page data is the first page data received from the preset page interface.
[0115] Furthermore, in order to simply and quickly determine whether the current page data is the page data received from the preset page interface for the first time, the steps of determining whether the current page data is the page data received from the preset page interface for the first time in this embodiment are specifically as follows:
[0116] Obtain the interface identifier of the preset page interface, and search for the interface identifier in the preset interface identifier set; when the interface identifier can be found in the preset interface identifier set, determine that the current page data is not the page data received from the preset page interface for the first time; when the interface identifier is not found in the preset interface identifier set, determine that the current page data is the page data received from the preset page interface for the first time and update the preset interface identifier set according to the interface identifier.
[0117] It can be understood that the preset page interface can be set with a unique interface identifier, and an interface identifier set can be preset. Each time data fed back by the preset page interface is received, a search is performed in the preset interface identifier set based on the interface identifier of the preset page interface. When no results are found, it is determined that this is the first time that data fed back by the preset page interface is received, and the interface identifier is added to the preset interface identifier set. When results are found, it is determined that this is not the first time that data fed back by the preset page interface is received.
[0118] Step S202: when the current page data is not the page data received from the preset page interface for the first time, obtain a historical hash value, and perform the step of comparing the current hash value with the historical hash value to obtain a comparison result.
[0119] It is understandable that when the current page data is not the page data received from the preset page interface for the first time, there is a historical hash value, so the historical hash value can be directly obtained, and the step of comparing the current hash value with the historical hash value to obtain the comparison result is performed.
[0120] It should be noted that when the current page data is page data received from the preset page interface for the first time, there is no historical hash value, and special processing is required.
[0121] Furthermore, in order to be able to perform processing even when there is no historical hash value, this embodiment further includes the following steps after the step of determining whether the current page data is page data received from the preset page interface for the first time:
[0122] When the current page data is page data received from the preset page interface for the first time, the page is redrawn according to the current page data.
[0123] It is understandable that when the current page data is page data received from the preset page interface for the first time, there is no historical page data, and the page can be redrawn directly according to the current page data.
[0124] This embodiment determines whether the current page data is the page data received from the preset page interface for the first time. When the current page data is the page data received from the preset page interface for the first time, the page is redrawn directly according to the current page data. When the current page data is not the page data received from the preset page interface for the first time, the current hash value corresponding to the current page data is calculated and compared with the historical hash value, thereby effectively avoiding unnecessary calculations and further reducing unnecessary performance consumption.
[0125] refer to Figure 4 , Figure 4 It is a flow chart of a third embodiment of a page redrawing method of the present invention.
[0126] Based on the first embodiment, the page redrawing method of this embodiment further includes, before step S20:
[0127] Step S101: performing security verification on the current page data;
[0128] It should be noted that during the data transmission process, the data may be tampered with by hackers or other malicious operations. In order to identify the data that has been maliciously tampered with and prevent the page from being redrawn based on the data that has been maliciously tampered with, the current page data can be checked for security.
[0129] Furthermore, in order to accurately identify whether the current page data is maliciously tampered data, the steps of performing security verification on the current page data in this embodiment are specifically as follows:
[0130] Obtain verification data and page parameter data in the current page data; securely encrypt the page parameter data according to a preset security verification algorithm to obtain encrypted security verification data; determine whether the security verification data is the same as the verification data; if the security verification data is the same as the verification data, determine that the current page data has passed the security verification; if the security verification data is different from the verification data, determine that the current page data has not passed the security verification.
[0131] It should be noted that in order to perform security verification, the preset page interface can encrypt the page parameter data in a preset encryption method before feeding back the current page data to obtain corresponding verification data, and then generate the corresponding current page data based on the verification data and the page parameter data.
[0132] It should be noted that when the current page data is received, the verification data and page parameter data in the current page data can be extracted, and the page parameter data can be encrypted in a preset encryption method to obtain corresponding security verification data. The security verification data is compared with the verification data. If the security verification data is the same as the verification data, it means that the current page data has not been tampered with, and it is determined that the current page data has passed the security verification. If the security verification data is different from the verification data, it means that the current page data has been tampered with, and it is determined that the current page data has not passed the security verification.
[0133] In actual use, if it is determined that the current page data passes the security check, you can continue to the subsequent steps. If it is determined that the current page data does not pass the security check, it means that the data has been maliciously tampered with and the data is not the data actually needed. At this time, the corresponding process needs to be interrupted. The corresponding warning information can be generated based on the current page data and sent to the warning server and other processing devices to collect information for processing.
[0134] For example: the preset page interface generates corresponding page parameter data A, B and C according to the page data acquisition request, sorts them in ACB mode, and then uses the MD5 algorithm to calculate ACB to obtain the corresponding verification data E. When the page redrawing device receives the current page data, it can extract the corresponding page parameter data A, B and C and the verification data E, sort the page parameter data in ACB mode, and also use the MD5 algorithm to calculate to obtain the security verification data E`, compare E with E`, and determine whether E and E' are the same.
[0135] It should be noted that, during the transmission of the current page data, in order to prevent interception, the current page data may be encrypted data.
[0136] Furthermore, in order to extract verification data and page parameter data when the current page data is encrypted data, the step of obtaining the verification data and page parameter data in the current page data in this embodiment includes:
[0137] The current page data is decrypted according to a preset decryption algorithm to obtain the decrypted page data; and the verification data and page parameter data are extracted from the decrypted page data.
[0138] It is understandable that the encrypted data cannot be read directly, so the current page data needs to be decrypted according to a preset decryption algorithm to obtain the decrypted page data, and then the corresponding verification data and page parameter data can be extracted from the decrypted page data.
[0139] Step S102: When the current page data passes the security check, the step of calculating the current hash value corresponding to the current page data is performed.
[0140] It can be understood that if the current page data passes the security check, it means that the current page data has not been tampered with and the current page data is safe. Therefore, the step of calculating the current hash value corresponding to the current page data can be performed.
[0141] This embodiment performs a security check on the received current page data to verify whether the data has been maliciously tampered with. When it is determined that the current page data has been maliciously tampered with, the page redrawing operation is abandoned and the current page data information is collected for reporting. When it is determined that the current page data has not been maliciously tampered with, the current hash value is calculated based on the current page data, and the current hash value is compared with the historical hash value to determine whether to redraw the page. This can effectively prevent the current page data from being maliciously tampered with, thereby improving data security.
[0142] refer to Figure 5 , Figure 5 FIG. 4 is a flow chart of a fourth embodiment of a page redrawing method according to the present invention.
[0143] Based on the first embodiment, the page redrawing method of this embodiment further includes, after step S40:
[0144] Step S50: updating the historical hash value according to the current hash value.
[0145] It should be noted that every time a hash value judgment is required, the hash value needs to be calculated based on the historical page data, which will waste computing performance. In addition, saving the historical page data will also waste a lot of storage space when the data volume is large. Therefore, only the historical hash value can be saved. After each page redrawing process is completed, the historical hash value can be directly updated according to the current hash value.
[0146] For example: the current hash value is A, and the hash value calculated based on the historical page data is B. After the page redraw process is completed, A overwrites B, and the new historical hash value is A.
[0147] Step S60: After waiting for a preset time, return to the step of receiving the current page data fed back by the preset page interface after sending the data acquisition request to the preset page interface.
[0148] In actual use, according to the requirements of the specific usage scenario, it may be necessary to request page data from the preset page interface once every certain period of time. Therefore, the preset time can be set. After a page redrawing process is completed, wait for the preset time and then return to the step of sending a data acquisition request to the preset page interface and receiving the current page data fed back by the preset page interface and repeating it.
[0149] For example, the preset duration is set to 60 seconds. After a page redraw process is completed, the timing starts. When the timing reaches 60 seconds, a data acquisition request is sent to the preset page interface again.
[0150] This embodiment can further save storage space, reduce unnecessary computing processes, and reduce performance consumption by saving historical hash values instead of saving historical page data. By adjusting the preset time according to the actual usage scenario to adjust the frequency of polling the preset page interface, the interface utilization rate can be improved, which in turn reduces unnecessary performance consumption.
[0151] In addition, an embodiment of the present invention further provides a storage medium, on which a page redrawing program is stored. When the page redrawing program is executed by a processor, the steps of the page redrawing method described above are implemented.
[0152] Reference Figure 6 , Figure 6 It is a structural block diagram of the first embodiment of the page redrawing device of the present invention.
[0153] like Figure 6 As shown, the page redrawing device proposed in the embodiment of the present invention includes:
[0154] The data receiving module 601 is used to receive the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface;
[0155] The data calculation module 602 is used to calculate the current hash value corresponding to the current page data;
[0156] A data comparison module 603, configured to compare the current hash value with a historical hash value to obtain a comparison result, wherein the historical hash value is generated based on the historical page data fed back by the preset page interface;
[0157] The page redrawing module 604 is used to redraw the page according to the current page data and the comparison result.
[0158] Furthermore, the data comparison module 603 is also used to determine whether the current page data is page data received from the preset page interface for the first time; when the current page data is not page data received from the preset page interface for the first time, obtain the historical hash value, and execute the step of comparing the current hash value with the historical hash value to obtain the comparison result.
[0159] Furthermore, the data comparison module 603 is also used to obtain the interface identifier of the preset page interface, and search for the interface identifier in the preset interface identifier set; when the interface identifier can be found in the preset interface identifier set, it is determined that the current page data is not the page data received from the preset page interface for the first time; when the interface identifier is not found in the preset interface identifier set, it is determined that the current page data is the page data received from the preset page interface for the first time and the preset interface identifier set is updated according to the interface identifier.
[0160] Furthermore, the data comparison module 603 is further configured to redraw the page according to the current page data when the current page data is page data received from the preset page interface for the first time.
[0161] Furthermore, the data calculation module 602 is also used to perform security verification on the current page data; when the current page data passes the security verification, the step of calculating the current hash value corresponding to the current page data is executed.
[0162] Furthermore, the data calculation module 602 is also used to obtain the verification data and page parameter data in the current page data; securely encrypt the page parameter data according to a preset security verification algorithm to obtain encrypted security verification data; determine whether the security verification data is the same as the verification data; when the security verification data is the same as the verification data, determine that the current page data has passed the security verification; when the security verification data is different from the verification data, determine that the current page data has not passed the security verification.
[0163] Furthermore, the data calculation module 602 is further used to decrypt the current page data according to a preset decryption algorithm to obtain the decrypted page data;
[0164] The verification data and the page parameter data are extracted from the decrypted page data.
[0165] Furthermore, the page redrawing module 604 is also used to obtain the target page component corresponding to the current page data when the comparison result is that the current hash value is different from the historical hash value; compare the current page data with the component data of the target page component; and redraw the target page component when the page data is different from the component data.
[0166] Furthermore, the page redrawing module 604 is also used to obtain component identification data in the current page data when the current hash value is different from the historical hash value; match the component identification data with the component identifications of each component of the page to determine the target page component corresponding to the current page data.
[0167] Furthermore, the page redrawing module 604 is also used to update the historical hash value according to the current hash value.
[0168] Furthermore, the page redrawing module 604 is also used to wait for a preset time period and then return to the step of receiving the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface.
[0169] Furthermore, the data calculation module 602 is also used to extract characteristic parameters from the current page data; convert the characteristic parameters into a format to obtain hash parameters; and perform calculations based on the hash parameters to obtain a corresponding current hash value.
[0170] Furthermore, the data receiving module 601 is also used to send a data acquisition request to a preset page interface; wait for a preset period of time to detect whether the current page data fed back by the preset page interface is received; if the current page data fed back by the preset page interface is not received, return to the step of sending a data acquisition request to the preset page interface until the current page data fed back by the preset page interface is received.
[0171] Furthermore, the data receiving module 601 is also used to receive multiple response data fed back by multiple preset page interfaces after sending data acquisition requests to multiple preset page interfaces respectively; and combine the multiple response data to obtain current page data.
[0172] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0173] This embodiment receives the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface; calculates the current hash value corresponding to the current page data; compares the current hash value with the historical hash value to obtain a comparison result, and the historical hash value is generated based on the historical page data fed back by the preset page interface; and redraws the page according to the current page data and the comparison result. The present invention compares the current hash value with the historical hash value. Since the hash value can reflect the page data, it can determine whether the current page data and the historical page data are the same, so that it can be very simple to determine whether the page needs to be redrawn. Therefore, when the interface data is very complex, by calculating the hash value for comparison, it can be quickly determined whether the page needs to be redrawn.
[0174] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0175] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the page redrawing method provided in any embodiment of the present invention, and will not be repeated here.
[0176] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0177] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0178] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0179] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A page redrawing method, characterized in that: The page redrawing method comprises the following steps: After sending a data acquisition request to a preset page interface, receiving current page data fed back by the preset page interface; Calculate the current hash value corresponding to the current page data; Comparing the current hash value with a historical hash value to obtain a comparison result, wherein the historical hash value is generated based on the historical page data fed back by the preset page interface; Redrawing the page according to the current page data and the comparison result; Wherein, after sending a data acquisition request to a preset page interface, the step of receiving current page data fed back by the preset page interface includes: After sending data acquisition requests to multiple preset page interfaces respectively, receiving multiple response data fed back by the multiple preset page interfaces; Combine the plurality of response data to obtain current page data.
2. The page redrawing method according to claim 1, characterized in that: Before the step of comparing the current hash value with the historical hash value to obtain a comparison result, the method further includes: Determining whether the current page data is page data received from the preset page interface for the first time; When the current page data is not the page data received from the preset page interface for the first time, a historical hash value is obtained, and the step of comparing the current hash value with the historical hash value to obtain a comparison result is performed.
3. The page redrawing method according to claim 2, characterized in that: The step of determining whether the current page data is page data received from the preset page interface for the first time includes: Obtaining the interface identifier of the preset page interface, and searching for the interface identifier in the preset interface identifier set; When the interface identifier can be found in the preset interface identifier set, determining that the current page data is not page data received from the preset page interface for the first time; When the interface identifier is not found in the preset interface identifier set, it is determined that the current page data is page data received from the preset page interface for the first time and the preset interface identifier set is updated according to the interface identifier.
4. The page redrawing method according to claim 2, characterized in that: After the step of determining whether the current page data is page data received from the preset page interface for the first time, the method further includes: When the current page data is page data received from the preset page interface for the first time, the page is redrawn according to the current page data.
5. The page redrawing method according to claim 1, characterized in that: Before the step of calculating the current hash value corresponding to the current page data, the method further includes: Performing security verification on the current page data; When the current page data passes the security check, the step of calculating the current hash value corresponding to the current page data is performed.
6. The page redrawing method according to claim 5, characterized in that: The step of performing security verification on the current page data includes: Obtaining verification data and page parameter data in the current page data; Securely encrypt the page parameter data according to a preset security verification algorithm to obtain encrypted security verification data; Determining whether the security verification data is the same as the verification data; When the security verification data is the same as the verification data, determining that the current page data passes the security verification; When the security verification data is different from the verification data, it is determined that the current page data has failed the security verification.
7. The page redrawing method according to claim 6, characterized in that: The step of obtaining the verification data and page parameter data in the current page data includes: Decrypt the current page data according to a preset decryption algorithm to obtain the decrypted page data; The verification data and the page parameter data are extracted from the decrypted page data.
8. The page redrawing method according to claim 1, characterized in that: The step of redrawing the page according to the current page data and the comparison result includes: When the comparison result is that the current hash value is different from the historical hash value, obtaining a target page component corresponding to the current page data; Comparing the current page data with the component data of the target page component; When the page data is different from the component data, the target page component is redrawn.
9. The page redrawing method according to claim 8, characterized in that: The step of obtaining the target page component corresponding to the current page data when the comparison result is that the current hash value is different from the historical hash value includes: When the current hash value is different from the historical hash value, obtaining component identification data in the current page data; The component identification data is matched with the component identifications of each component of the page to determine the target page component corresponding to the current page data.
10. The page redrawing method according to claim 1, characterized in that: After the step of redrawing the page according to the current page data and the comparison result, the method further includes: The historical hash value is updated according to the current hash value.
11. The page redrawing method according to claim 10, characterized in that: After the step of updating the historical hash value according to the current hash value, the method further includes: After waiting for a preset time, the method returns to the step of sending a data acquisition request to the preset page interface and receiving the current page data fed back by the preset page interface.
12. The page redrawing method according to any one of claims 1 to 11, characterized in that: The step of calculating the current hash value corresponding to the current page data includes: Extracting characteristic parameters from the current page data; Convert the characteristic parameters into a hash parameter. Calculate according to the hash parameter to obtain the corresponding current hash value.
13. The page redrawing method according to any one of claims 1 to 11, characterized in that: The step of receiving the current page data fed back by the preset page interface after sending the data acquisition request to the preset page interface includes: Send a data acquisition request to the preset page interface; Waiting for a preset time to detect whether the current page data fed back by the preset page interface is received; If the current page data fed back by the preset page interface is not received, the process returns to the step of sending a data acquisition request to the preset page interface until the current page data fed back by the preset page interface is received.
14. A page redrawing device, characterized in that: The page redrawing device includes the following modules: A data receiving module, used for receiving the current page data fed back by the preset page interface after sending a data acquisition request to the preset page interface; A data calculation module, used to calculate the current hash value corresponding to the current page data; A data comparison module, used to compare the current hash value with a historical hash value to obtain a comparison result, wherein the historical hash value is generated based on the historical page data fed back by the preset page interface; A page redrawing module, used for redrawing the page according to the current page data and the comparison result; The data receiving module is further used to receive multiple response data fed back by multiple preset page interfaces after sending data acquisition requests to the multiple preset page interfaces respectively; and combine the multiple response data to obtain current page data.
15. The page redrawing device according to claim 14, characterized in that: The data calculation module is also used to perform security verification on the current page data; when the current page data passes the security verification, the step of calculating the current hash value corresponding to the current page data is executed.
16. The page redrawing device according to claim 15, characterized in that: The data comparison module is also used to determine whether the current page data is the page data received from the preset page interface for the first time; when the current page data is not the page data received from the preset page interface for the first time, obtain the historical hash value, and execute the step of comparing the current hash value with the historical hash value to obtain the comparison result.
17. The page redrawing device according to claim 14, characterized in that: The page redrawing module is also used to obtain the target page component corresponding to the current page data when the comparison result is that the current hash value is different from the historical hash value; compare the current page data with the component data of the target page component; and redraw the target page component when the page data is different from the component data.
18. A page redrawing device, characterized in that: The page redrawing device includes: a memory, a processor, and a page redrawing program stored in the memory and executable on the processor. When the page redrawing program is executed by the processor, the steps of the page redrawing method according to any one of claims 1 to 13 are implemented.
19. A computer storage medium, characterized in that: The computer-readable storage medium stores a page redrawing program, and when the page redrawing program is executed, the steps of the page redrawing method according to any one of claims 1 to 13 are implemented.
