CN107861713B - Data calling method and device and computer readable storage medium - Google Patents

Data calling method and device and computer readable storage medium Download PDF

Info

Publication number
CN107861713B
CN107861713B CN201710617383.0A CN201710617383A CN107861713B CN 107861713 B CN107861713 B CN 107861713B CN 201710617383 A CN201710617383 A CN 201710617383A CN 107861713 B CN107861713 B CN 107861713B
Authority
CN
China
Prior art keywords
interface
data
calling
information
dictionary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710617383.0A
Other languages
Chinese (zh)
Other versions
CN107861713A (en
Inventor
梁承飞
林泽全
周鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201710617383.0A priority Critical patent/CN107861713B/en
Publication of CN107861713A publication Critical patent/CN107861713A/en
Application granted granted Critical
Publication of CN107861713B publication Critical patent/CN107861713B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a data calling method, a data calling device and a computer readable storage medium, wherein the method comprises the following steps: receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface; converting the data type of the demand parameters from the character string type into a dictionary type matched with the dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set; and determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling. The method comprises the steps of converting required parameters in calling information into keywords of a dictionary type, obtaining parameter values from the dictionary information set according to the keywords, processing the parameter values by using a calling interface to complete data calling, and maintaining the dictionary information set only by aiming at the keywords and the parameter values, so that the data coupling of the interface is reduced, and the maintenance is convenient.

Description

Data calling method and device and computer readable storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data calling method, a data calling device, and a readable storage medium.
Background
H5 is the 5 th edition of HTML, HTML is a webpage descriptive language, is used for designing the front ends of websites and APP, and can realize cross-platform use; native is based on the development of the native system kernel, and needs to be developed by adopting different languages according to the platform type, such as android Java and Swift of ios. At present, APP generally adopts a Hybrid development mode, a unified interface (API) is provided by Native through methods such as JSbridge and the like, then actual logic is written by H5+ JS, and the API is called.
However, interface parameters of interaction between the native terminal and the H5 in the Hybrid development mode in the market are defined as an array format of a string with strict coupling, wherein for searching, the parameter sequence and the parameter number are set according to a strict rule, and when the parameters are increased or modified in the later maintenance, both the native terminal and the H5 need to be modified, otherwise, the breakdown is caused, and the expansion and maintenance are not facilitated.
Disclosure of Invention
The invention mainly aims to provide a data calling method, a data calling device and a computer readable storage medium, and aims to solve the problems that in the prior art, data interaction is high in coupling and is not beneficial to expansion and maintenance.
In order to achieve the above object, the present invention provides a data calling method, including the following steps:
receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface;
converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set;
determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling.
Preferably, the step of determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling includes:
determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface;
and converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to finish data calling.
Preferably, the processing the data entity model through the call interface, and after the step of completing the data call, the method includes:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
Preferably, the splitting data further includes a protocol header, and the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with a dictionary information set includes:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
Preferably, the step of receiving the calling information and the dictionary information set sent by the H5 interface includes:
and receiving initialization configuration information, and performing initialization configuration on all interfaces for communication call of the H5 interface so as to respond to the call information sent by the H5 interface when the call information is received.
In addition, to achieve the above object, the present invention further provides a data call apparatus, including: a memory, a processor, a communication bus, and a data calling program stored on the memory;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the data calling program to realize the following steps:
receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface;
converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set;
determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling.
Preferably, the step of determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling includes:
determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface;
and converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to finish data calling.
Preferably, after the step of processing the data entity model through the call interface and completing the data call, the processor is configured to execute the data call program to implement the following steps:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
Preferably, the splitting data further includes a protocol header, and before the step of converting the data type of the requirement parameter from a character string type to a dictionary type matching a dictionary information set, the processor is configured to execute the data call program to implement the following steps:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors for:
receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface;
converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set;
determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling.
According to the data calling method, when calling information and a dictionary information set sent by an H5 interface are received, the calling information is split to obtain an interface name and a requirement parameter of a current H5 interface calling interface, the data type of the requirement parameter is converted into a dictionary type matched with the dictionary information set from a character string type, the requirement parameter of the dictionary type is used as a keyword, a parameter value corresponding to the keyword is obtained from the dictionary information set, the parameter value is processed through a calling interface corresponding to the interface name, the interface function of the current H5 interface calling interface is achieved, and data calling is completed. The method comprises the steps of receiving a dictionary information set, converting the required parameters of the character string types in calling information into the required parameters of the dictionary types matched with the dictionary information set, using the required parameters of the dictionary types as keywords, and because the parameters in the dictionary information set exist in a key _ value mode, obtaining corresponding parameter values (values) from the dictionary information according to the converted keywords (keys), reducing the coupling between an H5 interface and native communication calling through the dictionary information set, only adding, deleting or modifying the keyword keys and the corresponding value values when performing maintenance expansion of addition, deletion or modification, avoiding the high coupling of correlation between the H5 interface and native, simultaneously performing the maintenance expansion aiming at the H5 interface and native, and performing the processing related to the calling interface types on the parameter values corresponding to the keywords through the calling interface, and the function of calling the interface is realized, and the data calling is completed. The communication interface coupling between the H5 interface and the native is low, and the maintainability and the expansibility are good.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a data call method according to the present invention;
FIG. 2 is a flowchart illustrating a second embodiment of a data call method according to the present invention;
FIG. 3 is a flowchart illustrating a third embodiment of a data call method according to the present invention;
FIG. 4 is a flowchart illustrating a fourth embodiment of a data call method according to the present invention;
fig. 5 is a schematic device structure diagram of a hardware operating environment related to a method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a data calling method.
Referring to fig. 1, fig. 1 is a flowchart illustrating a data calling method according to a first embodiment of the present invention. In this embodiment, the data calling method includes:
and step S10, receiving the calling information and the dictionary information set sent by the H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises the interface name and the requirement parameters of the current H5 interface calling interface.
Currently, various APPs (abbreviations of applications) are installed on smart terminals such as mobile phones and tablet computers in the market to overcome the shortcomings of the original system and meet various requirements of users. The current APP development modes mainly comprise a Native App, a Web App, a Hybrid App and a real Native App. The Native App is a traditional Native APP development mode, the Android is based on Java language, and the bottom layer calls Google API for development; the iOS is based on OC or Swift language, and the bottom layer calls API provided by App official to develop; the Web App is a website development mode of a mobile terminal, a Page is deployed on a server, and then a user accesses the website developed by an SPA (Single Page application) mode generally by using various large browsers; the Hybrid App is a Hybrid development mode, a unified API is provided by Native through JSbridge and other methods, actual logic is written by using Html5+ JS, and the API is called, and in the Hybrid development mode, due to the fact that the APIs of Android and iOS are generally consistent and a final page is displayed in webview, the cross-platform effect is good; the fact Native App is an open source APP development scheme initiated by Facebook, functions are realized by using JS + partial Native grammar, and most of cross-platform can be realized through good packaging.
The scheme is mainly suitable for communication calling between an H5 interface and a native in a Hybrid APP Hybrid development mode. The H5 interface is an interface developed based on the H5 language, the native is an interface (API) for calling non-Java codes by Java, the H5 interface calls the native to realize the function of the corresponding interface of the native, and if the function of a certain native is timing, the H5 interface calls the interface to realize the timing function. Specifically, a communication channel is established between an H5 interface and a native, an H5 interface sends calling information and dictionary information to the native, the calling information is used for calling a resource of the native end to realize a function corresponding to the calling information sent by the H5 interface, the dictionary information set is a json-format dictionary information set, json (JavaScript Object Notation, JS Object Notation) is a lightweight data exchange format, and the json-format dictionary information set has two data structures of an Object and an array. The data structure of the object is a structure mode of key _ value key/value pairs, the structure mode of the key _ value key/value pairs is used as a dictionary information set in the application, the key represents parameters, and the value represents the value of the parameters and is used for representing the characteristics of the parameters. If the calling information sent by the H5 interface is to call a native picture and perform animation display, the dictionary information set may include the number of calling pictures, the name of each picture, the display time of each picture, and the like, so that { key1_ value1, key2_ value2, key3_ value3 … key _ value, { number _ a, picture 1_ b, picture 2_ c … picture i _ m, display time _ n }. The keyword (key) is generally a string type, the parameter value (value) may be a basic type such as a string type, a double-precision floating point type (double), an integer type (int), and the like, a key/value pair may be nested, or an array, and the type of data in the array may be a basic type, or a key/value pair.
And when the calling information and the dictionary information set sent by the H5 interface are received, splitting the calling information. Understandably, the H5 interface communicates with the native, and must follow a certain communication protocol, and split the call information according to the specification of the communication protocol to obtain split data including the interface name and the requirement parameter of the current H5 interface call interface. For example, the communication protocol specifies that the information sent by the H5 interface must use 8 bytes as the minimum sending unit, and the first two bytes are interface names, the last 6 bytes are requirement parameters, that is, the information carried in byte0 and byte1 represents the interface names, and the information carried in byte2 to byte7 represents the requirement parameters, so that when the calling information is received, the calling information is split into byte0 to byte7, the information in byte0 and byte1 is captured as the interface names, and the information in byte2 to byte7 is captured as the calling information. The split may be performed according to another communication rule, and this is not limited. In the field of communications, in order to simplify the work of developers and improve the development efficiency of developers, interfaces are usually provided for the developers to call, and an interface (API) is a predefined function provided for the developers to call to implement a certain function without concern about how the inside of the interface is implemented. In this embodiment, the call information sent by the H5 interface is used to call an interface related to the call information to implement an interface function, the call information is split to obtain an interface name and a requirement parameter of a current H5 interface call interface, the interface name of the current H5 interface call interface is an interface name used to implement the current call of the H5 interface, and the requirement parameter is used to represent a requirement of the H5 interface call interface, that is, what the call interface function is used to do. The received dictionary information set comprises a plurality of pairs of key/value pairs relevant to data calling, the requirement parameters in the split data also exist in a character conversion type in a json format, and the requirement parameters and the dictionary information set are converted to obtain the corresponding key/value pairs so as to realize the data calling function. For example, when the user logs in from the H5 interface to the Native login interface of the Native APP, the user inputs login information on the client login interface and clicks the login virtual key, and according to the triggering operation of the login virtual key, the H5 interface sends the login information input by the user as calling information to the Native to pull up the Native login. And splitting the login information to obtain split data such as a login module name, a login account name, a login password and an authentication code in the login information, wherein the login module name is an interface name, and the login account name, the login password and the authentication code are requirement parameters. Therefore, the calling of the H5 interface is realized according to the interface name, the requirement parameters and the dictionary information set, and the login operation is completed.
Step S20, converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set, taking the requirement parameter converted to the dictionary type as a keyword, and acquiring a parameter value corresponding to the keyword from the dictionary information set.
Further, because the data in the calling information sent by the H5 interface exists in the form of a character string type, the requirement parameters in the split data obtained by splitting the calling information still exist in the form of a character string type. The String (String) is a String of characters consisting of numbers, letters, and underlines, and is generally denoted as "a 1a2 · an" (n > -0), which represents a data type of a text. A character string is stored similar to a character array, so that the individual elements of each bit can be extracted, e.g., s ═ abcdefghij, s [0] ═ a ", s [9] ═ j", and the zero bits of the character string indicate the length of the character string, e.g., s [0] ═ 10, the character string contains 10 characters. The data in the dictionary information set of the present embodiment exists in the form of key _ value key/value pairs, and given a key (key) and a parameter value (value), once the parameter value (value) is stored, it can be retrieved using the corresponding key (key). Dictionary-type parameter data is similar to a map and can be thought of as a list of key/value pairs. The data type of the requirement parameters is converted into a dictionary type matched with a dictionary information set from a character string type through a program, for example, the character string s is a 'picture', the character string s is converted into a keyword picture in the dictionary information through a program language, the requirement parameters of the dictionary type after conversion are used as keywords, namely the requirement parameters after conversion exist in a key form, so that value is obtained from the dictionary information set through the key, the communication parameters of an H5 interface and a native are prevented from being stored in the character string form and needing to be searched according to a stored sequence, and when the parameter data are expanded, the expanded parameter data need to be arranged according to the sequence, so that the position of the parameter data before expansion is prevented from being influenced, and searching confusion is avoided. Specifically, in an embodiment, when a parameter set at a native end exists in a form of a character string, and the parameter sets are V1, V2, V3, V4, and V5, when the invocation information of the H5 interface is received, corresponding data of the invocation information can only be obtained according to the arrangement position of the parameter, for example, if the invocation information sent by the H5 interface indicates that the invocation information needs to invoke V3, the native finds V3 according to the arrangement position of V3 in the parameter set, that is, a third bit. Therefore, when expansion is needed, in order to not influence searching according to the arrangement position of the parameters before expansion, the arrangement position of the parameters cannot be changed, and only the added parameters are arranged backwards, so that the coupling between the H5 interface and the native interface parameters is high. While the parameters exist in a dictionary information set in json format and it includes 5 pairs of dictionary type parameter sets: k1_ value1, k2_ value2, k3_ value3, k4_ value4 and k5_ value5, when a parameter M needs to be expanded, the key k6 of the parameter M and the corresponding value6, namely k6_ value6, are added to the parameter set, and the parameter sequence in the parameter set does not need to be considered. When calling is needed, the H5 interface sends calling information X and the expanded dictionary information set, the calling information is split and converted to obtain a key word k1, searching is carried out according to k1, and value1 is obtained according to k1 because the received dictionary information set k1 corresponds to value 1. Therefore, by means of sending the dictionary information set, only the key and the corresponding value need to be stored during expansion, a strict sequence relation does not need to be followed, the value can be found according to the key due to correspondence of the key and the value, expansion is convenient, and coupling is low.
And step S30, determining a calling interface according to the interface name, and processing the parameter value through the calling interface to complete data calling.
Understandably, with the development of intelligent terminals and the appearance of various functions, the types of interfaces are more and more. Different interfaces realize different functions, and the functions of the interfaces can be distinguished by naming the interfaces. The H5 interface sends the calling information according to the function to be realized, so the specific calling interface can be obtained by the interface name in the calling information, the parameter value in the calling information is processed related to the interface function through the calling interface, the data calling is completed, and the function of the H5 interface is realized. Therefore, according to different calling interface types, the calling interfaces have different processing modes for parameter values, so that different interface functions are realized according to the calling interface types, and data calling is completed.
The data calling method comprises the steps of receiving calling information and a dictionary information set sent by an H5 interface, splitting the calling information to obtain split data, wherein the split data comprise an interface name and requirement parameters of a current H5 interface calling interface; converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set; determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling. The method comprises the steps of receiving a dictionary information set, converting the required parameters of the character string types in calling information into the required parameters of the dictionary types matched with the dictionary information set, using the required parameters of the dictionary types as keywords, and because the parameters in the dictionary information set exist in a key _ value mode, obtaining corresponding parameter values (values) from the dictionary information according to the converted keywords (keys), reducing the coupling between an H5 interface and native communication calling through the dictionary information set, only adding, deleting or modifying the keyword keys and the corresponding value values when performing maintenance expansion of addition, deletion or modification, avoiding the high coupling of correlation between the H5 interface and native, simultaneously performing the maintenance expansion aiming at the H5 interface and native, and performing the processing related to the calling interface types on the parameter values corresponding to the keywords through the calling interface, and the function of calling the interface is realized, and the data calling is completed. The communication interface coupling between the H5 interface and the native is low, and the maintainability and the expansibility are good.
Further, in another embodiment of the data call method of the present invention, the step of determining a call interface according to the interface name, and processing the parameter value through the call interface to complete the data call includes:
and step S31, determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface.
And step S32, converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to complete data calling.
Further, since the interface is used for realizing the function according to the call, the specific implementation manner inside the interface is not concerned, and in the case of needing to check, the number, the attribute and the corresponding parameter value of the keyword key of the interface can be checked from the running program only by running the program, and in the case of not running the program, the number, the attribute and the corresponding parameter value of the keyword key of the interface cannot be known from the beginning. For example, in an interface for implementing a page switching function, keywords of the interface include a return key, a left switching key and a right switching key, and parameter values corresponding to the three are all 0 and 1, where 0 indicates that a key is not triggered and stays in a current page without switching, and 1 indicates that the key is triggered to perform page return or left switching or right switching, and a developer finds that the return key does not work and cannot perform a return operation in a test process, and runs a program to find that a keyword key of the return key is missing because a reason cannot be found from a non-running program, thereby causing that the return key cannot run. This manner of viewing key _ value in the running state is inconvenient to operate, and makes readability of the program poor. In this embodiment, basic information such as whether the types of parameters of the interface functions are complete or not, the types of the interface functions, and the like is reflected by providing a data model for the interface. When the interface function can not be realized, the reason can be preliminarily judged through the data model. For example, for the interface for implementing the page switching function, the corresponding data model is a data model established by a page switching instruction. Determining a calling interface for realizing the function according to the interface name, determining a data model corresponding to the function according to the calling interface, converting the key words and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through the calling interface to finish data calling. Wherein key _ value can be assigned to the data model as a data entity model by a dynamic reflection technique. After the conversion into the data entity model, the number and the attribute of the interface keyword key can be known by looking up the content of the data model file in the program. For the above embodiment of the interface for implementing the page switching function, the keyword return key, the left switch key, the right switch key, and the parameter values 0 and 1 corresponding to the three keys are assigned to the data model as the data entity model. Similarly, under the condition that the return key does not work due to the fact that the keyword key of the return key is lost, the loss of the keyword of the return key can be found only by looking up the number of the keywords in the data model file, and a program does not need to be operated. By converting the key _ value into the data entity model, the number and the attribute of the key _ value can be acquired under the condition of no operation, the correctness of the program is conveniently judged, and the readability of the program and the normalization of the interface are enhanced.
Further, referring to fig. 2, fig. 2 is a flowchart illustrating a second embodiment of the data calling method of the present invention, and the second embodiment of the present invention is proposed based on the first embodiment of the data calling method of the present invention.
In this embodiment, the processing the data entity model through the invocation interface, and after the step of completing the data invocation, the method includes:
and step S40, judging whether the calling information contains feedback information, and feeding back reply data to the H5 interface according to the feedback information when the calling information contains the feedback information.
In this embodiment, after the calling interface processes the data entity model and completes data calling, it is determined whether the calling information includes feedback information, where the feedback information is return information of completing calling to the H5 interface that sent the calling information after completing the calling function of the calling information. Because the call information is sent from the H5 interface, when the H5 interface expects to receive the feedback information of the call information, it can add a specific field in the call information, and when the split call information includes this field, it indicates that the H5 interface needs to feed back the call information, and the specific feedback content can be determined by what type of feedback is needed by the H5 interface included in the feedback information. For example, when the calling information is APP login, after the native executes login information, it is determined that the H5 interface needs to feed back login success or failure and feedback information of the reason of the failure to the login information, so based on the feedback information, when the native determines that the login information matches, the response data of login success is fed back to the H5 interface, and when the native determines that the password in the login information is wrong, the response data of login failure is fed back to the H5 interface, and the reason of login failure is the password error. The feedback of the reply data to the H5 interface can be carried out through a communication channel between the H5 interface and the native, the reply data of the calling information is generated according to the feedback information reflecting the requirements of the H5 interface, and the reply data is fed back to the H5 interface through the communication channel. And (4) feeding back reply data of the calling information to the H5 interface, and reflecting the execution condition of the calling information sent to the H5 interface while finishing data calling. And when the calling information does not contain feedback data, the H5 interface does not need to feed back the calling information, and the calling interface processes the data entity model to complete data calling.
Further, referring to fig. 3, fig. 3 is a flowchart illustrating a third embodiment of the data invoking method according to the present invention, and the third embodiment of the present invention is proposed based on the second embodiment of the data invoking method according to the present invention.
In this embodiment, the splitting data further includes a protocol header, and the step of converting the data type of the requirement parameter from a string type to a dictionary type matching the dictionary information set includes:
step S50, determining whether the protocol header is a set protocol type, and if the protocol header is the set protocol type, executing a step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
In this embodiment, the split data further includes a protocol header, and the split data obtained by splitting the call information sent by the H5 interface includes the protocol header, an interface name, and parameters. Before the data type of the parameter is converted, the split protocol header needs to be checked to determine whether the protocol type corresponding to the protocol header is the set protocol type. Understandably, the H5 interface users are numerous and need to establish different types of communication protocols to distinguish when communicating with different types of native. And for the determined H5 interface and native, setting a uniquely determined communication protocol between the two interfaces, wherein the set communication protocol is a set protocol type. For example, A, B, C three interfaces are used for a certain H5 interface and the native thereof to communicate, the protocol headers are aa, bb and cc, and the communication with the H5 interface is only carried out when the protocol header of A is judged to be aa; correspondingly, when the protocol header of B is judged to be bb, the communication is carried out with an H5 interface; when the protocol header of C is judged to be cc, the communication is carried out with the H5 interface. Splitting calling information to obtain a protocol header of a communication protocol, comparing the protocol header with a set protocol type to judge whether the calling information is from an H5 interface communicated with a native, converting the data type of a required parameter when the calling information is from an H5 interface communicated with the native, and indicating that the situations of communication errors or other dangerous attacks exist when the calling information is not from an H5 interface communicated with the native, so as to ensure the communication safety without processing the situations, and prevent dangerous communication requests from attacking the native to cause system faults; meanwhile, only data in the communication protocol is received, so that data in a non-communication protocol is prevented from being received, the burden of a communication channel is increased, and the communication accuracy is improved.
Further, referring to fig. 4, fig. 4 is a flowchart illustrating a fourth embodiment of the data invoking method according to the present invention, and the fourth embodiment of the present invention is proposed based on the third embodiment of the data invoking method according to the present invention.
In this embodiment, the step of receiving the calling information and the dictionary information set sent by the H5 interface includes:
and step S60, receiving the initialization configuration information, and performing initialization configuration on all interfaces for communication call of the H5 interface so as to respond to the call information sent by the H5 interface when the call information is received.
Furthermore, in the scheme, before communication call with the H5 interface, an interface for communication call with the H5 interface needs to be initialized and configured, since the function of the interface is realized by an interface module, the interface module needs to be initialized and configured, and since there are many interface modules that can be called for communication with the H5 interface, all interface modules that can be called for communication with the H5 interface should be initialized and configured. And calling corresponding interface modules to respond to the calling information according to the received different calling information sent by the H5 interface, so as to realize the calling function of the H5 interface. In addition, the scheme is provided with a data interaction management center, so that after the calling information of the H5 interface is received, the data interaction is uniformly started through the data interaction management center to split the calling information, the situation that different data interactions are started according to different received calling information of the H5 interface is avoided, system resources can be saved, and memory consumption is reduced. Correspondingly, initialization configuration needs to be carried out on the data interaction management center, specifically, initialization configuration file array filelist, initialization read configuration file array readfilelist, initialization js interface and model mapping relation dictionary modelinfo are carried out, and the configuration files are loaded. Wherein the step of loading the configuration file comprises: judging whether the configuration file is loaded or not, and skipping and not processing when the configuration file is loaded; when the configuration file is not loaded, the configuration file is analyzed, the configuration file is recorded to a read list readfileist, an extended configuration file list in the configuration file is read to the filelist, the relationship between an interface and a model in each interface module in the configuration file is read to be mapped to modelinfo, and the initialization configuration of the data interaction management center is completed.
Further, after the interface modules of all interfaces capable of being called by communication with the H5 interface are initialized, the information of all the interface modules capable of being called by communication with the H5 interface needs to be injected into the H5 interface, so that the H5 interface knows all the interface modules capable of communicating with the H5 interface, and sends the calling information according to the requirement. Wherein the step of injecting interface module information into the H5 interface comprises: judging whether the interface module information is loaded, if the interface module information is not loaded, searching the configuration file where the interface module is located, and judging whether the configuration file is found, if not, skipping and not processing and checking whether the configuration is correct, and if so, loading the configuration file where the interface module is located; if the interface module information is loaded, acquiring all configured interface array information of the interface module from a mapping relation dictionary modelinfo, traversing the interface array information of all the interface modules, splicing the interfaces of the interface modules, and injecting the interface module information into an H5 interface, thereby completing the operation of injecting the interface module information of all the interfaces which can be called by communicating with the H5 interface into the H5 interface.
Referring to fig. 5, fig. 5 is a schematic device structure diagram of a hardware operating environment related to a method according to an embodiment of the present invention.
The data calling device in the embodiment of the present invention may be a PC, or may be a terminal device such as a smart phone, a tablet PC, an electronic book reader, an MP3(Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3) player, an MP4(Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 3) player, a portable computer, or the like.
As shown in fig. 5, the data call device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used for realizing connection communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the data call device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. The user interface may comprise a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may also comprise a standard wired interface, a wireless interface. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Those skilled in the art will appreciate that the data call device architecture shown in FIG. 5 does not constitute a limitation of the data call device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 5, a memory 1005, which is a kind of computer storage medium, may include an operating system, a network communication module, and a data calling program therein. An operating system is a program that manages and controls the hardware and software resources of a data call device, supporting the operation of the data call program as well as other software and/or programs. The network communication module is used to implement communication between the various components within the memory 1005, as well as communication with other hardware and software in the data call device.
In the data call device shown in fig. 5, the processor 1001 is configured to execute the data call program stored in the memory 1005, and implement the following steps:
and receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and requirement parameters of the current H5 interface calling interface.
Converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set.
Determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling.
Further, the step of determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling includes:
and determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface.
And converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to finish data calling.
Further, after the data entity model is processed through the call interface and the step of data call is completed, the processor 1001 is configured to execute the data call program to implement the following steps:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
Further, the splitting data further includes a protocol header, and before the step of converting the data type of the requirement parameter from a string type to a dictionary type matching a dictionary information set, the processor 1001 is configured to execute the data call program to implement the following steps:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
Further, before the step of receiving the calling information and the dictionary information set sent by the H5 interface, the processor 1001 is configured to execute the data calling program to implement the following steps:
and receiving initialization configuration information, and performing initialization configuration on all interfaces for communication call of the H5 interface so as to respond to the call information sent by the H5 interface when the call information is received.
The specific implementation of the data calling device of the present invention is basically the same as the embodiments of the data calling method, and is not described herein again.
The present invention provides a computer readable storage medium storing one or more programs, the one or more programs further executable by one or more processors for:
and receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and requirement parameters of the current H5 interface calling interface.
Converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set.
Determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling.
Further, the step of determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling includes:
and determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface.
And converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to finish data calling.
Further, after the step of processing the data mockup through the call interface and completing the data call, the one or more programs are further executable by the one or more processors for:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
Further, the splitting data further comprises a protocol header, and prior to the step of converting the data type of the demand parameter from a string type to a dictionary type matching a dictionary information set, the one or more programs are further executable by the one or more processors for:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
Further, before the step of receiving the calling information and the dictionary information set sent by the H5 interface, the one or more programs may be further executable by the one or more processors for:
and receiving initialization configuration information, and performing initialization configuration on all interfaces for communication call of the H5 interface so as to respond to the call information sent by the H5 interface when the call information is received.
The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the embodiments of the data invoking method, and is not described herein again.
It should also be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
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 may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, 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 is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A data calling method, characterized in that the data calling method comprises the steps of:
receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface;
converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set;
determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling;
determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling, wherein the step of determining the calling interface according to the interface name comprises the following steps:
determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface;
converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to complete data calling;
and if a processing error occurs in the process of processing the data entity model through the calling interface, checking parameters of the calling interface based on the data entity model to determine the reason of the processing error.
2. The data call method as claimed in claim 1, wherein said step of processing said data entity model through a call interface, completing a data call comprises:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
3. The data call method of claim 1, wherein the split data further comprises a protocol header,
the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with a dictionary information set comprises the following steps:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
4. The data call method according to any of claims 1 to 3, wherein the step of receiving the call information and the dictionary information set sent by the H5 interface is preceded by the steps of:
and receiving initialization configuration information, and performing initialization configuration on all interfaces for communication call of the H5 interface so as to respond to the call information sent by the H5 interface when the call information is received.
5. A data call apparatus, characterized in that the data call apparatus comprises: a memory, a processor, a communication bus, and a data calling program stored on the memory;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the data calling program to realize the following steps:
receiving calling information and a dictionary information set sent by an H5 interface, and splitting the calling information to obtain split data, wherein the split data comprises an interface name and demand parameters of a current H5 interface calling interface;
converting the data type of the demand parameters from a character string type into a dictionary type matched with a dictionary information set, taking the demand parameters converted into the dictionary type as keywords, and acquiring parameter values corresponding to the keywords from the dictionary information set;
determining a calling interface according to the interface name, and processing the parameter value through the calling interface to finish data calling;
determining a calling interface according to the interface name, processing the parameter value through the calling interface, and completing data calling, wherein the step of determining the calling interface according to the interface name comprises the following steps:
determining a calling interface according to the interface name, and determining a data model corresponding to the calling interface according to the calling interface;
converting the keywords and the parameter values into a data entity model corresponding to the data model, and processing the data entity model through a calling interface to complete data calling;
and if a processing error occurs in the process of processing the data entity model through the calling interface, checking parameters of the calling interface based on the data entity model to determine the reason of the processing error.
6. The data call device of claim 5, wherein the processor is configured to execute the data call procedure after the step of processing the data entity model through the call interface to perform the step of:
and judging whether the calling information contains feedback information, and feeding back reply data to an H5 interface according to the feedback information when the calling information contains the feedback information.
7. The data call apparatus of claim 5, wherein the split data further comprises a protocol header,
before the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with a dictionary information set, the processor is configured to execute the data calling program to implement the following steps:
and judging whether the protocol header is a set protocol type, and when the protocol header is the set protocol type, executing the step of converting the data type of the requirement parameter from a character string type to a dictionary type matched with the dictionary information set.
8. A computer-readable storage medium, having stored thereon a data call program, which when executed by a processor implements the steps of the data call method of any of claims 1-4.
CN201710617383.0A 2017-07-25 2017-07-25 Data calling method and device and computer readable storage medium Active CN107861713B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710617383.0A CN107861713B (en) 2017-07-25 2017-07-25 Data calling method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710617383.0A CN107861713B (en) 2017-07-25 2017-07-25 Data calling method and device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107861713A CN107861713A (en) 2018-03-30
CN107861713B true CN107861713B (en) 2020-10-27

Family

ID=61699244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710617383.0A Active CN107861713B (en) 2017-07-25 2017-07-25 Data calling method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107861713B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804082A (en) * 2018-05-10 2018-11-13 北京酷我科技有限公司 A kind of implementation method of plug-in unit JSBridge
CN108733377B (en) * 2018-05-14 2020-03-10 蜂助手股份有限公司 JS interaction method for webpage end and mobile phone end in App
CN108920218B (en) * 2018-05-23 2023-03-03 北京五八信息技术有限公司 Reflection calling method, device, terminal and computer readable storage medium
CN110750738B (en) * 2018-07-06 2023-11-24 乐万家财富(北京)科技有限公司 Method for adding tag to anchor and electronic equipment
CN109377348A (en) * 2018-09-27 2019-02-22 深圳市佰仟金融服务有限公司 Applied to the business interface call method for helping loan operation system and help loan operation system
CN111352741B (en) * 2018-12-21 2021-04-06 马上消费金融股份有限公司 Interface calling method and device, intelligent terminal and storage device
CN111382378B (en) * 2018-12-28 2023-04-25 北京字节跳动网络技术有限公司 Resource loading method and device, mobile terminal and storage medium
CN109814965B (en) * 2019-01-10 2021-06-04 北京城市网邻信息技术有限公司 H5 page processing method and device, electronic equipment and storage medium
CN109688158B (en) * 2019-01-23 2022-07-08 平安科技(深圳)有限公司 Financial execution chain authentication method, electronic device and storage medium
CN110069248A (en) * 2019-03-16 2019-07-30 平安城市建设科技(深圳)有限公司 Call method, device, equipment and the computer readable storage medium of interface data
CN110222286A (en) * 2019-05-21 2019-09-10 平安普惠企业管理有限公司 Information acquisition method, device, terminal and computer readable storage medium
CN110674376A (en) * 2019-09-09 2020-01-10 中国平安财产保险股份有限公司 Interface parameter checking method, device, equipment and computer readable storage medium
CN111338819A (en) * 2020-02-24 2020-06-26 政采云有限公司 Method, system, equipment and readable storage medium for processing business object
CN111381824A (en) * 2020-03-11 2020-07-07 苏州金羲智慧科技有限公司 Method, system, device and medium for synchronizing user data in multi-architecture
CN111858368B (en) * 2020-07-27 2022-11-25 成都新潮传媒集团有限公司 Data processing method, device and storage medium
CN116302041B (en) * 2023-04-06 2023-11-21 北京拙河科技有限公司 Optimization method and device for light field camera interface module

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824626A (en) * 2016-03-14 2016-08-03 广东电网有限责任公司电力科学研究院 External shared service method for data pool

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150293797A1 (en) * 2014-04-14 2015-10-15 Chall Fry Methods and systems for key value observing
CN105204824A (en) * 2014-05-30 2015-12-30 北大方正集团有限公司 Method and device for communication between application and mobile terminal
CN105607895B (en) * 2014-11-21 2021-03-02 阿里巴巴集团控股有限公司 Application program operation method and device based on application program programming interface
JP2018538595A (en) * 2015-10-15 2018-12-27 ポキットドク インコーポレイテッド System and method for dynamic metadata persistence and correlation in API transactions
CN105739967A (en) * 2016-01-19 2016-07-06 四川长虹电器股份有限公司 Method of asynchronously calling native by js in mobile application
CN106897162B (en) * 2017-02-23 2021-06-11 腾讯科技(深圳)有限公司 Communication mode selection method of component in application, communication system and mobile terminal

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824626A (en) * 2016-03-14 2016-08-03 广东电网有限责任公司电力科学研究院 External shared service method for data pool

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
移动运维系统的设计与实现;张帆;《中国优秀硕士学位论文全文数据库 科技辑》;20170215;I138-1521 *

Also Published As

Publication number Publication date
CN107861713A (en) 2018-03-30

Similar Documents

Publication Publication Date Title
CN107861713B (en) Data calling method and device and computer readable storage medium
US11461111B2 (en) Method for running applets, and electronic device
US10904361B2 (en) Method, apparatus, and system for implementing JAVA application installation by means of cloud compilation
WO2016192556A1 (en) Interface invoking method, device and terminal
WO2019072201A1 (en) Webpage content extraction method and terminal device
US9436482B2 (en) Input content to application via web browser
WO2016177341A1 (en) Interface calling method and device, and terminal
CN110334297B (en) Terminal page loading method, terminal, server and storage medium
CN107133199B (en) Acquiring font parts using a compression mechanism
US10191751B2 (en) Information processing device for generating application programming interface information
BR112016010052B1 (en) PAGE OPERATION PROCESSING METHOD AND APPLIANCE, AND TERMINAL
CN113536185B (en) Application page loading method, storage medium and related equipment
JP2016540333A (en) Terminal marking method, terminal marking device, program, and recording medium
CN113778897B (en) Automatic test method, device and equipment for interface and storage medium
US10353700B1 (en) Code base sharing between standalone and web-based versions of an application via an emulated network communication channel
WO2014177033A1 (en) Input method invoking method and invoking device, and terminal
CN113467777A (en) Path identification method, device and system
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
CN113157722B (en) Data processing method, device, server, system and storage medium
CN112256252B (en) Interface generation method and device, storage medium and electronic equipment
KR20130103239A (en) Method, server and terminal for providing web browsing service having translation
CN113268277A (en) Web-based client access method and terminal equipment
US20210021639A1 (en) Method and electronic device for displaying web page
CN114461411A (en) Service processing system, method, device and medium
CN107015826B (en) Script file loading method, terminal and server

Legal Events

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