CN112637280A - Data transmission method and device, electronic equipment and storage medium - Google Patents
Data transmission method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112637280A CN112637280A CN202011439655.0A CN202011439655A CN112637280A CN 112637280 A CN112637280 A CN 112637280A CN 202011439655 A CN202011439655 A CN 202011439655A CN 112637280 A CN112637280 A CN 112637280A
- Authority
- CN
- China
- Prior art keywords
- data
- browser
- local
- global variable
- transmitted
- 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.)
- Granted
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 77
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000012544 monitoring process Methods 0.000 claims description 20
- 238000013500 data storage Methods 0.000 claims description 19
- 230000007246 mechanism Effects 0.000 claims description 15
- 230000004044 response Effects 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 abstract description 5
- 230000006870 function Effects 0.000 description 14
- 238000007726 management method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 235000014510 cooky Nutrition 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002085 persistent effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the field of data processing, and discloses a data transmission method, which comprises the following steps: acquiring local data of a browser and global variables defined in the browser, and identifying whether the browser is compatible with a local database; if the local database is incompatible, storing the local data into a pre-established local storage space, responding to a data application event of a page in the browser, performing global variable declaration on first to-be-transmitted data in the local storage space by using a global variable, and transmitting the data to a corresponding browser page; and if the local database is compatible, storing the local data into the local database, responding to a data application event of a page in the browser, performing global variable statement on second to-be-transmitted data of the local database by using the global variable, and transmitting the second to-be-transmitted data to the corresponding browser page. Furthermore, the invention relates to a blockchain technique, in which the local data can be stored in a blockchain. The invention can solve the problem of insufficient storage space for multi-page application data transmission of the browser.
Description
Technical Field
The present invention relates to the field of data processing, and in particular, to a data transmission method, an apparatus, an electronic device, and a computer-readable storage medium.
Background
With the continuous enhancement of the functions of the browser, local data of a single-page application in the browser can be directly called without storing the local data in the data transmission process of the single-page application in the browser, but the local variable data of the multi-page application in the browser cannot be directly transmitted, the local variable data transmission of the multi-page application is generally realized after the local variable data are stored in a cookie mode and the like, and as the cookie storage capacity is small, the size of the cookie does not exceed 4kb generally, and if the data volume needing to be transmitted is large, the page of the browser is easy to generate a pause phenomenon.
Disclosure of Invention
The invention provides a data transmission method, a data transmission device, electronic equipment and a computer readable storage medium, and mainly aims to solve the problem that storage space is insufficient when data of multi-page application in a browser is transmitted and reduce the phenomenon that a page of the browser is blocked.
In order to achieve the above object, a data transmission method provided by the present invention includes:
acquiring local data of a browser and a global variable defined in the browser, and identifying whether the browser is compatible with a local database according to the version number of the browser;
if the browser is not compatible with a local database, storing the local data into a pre-established local storage space, responding to a data application event of a page in the browser, reading first data to be transmitted from the local storage space, performing global variable statement on the first data to be transmitted by using the global variable, generating first global variable data, and transmitting the first global variable data to a corresponding browser page;
if the browser is compatible with a local database, storing the local data into the local database, responding to a data application event of a page in the browser, reading second data to be transmitted from the local database, performing global variable statement on the second data to be transmitted by using the global variable, generating second global variable data, and transmitting the second global variable data to a corresponding browser page.
Optionally, the storing the local data in a pre-created local storage space includes:
acquiring a compiling environment of the local storage space, and declaring a data storage variable in the compiling environment;
and storing the local data into a key value of the local storage space according to the data storage variable.
Optionally, the reading, in response to a data application event of a page in the browser, first data to be transmitted from the local storage space includes:
triggering a data application event of a page in the browser based on a preset data monitoring mechanism;
and reading data to be transmitted from the key value of the local storage space according to the data application event to obtain first data to be transmitted.
Optionally, the performing, by using the global variable, a global variable declaration on the first to-be-transmitted data to generate first global variable data includes:
loading the first data to be transmitted into a compiling environment of the global variable;
and in the compiling environment of the global variables, performing global variable statement on the data to be transmitted by using the global variables to generate first global variable data.
Optionally, after the transmitting the first global variable data to the corresponding browser page, the method further includes:
and monitoring whether the first global variable data is subjected to data updating, if so, updating corresponding first data to be transmitted, and storing the updated first data to be transmitted into the local storage space.
Optionally, the storing the local data in the local database includes:
and loading the local database into the browser, and storing the local data into the local database loaded into the browser according to a data storage transaction created in the local database in advance.
Optionally, the storing the local data in a local database loaded to a browser includes:
and storing the local data in a local database loaded to the browser in a key-value pair mode.
In order to solve the above problem, the present invention also provides a data transmission apparatus, including:
the identification module is used for acquiring local data of a browser and global variables defined in the browser and identifying whether the browser is compatible with a local database according to the version number of the browser;
the transmission module is used for storing the local data into a pre-established local storage space when the browser is incompatible with a local database, reading first data to be transmitted from the local storage space in response to a data application event of a page in the browser, performing global variable statement on the first data to be transmitted by using the global variable, generating first global variable data, and transmitting the first global variable data to a corresponding browser page;
the transmission module is further configured to, when the browser is compatible with a local database, store the local data in the local database, read, in response to a data application event of a page in the browser, second data to be transmitted from the local database, perform global variable declaration on the second data to be transmitted by using the global variable, generate second global variable data, and transmit the second global variable data to a corresponding browser page.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to implement the data transmission method described above.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, the at least one computer program being executed by a processor in an electronic device to implement the data transmission method described above.
According to the method, firstly, a storage mode corresponding to local data is selected according to the compatibility of the browser, and the problem that the storage space is insufficient when data of multi-page application in the browser are transmitted is solved, so that the response speed of the local data is improved, and the phenomenon that the page of the browser is blocked is reduced; secondly, the invention carries out global variable statement on the local data by combining the predefined global variable, thereby solving the problem that the local variable in a single page of the browser can not be transmitted; furthermore, the local data of the global variable statement is transmitted to the corresponding browser page, so that the data transmission of the multi-page application of the browser is realized. Therefore, the data transmission method, the data transmission device, the electronic equipment and the storage medium provided by the invention can solve the problem of insufficient storage space during data transmission of multi-page applications in the browser and reduce the phenomenon of jamming of the page of the browser.
Drawings
Fig. 1 is a schematic flow chart of a data transmission method according to an embodiment of the present invention;
fig. 2 is a detailed flowchart illustrating a step of the data transmission method shown in fig. 1 according to a first embodiment of the present invention;
fig. 3 is a detailed flowchart illustrating another step of the data transmission method provided in fig. 1 according to the first embodiment of the present invention;
fig. 4 is a block diagram of a data transmission apparatus according to an embodiment of the present invention;
fig. 5 is a schematic internal structural diagram of an electronic device implementing a data transmission method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a data transmission method. The execution subject of the data transmission method includes, but is not limited to, at least one of electronic devices, such as a server and a terminal, which can be configured to execute the method provided by the embodiments of the present application. In other words, the data transmission method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a data transmission method according to an embodiment of the present invention is shown. In the embodiment of the present invention, the data transmission method includes:
s1, acquiring local data of the browser and global variables defined in the browser, and identifying whether the browser is compatible with a local database according to the version number of the browser.
The browser refers to an application program used for retrieving, presenting and transmitting Web information resources, such as an IE browser, a QQ browser, a firefox browser, and the like. The local data refers to page data displayed in a browser, and the global variable refers to a variable that can be referenced by all objects or functions in the browser.
Further, according to the webpage opened in the browser, the crawler script is used for acquiring the local data of the corresponding page, and the object function is used for defining the global variable in the browser. Wherein the object function comprises global.
Further, the local database refers to a browser database for storing browser data, and preferably, in an embodiment of the present invention, the local browser is an indexedb, and the indexedb is created through a web script, such as a JavaScript script.
Further, the identifying whether the browser is compatible with the local database according to the version number of the browser includes: if the version number does not support the local database, the browser is not compatible with the local database, and if the version number supports the local database, the browser is compatible with the local database.
Furthermore, it needs to be stated that the local database has the advantages of large data storage amount, high data query speed and the like, but because the version levels of the browsers are different, not all browsers support the local database, the embodiment of the present invention can better select the storage mode of the local data by identifying whether the corresponding browser is compatible with the local database, thereby reducing page jamming of the browser.
Further, to ensure availability and security of the local data, the local data may also be stored in a blockchain node.
If the browser is not compatible with the local database, S2 is executed, the local data is stored into a pre-created local storage space, in response to a data application event of the page in the browser, first data to be transmitted is read from the local storage space, global variable declaration is performed on the first data to be transmitted by using the global variable, first global variable data is generated, and the first global variable data is transmitted to a corresponding browser page.
In a preferred implementation of the present invention, if the browser is not compatible with the local database, the local data is stored in a pre-created local storage space, where the pre-created local storage space is created by localStorage.
In detail, referring to fig. 2, the storing the local data in the pre-created local storage space includes:
s20, acquiring a compiling environment of the local storage space, and declaring a data storage variable in the compiling environment;
and S21, storing the local data into the key value (key) of the local storage space by using a preset storage method according to the data storage variable.
In this embodiment of the present invention, the compiling environment may be a publish, the data storage variable may be a var variable function, and the preset storage method is a localstorage.
Further, in the embodiment of the present invention, in response to a data application event of the page in the browser, the local data to be transmitted is read from the local storage space, so as to obtain the first data to be transmitted. For example, in the browser, the page a needs to apply local data in the page B, and the local data in the page B belongs to a local variable and cannot be directly transmitted from the page B to the page a, so that the local data that the page B needs to transmit is read from the local storage space according to the data application event that triggers the page a, and the data transmission precondition of the local variable in the page B is ensured.
Specifically, the reading the first data to be transmitted from the local storage space in response to the data application event of the page in the browser includes: triggering a data application event of a page in the browser based on a preset data monitoring mechanism; and reading data to be transmitted from the key value of the local storage space by using a preset data reading method according to the data application event to obtain first data to be transmitted.
The data monitoring mechanism is compiled through java language and is used for monitoring data application events of pages in the browser.
The preset data reading method comprises the following steps: a var naid ═ localstorage setitem ("key").
Because the first data to be transmitted belongs to the local variable and cannot be transmitted in multiple pages of the browser, the embodiment of the invention updates the data to be transmitted by using the global variable to generate the updated data, so as to realize the multi-page transmission of the first data to be transmitted.
In detail, referring to fig. 3, the performing global variable declaration on the first to-be-transmitted data by using the global variable to generate first global variable data includes:
s30, loading the first data to be transmitted into the compiling environment of the global variable;
and S31, in the compiling environment of the global variables, performing global variable statement on the data to be transmitted by using the global variables to generate first global variable data.
Illustratively, the first data to be transmitted are X and Y, the global variable is global, the X and Y are transmitted to a compiling environment of the global by using a data transmission tool, global variable declarations (global X, Y) are performed on the X and Y by the global, and the generated X and Y are global variable data.
Further, after the first global variable data is transmitted to the corresponding browser page, the embodiment of the present invention further includes: monitoring whether the first global variable data is subjected to data updating or not through a variable subscription mechanism, if the first global variable data is subjected to data updating, updating corresponding first data to be transmitted, and storing the updated first data to be transmitted into the local storage space, so that the first data to be transmitted can be conveniently and directly transmitted from the local storage space next time.
Further, in the embodiment of the present invention, the first global variable data is transmitted to the corresponding browser page according to a data application event of the page in the browser.
And if the browser is compatible with a local database, executing S3, storing the local data into the local database, responding to a data application event of a page in the browser, reading second data to be transmitted from the local database, performing global variable statement on the second data to be transmitted by using the global variable, generating second global variable data, and transmitting the second global variable data to a corresponding browser page.
In a preferred embodiment of the present invention, the storing the local data in the local database includes:
and loading the local database into a corresponding browser, and storing the local data into the local database loaded into the browser according to a data storage transaction created in the local database in advance.
Wherein the loading of the local database is loaded in a persistent form; the data storage Transaction is created by a Transaction.
In this embodiment of the present invention, the storage form of storing the local data in the local database is a key-value pair (key-value) form.
Further, the reading second data to be transmitted from the local database in response to the data application event of the page in the browser includes: triggering a data application event of a page in the browser based on a preset data monitoring mechanism; and reading local data to be transmitted from the local database according to the data application event and a preset data reading transaction to obtain second data to be transmitted.
The data monitoring mechanism is compiled through java language and is used for monitoring data application events of pages in the browser.
The preset data reading transaction comprises the following steps: object store transaction, an embodiment of the present invention performs reading of local data using the object store.get () method in the transaction object store transaction.
The invention preferably implements global variable declaration on the second data to be transmitted by using the global variable, generates second global variable data, and transmits the second global variable data to a corresponding browser page. The execution principle of performing the global variable declaration on the second to-be-transmitted data by using the global variable may refer to the execution principle of performing the global variable declaration on the first to-be-transmitted data by using the global variable, which is not further described herein.
Further, after the second global variable data is transmitted to the corresponding browser page, the embodiment of the present invention further includes: and monitoring whether the second global variable data is subjected to data updating or not through a variable subscription mechanism, if the second global variable data is subjected to data updating, updating corresponding second to-be-transmitted data, and storing the updated second to-be-transmitted data into the local database so as to conveniently and directly transmit the second to-be-transmitted data from the local database next time.
Fig. 4 is a functional block diagram of the data transmission device according to the present invention.
The data transmission device 100 of the present invention may be installed in an electronic device. Depending on the implemented functionality, the data transmission means may comprise an identification module 101 and a transmission module 102. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the identification module 101 is configured to obtain local data of a browser and a global variable defined in the browser, and identify whether the browser is compatible with a local database according to a version number of the browser.
The browser refers to an application program used for retrieving, presenting and transmitting Web information resources, such as an IE browser, a QQ browser, a firefox browser, and the like. The local data refers to page data displayed in a browser, and the global variable refers to a variable that can be referenced by all objects or functions in the browser.
Further, according to the webpage opened in the browser, the crawler script is used for acquiring the local data of the corresponding page, and the object function is used for defining the global variable in the browser. Wherein the object function comprises global.
Further, the local database refers to a browser database for storing browser data, and preferably, in an embodiment of the present invention, the local browser is an indexedb, and the indexedb is created through a web script, such as a JavaScript script.
Further, the identifying module 101 identifies whether the browser is compatible with the local database according to the version number of the browser, and executes the following steps: if the version number does not support the local database, the browser is not compatible with the local database, and if the version number supports the local database, the browser is compatible with the local database.
Furthermore, it needs to be stated that the local database has the advantages of large data storage amount, high data query speed and the like, but because the version levels of the browsers are different, not all browsers support the local database, the embodiment of the present invention can better select the storage mode of the local data by identifying whether the corresponding browser is compatible with the local database, thereby reducing page jamming of the browser.
Further, to ensure availability and security of the local data, the local data may also be stored in a blockchain node.
The transmission module 102 is configured to, when the browser is incompatible with the local database, store the local data in a local storage space created in advance, respond to a data application event of a page in the browser, read first data to be transmitted from the local storage space, perform global variable declaration on the first data to be transmitted by using the global variable, generate first global variable data, and transmit the first global variable data to a corresponding browser page.
In a preferred implementation of the present invention, if the browser is not compatible with the local database, the local data is stored in a pre-created local storage space, where the pre-created local storage space is created by localStorage.
In detail, the storing the local data into the pre-created local storage space is performed by the transmission module 102 in the following manner: acquiring a compiling environment of the local storage space, and declaring a data storage variable in the compiling environment; and storing the local data into a key value (key) of the local storage space by using a preset storage method according to the data storage variable.
In this embodiment of the present invention, the compiling environment may be a publish, the data storage variable may be a var variable function, and the preset storage method is a localstorage.
Further, the transmission module 102 reads local data to be transmitted from the local storage space in response to a data application event of the page in the browser, so as to obtain first data to be transmitted. For example, in the browser, the page a needs to apply local data in the page B, and the local data in the page B belongs to a local variable and cannot be directly transmitted from the page B to the page a, so that the local data that the page B needs to transmit is read from the local storage space according to the data application event that triggers the page a, and the data transmission precondition of the local variable in the page B is ensured.
Specifically, the reading of the first data to be transmitted from the local storage space in response to the data application event of the page in the browser is performed by the transmission module 102 in the following manner: triggering a data application event of a page in the browser based on a preset data monitoring mechanism; and reading data to be transmitted from the key value of the local storage space by using a preset data reading method according to the data application event to obtain first data to be transmitted.
The data monitoring mechanism is compiled through java language and is used for monitoring data application events of pages in the browser.
The preset data reading method comprises the following steps: a var naid ═ localstorage setitem ("key").
Because the first data to be transmitted belongs to the local variable and cannot be transmitted in multiple pages of the browser, the embodiment of the invention updates the data to be transmitted by using the global variable to generate the updated data, so as to realize the multi-page transmission of the first data to be transmitted.
In detail, the global variable declaration is performed on the first to-be-transmitted data by using the global variable to generate first global variable data, and the transmission module 102 performs the following steps:
step I, loading the first data to be transmitted into a compiling environment of the global variable;
and step II, performing global variable statement on the data to be transmitted by using the global variable in the compiling environment of the global variable to generate first global variable data.
Illustratively, the first data to be transmitted are X and Y, the global variable is global, the X and Y are transmitted to a compiling environment of the global by using a data transmission tool, global variable declarations (global X, Y) are performed on the X and Y by the global, and the generated X and Y are global variable data.
Further, after transmitting the first global variable data to the corresponding browser page, the transmitting module 102 further includes: monitoring whether the first global variable data is subjected to data updating or not through a variable subscription mechanism, if the first global variable data is subjected to data updating, updating corresponding first data to be transmitted, and storing the updated first data to be transmitted into the local storage space, so that the first data to be transmitted can be conveniently and directly transmitted from the local storage space next time.
Further, in the embodiment of the present invention, the first global variable data is transmitted to the corresponding browser page according to a data application event of the page in the browser.
The transmission module 102 is further configured to, when the browser is compatible with a local database, store the local data in the local database, respond to a data application event of a page in the browser, read second data to be transmitted from the local database, perform global variable declaration on the second data to be transmitted by using the global variable, generate second global variable data, and transmit the second global variable data to a corresponding browser page.
In a preferred embodiment of the present invention, the transmission module 102 stores the local data in the local database by:
and loading the local database into a corresponding browser, and storing the local data into the local database loaded into the browser according to a data storage transaction created in the local database in advance.
Wherein the loading of the local database is loaded in a persistent form; the data storage Transaction is created by a Transaction.
In this embodiment of the present invention, the storage form of storing the local data in the local database is a key-value pair (key-value) form.
Further, when the data application event of the page in the browser is responded, and the second data to be transmitted is read from the local database, the transmission module 102 performs the following steps: triggering a data application event of a page in the browser based on a preset data monitoring mechanism; and reading local data to be transmitted from the local database according to the data application event and a preset data reading transaction to obtain second data to be transmitted.
The data monitoring mechanism is compiled through java language and is used for monitoring data application events of pages in the browser.
The preset data reading transaction comprises the following steps: object store transaction, an embodiment of the present invention performs reading of local data using the object store.get () method in the transaction object store transaction.
In a preferred embodiment of the present invention, the transmission module 102 performs global variable declaration on the second data to be transmitted by using the global variable, generates second global variable data, and transmits the second global variable data to a corresponding browser page. The execution principle of performing the global variable declaration on the second to-be-transmitted data by using the global variable may refer to the execution principle of performing the global variable declaration on the first to-be-transmitted data by using the global variable, which is not further described herein.
Further, in the embodiment of the present invention, after the second global variable data is transmitted to the corresponding browser page, the transmission module 102 further includes: and monitoring whether the second global variable data is subjected to data updating or not through a variable subscription mechanism, if the second global variable data is subjected to data updating, updating corresponding second to-be-transmitted data, and storing the updated second to-be-transmitted data into the local database so as to conveniently and directly transmit the second to-be-transmitted data from the local database next time.
Fig. 5 is a schematic structural diagram of an electronic device implementing the data transmission method according to the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a data transfer program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes for data transmission, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, performing data transmission and the like) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The data transmission 12 stored by the memory 11 in the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
receiving a data transmission request, dividing the data transmission request into a plurality of data transmission tasks, and submitting the data transmission tasks to a preset waiting queue after carrying out priority sequencing on the data transmission tasks;
responding to the data transmission event in the waiting queue, and transmitting the data transmission task in the waiting queue to a preset running queue;
dividing the data transmission tasks in the running queue into subtasks to generate data transmission subtasks;
and executing corresponding data transmission from the service system according to the data transmission subtasks to obtain the subdata files.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A method of data transmission, the method comprising:
acquiring local data of a browser and a global variable defined in the browser, and identifying whether the browser is compatible with a local database according to the version number of the browser;
if the browser is not compatible with a local database, storing the local data into a pre-established local storage space, responding to a data application event of a page in the browser, reading first data to be transmitted from the local storage space, performing global variable statement on the first data to be transmitted by using the global variable, generating first global variable data, and transmitting the first global variable data to a corresponding browser page;
if the browser is compatible with a local database, storing the local data into the local database, responding to a data application event of a page in the browser, reading second data to be transmitted from the local database, performing global variable statement on the second data to be transmitted by using the global variable, generating second global variable data, and transmitting the second global variable data to a corresponding browser page.
2. The data transmission method according to claim 1, wherein the storing the local data into a pre-created local storage space includes:
acquiring a compiling environment of the local storage space, and declaring a data storage variable in the compiling environment;
and storing the local data into a key value of the local storage space according to the data storage variable.
3. The data transmission method according to claim 1, wherein the reading of the first data to be transmitted from the local storage space in response to the data application event of the page in the browser comprises:
triggering a data application event of a page in the browser based on a preset data monitoring mechanism;
and reading data to be transmitted from the key value of the local storage space according to the data application event to obtain first data to be transmitted.
4. The data transmission method according to claim 1, wherein the performing global variable declaration on the first data to be transmitted using the global variable to generate first global variable data includes:
loading the first data to be transmitted into a compiling environment of the global variable;
and in the compiling environment of the global variables, performing global variable statement on the data to be transmitted by using the global variables to generate first global variable data.
5. The data transmission method according to claim 4, wherein after transmitting the first global variable data to the corresponding browser page, further comprising:
and monitoring whether the first global variable data is subjected to data updating, if so, updating corresponding first data to be transmitted, and storing the updated first data to be transmitted into the local storage space.
6. The data transmission method according to any one of claims 1 to 5, wherein the storing the local data in the local database comprises:
and loading the local database into the browser, and storing the local data into the local database loaded into the browser according to a data storage transaction created in the local database in advance.
7. The data transmission method according to claim 6, wherein the storing the local data in a local database loaded to a browser comprises:
and storing the local data in a local database loaded to the browser in a key-value pair mode.
8. A data transmission apparatus, characterized in that the apparatus comprises:
the identification module is used for acquiring local data of a browser and global variables defined in the browser and identifying whether the browser is compatible with a local database according to the version number of the browser;
the transmission module is used for storing the local data into a pre-established local storage space when the browser is incompatible with a local database, reading first data to be transmitted from the local storage space in response to a data application event of a page in the browser, performing global variable statement on the first data to be transmitted by using the global variable, generating first global variable data, and transmitting the first global variable data to a corresponding browser page;
the transmission module is further configured to, when the browser is compatible with a local database, store the local data in the local database, read, in response to a data application event of a page in the browser, second data to be transmitted from the local database, perform global variable declaration on the second data to be transmitted by using the global variable, generate second global variable data, and transmit the second global variable data to a corresponding browser page.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the data transmission method of any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a data transmission method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011439655.0A CN112637280B (en) | 2020-12-10 | 2020-12-10 | Data transmission method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011439655.0A CN112637280B (en) | 2020-12-10 | 2020-12-10 | Data transmission method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112637280A true CN112637280A (en) | 2021-04-09 |
CN112637280B CN112637280B (en) | 2023-05-05 |
Family
ID=75309262
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011439655.0A Active CN112637280B (en) | 2020-12-10 | 2020-12-10 | Data transmission method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112637280B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070073902A1 (en) * | 2005-09-27 | 2007-03-29 | Ns Solutions Corporation | Information processor, information processing method and program |
CN107391768A (en) * | 2017-09-12 | 2017-11-24 | 广州酷狗计算机科技有限公司 | Web data processing method, device, equipment and computer-readable recording medium |
CN109343971A (en) * | 2018-08-20 | 2019-02-15 | 平安普惠企业管理有限公司 | A kind of browser data transmission method and device based on caching technology |
CN109522499A (en) * | 2018-11-20 | 2019-03-26 | 平安科技(深圳)有限公司 | Method, apparatus, computer equipment and the storage medium of local loading page data |
CN109688202A (en) * | 2018-12-04 | 2019-04-26 | 北京腾云天下科技有限公司 | A kind of processing method of interface data, calculates equipment and storage medium at device |
CN111444455A (en) * | 2020-03-25 | 2020-07-24 | 平安医疗健康管理股份有限公司 | Browser compatible method, system, computer device and storage medium |
CN112040025A (en) * | 2020-09-03 | 2020-12-04 | 北京文香信息技术有限公司 | Server address switching method, system and terminal equipment |
-
2020
- 2020-12-10 CN CN202011439655.0A patent/CN112637280B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070073902A1 (en) * | 2005-09-27 | 2007-03-29 | Ns Solutions Corporation | Information processor, information processing method and program |
CN107391768A (en) * | 2017-09-12 | 2017-11-24 | 广州酷狗计算机科技有限公司 | Web data processing method, device, equipment and computer-readable recording medium |
CN109343971A (en) * | 2018-08-20 | 2019-02-15 | 平安普惠企业管理有限公司 | A kind of browser data transmission method and device based on caching technology |
CN109522499A (en) * | 2018-11-20 | 2019-03-26 | 平安科技(深圳)有限公司 | Method, apparatus, computer equipment and the storage medium of local loading page data |
CN109688202A (en) * | 2018-12-04 | 2019-04-26 | 北京腾云天下科技有限公司 | A kind of processing method of interface data, calculates equipment and storage medium at device |
CN111444455A (en) * | 2020-03-25 | 2020-07-24 | 平安医疗健康管理股份有限公司 | Browser compatible method, system, computer device and storage medium |
CN112040025A (en) * | 2020-09-03 | 2020-12-04 | 北京文香信息技术有限公司 | Server address switching method, system and terminal equipment |
Also Published As
Publication number | Publication date |
---|---|
CN112637280B (en) | 2023-05-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112506779A (en) | Software interface testing method and device, electronic equipment and storage medium | |
CN114881616A (en) | Business process execution method and device, electronic equipment and storage medium | |
CN112506559A (en) | Gray scale publishing method and device based on gateway, electronic equipment and storage medium | |
CN111694844A (en) | Enterprise operation data analysis method and device based on configuration algorithm and electronic equipment | |
CN111880948A (en) | Data refreshing method and device, electronic equipment and computer readable storage medium | |
CN112256783A (en) | Data export method and device, electronic equipment and storage medium | |
CN112650909A (en) | Product display method and device, electronic equipment and storage medium | |
CN112486490A (en) | Front-end code packaging method and device, electronic equipment and storage medium | |
CN114356530A (en) | Task scheduling method and device, electronic equipment and storage medium | |
CN112637280B (en) | Data transmission method, device, electronic equipment and storage medium | |
CN112328656B (en) | Service query method, device, equipment and storage medium based on middle platform architecture | |
CN115033605A (en) | Data query method and device, electronic equipment and storage medium | |
CN115080899A (en) | Interactive sub-web page starting method, device, equipment and storage medium | |
CN114896164A (en) | Interface optimization method and device, electronic equipment and storage medium | |
CN114625712A (en) | Data synchronization method and device, electronic equipment and storage medium | |
CN113918296A (en) | Model training task scheduling execution method and device, electronic equipment and storage medium | |
CN114371962A (en) | Data acquisition method and device, electronic equipment and storage medium | |
CN113918305A (en) | Node scheduling method and device, electronic equipment and readable storage medium | |
CN113542387A (en) | System publishing method, device, electronic equipment and storage medium | |
CN113515265A (en) | Site configuration method, device, equipment and computer readable storage medium | |
CN112527443A (en) | Prompt box display method and device, electronic equipment and computer readable storage medium | |
CN112540839A (en) | Information changing method, device, electronic equipment and storage medium | |
CN112686759A (en) | Account checking monitoring method, device, equipment and medium | |
CN111859452A (en) | Page information checking method, device and equipment and computer readable storage medium | |
CN114860349B (en) | Data loading method, device, equipment and medium |
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 |