Nothing Special   »   [go: up one dir, main page]

CN109471988B - Page information updating method and device, computer equipment and storage medium - Google Patents

Page information updating method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN109471988B
CN109471988B CN201811187153.6A CN201811187153A CN109471988B CN 109471988 B CN109471988 B CN 109471988B CN 201811187153 A CN201811187153 A CN 201811187153A CN 109471988 B CN109471988 B CN 109471988B
Authority
CN
China
Prior art keywords
script
standard
basic
target
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811187153.6A
Other languages
Chinese (zh)
Other versions
CN109471988A (en
Inventor
吴启
黄成�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811187153.6A priority Critical patent/CN109471988B/en
Publication of CN109471988A publication Critical patent/CN109471988A/en
Application granted granted Critical
Publication of CN109471988B publication Critical patent/CN109471988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a page information updating method, a device, terminal equipment and a storage medium, wherein the page information updating method comprises the following steps: if the page loading request is detected, acquiring a current js script contained in the page loading request; sending a standard version information inquiry request to a server according to the basic script identification; the method comprises the steps of receiving standard version information returned by a server, carrying out consistency check on a standard version identifier and a basic version identifier to obtain a first check result, and acquiring a latest js script corresponding to the basic script identifier from the server if the first check result is that the versions are inconsistent; replacing the current js script with the latest js script to obtain an updated current js script; and loading the updated current js script, so that page information corresponding to the updated current js script is displayed on the interface. The method can improve the efficiency of page information updating.

Description

Page information updating method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for updating page information, a computer device, and a storage medium.
Background
In a system with larger access quantity, when a page is opened, the browser caches data to a local computer, and after the cached page is optimized by a certain version, the user opens the page again or opens the cached page again, so that the latest content is not displayed on an interface or even reported by mistake.
Conventionally, for the problem of page content update, some static files need to be cached at the client to reduce the downloading traffic, thereby increasing the access speed of the client. However, the cache brings a problem that after the server updates the file, the client is difficult to update in time, thereby affecting the efficiency of updating the page information.
Disclosure of Invention
The embodiment of the invention provides a page information updating method, a page information updating device, computer equipment and a storage medium, which are used for solving the problem of low page information updating efficiency.
A page information updating method, comprising:
if the page loading request is detected, acquiring a current js script contained in the page loading request, wherein the current js script comprises a basic script identifier and a basic version identifier;
sending a standard version information inquiry request to a server according to the basic script identification;
receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
Consistency verification is carried out on the standard version identifier and the basic version identifier, and a first verification result is obtained;
If the first verification result is that the versions are inconsistent, acquiring the latest js script corresponding to the basic script identifier from the server;
Replacing the current js script with the latest js script to obtain an updated current js script;
And loading the updated current js script, so that page information corresponding to the updated current js script is displayed on an interface.
A page information updating apparatus comprising:
The loading request detection module is used for acquiring a current js script contained in the page loading request if the page loading request is detected, wherein the current js script comprises a basic script identifier and a basic version identifier;
the standard version information inquiry request sending module is used for sending a standard version information inquiry request to a server according to the basic script identification;
The standard version information acquisition module is used for receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
The version identification verification module is used for carrying out consistency verification on the standard version identification and the basic version identification to obtain a first verification result;
The latest js script acquisition module is used for acquiring the latest js script corresponding to the basic script identifier from the server if the first verification result is that the versions are inconsistent;
the updated current js script acquisition module is used for replacing the current js script with the latest js script to obtain an updated current js script;
and the page information updating module is used for loading the updated current js script so as to display page information corresponding to the updated current js script on an interface.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the above page information updating method when the computer program is executed.
A computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the page information updating method described above.
In the page information updating method, the device, the computer equipment and the storage medium, if the page loading request is detected, the current js script contained in the page loading request is acquired, and the page structure information and the behavior are separated through the current js script, so that the information of the current access page is updated rapidly. And sending a standard version information inquiry request to the server according to the basic script identification, so as to prevent the browser from caching the current js script and loading the cache information. And receiving standard version information returned by the server. And then, carrying out consistency check on the standard version identifier and the basic version identifier to obtain a first check result, preventing the page corresponding to the standard version identifier from being loaded, and ensuring the accuracy of page information. If the first verification result is that the versions are inconsistent, the latest js script corresponding to the basic script identification is obtained from the server, the page corresponding to the current js script is prevented from being loaded, the latest js script is ensured to be loaded, the latest js script is conveniently processed, and the page loading accuracy is improved. And replacing the current js script with the latest js script to obtain an updated current js script. And finally, loading the updated current js script, so that page information corresponding to the updated current js script is displayed on the interface, and the page information updating efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an application environment schematic diagram of a page information updating method provided by an embodiment of the present invention;
FIG. 2 is a diagram illustrating an exemplary method for updating page information according to an embodiment of the present invention;
FIG. 3 is another exemplary diagram of a page information updating method according to an embodiment of the present invention;
FIG. 4 is another exemplary diagram of a page information updating method according to an embodiment of the present invention;
FIG. 5 is another exemplary diagram of a page information updating method according to an embodiment of the present invention;
FIG. 6 is another exemplary diagram of a page information updating method according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a page information updating apparatus according to an embodiment of the present invention;
FIG. 8 is another schematic block diagram of a page information updating apparatus according to an embodiment of the present invention;
FIG. 9 is another schematic block diagram of a page information updating apparatus provided by an embodiment of the present invention;
Fig. 10 is a schematic diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The page information updating method provided by the application can be applied to an application environment as shown in fig. 1, wherein a client communicates with a server through a network, the client acquires a current js script from the server, sends a standard version information inquiry request to the server according to a basic script identifier in the current js script, returns standard version information, carries out consistency check on the standard version identifier and the basic version identifier to obtain a first check result, acquires an latest js script corresponding to the basic script identifier from the server if the first check result is inconsistent in version, replaces the current js script with the latest js script to obtain an updated current js script, and finally loads the updated current js script so that page information corresponding to the updated current js script is displayed on an interface. The clients may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server may be implemented by a stand-alone server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, the method is applied to the server in fig. 1, and the method includes the following steps:
s10: if the page loading request is detected, acquiring a current js script contained in the page loading request, wherein the current js script comprises a basic script identifier and a basic version identifier.
The JavaScript is an transliteration script language, and is a dynamic type, a weak type and a language based on a prototype, and a built-in support type is adopted. A file written in JavaScript is called JavaScript script (js script for short). The js script can be embedded in the current HTML page to add various dynamic functions to the webpage, and can be written as a single js script to separate the structure and the behavior of the webpage. The current js script in the embodiment refers to a JavaScript script in the current access webpage, so that the page structure information and the behavior are separated through the current js script, and the information rapid updating process of the current access webpage is realized.
Wherein the base script identification is used to uniquely identify the current js script. The base script identification may be, but is not limited to: the script name, the current page Identifier (ID), the update time, etc., for example, a basic script identifier is denoted as "2018-09-19" by the update time, and may be set according to actual needs, which is not particularly limited herein.
Wherein the base version identification is used to uniquely identify the version number of the current js script. The base version identification may be, but is not limited to: the version number, update time, or other symbols for distinguishing different version numbers, such as a random number and a combination of the version number and the timestamp, may also be set according to actual needs, and is not particularly limited herein.
Specifically, when the client detects a page loading request for a page, the client obtains a current js script contained in the page loading request, and the page loading request can be automatically triggered by the client or can be passively triggered when the client is detected to operate by a user, and the setting can be specifically performed according to actual needs, so that the method is not limited.
For example, in a specific embodiment, when a certain operation of the client by the user is detected, a loading request of the client for the page, namely, the home page of "happy and safe", is passively triggered, so that a current js script contained in the page loading request is obtained, where the current js script includes a base script identifier "happypa 1.0.0" and a base version identifier "version1.0".
S20: and sending a standard version information query request to the server according to the basic script identification.
The standard version information refers to the suffix content of the js script file of the server corresponding to the basic script identifier, and is used as a basis for judging whether the js script of the server is consistent with the current js script. The current js script includes a base script identifier, and accordingly, a base script identifier corresponds to a standard version information. For example, a server js script corresponding to the basic script identifier is "< link rel=" stylesheet "href="/css/index. Cssver=10 "/>, and it is understood that the suffix content of the server js script is" ver=10 ", that is, the standard version information is" ver=10 ".
The standard version information query request is a query request for acquiring standard version information of the js script of the server side, so that whether the current js script corresponding to the basic script identifier is consistent with the js script of the server side or not can be judged later, and the condition that after the js script of the server side is updated, the client side still loads the js script (cache page) which is not updated is prevented, so that abnormality occurs.
Specifically, the client sends a standard version information query request to the server, the query request comprises a basic script identifier, and the browser is prevented from caching the current js script by sending the standard version information query request to the server according to the basic script identifier, so that cache information is directly loaded, an updated page is not loaded, and abnormality occurs.
S30: and receiving standard version information returned by the server, wherein the standard version information comprises a standard version identifier.
The standard version identification is used for uniquely identifying the version number of the js script at the server. Continuing with the standard version information "ver=10" in step S20 as an example, the standard version is identified as "10". The standard version identification may be, but is not limited to: the version number, update time, or other symbols for distinguishing different versions, such as a combination of a random number and a version number and a time stamp, may also be set according to actual needs, and is not particularly limited herein.
Specifically, standard version information returned by the server is received, wherein the standard version information comprises a standard version identifier.
S40: and carrying out consistency check on the standard version identifier and the basic version identifier to obtain a first check result.
The consistency check is a check for judging whether the standard version identifier is consistent with the basic version identifier, so as to judge whether the server js script is updated or not. For subsequent further processing of the page load based on the consistency or non-consistency of the information. The consistency verification method can be a verification algorithm based on the editing distance, a verification algorithm based on similarity, or a verification algorithm based on approximate search.
The first verification result is obtained by comparing the consistency of the standard version identifier and the basic version identifier, and comprises inconsistent versions and consistent versions.
It can be appreciated that if the first verification result is that the versions are consistent, the standard version identification is unchanged, and the current js script is unchanged. Because the request is still the original address, the current js script is read from the local browser cache without increasing the burden on the server. If the js script at the server side changes, the browser caches the current js script, and the basic version identifier corresponding to the current js script is unchanged, namely, the standard version identifier and the first verification result of the basic version identifier are inconsistent in version, at the moment, the page information obtained by page loading is abnormal, so that consistency verification is carried out on the standard version identifier and the basic version identifier, the page corresponding to the standard version identifier is prevented from being loaded, and the accuracy of page information loading is ensured.
S50: and if the first verification result is that the versions are inconsistent, acquiring the latest js script corresponding to the basic script identifier from the server.
The latest js script refers to the js script updated by the server page last time. After the script is reloaded, the loading of the cache page is avoided, the loading to the latest js script is ensured, the latest js script is processed later, and the page loading accuracy is improved. The basic script identification has a corresponding relation with the latest js script, namely, the corresponding latest js script can be obtained through the basic script identification
Specifically, when the server js script is updated, the first verification result is that the versions are inconsistent, and at the moment, the server acquires the latest js script corresponding to the basic script identifier, so that a cache page corresponding to the current js script is prevented from being loaded, the latest js script is ensured to be loaded, the latest js script is processed later, and the page loading accuracy is improved.
S60: and replacing the current js script with the latest js script to obtain an updated current js script.
Specifically, after the latest js script corresponding to the basic version identifier is obtained from the server, the latest js script is used for replacing the current js script, namely the latest js script is used as the updated current js script, so that the current js script is updated, and the phenomenon that page information is abnormal due to the fact that the browser accesses a cache page due to reloading of the current js script is avoided.
S70: and loading the updated current js script, so that page information corresponding to the updated current js script is displayed on the interface.
Specifically, after reloading the updated current js script, the cache page corresponding to the current js script is prevented from being loaded, and the page corresponding to the latest js script is ensured to be loaded, so that the latest page content is acquired and displayed on the interface. The page updating efficiency is improved.
In this embodiment, if a page loading request is detected, a current js script included in the page loading request is obtained, so that the page structure information and the behavior are separated through the current js script, thereby implementing the rapid update processing of the information of the current access page. And sending a standard version information inquiry request to the server according to the basic script identification, so as to prevent the browser from caching the current js script and loading the cache information. And receiving standard version information returned by the server. And then, carrying out consistency check on the standard version identifier and the basic version identifier to obtain a first check result, preventing the page corresponding to the standard version identifier from being loaded, and ensuring the accuracy of page information. If the first verification result is that the versions are inconsistent, the latest js script corresponding to the basic script identification is obtained from the server, the page corresponding to the current js script is prevented from being loaded, the latest js script is ensured to be loaded, the latest js script is conveniently processed, and the page loading accuracy is improved. And replacing the current js script with the latest js script to obtain an updated current js script. And finally, loading the updated current js script, so that page information corresponding to the updated current js script is displayed on the interface, and the page information updating efficiency is improved.
In one embodiment, as shown in fig. 3, in step S40, consistency verification is performed on a standard version identifier and a basic version identifier to obtain a first verification result, which specifically includes the following steps:
S41: extracting character strings contained in the standard version identification as standard character strings, and extracting character strings contained in the basic version identification as basic character strings.
The standard character strings refer to character strings contained in the standard version identification, namely, character strings with preset number in the standard version identification are extracted. For example, the first 10 character strings of the standard version identification are extracted as standard character strings. The basic character strings refer to character strings contained in the basic version identifier, namely, the character strings with preset quantity in the basic version identifier are extracted. It should be noted that, the extraction rule of the standard character string is consistent with that of the basic character string, so as to ensure that the subsequent comparison is accurately performed.
Preferably, all character strings in the standard version identifier are extracted as standard character strings, and all character strings in the basic version identifier are extracted as basic character strings, so that the accuracy of subsequent calculation is improved.
S42: and calculating the editing distance between the standard character string and the basic character string by using an editing distance algorithm, and taking the editing distance as a target editing distance.
The edit distance (EDIT DISTANCE) is also called as a Levenshtein distance, and refers to the minimum number of editing operations required for converting one character string into another character string between two character strings, and if the distance between the two character strings is larger, the similarity between the two character strings is lower. The editing operation of the license includes replacing one character with another, inserting one character or deleting one character.
The edit distance algorithm is an algorithm for measuring the similarity of two character strings by taking the edit distance as the similarity. For determining whether the two strings are identical. The target edit distance is the distance required to obtain two identical character strings after three operations, i.e., inserting, deleting or replacing one of the two character strings. In this embodiment, the distance required to obtain the character string identical to the standard character string is obtained after three operations of inserting, deleting or replacing the basic character string. In one embodiment, the names of the standard string and the base string are str1 and str2, respectively. The calculation process of the target editing distance comprises the following four steps:
The first step: initializing a matrix d of (n+1) × (m+1), and allowing the values of the first row and column to increase from 0, where n is the length of the standard string str1 and m is the length of the base string str 2.
And a second step of: the standard string str1 and the base string str2 are scanned simultaneously, if str1[ i ] = str2[ j ], the edit distance 0 is recorded by temp, otherwise, the edit distance temp is recorded as 1.
And a third step of: the matrix d [ i, j ] is given the minimum values of d [ i-1, j ] +1, d [ i, j-1] +1, d [ i-1, j-1] +temp.
Fourth step: after scanning, the last value d [ n ] [ m ] of the matrix is returned, namely the target editing distance.
Specifically, an edit distance algorithm is used to calculate the edit distance between the standard character string and the base character string as a target edit distance. It can be appreciated that the calculation process of the edit distance algorithm is simple and convenient, and the calculated target edit distance can accurately measure the consistency degree of the standard version identifier and the basic version identifier, so in the embodiment, the edit distance between the standard character string and the basic character string is calculated by using the edit distance algorithm, and the consistency check of the standard version identifier and the basic version identifier can be accurately and rapidly performed.
S43: comparing the target editing distance with a preset distance threshold, if the target editing distance is smaller than or equal to the preset distance threshold, the first verification result is that the versions are consistent, otherwise, if the target editing distance is larger than the preset distance threshold, the first verification result is that the versions are inconsistent.
The preset threshold distance is a preset critical distance for measuring the consistency degree of two character strings. Specifically, the purpose of calculating the target edit distance in this embodiment is to perform consistency check on the standard version identifier and the base version identifier, that is, determine whether the standard character string and the base character string are identical. And if the target editing distance is smaller than or equal to the preset distance threshold, the first verification result is that the versions are consistent, otherwise, if the target editing distance is larger than the preset distance threshold, the first verification result is that the versions are inconsistent. For example, when the preset threshold distance is 2 and the target editing distance is 1, the first verification result is that the versions are consistent. It will be appreciated that when the standard string and the base string are identical, the target edit distance is zero. And comparing the target editing distance with a preset distance threshold value, thereby improving the accuracy of consistency verification.
Preferably, the preset distance threshold in this embodiment is zero. And if the target editing distance is equal to zero, the first verification result is that the versions are consistent, otherwise, the first verification result is that the versions are inconsistent.
In this embodiment, the character string included in the standard version identifier and the character string included in the base version identifier are extracted first. Then, an edit distance algorithm is used for calculating the edit distance between the standard character string and the basic character string, and the edit distance is used as a target edit distance, so that consistency check can be accurately and rapidly carried out on the standard version identification and the basic version identification. Finally, the accuracy of consistency verification is improved by comparing the target editing distance with a preset distance threshold.
In one embodiment, as shown in fig. 4, in step S40, consistency verification is performed on the standard version identifier and the base version identifier to obtain a first verification result, which specifically includes the following steps:
s41': the standard version identification is converted into a standard feature vector and the base version identification is converted into a base feature vector.
The standard feature vector is a feature vector of the standard version identifier and is used for representing a vector of text information features of the standard version table identifier, and the basic feature vector is a feature vector of the basic version identifier and is used for representing a vector of text information features of the basic version identifier. In particular, the standard version identification may be converted into a standard feature vector and the base version identification into a base feature vector by a hash vectorization tool. The feature vector can characterize text information features of the version identifier by simple data, and the subsequent consistency check process can be simplified by converting the standard version identifier and the basic version identifier into the feature vector.
S42': and calculating cosine similarity of the standard feature vector and the basic feature vector by using a cosine similarity algorithm, and taking the cosine similarity as the target similarity.
The cosine similarity algorithm is an algorithm that takes cosine similarity as a measure of similarity of two feature vectors. In this embodiment, cosine similarity is used to determine whether two character strings are identical. The cosine similarity value is between 0 and 1. The target similarity is a numerical value for measuring the similarity degree of the standard version identifier and the standard version identifier, and the target similarity is equal to 1, so that the standard version identifier is identical to the basic version identifier.
Specifically, a cosine similarity algorithm is used to calculate cosine similarity of the standard feature vector and the basic feature vector, and the cosine similarity is used as the target similarity, so that consistency verification can be accurately and rapidly performed on the standard version identifier and the basic version identifier.
S43': and comparing the target similarity with a preset similarity threshold, wherein if the target similarity is greater than or equal to the preset similarity threshold, the first verification result is that the versions are consistent, otherwise, if the target similarity is less than the preset similarity threshold, the first verification result is that the versions are inconsistent.
The preset similarity threshold is a preset critical similarity for measuring the consistency degree of two character strings.
Specifically, the purpose of calculating the cosine similarity in this embodiment is to perform consistency check on the standard version identifier and the base version identifier, that is, determine whether the standard character string and the base character string are identical. And if the target similarity is greater than or equal to a preset similarity threshold, the first verification result is that the versions are consistent, otherwise, the first verification result is that the versions are inconsistent. For example, when the preset similarity threshold is 0.98 and the target similarity is 0.99, the first verification result is that the versions are consistent. It will be appreciated that when the standard string and the base string are identical, the target similarity is 1. And the accuracy of consistency verification is improved by comparing the target similarity with a preset similarity threshold.
Preferably, the preset similarity threshold in this embodiment is 1. And if the target similarity is smaller than a preset similarity threshold, the first verification result is that the versions are inconsistent.
In this embodiment, the standard version identifier is first converted into the standard feature vector, and the basic version identifier is converted into the basic feature vector, so that the subsequent consistency verification process is simplified. And then, a cosine similarity algorithm is used for calculating cosine similarity of the standard feature vector and the basic feature vector, and the cosine similarity is used as the target similarity, so that consistency verification can be accurately and rapidly carried out on the standard version identifier and the basic version identifier. Finally, the accuracy of consistency verification is improved by comparing the target similarity with a preset similarity threshold.
In one embodiment, the current js script includes a base security code and the standard version information includes a standard security code.
The basic security code is used for preventing the falsification of the basic version identification of the current js script. The standard security code refers to a character string for preventing the standard version identification from being tampered with. Specifically, whether the version identifier of the page to be loaded is updated or not can be judged by inquiring the version information inquiry request sent by the server, and if whether the page to be loaded is updated or not is judged by only the basic version identifier, one disadvantage exists: the hacker can access the page by modifying the standard version identification, and potential safety hazards exist, so that the hacker is prevented from attacking the page to be accessed through the standard safety code and the basic safety code, and the safety of the user for accessing the page is improved.
In this embodiment, as shown in fig. 5, after the step of performing consistency check on the standard version identifier and the base version identifier to obtain the first check result, and before the step of replacing the current js script with the latest js script to obtain the updated current js script, the page information updating method further includes the following steps:
S51: if the first verification result is that the versions are consistent, the standard security code is input into a preset calculation formula, and the target security code is calculated.
The target security code is a security code obtained by calculating a standard security code according to a preset calculation formula, and is used for improving the security of page access.
The preset calculation formula is a formula for transforming the standard security code according to a certain rule in advance. The standard security codes are transformed by adopting a preset calculation formula, so that the subsequent standard security codes are prevented from being cracked, and the risk of page updating is increased.
Specifically, after the step of performing consistency check on the standard version identifier and the basic version identifier to obtain a first check result and before the step of replacing the current js script with the latest js script to obtain an updated current js script, the method further comprises the step of performing security check on the standard security code. When the first verification result is that the versions are consistent, namely the current js script is not updated, the js script of the server is consistent with the current js script, and at the moment, if the standard security code is not verified, a hacker can access the page by modifying the standard version identifier, so that potential safety hazards exist. The standard security code is input into a preset calculation formula, the target security code is calculated, hacking is prevented, and the security of page access is improved.
S52: and carrying out security verification on the target security code and the basic security code to obtain a second verification result, wherein the second verification result comprises inconsistent security codes and consistent security codes.
The security check refers to a check that determines whether the target security code is consistent with the basic security code, so as to determine the accuracy of the target security code and prevent hacking. Whether the target security code is consistent with the basic security code can be realized by adopting a regular expression algorithm or a character string comparison algorithm.
The second checking result is a result obtained by comparing the consistency of the target security code and the basic security code, and comprises inconsistent security codes and consistent security codes.
It can be understood that when the second checking result is that the security codes are inconsistent, it can be determined that the current js script is different from the server js script, and further it is determined that the server js script has been updated.
S53: if the second checking result is that the security codes are inconsistent, the latest js script is obtained from the server.
Specifically, when the server js script is updated, the second checking result is that the security codes are inconsistent, at this time, the server acquires the latest js script corresponding to the basic script identifier, so that the page corresponding to the current js script is prevented from being loaded, the latest js script is ensured to be loaded, the latest js script is processed later, the accuracy of page loading is improved, and meanwhile, the security codes can be prevented from being tampered after being checked, and the efficient updating of the page is ensured and the security of page access is improved.
In this embodiment, when the first verification result is that the versions are consistent, the standard security code is input into a preset calculation formula, and the target security code is calculated, so that hacking is prevented, and the security of page access is improved. And then carrying out security check on the target security code and the basic security code to obtain a second check result. If the second checking result is that the security codes are inconsistent, the latest js script is acquired from the server, so that the page corresponding to the current js script is prevented from being loaded, the latest js script is ensured to be loaded, the latest js script is processed later, the accuracy of page loading is improved, and meanwhile, the security codes can be prevented from being tampered after being checked, and the efficient updating of the page is ensured, and the security of page access is improved.
In one embodiment, as shown in fig. 6, in step S51, a standard security code is input into a preset calculation formula to calculate a target security code, and the method specifically includes the following steps:
S511: and obtaining the machine code of the client.
The machine code of the client side refers to a serial number formed by encrypting and hashing a hardware serial number. Both the hard disk and the CPU in the client have an identification code that cannot be modified. When a user registers, a unique identification code is generated according to the software and hardware information of the computer installed by the user software, and the unique identification code is generally called a machine code, also called a serial number, an authentication code or a registration application code and the like.
S512: the target security code is obtained by adopting the following preset calculation formula:
S=A+B2
S is expressed as a target security code, A is expressed as a machine code, and B is expressed as a numerical value corresponding to a standard version identifier.
Specifically, the preset calculation formula s=a+b 2 indicates that the calculation result of the target security code is the sum of the square of the numerical value corresponding to the standard version identifier and the machine code. It can be understood that the data of the target security code obtained in the calculation process is complex, so that the target security code is better prevented from being cracked by a hacker, and the security of the subsequent page updating process is ensured.
In this embodiment, the machine code of the client is obtained, and the target security code is calculated by adopting a preset calculation formula s=a+b 2, so that a hacker is better prevented from cracking the target security code, and the security of the subsequent page updating process is ensured.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In an embodiment, a page information updating apparatus is provided, where the page information updating apparatus corresponds to the page information updating method in the above embodiment one by one. As shown in fig. 7, the page information updating apparatus includes a standard version information query request transmitting module 10, a standard version information query request transmitting module 20, a standard version information acquiring module 30, a version identification checking module 40, a latest js script acquiring module 50, an updated current js script acquiring module 60, and a page information updating module 70. The functional modules are described in detail as follows:
The loading request detection module 10 is configured to obtain a current js script included in the page loading request if the page loading request is detected, where the current js script includes a base script identifier and a base version identifier;
The standard version information inquiry request sending module 20 is used for sending a standard version information inquiry request to the server according to the basic script identification;
The standard version information obtaining module 30 is configured to receive standard version information returned by the server, where the standard version information includes a standard version identifier;
The version identifier verification module 40 is configured to perform consistency verification on the standard version identifier and the basic version identifier to obtain a first verification result;
The latest js script acquisition module 50 is configured to acquire, if the first verification result is that the versions are inconsistent, a latest js script corresponding to the basic script identifier from the server;
the updated current js script obtaining module 60 is configured to replace the current js script with the latest js script, so as to obtain an updated current js script;
The page information updating module 70 is configured to load the updated current js script, so that page information corresponding to the updated current js script is displayed on the interface.
Preferably, as shown in fig. 8, the version identification verification module 40 includes a character string extraction unit 41, a target edit distance calculation unit 42, and a first verification result acquisition unit 43.
A character string extracting unit 41 for extracting a character string contained in the standard version identifier as a standard character string, and extracting a character string contained in the base version identifier as a base character string;
A target edit distance calculating unit 42 for calculating an edit distance of the standard character string and the base character string as a target edit distance using an edit distance algorithm;
the first verification result obtaining unit 43 is configured to compare the target editing distance with a preset distance threshold, and if the target editing distance is less than or equal to the preset distance threshold, the first verification result is the version is consistent, otherwise, if the target editing distance is greater than the preset distance threshold, the first verification result is the version is inconsistent.
Preferably, as shown in fig. 9, the revision identification verification module 40 further includes a feature vector conversion unit 41', a target similarity calculation unit 42', and a second verification result acquisition unit 43'.
A feature vector conversion unit 41' for converting the standard version identification into a standard feature vector and converting the base version identification into a base feature vector;
a target similarity calculating unit 42' for calculating cosine similarity of the standard feature vector and the basic feature vector as the target similarity using a cosine similarity algorithm;
The second checking result obtaining unit 43' is configured to compare the target similarity with a preset similarity threshold, and if the target similarity is greater than or equal to the preset similarity threshold, the first checking result is the version is consistent, otherwise, if the target similarity is less than the preset similarity threshold, the first checking result is the version is inconsistent.
Preferably, the current js script comprises a basic security code, the standard version information comprises a standard security code, and the page updating device further comprises a target security code calculation module, a security verification module and a server js script acquisition module.
The target security code calculation module is used for inputting the standard security code into a preset calculation formula to calculate the target security code if the first verification result is that the versions are consistent;
the security verification module is used for performing security verification on the target security code and the basic security code to obtain a second verification result, wherein the second verification result comprises inconsistent security codes and consistent security codes;
The server js script acquisition module is used for acquiring the latest js script from the server if the second checking result is that the security codes are inconsistent.
Preferably, the target security code calculation module includes a machine code acquisition unit and a target security code acquisition unit.
The machine code acquisition unit is used for acquiring the machine code of the client;
the target security code acquisition unit is used for calculating and obtaining the target security code by adopting the following preset calculation formula:
S=A+B2
S is expressed as a target security code, A is expressed as a machine code, and B is expressed as a numerical value corresponding to a standard version identifier.
The specific limitation of the page information updating apparatus may be referred to the limitation of the page information updating method hereinabove, and will not be described herein. The respective modules in the above page information updating apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data used in the page update method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a page information updating method.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program:
if the page loading request is detected, acquiring a current js script contained in the page loading request, wherein the current js script comprises a basic script identifier and a basic version identifier;
sending a standard version information inquiry request to a server according to the basic script identification;
receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
Consistency verification is carried out on the standard version identifier and the basic version identifier to obtain a first verification result, wherein the first verification result comprises inconsistent versions and consistent versions;
If the first verification result is that the versions are inconsistent, acquiring the latest js script corresponding to the basic script identifier from the server;
Replacing the current js script with the latest js script to obtain an updated current js script;
And loading the updated current js script, so that page information corresponding to the updated current js script is displayed on an interface.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
The loading request detection module is used for acquiring a current js script contained in the page loading request if the page loading request is detected, wherein the current js script comprises a basic script identifier and a basic version identifier;
the standard version information inquiry request sending module is used for sending a standard version information inquiry request to a server according to the basic script identification;
The standard version information acquisition module is used for receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
The version identification verification module is used for carrying out consistency verification on the standard version identification and the basic version identification to obtain a first verification result, wherein the first verification result comprises inconsistent versions and consistent versions;
The latest js script acquisition module is used for acquiring the latest js script corresponding to the basic script identifier from the server if the first verification result is that the versions are inconsistent;
the updated current js script acquisition module is used for replacing the current js script with the latest js script to obtain an updated current js script;
and the page information updating module is used for loading the updated current js script so as to display page information corresponding to the updated current js script on an interface.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (8)

1. A page information updating method, characterized in that the page information updating method comprises:
if the page loading request is detected, acquiring a current js script contained in the page loading request, wherein the current js script comprises a basic script identifier and a basic version identifier;
sending a standard version information inquiry request to a server according to the basic script identification;
receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
Consistency verification is carried out on the standard version identifier and the basic version identifier, and a first verification result is obtained;
If the first verification result is that the versions are inconsistent, acquiring the latest js script corresponding to the basic script identifier from the server;
Replacing the current js script with the latest js script to obtain an updated current js script;
loading the updated current js script, so that page information corresponding to the updated current js script is displayed on an interface;
the current js script comprises a basic security code, and the standard version information comprises a standard security code;
After the step of performing consistency verification on the standard version identifier and the basic version identifier to obtain a first verification result, and before the step of replacing the current js script with the latest js script to obtain an updated current js script, the page information updating method further includes:
If the first verification result is that the versions are consistent, inputting the standard security code into a preset calculation formula, and calculating a target security code;
carrying out security verification on the target security code and the basic security code to obtain a second verification result, wherein the second verification result comprises inconsistent security codes and consistent security codes;
if the second checking result is that the security codes are inconsistent, acquiring the latest js script from the server;
the step of inputting the standard security code into a preset calculation formula to calculate a target security code includes:
Acquiring a machine code of a client;
The target security code is obtained by adopting the following preset calculation formula:
S=A+B2;
And S is expressed as the target security code, A is expressed as the machine code, and B is expressed as a numerical value corresponding to the standard version identifier.
2. The method for updating page information according to claim 1, wherein the performing the consistency check on the standard version identifier and the base version identifier to obtain a first check result includes:
Extracting character strings contained in the standard version identifier as standard character strings, and extracting character strings contained in the basic version identifier as basic character strings;
Calculating the editing distance between the standard character string and the basic character string by using an editing distance algorithm, and taking the editing distance as a target editing distance;
Comparing the target editing distance with a preset distance threshold, if the target editing distance is smaller than or equal to the preset distance threshold, the first verification result is that the versions are consistent, otherwise, if the target editing distance is larger than the preset distance threshold, the first verification result is that the versions are inconsistent.
3. The method for updating page information according to claim 1, wherein the performing the consistency check on the standard version identifier and the base version identifier to obtain a first check result includes:
Converting the standard version identification into a standard feature vector, and converting the basic version identification into a basic feature vector;
using a cosine similarity algorithm to calculate cosine similarity of the standard feature vector and the basic feature vector, and taking the cosine similarity as target similarity;
Comparing the target similarity with a preset similarity threshold, if the target similarity is larger than or equal to the preset similarity threshold, the first verification result is that the versions are consistent, otherwise, if the target similarity is smaller than the preset similarity threshold, the first verification result is that the versions are inconsistent.
4. A page information updating apparatus, characterized in that the page information updating apparatus comprises:
The loading request detection module is used for acquiring a current js script contained in the page loading request if the page loading request is detected, wherein the current js script comprises a basic script identifier and a basic version identifier;
the standard version information inquiry request sending module is used for sending a standard version information inquiry request to a server according to the basic script identification;
The standard version information acquisition module is used for receiving the standard version information returned by the server, wherein the standard version information comprises a standard version identifier;
The version identification verification module is used for carrying out consistency verification on the standard version identification and the basic version identification to obtain a first verification result;
The latest js script acquisition module is used for acquiring the latest js script corresponding to the basic script identifier from the server if the first verification result is that the versions are inconsistent;
the updated current js script acquisition module is used for replacing the current js script with the latest js script to obtain an updated current js script;
the page information updating module is used for loading the updated current js script so as to display page information corresponding to the updated current js script on an interface;
the current js script comprises a basic safety code, standard version information comprises a standard safety code, and the page information updating device further comprises a target safety code calculation module, a safety verification module and a server js script acquisition module;
the target security code calculation module is used for inputting the standard security code into a preset calculation formula to calculate the target security code if the first verification result is that the versions are consistent;
the security verification module is used for performing security verification on the target security code and the basic security code to obtain a second verification result, wherein the second verification result comprises inconsistent security codes and consistent security codes;
The server js script acquisition module is used for acquiring the latest js script from the server if the second checking result is that the security codes are inconsistent;
the target security code calculation module comprises a machine code acquisition unit and a target security code acquisition unit;
the machine code acquisition unit is used for acquiring the machine code of the client;
the target security code acquisition unit is used for calculating and obtaining the target security code by adopting the following preset calculation formula:
S=A+B2;
S is expressed as a target security code, A is expressed as a machine code, and B is expressed as a numerical value corresponding to a standard version identifier.
5. The page information updating apparatus according to claim 4, wherein the revision identification verification module includes:
A character string extracting unit, configured to extract a character string included in the standard version identifier as a standard character string, and extract a character string included in the base version identifier as a base character string;
a target editing distance calculation unit, configured to calculate, using an editing distance algorithm, an editing distance between the standard character string and the base character string as a target editing distance;
The first verification result obtaining unit is used for comparing the target editing distance with a preset distance threshold, if the target editing distance is smaller than or equal to the preset distance threshold, the first verification result is the version is consistent, otherwise, if the target editing distance is larger than the preset distance threshold, the first verification result is the version is inconsistent.
6. The page information updating apparatus according to claim 4, wherein the revision identification verification module includes:
The feature vector conversion unit is used for converting the standard version identification into a standard feature vector and converting the basic version identification into a basic feature vector;
The target similarity calculation unit is used for calculating cosine similarity of the standard feature vector and the basic feature vector by using a cosine similarity algorithm, and taking the cosine similarity as the target similarity;
The second checking result obtaining unit is configured to compare the target similarity with a preset similarity threshold, if the target similarity is greater than or equal to the preset similarity threshold, the first checking result is the version is consistent, otherwise, if the target similarity is less than the preset similarity threshold, the first checking result is the version is inconsistent.
7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the page information updating method according to any of claims 1 to 3 when executing the computer program.
8. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the page information updating method according to any one of claims 1 to 3.
CN201811187153.6A 2018-10-12 2018-10-12 Page information updating method and device, computer equipment and storage medium Active CN109471988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811187153.6A CN109471988B (en) 2018-10-12 2018-10-12 Page information updating method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811187153.6A CN109471988B (en) 2018-10-12 2018-10-12 Page information updating method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109471988A CN109471988A (en) 2019-03-15
CN109471988B true CN109471988B (en) 2024-06-25

Family

ID=65664015

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811187153.6A Active CN109471988B (en) 2018-10-12 2018-10-12 Page information updating method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109471988B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162725A (en) * 2019-04-10 2019-08-23 浙江口碑网络技术有限公司 Online page loading method, device, storage medium and computer equipment
CN110162319A (en) * 2019-04-15 2019-08-23 深圳壹账通智能科技有限公司 Application program update method, apparatus, computer equipment and storage medium
CN110177081A (en) * 2019-04-18 2019-08-27 视联动力信息技术股份有限公司 Script file acquisition methods and device
CN110245559A (en) * 2019-05-09 2019-09-17 平安科技(深圳)有限公司 Real-time object identification method, device and computer equipment
CN110221853A (en) * 2019-05-15 2019-09-10 无线生活(杭州)信息科技有限公司 The method and Nginx server of page script are updated based on Nginx
CN110569082B (en) * 2019-08-06 2023-03-14 创新先进技术有限公司 Method and device for controlling page content
CN110674435A (en) * 2019-09-27 2020-01-10 网易(杭州)网络有限公司 Page access method, server, terminal, electronic equipment and readable storage medium
CN111046311A (en) * 2019-12-17 2020-04-21 深圳前海环融联易信息科技服务有限公司 Method and device for realizing traceless iteration version of PC (personal computer) end, computer equipment and storage medium
CN111191167A (en) * 2019-12-23 2020-05-22 京信通信系统(中国)有限公司 Page resource updating method and device, computer equipment and storage medium
CN111552513B (en) * 2020-04-30 2024-04-16 中国银行股份有限公司 Character set replacement method and device
CN111681724A (en) * 2020-05-07 2020-09-18 浙江大学医学院附属第四医院(浙江省义乌医院、浙江大学医学院附属第四医院医共体) Electronic medical record key entity standardized identification method and identification system
CN112817700A (en) * 2021-02-25 2021-05-18 北京顶象技术有限公司 Method and device for realizing active updating of client script and computer equipment
CN112947974B (en) * 2021-04-12 2022-10-28 平安国际智慧城市科技股份有限公司 Desktop icon updating method, device and equipment and computer readable storage medium
CN113835732A (en) * 2021-09-29 2021-12-24 马上消费金融股份有限公司 Version updating method and related equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933614A (en) * 2015-12-30 2017-07-07 广州爱九游信息技术有限公司 A kind of single-page application upgrade method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7500223B2 (en) * 2004-01-02 2009-03-03 International Business Machines Corporation Automatically creating JavaScript objects to invoke methods on server-side Java beans
US9053199B2 (en) * 2012-03-07 2015-06-09 Google Inc. Uniquely identifying script files by appending a unique identifier to a URL
CN106598673B (en) * 2016-12-16 2021-01-01 武汉斗鱼网络科技有限公司 Application program upgrading method and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933614A (en) * 2015-12-30 2017-07-07 广州爱九游信息技术有限公司 A kind of single-page application upgrade method and device

Also Published As

Publication number Publication date
CN109471988A (en) 2019-03-15

Similar Documents

Publication Publication Date Title
CN109471988B (en) Page information updating method and device, computer equipment and storage medium
US11683330B2 (en) Network anomaly data detection method and device as well as computer equipment and storage medium
CN110866198B (en) Static resource caching method, system, device, computer equipment and storage medium
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN112559354A (en) Front-end code specification detection method and device, computer equipment and storage medium
CN110866258A (en) Method for quickly positioning bug, electronic device and storage medium
CN111291083B (en) Webpage source code data processing method and device and computer equipment
CN115277677A (en) Batch archive hooking method and device, computer equipment and storage medium
CN111125748A (en) Judgment method and device for unauthorized query, computer equipment and storage medium
CN108460116B (en) Search method, search device, computer equipment, storage medium and search system
CN112783866A (en) Data reading method and device, computer equipment and storage medium
CN110460685B (en) User unique identifier processing method and device, computer equipment and storage medium
CN112765215A (en) Data query method and device
CN116304458B (en) Method, device, equipment and medium for web page real-time notification update
CN112463783A (en) Index data monitoring method and device, computer equipment and storage medium
CN116956954A (en) Text translation method, device, electronic equipment and storage medium
CN112363929B (en) System online method and device, computer equipment and storage medium
CN109657178B (en) Page form processing method and device, computer equipment and storage medium
CN114218188A (en) Data migration method, device, equipment and storage medium
CN114629875A (en) Active detection domain name brand protection method and device
CN112711574A (en) Database security detection method and device, electronic equipment and medium
CN113282849A (en) Similar URL character string recognition method and device, computer equipment and storage medium
CN112417324A (en) Chrome-based URL (Uniform resource locator) interception method and device and computer equipment
CN118138373B (en) Method, device and equipment for unauthorized detection based on webpack data analysis
JP6860156B1 (en) Fraud detection systems, fraud detection methods, and programs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant