CN114610386A - Interaction method, device, equipment and storage medium of H5 and application program - Google Patents

Interaction method, device, equipment and storage medium of H5 and application program Download PDF

Info

Publication number
CN114610386A
CN114610386A CN202210259039.XA CN202210259039A CN114610386A CN 114610386 A CN114610386 A CN 114610386A CN 202210259039 A CN202210259039 A CN 202210259039A CN 114610386 A CN114610386 A CN 114610386A
Authority
CN
China
Prior art keywords
request
information
type
application program
function
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
CN202210259039.XA
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.)
Shenzhen Ping An Smart Healthcare Technology Co ltd
Original Assignee
Ping An International Smart City Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202210259039.XA priority Critical patent/CN114610386A/en
Publication of CN114610386A publication Critical patent/CN114610386A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms

Abstract

The invention relates to process optimization and provides a method, a device, equipment and a storage medium for interaction of H5 and an application program. The method obtains a call request initiated by H5 to a target application program; detecting a request type of the call request based on a preset interaction list; if the request type is an asynchronous type, generating a callback function based on the call request; generating a page request according to the calling request and the function name of the callback function; identifying the type of the system where the target application program is located based on the calling request; processing the page request according to the system type to obtain request transfer information; and analyzing the request transfer information based on the callback function to obtain a request result, which is favorable for the interaction of H5 and the native APP. In addition, the invention also relates to a block chain technology, and the request result can be stored in the block chain.

Description

Interaction method, device, equipment and storage medium of H5 and application program
Technical Field
The invention relates to the technical field of process optimization, in particular to an interaction method, device, equipment and storage medium for H5 and an application program.
Background
At present, in an interaction scheme between H5 and a native APP, because a device in which the native APP is located may have different system types, two sets of callback functions need to be maintained in the current interaction scheme, and in addition, when different service scenarios are handled, the callback functions need to be distinguished by using an identification parameter, which is not favorable for interaction between H5 and the native APP.
Disclosure of Invention
In view of the foregoing, there is a need to provide a method, an apparatus, a device, and a storage medium for interacting H5 with an application, which can generate callback functions suitable for different system types, and do not need to identify the callback functions to distinguish different service scenarios, and are beneficial to facilitating the interaction between H5 and a native APP.
In one aspect, the invention provides an interaction method of H5 and an application program, where the interaction method of H5 and the application program includes:
acquiring a call request initiated by H5 to a target application program;
detecting a request type of the call request based on a preset interaction list;
if the request type is an asynchronous type, generating a callback function based on the call request;
generating a page request according to the calling request and the function name of the callback function;
identifying the type of the system where the target application program is located based on the calling request;
processing the page request according to the system type to obtain request transfer information;
and analyzing the request transfer information based on the callback function to obtain a request result.
According to a preferred embodiment of the present invention, the detecting the request type of the invocation request based on the preset interaction list includes:
extracting a program method name of the target application program from the calling request;
traversing the preset interaction list based on the program method name;
and if the callback method name corresponding to the program method name exists in the preset interaction list, determining the request type as the asynchronous type.
According to a preferred embodiment of the present invention, the generating a callback function based on the call request includes:
extracting parameter information from the call request;
processing the parameter information based on a random function generator to obtain the function name and function information;
acquiring a function method corresponding to the function name;
writing the function information into the function method to obtain code information;
and running the code information to generate the callback function.
According to the preferred embodiment of the present invention, the identifying the type of the system in which the target application is located based on the invocation request includes:
extracting address information from the call request;
extracting information corresponding to a preset label from the address information to serve as a generated address;
taking the device corresponding to the generated address as the program device where the target application program is located;
acquiring a device code in the program device;
and identifying the equipment code based on a user agent detection tool to obtain the system type.
According to a preferred embodiment of the present invention, the processing the page request according to the system type, and obtaining the request transfer information includes:
selecting a parameter processor corresponding to the system type;
counting the number of names of the function names;
cutting the page request based on the number of the names to obtain a plurality of sub-requests;
calling the parameter processor to process the sub-requests in parallel to obtain response information corresponding to each sub-request;
detecting a request position of each sub-request in the page request;
and splicing the response information based on the request position to obtain the request transfer information.
According to the preferred embodiment of the present invention, when the parameter processor is called to process the plurality of sub-requests in parallel, the method for H5 interacting with the application further includes:
monitoring the parameter processor to process the sub-requests in parallel to obtain a monitoring result;
extracting the sub-request with the monitoring result being an abnormal result from the plurality of sub-requests as a target request, and extracting the position of the target request from the request position as a target position;
generating feedback information according to the target request and the target position;
and sending the feedback information to a preset binding terminal.
According to the preferred embodiment of the present invention, after analyzing the request relay information based on the callback function and obtaining a request result, the method for interacting between H5 and the application further includes:
calculating the information similarity between the request result and the configuration information;
and if the information similarity is smaller than a preset threshold value, deleting the callback function.
In another aspect, the present invention further provides an H5 and application program interaction apparatus, where the H5 and application program interaction apparatus includes:
the obtaining unit is used for obtaining a call request initiated by H5 to a target application program;
the detection unit is used for detecting the request type of the calling request based on a preset interaction list;
the generating unit is used for generating a callback function based on the calling request if the request type is an asynchronous type;
the generating unit is further configured to generate a page request according to the call request and the function name of the callback function;
the identification unit is used for identifying the type of the system where the target application program is located based on the calling request;
the processing unit is used for processing the page request according to the system type to obtain request transfer information;
and the analysis unit is used for analyzing the request transfer information based on the callback function to obtain a request result.
In another aspect, the present invention further provides an electronic device, including:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the H5 method of interacting with an application.
In another aspect, the present invention further provides a computer-readable storage medium, in which computer-readable instructions are stored, and the computer-readable instructions are executed by a processor in an electronic device to implement the method for interacting H5 with an application program.
It can be seen from the above technical solutions that the present invention directly generates a callback function based on the call request, and since it is not necessary to name and generate the callback function by different methods based on different system types, it is able to generate callback functions suitable for different system types, thereby improving the maintenance convenience of the callback function, and in addition, the callback function is randomly generated based on the call request when it is detected that the request type is an asynchronous type, so when the service scene of an application program changes, it is not necessary to identify the callback function to distinguish different service scenes, improving the development efficiency, and further generating a page request based on the call request and the function name, it is able to avoid the division of the call request of the asynchronous type and the callback function, improving the code readability and the maintenance, and since the call request is converted into the page request, the method and the device can not only avoid the service logic that the calling request and the callback function are excessively coupled due to the fact that the calling request and the callback function are stored in the same path, but also avoid storage dispersion caused by the fact that the calling request and the callback function are stored in different paths.
Drawings
FIG. 1 is a flowchart of a preferred embodiment of the interaction method of the invention H5 with an application program.
FIG. 2 is a functional block diagram of a preferred embodiment of an apparatus for H5 interaction with an application program.
Fig. 3 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the method for interacting H5 with an application program according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of the preferred embodiment of the interaction method of H5 and an application program. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The interaction method of the H5 and the application program can acquire and process related data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence base technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
The method for interacting H5 with an Application is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to computer readable instructions set or stored in advance, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), a smart wearable device, and the like.
The electronic device may include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of a plurality of network electronic devices, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network electronic devices.
The network in which the electronic device is located includes, but is not limited to: the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
And S10, acquiring the call request initiated by the H5 to the target application program.
In at least one embodiment of the invention, the target application may be any application associated with a business scenario, for example, the target application may be a payment-type application.
The information carried in the call request includes, but is not limited to: program method name, parameter information, address information, etc. of the target application program. The parameter information refers to parameters contained in an object in the call request. The address information includes an address for generating the call request, an address for processing the call request, and the like.
In at least one embodiment of the present invention, the electronic device calls a monitoring tool to monitor H5, and when it is monitored that information related to the target application program is generated on H5, the electronic device obtains the call request.
S11, detecting the request type of the call request based on the preset interaction list.
In at least one embodiment of the present invention, the preset interaction list stores a mapping relationship between a program method name and a calling method name in an asynchronous type.
The request types include an asynchronous type and a synchronous type.
In at least one embodiment of the present invention, the detecting, by the electronic device, the request type of the invocation request based on the preset interaction list includes:
extracting a program method name of the target application program from the calling request;
traversing the preset interaction list based on the program method name;
and if the callback method name corresponding to the program method name exists in the preset interaction list, determining the request type as the asynchronous type.
Wherein the program method name is used to indicate the target application program.
The program method name can be accurately extracted through the calling request, and the preset interaction list is detected based on the program method name, so that the accuracy of determining the request type is improved.
In at least one embodiment of the present invention, if a callback method name corresponding to the program method name does not exist in the preset interaction list, the request type is determined as a synchronization type.
In at least one embodiment of the present invention, after detecting the request type of the invocation request based on a preset interaction list, the method for interacting the H5 with the application program further includes:
and if the request type is the synchronous type, operating the calling request to obtain the request result.
Through the implementation mode, the call request can be directly operated when the request type is the synchronous type, and the generation efficiency of the request result is improved.
And S12, if the request type is an asynchronous type, generating a callback function based on the call request.
In at least one embodiment of the present invention, the callback function refers to a function for passing parameter information in the call request.
In at least one embodiment of the present invention, the generating, by the electronic device, the callback function based on the call request includes:
extracting parameter information from the call request;
processing the parameter information based on a random function generator to obtain the function name and function information;
acquiring a function method corresponding to the function name;
writing the function information into the function method to obtain code information;
and running the code information to generate the callback function.
The parameter information refers to parameters contained in an object in the call request.
The parameter information is processed by the random function generator, so that the function name and the function information suitable for the call request can be generated, and the generation accuracy of the callback function is improved.
And S13, generating a page request according to the calling request and the function name of the callback function.
In at least one embodiment of the present invention, the page request refers to a request that the electronic device can directly run.
In at least one embodiment of the present invention, the generating, by the electronic device, the page request according to the call request and the function name of the callback function includes:
and writing the function name into the calling request to obtain the page request.
S14, identifying the system type of the target application program based on the calling request.
In at least one embodiment of the present invention, the system type refers to a code type corresponding to a code in the target application program, for example, the system type may be JAVA or the like.
In at least one embodiment of the present invention, the identifying, by the electronic device, the type of the system in which the target application is located based on the invocation request includes:
extracting address information from the call request;
extracting information corresponding to a preset label from the address information as a generated address;
taking the device corresponding to the generated address as the program device where the target application program is located;
acquiring a device code in the program device;
and identifying the equipment code based on a user agent detection tool to obtain the system type.
The address information includes an address for generating the call request, an address for processing the call request, and the like.
The preset tag user indicates the address at which information is generated, e.g., the preset tag may be from.
The program device is consistent with the generation device of the call request.
The device code may be any code information on the operating system platform in the program device.
The user agent detection tool is typically referred to as a Useragent tool.
The program equipment can be accurately positioned through the calling request and the preset label, and the system type can be accurately determined based on the identification of the user agent detection tool on the equipment code.
And S15, processing the page request according to the system type to obtain request transfer information.
In at least one embodiment of the present invention, the request relay information refers to a response result corresponding to the page request.
In at least one embodiment of the present invention, the processing, by the electronic device, the page request according to the system type, and obtaining request transfer information includes:
selecting a parameter processor corresponding to the system type;
counting the name number of the function names;
cutting the page request based on the number of the names to obtain a plurality of sub-requests;
calling the parameter processor to process the sub-requests in parallel to obtain response information corresponding to each sub-request;
detecting a request position of each sub-request in the page request;
and splicing the response information based on the request position to obtain the request transfer information.
The parameter processor may be an Android parameter processor, or an Ios parameter processor.
The page requests are cut according to the name number, sub-requests corresponding to each parameter information can be generated, the parameter processors are called to process the sub-requests in parallel, the generation efficiency of the response information is improved, the response information is further spliced according to the request positions, and the accuracy of the request transfer information can be improved.
In at least one embodiment of the present invention, when the parameter processor is called to process the plurality of sub-requests in parallel, the method for H5 interacting with the application further includes:
monitoring the parameter processor to process the sub-requests in parallel to obtain a monitoring result;
extracting the sub-request with the monitoring result being an abnormal result from the plurality of sub-requests as a target request, and extracting the position of the target request from the request position as a target position;
generating feedback information according to the target request and the target position;
and sending the feedback information to a preset binding terminal.
Wherein, the situation that the monitoring result is an abnormal result comprises: the parameter processor cannot process the sub-requests, and the time for processing the sub-requests by the parameter processor is longer than the preset time.
The preset binding terminal may be a terminal device bound by an operation and maintenance user in charge of the target application program.
Through the embodiment, the parameter processor can perform exception capture when processing the plurality of sub-requests in parallel, and the feedback information is generated, so that operation and maintenance personnel can be informed in time when capturing the exception.
And S16, analyzing the request transfer information based on the callback function to obtain a request result.
It is emphasized that the request result may also be stored in a node of a block chain in order to further ensure the privacy and security of the request result.
In at least one embodiment of the present invention, after parsing the request transit information based on the callback function to obtain a request result, the method for interacting H5 with an application further includes:
calculating the information similarity between the request result and the configuration information;
and if the information similarity is smaller than a preset threshold value, deleting the callback function.
The configuration information refers to preset information when the request fails to be executed, and for example, the configuration information may be an unresponsive response.
The preset threshold value can be set according to actual requirements, and the value of the preset threshold value is not particularly limited.
Through the above embodiment, when the information similarity is smaller than the preset threshold, it indicates that the call request has been successfully executed, so that the callback function is destroyed when the call request is successfully executed, thereby avoiding the dimensionality of the callback function and improving convenience.
It can be seen from the above technical solutions that the present invention directly generates a callback function based on the call request, and since it is not necessary to name and generate the callback function by different methods based on different system types, it is able to generate callback functions suitable for different system types, thereby improving the maintenance convenience of the callback function, and in addition, the callback function is randomly generated based on the call request when it is detected that the request type is an asynchronous type, so when the service scene of an application program changes, it is not necessary to identify the callback function to distinguish different service scenes, improving the development efficiency, and further generating a page request based on the call request and the function name, it is able to avoid the division of the call request of the asynchronous type and the callback function, improving the code readability and the maintenance, and since the call request is converted into the page request, the method and the device can not only avoid the service logic that the calling request and the callback function are excessively coupled due to the fact that the calling request and the callback function are stored in the same path, but also avoid storage dispersion caused by the fact that the calling request and the callback function are stored in different paths.
Fig. 2 is a functional block diagram of an interactive device of H5 and an application according to a preferred embodiment of the present invention. The H5 and application program interaction device 11 includes an acquisition unit 110, a detection unit 111, a generation unit 112, an identification unit 113, a processing unit 114, an analysis unit 115, a monitoring unit 116, an extraction unit 117, a sending unit 118, a calculation unit 119, and a deletion unit 120. The module/unit referred to herein is a series of computer readable instruction segments that can be accessed by the processor 13 and perform a fixed function and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The acquisition unit 110 acquires a call request initiated by H5 to a target application.
In at least one embodiment of the invention, the target application may be any application associated with a business scenario, for example, the target application may be a payment-type application.
The information carried in the call request includes, but is not limited to: program method name, parameter information, address information, etc. of the target application program. The parameter information refers to parameters contained in an object in the call request. The address information includes an address for generating the call request, an address for processing the call request, and the like.
In at least one embodiment of the present invention, the obtaining unit 110 calls a monitoring tool to monitor H5, and when it is monitored that information related to the target application program is generated on H5, the obtaining unit 110 obtains the call request.
The detection unit 111 detects a request type of the invocation request based on a preset interaction list.
In at least one embodiment of the present invention, a mapping relationship between a program method name and a calling method name in an asynchronous type is stored in the preset interaction list.
The request types include an asynchronous type and a synchronous type.
In at least one embodiment of the present invention, the detecting unit 111, based on the preset interaction list, detects a request type of the invocation request, including:
extracting a program method name of the target application program from the calling request;
traversing the preset interaction list based on the program method name;
and if the callback method name corresponding to the program method name exists in the preset interaction list, determining the request type as the asynchronous type.
Wherein the program method name is used to indicate the target application program.
The program method name can be accurately extracted through the calling request, and the preset interaction list is detected based on the program method name, so that the accuracy of determining the request type is improved.
In at least one embodiment of the present invention, if a callback method name corresponding to the program method name does not exist in the preset interaction list, the detection unit 111 determines the request type as a synchronization type.
In at least one embodiment of the present invention, after detecting the request type of the invocation request based on the preset interaction list, if the request type is a synchronization type, the processing unit 114 runs the invocation request to obtain the request result.
Through the implementation mode, the call request can be directly operated when the request type is the synchronous type, and the generation efficiency of the request result is improved.
If the request type is an asynchronous type, the generation unit 112 generates a callback function based on the call request.
In at least one embodiment of the present invention, the callback function refers to a function for passing parameter information in the call request.
In at least one embodiment of the present invention, the generating unit 112 generates the callback function based on the call request, including:
extracting parameter information from the call request;
processing the parameter information based on a random function generator to obtain the function name and function information;
acquiring a function method corresponding to the function name;
writing the function information into the function method to obtain code information;
and running the code information to generate the callback function.
The parameter information refers to parameters contained in an object in the call request.
The parameter information is processed by the random function generator, so that the function name and the function information suitable for the call request can be generated, and the generation accuracy of the callback function is improved.
The generating unit 112 generates a page request according to the call request and the function name of the callback function.
In at least one embodiment of the present invention, the page request refers to a request that the electronic device can directly run.
In at least one embodiment of the present invention, the generating unit 112 generates the page request according to the call request and the function name of the callback function, including:
and writing the function name into the calling request to obtain the page request.
The identification unit 113 identifies the type of system in which the target application is located based on the call request.
In at least one embodiment of the present invention, the system type refers to a code type corresponding to a code in the target application, for example, the system type may be JAVA or the like.
In at least one embodiment of the present invention, the identifying unit 113, based on the call request, identifies the type of the system in which the target application program is located, including:
extracting address information from the call request;
extracting information corresponding to a preset label from the address information to serve as a generated address;
taking the device corresponding to the generated address as the program device where the target application program is located;
acquiring a device code in the program device;
and identifying the equipment code based on a user agent detection tool to obtain the system type.
The address information includes an address for generating the call request, an address for processing the call request, and the like.
The preset tag user indicates an address at which information is generated, for example, the preset tag may be from.
The program device is consistent with the generation device of the call request.
The device code may be any code information on the operating system platform in the program device.
The user agent detection tool is typically referred to as a Useragent tool.
The program equipment can be accurately positioned through the calling request and the preset label, and the system type can be accurately determined based on the identification of the user agent detection tool on the equipment code.
The processing unit 114 processes the page request according to the system type to obtain request transfer information.
In at least one embodiment of the present invention, the request relay information refers to a response result corresponding to the page request.
In at least one embodiment of the present invention, the processing unit 114 processes the page request according to the system type, and obtaining the request transfer information includes:
selecting a parameter processor corresponding to the system type;
counting the name number of the function names;
cutting the page request based on the number of the names to obtain a plurality of sub-requests;
calling the parameter processor to process the sub-requests in parallel to obtain response information corresponding to each sub-request;
detecting a request position of each sub-request in the page request;
and splicing the response information based on the request position to obtain the request transfer information.
The parameter processor may be an Android parameter processor, or an Ios parameter processor.
The page requests are cut according to the name number, sub-requests corresponding to each parameter information can be generated, the parameter processors are called to process the sub-requests in parallel, the generation efficiency of the response information is improved, the response information is further spliced according to the request positions, and the accuracy of the request transfer information can be improved.
In at least one embodiment of the present invention, when the parameter processor is called to process the plurality of sub-requests in parallel, the monitoring unit 116 monitors the parameter processor to process the plurality of sub-requests in parallel, so as to obtain a monitoring result;
the extracting unit 117 extracts, from the plurality of sub-requests, a sub-request whose monitoring result is an abnormal result as a target request, and extracts a position of the target request from the request position as a target position;
the generating unit 112 generates feedback information according to the target request and the target position;
the sending unit 118 sends the feedback information to a preset binding terminal.
Wherein, the situation that the monitoring result is an abnormal result comprises: the parameter processor cannot process the sub-requests, and the time for processing the sub-requests by the parameter processor is longer than the preset time.
The preset binding terminal may be a terminal device bound by an operation and maintenance user in charge of the target application program.
Through the embodiment, the abnormal capture can be performed when the parameter processor processes the plurality of sub-requests in parallel, and the operation and maintenance personnel can be informed in time when the abnormal capture is facilitated by generating the feedback information.
The analysis unit 115 analyzes the request transfer information based on the callback function to obtain a request result.
It is emphasized that the request result may also be stored in a node of a block chain in order to further ensure the privacy and security of the request result.
In at least one embodiment of the present invention, after analyzing the request transfer information based on the callback function to obtain a request result, the calculating unit 119 calculates the information similarity between the request result and the configuration information;
if the information similarity is smaller than a preset threshold, the deleting unit 120 deletes the callback function.
The configuration information refers to preset information when the request fails to be executed, and for example, the configuration information may be an unresponsive response.
The preset threshold value can be set according to actual requirements, and the value of the preset threshold value is not particularly limited.
Through the above embodiment, when the information similarity is smaller than the preset threshold, it indicates that the call request has been successfully executed, so that the callback function is destroyed when the call request is successfully executed, thereby avoiding the dimensionality of the callback function and improving convenience.
It can be seen from the above technical solutions that the present invention directly generates a callback function based on the call request, and since it is not necessary to name and generate the callback function by different methods based on different system types, it is able to generate callback functions suitable for different system types, thereby improving the maintenance convenience of the callback function, and in addition, the callback function is randomly generated based on the call request when it is detected that the request type is an asynchronous type, so when the service scene of an application program changes, it is not necessary to identify the callback function to distinguish different service scenes, improving the development efficiency, and further generating a page request based on the call request and the function name, it is able to avoid the division of the call request of the asynchronous type and the callback function, improving the code readability and the maintenance, and since the call request is converted into the page request, the method and the device can not only avoid the service logic that the calling request and the callback function are excessively coupled due to the fact that the calling request and the callback function are stored in the same path, but also avoid storage dispersion caused by the fact that the calling request and the callback function are stored in different paths.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention, which implements the method for interacting H5 with an application program.
In one embodiment of the invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions stored in the memory 12 and executable on the processor 13, such as H5 interaction programs with application programs.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
Illustratively, the computer readable instructions may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing specific functions, which are used for describing the execution process of the computer readable instructions in the electronic device 1. For example, the computer readable instructions may be divided into an acquisition unit 110, a detection unit 111, a generation unit 112, a recognition unit 113, a processing unit 114, an analysis unit 115, a monitoring unit 116, an extraction unit 117, a transmission unit 118, a calculation unit 119, and a deletion unit 120.
The memory 12 may be used for storing the computer readable instructions and/or modules, and the processor 13 implements various functions of the electronic device 1 by executing or executing the computer readable instructions and/or modules stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. The memory 12 may include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by hardware that is configured to be instructed by computer readable instructions, which may be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer readable instructions comprise computer readable instruction code which may be in source code form, object code form, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying said computer readable instruction code, a recording medium, a U disk, a removable hard disk, a magnetic diskette, an optical disk, a computer Memory, a Read-Only Memory (ROM), a Random Access Memory (RAM).
The blockchain is a novel application mode of computer technologies such as interaction, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like of the distributed H5 and an application program. 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.
In conjunction with fig. 1, the memory 12 in the electronic device 1 stores computer-readable instructions to implement a method of H5 interacting with an application, and the processor 13 can execute the computer-readable instructions to implement:
acquiring a call request initiated by H5 to a target application program;
detecting a request type of the call request based on a preset interaction list;
if the request type is an asynchronous type, generating a callback function based on the call request;
generating a page request according to the calling request and the function name of the callback function;
identifying the type of the system where the target application program is located based on the calling request;
processing the page request according to the system type to obtain request transfer information;
and analyzing the request transfer information based on the callback function to obtain a request result.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer readable instructions, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may 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 computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions when executed by the processor 13 are configured to implement the steps of:
acquiring a call request initiated by H5 to a target application program;
detecting a request type of the call request based on a preset interaction list;
if the request type is an asynchronous type, generating a callback function based on the call request;
generating a page request according to the calling request and the function name of the callback function;
identifying the type of the system where the target application program is located based on the calling request;
processing the page request according to the system type to obtain request transfer information;
and analyzing the request transfer information based on the callback function to obtain a request result.
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.
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.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. The plurality of units or devices may also be implemented by one unit or device through software or hardware. The terms first, 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. An interaction method of H5 and an application program is characterized in that the interaction method of H5 and the application program comprises the following steps:
acquiring a call request initiated by H5 to a target application program;
detecting a request type of the call request based on a preset interaction list;
if the request type is an asynchronous type, generating a callback function based on the call request;
generating a page request according to the calling request and the function name of the callback function;
identifying the type of the system where the target application program is located based on the calling request;
processing the page request according to the system type to obtain request transfer information;
and analyzing the request transfer information based on the callback function to obtain a request result.
2. The H5 interaction method with an application program of claim 1, wherein the detecting the request type of the invocation request based on the preset interaction list includes:
extracting a program method name of the target application program from the calling request;
traversing the preset interaction list based on the program method name;
and if the callback method name corresponding to the program method name exists in the preset interaction list, determining the request type as the asynchronous type.
3. The method of claim 1, wherein said generating a callback function based on said call request comprises:
extracting parameter information from the call request;
processing the parameter information based on a random function generator to obtain the function name and function information;
acquiring a function method corresponding to the function name;
writing the function information into the function method to obtain code information;
and running the code information to generate the callback function.
4. The H5 method for interacting with an application program of claim 1, wherein the identifying the type of system in which the target application program is located based on the invocation request includes:
extracting address information from the call request;
extracting information corresponding to a preset label from the address information to serve as a generated address;
taking the device corresponding to the generated address as the program device where the target application program is located;
acquiring a device code in the program device;
and identifying the equipment code based on a user agent detection tool to obtain the system type.
5. The method of claim 1, wherein the processing the page request according to the system type to obtain request relay information comprises:
selecting a parameter processor corresponding to the system type;
counting the name number of the function names;
cutting the page request based on the number of the names to obtain a plurality of sub-requests;
calling the parameter processor to process the sub-requests in parallel to obtain response information corresponding to each sub-request;
detecting a request position of each sub-request in the page request;
and splicing the response information based on the request position to obtain the request transfer information.
6. The H5 interaction method with application according to claim 5, wherein when the parameter handler is invoked to process the plurality of sub-requests in parallel, the H5 interaction method with application further comprises:
monitoring the parameter processor to process the sub-requests in parallel to obtain a monitoring result;
extracting the sub-request with the monitoring result being an abnormal result from the plurality of sub-requests as a target request, and extracting the position of the target request from the request position as a target position;
generating feedback information according to the target request and the target position;
and sending the feedback information to a preset binding terminal.
7. The method of claim 1, wherein after parsing the request transit information based on the callback function to obtain a request result, the method of interacting H5 with an application further comprises:
calculating the information similarity between the request result and the configuration information;
and if the information similarity is smaller than a preset threshold value, deleting the callback function.
8. An H5 and application program interacting device, characterized in that the H5 and application program interacting device comprises:
the obtaining unit is used for obtaining a call request initiated by H5 to a target application program;
the detection unit is used for detecting the request type of the calling request based on a preset interaction list;
the generating unit is used for generating a callback function based on the calling request if the request type is an asynchronous type;
the generating unit is further configured to generate a page request according to the call request and the function name of the callback function;
the identification unit is used for identifying the type of the system where the target application program is located based on the calling request;
the processing unit is used for processing the page request according to the system type to obtain request transfer information;
and the analysis unit is used for analyzing the request transfer information based on the callback function to obtain a request result.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the method of interacting H5 with an application program according to any of claims 1-7.
10. A computer-readable storage medium characterized by: the computer readable storage medium stores computer readable instructions, which are executed by a processor in an electronic device to implement the method of interacting H5 with an application according to any one of claims 1 to 7.
CN202210259039.XA 2022-03-10 2022-03-10 Interaction method, device, equipment and storage medium of H5 and application program Pending CN114610386A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210259039.XA CN114610386A (en) 2022-03-10 2022-03-10 Interaction method, device, equipment and storage medium of H5 and application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210259039.XA CN114610386A (en) 2022-03-10 2022-03-10 Interaction method, device, equipment and storage medium of H5 and application program

Publications (1)

Publication Number Publication Date
CN114610386A true CN114610386A (en) 2022-06-10

Family

ID=81862151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210259039.XA Pending CN114610386A (en) 2022-03-10 2022-03-10 Interaction method, device, equipment and storage medium of H5 and application program

Country Status (1)

Country Link
CN (1) CN114610386A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022454B (en) * 2022-06-24 2024-02-02 中国平安财产保险股份有限公司 An Zhuo Duan return operation method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022454B (en) * 2022-06-24 2024-02-02 中国平安财产保险股份有限公司 An Zhuo Duan return operation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111694840B (en) Data synchronization method, device, server and storage medium
CN111797351A (en) Page data management method and device, electronic equipment and medium
CN112559535B (en) Multithreading-based asynchronous task processing method, device, equipment and medium
CN114418398A (en) Scene task development method, device, equipment and storage medium
CN114610386A (en) Interaction method, device, equipment and storage medium of H5 and application program
CN114116108A (en) Dynamic rendering method, device, equipment and storage medium
CN115037790B (en) Abnormal registration identification method, device, equipment and storage medium
CN111277626A (en) Server upgrading method and device, electronic equipment and medium
CN114329095A (en) System logic diagram generation method, device, equipment and storage medium
CN114003784A (en) Request recording method, device, equipment and storage medium
CN114416417A (en) System abnormity monitoring method, device, equipment and storage medium
CN115378806A (en) Flow distribution method and device, computer equipment and storage medium
CN112181485B (en) Script execution method and device, electronic equipment and storage medium
CN114692204A (en) Data query method, device, equipment and storage medium
CN113886263A (en) System testing method, device, equipment and storage medium
CN114185747A (en) Method, device and equipment for positioning program running problem and storage medium
CN110245074B (en) Log record generation method and device, storage medium and server
CN114721907A (en) Network log display method, device, equipment and storage medium
CN114398104A (en) Script processing method, device, equipment and storage medium
CN113064802B (en) Operation track restoration method, device, equipment and storage medium
CN112667659B (en) Feature processing method and related equipment
CN115269219A (en) Message communication method based on event notification mechanism and related equipment
CN114925354A (en) Password resetting detection method based on shared screen and related equipment
CN114500320A (en) Data monitoring method and device, electronic equipment and computer readable storage medium
CN115186261A (en) Security detection method, device, equipment and storage 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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220920

Address after: Room 2601 (Unit 07), Qianhai Free Trade Building, No. 3048, Xinghai Avenue, Nanshan Street, Qianhai Shenzhen-Hong Kong Cooperation Zone, Shenzhen, Guangdong 518000

Applicant after: Shenzhen Ping An Smart Healthcare Technology Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.