CN112083925A - Data acquisition method, device, equipment and storage medium based on H5 page development - Google Patents

Data acquisition method, device, equipment and storage medium based on H5 page development Download PDF

Info

Publication number
CN112083925A
CN112083925A CN202010927073.0A CN202010927073A CN112083925A CN 112083925 A CN112083925 A CN 112083925A CN 202010927073 A CN202010927073 A CN 202010927073A CN 112083925 A CN112083925 A CN 112083925A
Authority
CN
China
Prior art keywords
page
development
execution environment
preset
data
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.)
Pending
Application number
CN202010927073.0A
Other languages
Chinese (zh)
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 Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202010927073.0A priority Critical patent/CN112083925A/en
Publication of CN112083925A publication Critical patent/CN112083925A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a data processing technology and provides a data acquisition method, a device, equipment and a storage medium based on H5 page development. When a data acquisition request sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer, configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page, calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page. The invention can enable the H5 page to call different implementation layers under different execution environments to obtain corresponding target data, avoids the condition that a plurality of functions of the H5 page cannot be independently developed and debugged at a computer end, and improves the development efficiency of the H5 page. The invention also relates to a block chain technology, and data related to an interface layer and target data corresponding to the request can be stored in the block chain nodes.

Description

Data acquisition method, device, equipment and storage medium based on H5 page development
Technical Field
The invention relates to the technical field of data processing, in particular to a data acquisition method, a data acquisition device, data acquisition equipment and a storage medium based on H5 page development.
Background
At present, in a mixed mode mobile application (Hybrid App) mode, a webview loading H5 page is built in an App, H5 can perform basic functions of some pages and can also call native functions of the App, when an H5 page in the mode is developed, some data interaction with the native App can be encountered, when H5 tries to acquire some data from the native App, the development must be performed on the real App at this time, because the development work is mostly completed at a computer end and the real App environment does not exist at the computer end, the development efficiency is greatly influenced, and many functions of the H5 page cannot be independently developed and debugged at the computer end.
Disclosure of Invention
In view of the above, the present invention provides a data acquisition method, device, apparatus and storage medium based on H5 page development, and aims to solve the technical problem in the prior art that many functions of H5 page cannot be independently developed and debugged on the computer side.
In order to achieve the above object, the present invention provides a data acquisition method based on H5 page development, including:
when a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer;
configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page;
and calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page.
Preferably, the mode types include a local development mode and a debugging mode, and the configuring, based on the mode type of the H5 page, the execution environment corresponding to the mode type for the H5 page includes:
when the mode type of the H5 page is judged to be the local development mode, configuring the execution environment of the H5 page as a first preset execution environment;
and when the mode type of the H5 page is judged to be the debugging mode, configuring the execution environment of the H5 page as a second preset execution environment.
Preferably, the invoking a preset implementation layer based on the configured execution environment to obtain target data corresponding to the request, and feeding back the target data to the H5 page includes:
calling a first preset implementation layer by using the interface layer based on a first preset execution environment to acquire simulation data corresponding to the request, and feeding the simulation data back to the H5 page;
and calling a second preset implementation layer by using the interface layer based on a second preset execution environment to acquire real data corresponding to the request, and feeding back the real data to the H5 page.
Preferably, the determining, based on a preset interface layer, the mode type of the H5 page includes:
acquiring an identifier carried by the request, judging whether a character corresponding to the local development mode exists in the identifier, and if the character corresponding to the local development exists, judging that the mode type of the H5 page belongs to the local development mode;
and if the locally developed corresponding characters do not exist, judging that the mode type of the H5 page is a debugging mode.
Preferably, the configuring the execution environment of the H5 page as a first preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the first preset execution environment.
Preferably, the configuring the execution environment of the H5 page as a second preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the second preset execution environment.
Preferably, the interface layer is developed based on development code of the interface layer, and the specific development steps of the interface layer include:
extracting a universal part in development codes of the interface layer, and forming a plurality of interface development base classes by the extracted codes;
constructing an interface development framework according to the incidence relation among the interface development base classes, wherein the incidence relation comprises a logic relation or an execution sequence;
receiving a logic interface configuration instruction, and configuring the logic relationship among the components corresponding to the logic interface in the interface development framework;
receiving a general interface configuration instruction, configuring a component and a back-end interface corresponding to a general interface in the interface development framework, and taking the configured interface development framework as a developed interface layer.
In order to achieve the above object, the present invention further provides a data acquisition apparatus based on H5 page development, the data acquisition apparatus based on H5 page development comprising:
a judging module: the method comprises the steps of judging the mode type of an H5 page based on a preset interface layer when a request for acquiring data sent by the H5 page is received;
a configuration module: the method comprises the steps of configuring an execution environment corresponding to a mode type for an H5 page based on the mode type of the H5 page;
an acquisition module: and the execution environment is configured to call a preset implementation layer to obtain target data corresponding to the request, and feed the target data back to the H5 page.
In order to achieve the above object, 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 content of the first and second substances,
the memory stores a program executable by the at least one processor to enable the at least one processor to perform any of the steps of the data acquisition method developed based on the H5 page as described above.
To achieve the above object, the present invention further provides a computer-readable storage medium, which includes a storage data area and a storage program area, wherein the storage data area stores data created according to the use of the blockchain node, and the storage program area stores a data acquisition program developed based on the H5 page, and when the data acquisition program developed based on the H5 page is executed by a processor, any step of the data acquisition method developed based on the H5 page is implemented.
According to the data acquisition method, the data acquisition device, the data acquisition equipment and the data acquisition storage medium based on the H5 page development, an interface layer is uniformly called during H5 development, the interface layer is respectively butted with a realization layer in a local development mode and a realization layer in a debugging mode, different execution environments are configured according to the mode type of an H5 page, so that the H5 page can use different realization layers under different execution environments to acquire corresponding target data, decoupling in the H5 development can be realized, and the development efficiency is greatly improved.
Drawings
FIG. 1 is a diagram of an electronic device according to a preferred embodiment of the present invention;
FIG. 2 is a block diagram of a preferred embodiment of the data acquisition device developed based on the H5 page in FIG. 1;
FIG. 3 is a flow chart of a preferred embodiment of the data acquisition method developed based on the H5 page;
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
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an electronic device 1 according to a preferred embodiment of the invention.
The electronic device 1 includes but is not limited to: memory 11, processor 12, display 13, and network interface 14. The electronic device 1 is connected to a network through a network interface 14 to obtain raw data. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System for Mobile communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), Wi-Fi, or a communication network.
The memory 11 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 11 may be an internal storage unit of the electronic device 1, such as a hard disk or a memory of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like equipped with the electronic device 1. Of course, the memory 11 may also comprise both an internal memory unit and an external memory device of the electronic device 1. In this embodiment, the memory 11 is generally used for storing an operating system installed in the electronic device 1 and various application software, such as program codes of the data acquisition program 10 developed based on the H5 page. Further, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 12 is typically used for controlling the overall operation of the electronic device 1, such as performing data interaction or communication related control and processing. In this embodiment, the processor 12 is configured to run the program code stored in the memory 11 or process data, for example, run the program code of the data acquisition program 10 developed based on the H5 page.
The display 13 may be referred to as a display screen or display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch screen, or the like. The display 13 is used for displaying information processed in the electronic device 1 and for displaying a visual work interface, e.g. displaying the results of data statistics.
The network interface 14 may optionally comprise a standard wired interface, a wireless interface (e.g. WI-FI interface), the network interface 14 typically being used for establishing a communication connection between the electronic device 1 and other electronic devices.
Fig. 1 shows only the electronic device 1 with the components 11-14 and the data acquisition program 10 developed based on the H5 page, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Optionally, the electronic device 1 may further comprise a user interface, the user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface and 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 Organic Light-Emitting Diode (OLED) touch screen, 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.
The electronic device 1 may further include a Radio Frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described in detail herein.
In the above embodiment, the processor 12, when executing the data acquisition program 10 developed based on the H5 page stored in the memory 11, may implement the following steps:
when a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer;
configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page;
and calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page.
The storage device may be the memory 11 of the electronic device 1, or may be another storage device communicatively connected to the electronic device 1.
For detailed description of the above steps, please refer to the following description of fig. 2 regarding a functional block diagram of an embodiment of the data acquisition apparatus 100 developed based on the H5 page and fig. 3 regarding a flowchart of an embodiment of a data acquisition method developed based on the H5 page.
Referring to fig. 2, there is shown a functional block diagram of the data acquisition device 100 developed based on the H5 page according to the present invention.
The data acquisition device 100 developed based on the H5 page can be installed in an electronic device. According to the implemented functions, the data acquisition device 100 developed based on the H5 page may include a determination module 110, a configuration module 120, and an acquisition module 130. 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 determining module 110 is configured to determine, when receiving a request for acquiring data sent by an H5 page, a mode type of the H5 page based on a preset interface layer.
In this embodiment, in the Hybrid App (mixed mode mobile application) mode, the H5 page may use webviewjavascript bridg to call the Native function of App, and since Native does not exist when the H5 page calls Native under the development environment of the computer, the H5 page cannot complete calling Native under the environment of the computer.
The H5 development of the mixed-mode mobile application can cause the situation that data interaction with a native App is needed, when an H5 page needs to acquire some data from the native App, the development must be carried out on the native App at this time, and thus the development efficiency is greatly influenced, so that many functions of H5 cannot be independently developed and debugged, therefore, an interface layer and two implementation layers can be pre-developed to be realized in the development process, and the running environment of the H5 page always has a corresponding implementation layer.
When a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a pre-developed interface layer, namely judging the mode type of the H5 page needing to acquire data, further judging the mode types to include a local development mode and a debugging mode, namely judging whether the H5 page needing to acquire data is in the local development mode or the debugging mode, wherein in practical application, the data needing to be acquired by the H5 page can be acquiring a GPS position, OCR identifying information of a bank card, acquiring a bank data list and the like.
In one embodiment, the interface layer is developed based on development code of the interface layer, and the specific development steps of the interface layer include:
extracting a universal part in development codes of the interface layer, and forming a plurality of interface development base classes by the extracted codes;
constructing an interface development framework according to the incidence relation among the interface development base classes, wherein the incidence relation comprises a logic relation or an execution sequence;
receiving a logic interface configuration instruction, and configuring the logic relationship among the components corresponding to the logic interface in the interface development framework;
receiving a general interface configuration instruction, configuring a component and a back-end interface corresponding to a general interface in the interface development framework, and taking the configured interface development framework as a developed interface layer.
The universal part in the interface code is uniformly constructed into an interface development frame, the interface development frame is called during development, and only the logic interface and the universal interface part are configured, so that the development efficiency of an interface layer can be improved.
The establishing module 120 is configured to configure, based on the mode type of the H5 page, an execution environment corresponding to the mode type for the H5 page.
In this embodiment, because the H5 pages that need to obtain data have different schema types and different operating environments, the execution environment corresponding to the schema type may be configured for the H5 page based on the schema type of the H5 page, so that the H5 pages with different schema types can all obtain data in the corresponding execution environment, where the schema type of the H5 page includes a local development mode and a debugging mode.
In one embodiment, when the mode type of the H5 page is judged to be the local development mode, configuring the execution environment of the H5 page as a first preset execution environment;
and when the mode type of the H5 page is judged to be the debugging mode, configuring the execution environment of the H5 page as a second preset execution environment.
When the H5 page is determined to be in the local development mode, since development on the computer side is not in the real environment of App, the execution environment of the H5 page needs to be switched to the first preset execution environment, where the first preset execution environment may be a mock execution environment, at this time, the implementation layer javascript of the H5 may be called, that is, the implementation of the H5 itself is called, and since the H5 also has its own implementation on the interface, development data can be obtained at this time. For example: the page needs the GPS coordinates, but no App environment exists at this time, so the H5 page directly acquires data from the Javascript Impl, and the Javascript Impl can also return a simulated GPS data to realize the data requirement of development.
When the H5 page is judged to be in the debugging mode, the execution environment of the H5 page is configured to be a second preset execution environment, wherein the second preset execution environment is a real App environment, a native Impl of an App implementation layer is called, and the native App function is called at this time. And the native App returns to the method thereof to achieve normal calling. For example: the page needs the GPS coordinate, the GPS coordinate can be acquired from the App, and the App can acquire the GPS coordinate through the function of the mobile device.
Further, the configuring the execution environment of the H5 page as a first preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the first preset execution environment. For example, the field value of the Bridge Mock field in the configuration file is configured as Mock.
Further, the configuring the execution environment of the H5 page as a second preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the second preset execution environment. The field value of the Bridge Mock field in the configuration file is configured as App.
In one embodiment, the determining, based on a preset interface layer, the mode type of the H5 page includes:
acquiring an identifier carried by the request, judging whether a character corresponding to the local development mode exists in the identifier, and if the character corresponding to the local development exists, judging that the mode type of the H5 page belongs to the local development mode;
and if the locally developed corresponding characters do not exist, judging that the mode type of the H5 page is a debugging mode.
Specifically, it may be determined whether the environment to which the H5 page belongs is an Android or an ios device (i.e., App environment) through a window navigator user agent, where the window navigator user agent in the App environment includes a character of "Android", or "Adr" or "Mac OS", and if the character of "Android", or "Adr" or "Mac OS" exists, it is determined that the H5 page is a local development mode, otherwise, it is determined that the H5 page is a debugging mode, and the window navigator user agent indicates a value of a user agent header used for an HTTP request by a browser, and generally sends a character string capable of representing a client type, such as information of a browser type operating system.
The extracting module 130 is configured to call a preset implementation layer based on the configured execution environment to obtain target data corresponding to the request, and feed the target data back to the H5 page.
In this embodiment, since different execution environments need to call different implementation layers, a preset implementation layer may be called according to a configured execution environment to obtain target data corresponding to the request, and the target data may be fed back to the H5 page. The preset implementation layer comprises a first preset implementation layer and a second preset implementation layer, and the target data comprises simulation data and real data.
In an embodiment, the invoking a preset implementation layer based on the configured execution environment to obtain target data corresponding to the request, and feeding back the target data to the H5 page includes:
calling a first preset implementation layer by using the interface layer based on a first preset execution environment to acquire simulation data corresponding to the request, and feeding the simulation data back to the H5 page;
and calling a second preset implementation layer by using the interface layer based on a second preset execution environment to acquire real data corresponding to the request, and feeding back the real data to the H5 page.
The first preset implementation layer is implemented by JS for all the methods according to a method set defined in the interface layer, and the H5 implementation layer is also implemented for the requirements of the interface layer and also needs to provide functions of acquiring GPS data and acquiring bank data, but the difference is that the Mock layer is analog data and is only used as substitute data when no real App exists.
The second preset implementation layer is implemented by android or ios according to a method set defined in the interface layer, and unit testing is available. The App implementation layer is the implementation of the requirements of the interface layer, the interface layer needs GPS data and bank data, and the App implementation layer needs to provide the actual available functions of acquiring the GPS data and acquiring the bank data.
An interface layer is called in a unified mode during H5 development, the interface layer docks the realization layer under the local development mode and the realization layer under the debugging mode respectively, different execution environments are configured according to the mode type of H5 page, make the H5 page use different realization layers to obtain corresponding target data under different execution environments, decoupling zero in H5's development can be realized, very big promotion development efficiency, simultaneously, adopt the interface to maintain and also can formulate unified standard, conveniently read and code reconstruction.
In addition, the invention also provides a data acquisition method based on H5 page development. Referring to fig. 3, a method flow diagram of an embodiment of the data acquisition method developed based on the H5 page is shown. The processor 12 of the electronic device 1 implements the following steps of the data acquisition method based on H5 page development when executing the data acquisition program 10 based on H5 page development stored in the memory 11:
step S10: when a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer.
In this embodiment, in the Hybrid App (mixed mode mobile application) mode, the H5 page may use webviewjavascript bridg to call the Native function of App, and since Native does not exist when the H5 page calls Native under the development environment of the computer, the H5 page cannot complete calling Native under the environment of the computer.
The H5 development of the mixed-mode mobile application can cause the situation that data interaction with a native App is needed, when an H5 page needs to acquire some data from the native App, the development must be carried out on the native App at this time, and thus the development efficiency is greatly influenced, so that many functions of H5 cannot be independently developed and debugged, therefore, an interface layer and two implementation layers can be pre-developed to be realized in the development process, and the running environment of the H5 page always has a corresponding implementation layer.
When a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a pre-developed interface layer, namely judging the mode type of the H5 page needing to acquire data, further judging the mode types to include a local development mode and a debugging mode, namely judging whether the H5 page needing to acquire data is in the local development mode or the debugging mode, wherein in practical application, the data needing to be acquired by the H5 page can be acquiring a GPS position, OCR identifying information of a bank card, acquiring a bank data list and the like.
In one embodiment, the interface layer is developed based on development code of the interface layer, and the specific development steps of the interface layer include:
extracting a universal part in development codes of the interface layer, and forming a plurality of interface development base classes by the extracted codes;
constructing an interface development framework according to the incidence relation among the interface development base classes, wherein the incidence relation comprises a logic relation or an execution sequence;
receiving a logic interface configuration instruction, and configuring the logic relationship among the components corresponding to the logic interface in the interface development framework;
receiving a general interface configuration instruction, configuring a component and a back-end interface corresponding to a general interface in the interface development framework, and taking the configured interface development framework as a developed interface layer.
The universal part in the interface code is uniformly constructed into an interface development frame, the interface development frame is called during development, and only the logic interface and the universal interface part are configured, so that the development efficiency of an interface layer can be improved.
Step S20: and configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page.
In this embodiment, because the H5 pages that need to obtain data have different schema types and different operating environments, the execution environment corresponding to the schema type may be configured for the H5 page based on the schema type of the H5 page, so that the H5 pages with different schema types can all obtain data in the corresponding execution environment, where the schema type of the H5 page includes a local development mode and a debugging mode.
In one embodiment, when the mode type of the H5 page is judged to be the local development mode, configuring the execution environment of the H5 page as a first preset execution environment;
and when the mode type of the H5 page is judged to be the debugging mode, configuring the execution environment of the H5 page as a second preset execution environment.
When the H5 page is determined to be in the local development mode, since development on the computer side is not in the real environment of App, the execution environment of the H5 page needs to be switched to the first preset execution environment, where the first preset execution environment may be a mock execution environment, at this time, the implementation layer javascript of the H5 may be called, that is, the implementation of the H5 itself is called, and since the H5 also has its own implementation on the interface, development data can be obtained at this time. For example: the page needs the GPS coordinates, but no App environment exists at this time, so the H5 page directly acquires data from the Javascript Impl, and the Javascript Impl can also return a simulated GPS data to realize the data requirement of development.
When the H5 page is judged to be in the debugging mode, the execution environment of the H5 page is configured to be a second preset execution environment, wherein the second preset execution environment is a real App environment, a native Impl of an App implementation layer is called, and the native App function is called at this time. And the native App returns to the method thereof to achieve normal calling. For example: the page needs the GPS coordinate, the GPS coordinate can be acquired from the App, and the App can acquire the GPS coordinate through the function of the mobile device.
Further, the configuring the execution environment of the H5 page as a first preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the first preset execution environment. For example, the field value of the Bridge Mock field in the configuration file is configured as Mock.
Further, the configuring the execution environment of the H5 page as a second preset execution environment includes:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the second preset execution environment. The field value of the Bridge Mock field in the configuration file is configured as App.
In one embodiment, the determining, based on a preset interface layer, the mode type of the H5 page includes:
acquiring an identifier carried by the request, judging whether a character corresponding to the local development mode exists in the identifier, and if the character corresponding to the local development exists, judging that the mode type of the H5 page belongs to the local development mode;
and if the locally developed corresponding characters do not exist, judging that the mode type of the H5 page is a debugging mode.
Specifically, it may be determined whether the environment to which the H5 page belongs is an Android or an ios device (i.e., App environment) through a window navigator user agent, where the window navigator user agent in the App environment includes a character of "Android", or "Adr" or "Mac OS", and if the character of "Android", or "Adr" or "Mac OS" exists, it is determined that the H5 page is a local development mode, otherwise, it is determined that the H5 page is a debugging mode, and the window navigator user agent indicates a value of a user agent header used for an HTTP request by a browser, and generally sends a character string capable of representing a client type, such as information of a browser type operating system.
Step S30: and calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page.
In this embodiment, since different execution environments need to call different implementation layers, a preset implementation layer may be called according to a configured execution environment to obtain target data corresponding to the request, and the target data may be fed back to the H5 page. The preset implementation layer comprises a first preset implementation layer and a second preset implementation layer, and the target data comprises simulation data and real data.
In an embodiment, the invoking a preset implementation layer based on the configured execution environment to obtain target data corresponding to the request, and feeding back the target data to the H5 page includes:
calling a first preset implementation layer by using the interface layer based on a first preset execution environment to acquire simulation data corresponding to the request, and feeding the simulation data back to the H5 page;
and calling a second preset implementation layer by using the interface layer based on a second preset execution environment to acquire real data corresponding to the request, and feeding back the real data to the H5 page.
The first preset implementation layer is implemented by JS for all the methods according to a method set defined in the interface layer, and the H5 implementation layer is also implemented for the requirements of the interface layer and also needs to provide functions of acquiring GPS data and acquiring bank data, but the difference is that the Mock layer is analog data and is only used as substitute data when no real App exists.
The second preset implementation layer is implemented by android or ios according to a method set defined in the interface layer, and unit testing is available. The App implementation layer is the implementation of the requirements of the interface layer, the interface layer needs GPS data and bank data, and the App implementation layer needs to provide the actual available functions of acquiring the GPS data and acquiring the bank data.
An interface layer is called in a unified mode during H5 development, the interface layer docks the realization layer under the local development mode and the realization layer under the debugging mode respectively, different execution environments are configured according to the mode type of H5 page, make the H5 page use different realization layers to obtain corresponding target data under different execution environments, decoupling zero in H5's development can be realized, very big promotion development efficiency, simultaneously, adopt the interface to maintain and also can formulate unified standard, conveniently read and code reconstruction.
Furthermore, the embodiment of the present invention also provides a computer-readable storage medium, which may be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), a portable compact disc read only memory (CD-ROM), a USB memory, and the like. The computer-readable storage medium comprises a data storage area and a program storage area, the data storage area stores data created by using a blockchain node, the program storage area stores a data acquisition program 10 developed based on an H5 page, and the data acquisition program 10 developed based on the H5 page realizes the following operations when being executed by a processor:
when a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer;
configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page;
and calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page.
In another embodiment, in the data acquisition method developed based on the H5 page provided by the present invention, to further ensure the privacy and security of all the data appearing above, all the data may also be stored in a node of a block chain. Such as data associated with the interface layer, target data corresponding to the request, etc., which may be stored in block link points.
It should be noted that the blockchain in the present invention is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. 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.
The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the data acquisition method developed based on the H5 page, and will not be described herein again.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention essentially or contributing to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above and includes several instructions for enabling a terminal device (such as a mobile phone, a computer, an electronic device, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A data acquisition method based on H5 page development is applied to electronic equipment, and is characterized in that the method comprises the following steps:
when a request for acquiring data sent by an H5 page is received, judging the mode type of the H5 page based on a preset interface layer;
configuring an execution environment corresponding to the mode type for the H5 page based on the mode type of the H5 page;
and calling a preset implementation layer based on the configured execution environment to acquire target data corresponding to the request, and feeding the target data back to the H5 page.
2. The method for acquiring data based on H5 page development according to claim 1, wherein the schema types include a local development schema and a debugging schema, and the configuring the execution environment corresponding to the schema type for the H5 page based on the schema type of the H5 page includes:
when the mode type of the H5 page is judged to be the local development mode, configuring the execution environment of the H5 page as a first preset execution environment;
and when the mode type of the H5 page is judged to be the debugging mode, configuring the execution environment of the H5 page as a second preset execution environment.
3. The method for acquiring data developed based on H5 page as claimed in claim 2, wherein the invoking a preset implementation layer based on the configured execution environment to acquire the target data corresponding to the request and feed the target data back to the H5 page includes:
calling a first preset implementation layer by using the interface layer based on a first preset execution environment to acquire simulation data corresponding to the request, and feeding the simulation data back to the H5 page;
and calling a second preset implementation layer by using the interface layer based on a second preset execution environment to acquire real data corresponding to the request, and feeding back the real data to the H5 page.
4. The data acquisition method based on H5 page development as claimed in claim 2 or 3, wherein the determining the mode type of the H5 page based on the preset interface layer comprises:
acquiring an identifier carried by the request, judging whether a character corresponding to the local development mode exists in the identifier, and if the character corresponding to the local development exists, judging that the mode type of the H5 page belongs to the local development mode;
and if the locally developed corresponding characters do not exist, judging that the mode type of the H5 page is a debugging mode.
5. The method for data acquisition based on H5 page development according to claim 2, wherein the configuring the execution environment of the H5 page as a first preset execution environment comprises:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the first preset execution environment.
6. The method for data acquisition based on H5 page development according to claim 2, wherein the configuring the execution environment of the H5 page as a second preset execution environment comprises:
and configuring the field value of the Bridge Mock field in a preset configuration file as the field value corresponding to the second preset execution environment.
7. The method for acquiring data developed based on H5 page as claimed in claim 1, wherein the interface layer is developed based on development code of the interface layer, and the specific development steps of the interface layer include:
extracting a universal part in development codes of the interface layer, and forming a plurality of interface development base classes by the extracted codes;
constructing an interface development framework according to the incidence relation among the interface development base classes, wherein the incidence relation comprises a logic relation or an execution sequence;
receiving a logic interface configuration instruction, and configuring the logic relationship among the components corresponding to the logic interface in the interface development framework;
receiving a general interface configuration instruction, configuring a component and a back-end interface corresponding to a general interface in the interface development framework, and taking the configured interface development framework as a developed interface layer.
8. A data acquisition device developed based on H5 page, the device comprising:
a judging module: the method comprises the steps of judging the mode type of an H5 page based on a preset interface layer when a request for acquiring data sent by the H5 page is received;
a configuration module: the method comprises the steps of configuring an execution environment corresponding to a mode type for an H5 page based on the mode type of the H5 page;
an acquisition module: and the execution environment is configured to call a preset implementation layer to obtain target data corresponding to the request, and feed the target data back to the H5 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 content of the first and second substances,
the memory stores a program executable by the at least one processor to enable the at least one processor to perform the data acquisition method developed based on the H5 page as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores data created by using blockchain nodes, the program storage area stores a data acquisition program developed based on H5 page, and the program acquisition program developed based on H5 page realizes the steps of the data acquisition method developed based on H5 page as claimed in any one of claims 1 to 7 when being executed by a processor.
CN202010927073.0A 2020-09-07 2020-09-07 Data acquisition method, device, equipment and storage medium based on H5 page development Pending CN112083925A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010927073.0A CN112083925A (en) 2020-09-07 2020-09-07 Data acquisition method, device, equipment and storage medium based on H5 page development

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010927073.0A CN112083925A (en) 2020-09-07 2020-09-07 Data acquisition method, device, equipment and storage medium based on H5 page development

Publications (1)

Publication Number Publication Date
CN112083925A true CN112083925A (en) 2020-12-15

Family

ID=73732455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010927073.0A Pending CN112083925A (en) 2020-09-07 2020-09-07 Data acquisition method, device, equipment and storage medium based on H5 page development

Country Status (1)

Country Link
CN (1) CN112083925A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515767A (en) * 2021-08-02 2021-10-19 杭州粉象家科技有限公司 Interface request management method and device based on mixed-mode mobile application
CN114117285A (en) * 2022-01-27 2022-03-01 浙江口碑网络技术有限公司 Position information processing method and device based on H5 page and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252339A (en) * 2013-06-25 2014-12-31 腾讯科技(深圳)有限公司 Method and device for developing interface layers and realizing data interaction of interface layers
CN109726108A (en) * 2018-06-04 2019-05-07 平安普惠企业管理有限公司 Front-end code test method, device, system and medium based on analogue data
CN109783078A (en) * 2018-12-14 2019-05-21 平安证券股份有限公司 Stand-alone development method, apparatus, equipment and the storage medium of front end page

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252339A (en) * 2013-06-25 2014-12-31 腾讯科技(深圳)有限公司 Method and device for developing interface layers and realizing data interaction of interface layers
CN109726108A (en) * 2018-06-04 2019-05-07 平安普惠企业管理有限公司 Front-end code test method, device, system and medium based on analogue data
CN109783078A (en) * 2018-12-14 2019-05-21 平安证券股份有限公司 Stand-alone development method, apparatus, equipment and the storage medium of front end page

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515767A (en) * 2021-08-02 2021-10-19 杭州粉象家科技有限公司 Interface request management method and device based on mixed-mode mobile application
CN113515767B (en) * 2021-08-02 2024-01-23 杭州粉象家科技有限公司 Interface request management method and device based on mixed mode mobile application
CN114117285A (en) * 2022-01-27 2022-03-01 浙江口碑网络技术有限公司 Position information processing method and device based on H5 page and electronic equipment

Similar Documents

Publication Publication Date Title
CN108958714B (en) Business component type development method and device, computer equipment and storage medium
CN107656729B (en) List view updating apparatus, method and computer-readable storage medium
CN111831563A (en) Automatic interface test method and device and storage medium
CN112416458A (en) Preloading method and device based on ReactNative, computer equipment and storage medium
CN108762767B (en) Application publishing method, device and computer readable storage medium
CN110928802A (en) Test method, device, equipment and storage medium based on automatic generation of case
CN112506779A (en) Software interface testing method and device, electronic equipment and storage medium
CN108197024B (en) Embedded browser debugging method, debugging terminal and computer readable storage medium
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN111459812A (en) Interface test case generation method, electronic device and storage medium
CN106708704A (en) Method and device for classifying crash logs
CN113448862B (en) Software version testing method and device and computer equipment
CN112083925A (en) Data acquisition method, device, equipment and storage medium based on H5 page development
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN110941779A (en) Page loading method and device, storage medium and electronic equipment
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN112818270B (en) Data cross-domain transfer method and device and computer equipment
CN114138363A (en) Program data calling method, device, equipment and storage medium
CN113704339A (en) Recording of read information status, apparatus, device and storage medium
CN112579453A (en) Task testing method, device, equipment and storage medium
CN110764745B (en) Variable transmission and collection method, device and computer readable storage medium
CN112396314A (en) Task allocation method and device, electronic equipment and storage medium
CN108829574B (en) Test data laying method, test server and computer readable storage medium
CN113377346B (en) Integrated environment building method and device, electronic equipment and storage medium
CN114461531A (en) Platform adaptability test method, device, equipment and storage medium of test case

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