CN114924783A - Interface calling method, device, equipment and storage medium of application program - Google Patents

Interface calling method, device, equipment and storage medium of application program Download PDF

Info

Publication number
CN114924783A
CN114924783A CN202210449992.0A CN202210449992A CN114924783A CN 114924783 A CN114924783 A CN 114924783A CN 202210449992 A CN202210449992 A CN 202210449992A CN 114924783 A CN114924783 A CN 114924783A
Authority
CN
China
Prior art keywords
interface
calling
target
target interface
scene
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
CN202210449992.0A
Other languages
Chinese (zh)
Inventor
黎伟荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An International Smart City 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 CN202210449992.0A priority Critical patent/CN114924783A/en
Publication of CN114924783A publication Critical patent/CN114924783A/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/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/552Detecting local intrusion or implementing counter-measures involving long-term monitoring or reporting

Abstract

The invention relates to the technical field of Internet and discloses an interface calling method, device, equipment and storage medium of an application program. The method comprises the following steps: generating a target interface call request of a target application program in a corresponding service scene; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.

Description

Interface calling method, device, equipment and storage medium of application program
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, and a storage medium for calling an interface of an application program.
Background
The existing deployment environment is multi-node, and for some requests, time consumption or resource consumption is high, if an external system makes malicious calls, the whole service can be hung up, if a core system does not make service degradation, the whole system can be unavailable, and if an interface relates to charging, for example, short message resources can be wasted; some interfaces need to be controlled, which if left uncontrolled can lead to serious production problems.
Disclosure of Invention
The invention mainly aims to set an identification bit on a target calling interface and record the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and enabling the system to be more stable.
The invention provides a method for calling an interface of an application program, which comprises the following steps: generating a target interface calling request of a target application program in a corresponding service scene; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
Optionally, in a first implementation manner of the first aspect of the present invention, the generating a target interface call request of a target application in a corresponding service scenario includes: acquiring interface parameters of the target interface; packaging the interface name of the target interface and the interface parameters of the target interface to obtain a character string in a preset format; encrypting the character string based on a preset key to obtain an encrypted character string; and creating a Key-value pair set, replacing a value in the Key-value pair set with the encrypted character string, and setting a Key value in the Key-value pair set as a Key to obtain a target interface call request of a target application program in a corresponding service scene.
Optionally, in a second implementation manner of the first aspect of the present invention, the determining, based on preset permission data and the target interface call request, whether the target application has permission to call the target interface in the service scenario includes: acquiring queue data corresponding to the target interface based on preset authority data; if the number of times of calling the target interface in the queue data is less than a preset number of times, the target application program has the authority to call the target interface in the service scene; if the number of times of calling the target interface in the queue data is larger than a preset number of times, calculating the number of times of calling requests corresponding to the queue data in a preset time period according to the receiving time of the calling requests, and generating a relation between the calling times and the calling requests in the preset time period; fitting the calling frequency relation with the calling request in the preset time period based on a preset linear regression algorithm, and calculating a linear regression coefficient of the linear regression algorithm; and when the linear regression coefficient is detected to meet a preset value, determining whether the target application program has the authority to call the target interface under the service scene.
Optionally, in a third implementation manner of the first aspect of the present invention, the determining a scene identifier corresponding to the service scene and the target interface includes: determining whether the target interface calling request carries a scene identifier; if the target interface calling request does not carry the scene identification, determining a calling code corresponding to the target interface in a preset database; and if the target interface calling request carries the scene identification, marking the scene identification as the scene identification corresponding to the service scene and the target interface.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the determining a corresponding call code of the target interface in a preset database includes: matching interface parameter information carried in the target interface calling request with structural data in a preset database; and determining a calling code corresponding to the target interface according to the matching result.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the determining, based on the scene identifier, whether the target interface meets a call requirement includes: determining whether interface execution data corresponding to the scene identification exists or not based on the scene identification; if the interface execution data does not exist, determining that the target interface corresponding to the scene identification meets the calling condition; if the interface execution data exists, acquiring a calling code corresponding to the last successfully called interface under the scene identification, and determining whether the target interface meets the calling requirement when the calling code corresponding to the target interface is consistent with the next calling code of the calling code corresponding to the last successfully called interface.
A second aspect of the present invention provides an interface invoking device for an application program, including: the generation module is used for generating a target interface calling request of a target application program under a corresponding service scene; the first determining module is used for determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; a second determining module, configured to determine a scene identifier corresponding to the target interface and the service scene if the target application has a right to call the target interface in the service scene; the judging module is used for judging whether the target interface meets the calling requirement or not based on the scene identification; and the calling module is used for calling the corresponding system service through the target interface if the target interface meets the calling requirement.
Optionally, in a first implementation manner of the second aspect of the present invention, the generating module is specifically configured to:
acquiring interface parameters of the target interface; packaging the interface name of the target interface and the interface parameters of the target interface to obtain a character string in a preset format; encrypting the character string based on a preset key to obtain an encrypted character string; and creating a Key-value pair set, replacing a value in the Key-value pair set with the encrypted character string, and setting a Key value in the Key-value pair set as a Key to obtain a target interface call request of a target application program in a corresponding service scene.
Optionally, in a second implementation manner of the second aspect of the present invention, the first determining module is specifically configured to: acquiring queue data corresponding to the target interface based on preset authority data; if the number of times of calling the target interface in the queue data is less than the preset number of times, the target application program has the authority to call the target interface under the service scene; if the number of times of calling the target interface in the queue data is larger than a preset number of times, calculating the number of times of calling requests corresponding to the queue data in a preset time period according to the receiving time of the calling requests, and generating a relation between the calling times and the calling requests in the preset time period; fitting the calling frequency relation with the calling request in the preset time period based on a preset linear regression algorithm, and calculating a linear regression coefficient of the linear regression algorithm; and when the linear regression coefficient is detected to meet a preset value, determining whether the target application program has the authority to call the target interface under the service scene.
Optionally, in a third implementation manner of the second aspect of the present invention, the second determining module includes: a first determining unit, configured to determine whether the target interface call request carries a scene identifier; a second determining unit, configured to determine, if the target interface call request does not carry the scene identifier, a call code corresponding to the target interface in a preset database; and the marking unit is used for marking the scene identifier as a scene identifier corresponding to the service scene and the target interface if the target interface calling request carries the scene identifier.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the second determining unit is specifically configured to: matching interface parameter information carried in the target interface calling request with structural data in a preset database; and determining a calling code corresponding to the target interface according to the matching result.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the determining module is specifically configured to: determining whether interface execution data corresponding to the scene identification exists or not based on the scene identification; if the interface execution data does not exist, determining that the target interface corresponding to the scene identification meets the calling condition; if the interface execution data exists, acquiring a calling code corresponding to the last successfully called interface under the scene identification, and determining whether the target interface meets the calling requirement when the calling code corresponding to the target interface is consistent with the next calling code of the calling code corresponding to the last successfully called interface.
A third aspect of the present invention provides an interface calling device for an application program, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the interface call device of the application program to perform the steps of the interface call method of the application program described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the steps of the above-described interface calling method of an application program.
In the technical scheme provided by the invention, a target interface calling request of a target application program in a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Drawings
FIG. 1 is a diagram illustrating a first embodiment of an interface call method for an application program according to the present invention;
FIG. 2 is a diagram of a second embodiment of an interface calling method of an application program according to the present invention;
FIG. 3 is a diagram illustrating a third embodiment of an interface calling method for an application program according to the present invention;
FIG. 4 is a diagram illustrating a fourth embodiment of an interface call method of an application program according to the present invention;
FIG. 5 is a diagram illustrating a fifth embodiment of an interface calling method for an application program according to the present invention;
FIG. 6 is a schematic diagram of a first embodiment of an interface calling device of an application program provided in the present invention;
FIG. 7 is a diagram of a second embodiment of an interface invoking device of an application program according to the present invention;
fig. 8 is a schematic diagram of an embodiment of an interface calling device of an application program according to the present invention.
Detailed Description
The embodiment of the invention provides an interface calling method, device, equipment and storage medium of an application program, and the technical scheme of the invention is that firstly, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of an embodiment of the present invention is described below, with reference to fig. 1, a first embodiment of an interface calling method for an application program in an embodiment of the present invention includes:
101. generating a target interface calling request of a target application program in a corresponding service scene;
in this embodiment, it should be noted that, under the micro service architecture, a target service requested to be completed by a target application program in a target service scene may be split into multiple independent micro services, where each micro service corresponds to a respective application program interface. The target application needs to call different interfaces multiple times to complete the target service. However, there often exists an association relationship between the calls of these interfaces, for example, the post interface can be called only when a predetermined pre-interface call is completed.
Specifically, the target application is "mobile banking", and the target service is "bank account establishment" for example. When a mobile phone bank establishes a bank account, a plurality of interfaces such as networking check, face recognition, password setting, customer information creation and account establishment are required to be called in sequence. The interfaces are respectively connected with corresponding systems, and the application program can call the corresponding system service through calling the interfaces to obtain a result fed back by the system service. For example, the networking check interface is connected with a networking check citizen identity information system, and the authenticity of the resident identity document provided by the mobile phone bank in the process of completing the business of establishing the bank account can be verified by calling the service of the system.
102. Determining whether a target application program has the authority to call a target interface in a service scene based on preset authority data and a target interface calling request;
in this embodiment, the permission data may include data such as an application identifier, a service scenario identifier, and an interface code of an interface included in a service scenario. And analyzing the interface calling request, and determining relevant information of a target interface requested to be called, which is included in the interface calling request, such as data of target application program identification, scene identification of target service, interface coding of the target interface and the like.
Matching the authority data with the data analyzed from the interface calling request, and if the matching is successful, determining that the target application program has the authority to call the target interface in the scene of the target service; if the matching fails, a response message indicating "no right to call the interface" may be returned to the target application.
103. If the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface;
in this embodiment, the scene identifier is a unique code that identifies the target application program requesting completion of the target service once.
Wherein it is determined whether the interface call request includes a scene identification. The interface calling request comprises the relevant information of the target interface requested to be called; the information related to the target interface may comprise at least one of: scene code, interface version, interface name, identification of the target application program requesting to call the target interface, and scene identification. The data structure information comprises a sequence list obtained after all interfaces called by the target application program to finish the target service in the scene of the target service are arranged according to the calling sequence.
Specifically, the data structure information may be obtained by persisting the relevant information of the interface that needs to be called to complete the target service in the scene of the target service in advance, and the relevant information of the target interface that is requested to be called and included in the interface calling request may be matched with the data structure information. And determining the calling serial number corresponding to the target interface according to the matching result. And determining whether the target interface meets a calling condition under the scene identification.
104. Judging whether the target interface meets the calling requirement or not based on the scene identification;
in this embodiment, specifically, when it is determined that the call sequence number corresponding to the target interface is the next call sequence number of the call sequence number corresponding to the interface that has been successfully called, it is determined that the target interface meets the call condition. When the calling serial number corresponding to the target interface is not the next calling serial number of the calling serial number corresponding to the interface which is successfully called last, determining that the target interface does not meet the calling condition, and at the moment, returning a response message to the target application program to indicate that the target application program calls the target interface incorrectly.
In this embodiment, if the calling serial number corresponding to the target interface is the calling serial number corresponding to the interface which was successfully called last, it indicates that the target application program repeatedly calls the interface which has been successfully called, and at this time, the corresponding system service may be directly called through the interface corresponding to the next calling serial number of the calling serial number corresponding to the target interface.
When the number of data requests to any target server is greater than the maximum concurrency of the interface, the newly received data requests meeting the requirements for the interface are added into the wait queue data, and how to specifically judge whether one data request meets the requirements in the target server is described in detail in the embodiment on the target server side.
105. And if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
In this embodiment, the system service invoked through the target interface may be a service provided by an internal system, or may be a service provided by an external system. Corresponding to the above example, the service of providing face recognition by the external system of the bank may be called through the face recognition interface, and the service of providing set password by the internal system of the bank may be called through the password setting interface.
Optionally, the generating a call request of the target interface includes: acquiring parameters of implementation classes of the target interfaces, wherein the parameters of the implementation classes are used for determining a specific implementation class in the target interfaces; packaging the interface name of the target interface and the parameters of the implementation class of the target interface by a writeValuesAsString method to generate a json character string; encrypting the json character string through a preset key to generate an encrypted character string; creating a Map set, setting the value of the Map set as the encrypted string, setting the Key value of the Map set as the Key, and converting the Map set into a call request.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Referring to fig. 2, a second embodiment of the interface calling method of the application program according to the embodiment of the present invention includes:
201. acquiring interface parameters of a target interface;
202. packaging the interface name of the target interface and the interface parameters of the target interface to obtain a character string in a preset format;
in this embodiment, an interface is a reference type that specifies a set of function members without implementing members, and other types-classes and structures may implement the interface. The interface is specific to strong type object-oriented programming languages, such as C #, Java, and it appears colloquially that a standard entry is defined for these strong type languages and then used by subsequent descendants.
In the embodiment, the attribute and implementation details of the object are encapsulated, namely hidden, the interface is only externally disclosed, and the access level of reading and modifying the attribute in the program is controlled; the abstracted data and behaviors (or functions) are combined to form an organic whole, namely, the data and source codes of operation data are combined organically to form a class, wherein the data and the functions are members of the class. In electronic terms, packaging refers to the use of wire bonding of circuit pins on a silicon die to external connections for connection to other devices.
203. Encrypting the character string based on a preset key to obtain an encrypted character string;
in this embodiment, the character string is mainly used for programming, and the concept description, the function explanation, and the usage detailed description are shown in the text, which adds a point: the character string is similar to a character array in storage, so that a single element of each bit of the character string can be extracted, for example, s is abcdefghij, s [1] is b, and s [9] is j, which can provide a lot of convenience for people, for example, each bit can be converted into a number to be stored in the array during high-precision operation.
In this embodiment, the encryption is to change the original information data by a specific algorithm, so that even if an unauthorized user obtains the encrypted information, the content of the information cannot be known because the unauthorized user does not know the decryption method. In aeronautics, the method is to add control points to an image pair or the whole aerial photography zone by using a few known control points on an aerial photography image and by using a method for measuring and calculating the image.
204. Creating a Key-value pair set, replacing a value in the Key-value pair set with an encryption character string, and setting a Key value in the Key-value pair set as a Key to obtain a target interface calling request of a target application program in a corresponding service scene;
in this embodiment, in computer science, a name-value pair, which may also be referred to as a key-value pair or an attribute-value pair, is a basic data representation in computing systems and application programs. Designers often desire open data structures that can be expanded into the future without modifying existing code or data.
In this case, all or part of the data model may be represented as a set of tuples < name, value >; each element is a name-value pair, depending on the particular application and the implementation chosen by the programmer.
205. Determining whether the target application program has the authority to call the target interface under the service scene based on the preset authority data and the target interface calling request;
206. if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface;
207. judging whether the target interface meets the calling requirement or not based on the scene identification;
208. and if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
Steps 205-208 in this embodiment are similar to steps 102-105 in the first embodiment, and are not repeated herein.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene or not based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Referring to fig. 3, a third embodiment of the interface invoking method for application programs according to the embodiments of the present invention includes:
301. generating a target interface calling request of a target application program under a corresponding service scene;
302. acquiring queue data corresponding to a target interface based on preset authority data;
in this embodiment, the queue data corresponding to the target interface is acquired based on the preset authority data. The authority data may include data such as an application identifier, a service scenario identifier, and an interface code of an interface included in a service scenario. And analyzing the interface calling request, and determining relevant information of a target interface requested to be called, which is included in the interface calling request, such as data of target application program identification, scene identification of target service, interface coding of the target interface and the like.
303. If the number of times of calling the target interface in the queue data is less than the preset number of times, the target application program has the authority to call the target interface in a service scene;
in this embodiment, if the number of times of calling the target interface in the queue data is less than the preset number of times, the target application program has a right to call the target interface in a service scene.
Specifically, it can be understood that, in this case, since there are fewer call requests in the wait queue, receiving one more call request still does not affect normal operation, and the waiting time is not too long, so that the target interface is determined to meet the call requirement.
304. If the number of times of calling the target interface in the queue data is larger than the preset number of times, calculating the number of times of calling requests corresponding to the queue data in the preset time period according to the receiving time of the calling requests, and generating the relation between the calling times and the calling requests in the preset time period;
in this embodiment, if the number of times of calling the target interface in the queue data is greater than the preset number of times, the number of times of the queue data corresponding to the call request in the preset time period is calculated according to the receiving time of the call request, and a call number relationship between the queue data and the call request in the preset time period is generated.
Specifically, it can be understood that, in this case, since the number of times of the call requests in the wait queue is too large, the number of the call requests in the wait queue in the prior art is too large, which causes a series of problems, so that the target interface is determined not to meet the call requirement in order to avoid processing abnormality of the target server and to avoid too long waiting time.
305. Fitting the calling frequency relation with the calling request in a preset time period based on a preset linear regression algorithm, and calculating a linear regression coefficient of the linear regression algorithm;
in this embodiment, the linear regression is a statistical analysis method for determining the interdependent quantitative relationship between two or more variables by using regression analysis in mathematical statistics, and is widely applied. The expression is y ═ w' x + e, and e is a normal distribution with an error following a mean value of 0.
The regression analysis, which includes only one independent variable and one dependent variable and the relationship between them can be approximately expressed by a straight line, is called unitary linear regression analysis. If two or more independent variables are included in the regression analysis and there is a linear relationship between the dependent variable and the independent variable, it is called a multiple linear regression analysis.
In this embodiment, the fitting is performed by connecting a series of points on the plane by a smooth curve. Because of the myriad possibilities for this curve, there are various methods of fitting. The fitted curve can be generally represented by a function, and different fitting names are provided according to the function.
Common fitting methods are, for example, the least squares curve fitting method, in MATLAB polyfit can also be used to fit the polynomial. Fitting and interpolation as well as approximation are three major basic tools for numerical analysis, which differ in a popular sense: the fit is a known row of points, close to them as a whole; interpolation is a known point column and passes completely through the point column; approximations are known curves, or point columns, that by approximating make a constructed function infinitely close to them.
306. When the linear regression coefficient is detected to meet a preset value, determining whether a target application program has the authority to call a target interface under a service scene;
in this embodiment, when it is detected that the linear regression coefficient satisfies the preset value, it is determined whether the target application program has an authority to call the target interface in a service scene. For example, if the linear regression coefficient, that is, the slope of the linear regression equation, is a non-positive number, it is proved that the number of the call requests in the wait queue is not in a rising trend in the preset time period, so that on the premise that the number of the call requests in the wait queue is not greater than the second preset number, the wait queue of the target interface still has a certain storage space, and therefore, in the embodiment of the present invention, it is determined that the target interface meets the call requirement.
307. If the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface;
308. judging whether the target interface meets the calling requirement or not based on the scene identification;
309. and if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
Steps 301 and 307-309 in this embodiment are similar to steps 101 and 103-105 in the first embodiment, and are not described herein again.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene or not based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Referring to fig. 4, a fourth embodiment of the interface invoking method for application programs according to the embodiments of the present invention includes:
401. generating a target interface calling request of a target application program in a corresponding service scene;
402. determining whether the target application program has the authority to call the target interface under the service scene based on the preset authority data and the target interface calling request;
403. determining whether the target interface calling request carries a scene identifier;
in this embodiment, the interface call request includes information related to a target interface requested to be called; the information related to the target interface may comprise at least one of: scene code, interface version, interface name, identification of target application program requesting to call target interface, and scene identification.
404. If the target interface calling request does not carry the scene identification, matching interface parameter information carried in the target interface calling request with structural data in a preset database;
in this embodiment, the structural data includes a sequence list obtained after all interfaces called by the target application program to complete the target service in the scene of the target service are arranged according to the calling sequence.
Specifically, the structure data may be obtained by persisting, in advance, information related to an interface that needs to be called to complete the target service in the scene of the target service.
It should be noted that the calling sequence in the above structure data table is only an example, and in practical applications, the preset calling sequence is not necessarily a preceding interface that is successfully called, that is, a subsequent interface that is successfully called. For example, after the "networking check" interface is set in advance to be successfully called, a "face recognition" interface and a "fingerprint recognition" interface can be called; for another example, only after the face recognition interface and the fingerprint recognition interface are successfully called, the password setting interface can be called; for another example, after any one of the "face recognition" interface and the "fingerprint recognition" interface is successfully called or both interfaces are successfully called, a "password setting" interface and the like can be called. That is, the specific calling sequence may be preset or adjusted according to the actual service requirement, and the application is not limited herein.
405. Determining a calling code corresponding to the target interface according to the matching result;
in this embodiment, the call code corresponding to the target interface in the data structure information refers to a call code in which, in all interfaces called by the target application program to complete the target service in the target service scene, the target interfaces are arranged according to the call sequence. Optionally, the calling code of the target interface is determined by matching the related information of the target interface with the data structure information.
406. If the target interface calling request carries a scene identifier, marking the scene identifier as a scene identifier corresponding to the service scene and the target interface;
in this embodiment, if the target interface call request carries a scene identifier, the scene identifier is marked as a scene identifier corresponding to a service scene and a target interface, and it is determined whether the target interface meets a call condition in the field of the internet technology.
407. Judging whether the target interface meets the calling requirement or not based on the scene identification;
408. and if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
The steps 401-.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Referring to fig. 5, a fifth embodiment of the interface calling method for an application program according to the embodiment of the present invention includes:
501. generating a target interface calling request of a target application program in a corresponding service scene;
502. determining whether the target application program has the authority to call the target interface under the service scene based on the preset authority data and the target interface calling request;
503. if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface;
504. determining whether there is interface execution data corresponding to the scene identification based on the scene identification;
in this embodiment, the interface execution data includes related information generated in a process of calling an interface in the scenario of the target service. It should be noted that, in the process of requesting to complete the target service by the target application under the scene identifier, if a certain interface is successfully called, the information about the interface that is successfully called and corresponds to the scene identifier is cached. Illustratively, the cached related information that the interface has been successfully called includes a scene identifier corresponding to the interface and a calling code of the interface.
505. If the interface execution data does not exist, determining that the target interface corresponding to the scene identifier meets the calling condition;
in this embodiment, if it is determined that interface execution information that completes a target service in a scene of the target service and is cached before, which corresponds to the scene identifier, does not exist in the cache, it indicates that any interface in the scene of the target service is not successfully called before in the scene identifier, that is, the target interface is actually the first interface to be called in the scene of the target service, and therefore the call to the target interface inevitably satisfies a preset call sequence, and it may be directly determined that the target interface satisfies a call condition in the scene identifier.
506. If the interface execution data exists, acquiring a calling code corresponding to a last successfully called interface under the scene identification, and determining whether the target interface meets the calling requirement or not when the calling code corresponding to the target interface is the next calling code of the calling code corresponding to the last successfully called interface;
in this embodiment, if interface execution information that completes the target service in the scene of the target service and is cached before corresponding to the scene identifier exists, it indicates that a certain interface in the scene of the target service has been successfully called before, and at this time, it is necessary to further determine whether a calling sequence in which the target application program calls the target interface is correct, so as to avoid that the target interface is called to generate a "horizontal override" event when a previous interface of the target interface is not successfully called according to a preset calling sequence.
Specifically, when the calling code corresponding to the target interface is determined to be the next calling code of the calling code corresponding to the interface which is successfully called last according to the preset calling sequence, the target interface is determined to meet the calling condition. For example, corresponding to the above example, if the call code corresponding to the interface whose last call is successful is obtained from the cache, the call code is 3; matching the related information of the target interface with a pre-stored data structure information table 1, and determining that the calling code of the target interface is 4; and looking up the data structure information table 1 again, and determining that the calling code 4 is the next serial number of the calling code 3, and determining that the target interface meets the calling condition.
507. And if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
Steps 501-503 and 507 in this embodiment are similar to steps 101-103 and 105 in the first embodiment, and are not described again here.
In the embodiment of the invention, a target interface call request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
With reference to fig. 6, the method for calling an interface of an application program in the embodiment of the present invention is described above, and an interface calling device of an application program in the embodiment of the present invention is described below, where a first embodiment of the interface calling device of an application program in the embodiment of the present invention includes:
a generating module 601, configured to generate a target interface call request of a target application in a corresponding service scenario;
a first determining module 602, configured to determine, based on preset permission data and the target interface call request, whether the target application has permission to call the target interface in the service scenario;
a second determining module 603, configured to determine a scene identifier corresponding to the target interface for the service scene if the target application has permission to call the target interface in the service scene;
a determining module 604, configured to determine whether the target interface meets a call requirement based on the scene identifier;
a calling module 605, configured to call, if the target interface meets a calling requirement, a corresponding system service through the target interface.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene or not based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Referring to fig. 7, a second embodiment of the interface calling device of the application program according to the embodiment of the present invention specifically includes:
a generating module 601, configured to generate a target interface call request of a target application in a corresponding service scenario;
a first determining module 602, configured to determine, based on preset permission data and the target interface call request, whether the target application has permission to call the target interface in the service scenario;
a second determining module 603, configured to determine a scene identifier corresponding to the service scene and the target interface if the target application has an authority to call the target interface in the service scene;
a determining module 604, configured to determine whether the target interface meets a call requirement based on the scene identifier;
a calling module 605, configured to call, if the target interface meets a calling requirement, a corresponding system service through the target interface.
In this embodiment, the generating module 601 is specifically configured to:
acquiring interface parameters of the target interface;
packaging the interface name of the target interface and the interface parameters of the target interface to obtain a character string in a preset format;
encrypting the character string based on a preset key to obtain an encrypted character string;
and creating a Key-value pair set, replacing a value in the Key-value pair set with the encrypted character string, and setting a Key value in the Key-value pair set as a Key to obtain a target interface call request of a target application program in a corresponding service scene.
In this embodiment, the first determining module 602 is specifically configured to: acquiring queue data corresponding to the target interface based on preset authority data;
if the number of times of calling the target interface in the queue data is less than the preset number of times, the target application program has the authority to call the target interface under the service scene;
if the number of times of calling the target interface in the queue data is greater than the preset number of times, calculating the number of times of calling requests corresponding to the queue data in a preset time period according to the receiving time of the calling requests, and generating the relation between the calling times and the calling requests in the preset time period;
fitting the calling frequency relation with the calling request in the preset time period based on a preset linear regression algorithm, and calculating a linear regression coefficient of the linear regression algorithm;
and when the linear regression coefficient is detected to meet a preset value, determining whether the target application program has the authority to call the target interface under the service scene.
In this embodiment, the second determining module 603 includes:
a first determining unit 6031, configured to determine whether the target interface call request carries a scene identifier;
a second determining unit 6032, configured to determine, if the target interface call request does not carry the scene identifier, a call code corresponding to the target interface in a preset database;
a marking unit 6033, configured to mark the scene identifier as a scene identifier corresponding to the service scene and the target interface if the target interface invocation request carries the scene identifier.
In this embodiment, the second determining unit 6032 is specifically configured to:
matching interface parameter information carried in the target interface calling request with structural data in a preset database;
and determining a calling code corresponding to the target interface according to the matching result.
In this embodiment, the determining module 604 is specifically configured to:
determining whether there is interface execution data corresponding to the scene identification based on the scene identification;
if the interface execution data does not exist, determining that the target interface corresponding to the scene identification meets the calling condition;
if the interface execution data exists, acquiring a calling code corresponding to the last successfully called interface under the scene identification, and determining whether the target interface meets the calling requirement when the calling code corresponding to the target interface is consistent with the next calling code of the calling code corresponding to the last successfully called interface.
In the embodiment of the invention, a target interface calling request of a target application program under a corresponding service scene is generated; determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request; if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface; judging whether the target interface meets the calling requirement or not based on the scene identification; and if the target interface meets the calling requirement, calling the corresponding system service through the target interface. The invention sets the identification position on the target calling interface and records the calling times of the interface, thereby avoiding the malicious calling of the interface, improving the utilization rate of production resources and ensuring that the system is more stable.
Fig. 6 and fig. 7 describe the interface calling device of the application program in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the interface calling device of the application program in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 8 is a schematic structural diagram of an interface calling device for an application, where the interface calling device 800 for an application may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 810 (e.g., one or more processors) and a memory 820, and one or more storage media 830 (e.g., one or more mass storage devices) for storing an application 833 or data 832. Memory 820 and storage medium 830 may be, among other things, transitory or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown), and each module may include a series of instruction operations in the interface calling device 800 to the application program. Still further, the processor 810 may be configured to communicate with the storage medium 830, and execute a series of instruction operations in the storage medium 830 on the interface calling apparatus 800 of the application program, so as to implement the steps of the interface calling method of the application program provided by the above-mentioned method embodiments.
The application's interface invocation device 800 may also include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input-output interfaces 860, and/or one or more operating systems 831, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that the interface-invoking device structure of the application program illustrated in fig. 8 does not constitute a limitation of the interface-invoking device of the application program provided herein, and may include more or fewer components than illustrated, or some components in combination, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the instructions cause the computer to execute the steps of the interface calling method of the application program.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. 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 and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a portable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An interface calling method of an application program, the interface calling method of the application program comprising:
generating a target interface calling request of a target application program in a corresponding service scene;
determining whether the target application program has the authority to call the target interface under the service scene or not based on preset authority data and the target interface calling request;
if the target application program has the authority to call the target interface in the service scene, determining a scene identifier corresponding to the service scene and the target interface;
judging whether the target interface meets the calling requirement or not based on the scene identification;
and if the target interface meets the calling requirement, calling the corresponding system service through the target interface.
2. The method according to claim 1, wherein the generating a target interface call request of the target application program in the corresponding service scenario comprises:
acquiring interface parameters of the target interface;
packaging the interface name of the target interface and the interface parameters of the target interface to obtain a character string in a preset format;
encrypting the character string based on a preset key to obtain an encrypted character string;
and creating a Key-value pair set, replacing a value in the Key-value pair set with the encrypted character string, and setting a Key value in the Key-value pair set as a Key to obtain a target interface call request of a target application program in a corresponding service scene.
3. The method for calling the interface of the application program according to claim 1, wherein the determining whether the target application program has the authority to call the target interface in the service scenario based on the preset authority data and the target interface call request comprises:
acquiring queue data corresponding to the target interface based on preset authority data;
if the number of times of calling the target interface in the queue data is less than a preset number of times, the target application program has the authority to call the target interface in the service scene;
if the number of times of calling the target interface in the queue data is larger than a preset number of times, calculating the number of times of calling requests corresponding to the queue data in a preset time period according to the receiving time of the calling requests, and generating a relation between the calling times and the calling requests in the preset time period;
fitting the calling frequency relation with the calling request in the preset time period based on a preset linear regression algorithm, and calculating a linear regression coefficient of the linear regression algorithm;
and when the linear regression coefficient is detected to meet a preset value, determining whether the target application program has the authority to call the target interface in the service scene.
4. The method for calling an interface of an application program according to claim 1, wherein the determining the scene identifier corresponding to the service scene and the target interface comprises:
determining whether the target interface calling request carries a scene identifier;
if the target interface calling request does not carry the scene identification, determining a calling code corresponding to the target interface in a preset database;
and if the target interface calling request carries the scene identification, marking the scene identification as the scene identification corresponding to the service scene and the target interface.
5. The method according to claim 4, wherein the determining the corresponding calling code of the target interface in the preset database comprises:
matching interface parameter information carried in the target interface calling request with structural data in a preset database;
and determining a calling code corresponding to the target interface according to the matching result.
6. The method of claim 1, wherein the determining whether the target interface meets a calling requirement based on the scene identifier comprises:
determining whether interface execution data corresponding to the scene identification exists or not based on the scene identification;
if the interface execution data does not exist, determining that the target interface corresponding to the scene identification meets the calling condition;
if the interface execution data exists, acquiring a calling code corresponding to the last successfully called interface under the scene identification, and determining whether the target interface meets the calling requirement when the calling code corresponding to the target interface is consistent with the next calling code of the calling code corresponding to the last successfully called interface.
7. An interface invoking device for an application program, comprising:
the generation module is used for generating a target interface calling request of a target application program under a corresponding service scene;
the first determining module is used for determining whether the target application program has the authority to call the target interface under the service scene based on preset authority data and the target interface calling request;
a second determining module, configured to determine a scene identifier corresponding to the target interface and the service scene if the target application has a right to call the target interface in the service scene;
the judging module is used for judging whether the target interface meets the calling requirement or not based on the scene identifier;
and the calling module is used for calling the corresponding system service through the target interface if the target interface meets the calling requirement.
8. The interface calling apparatus of an application program according to claim 7, wherein the second determining module comprises:
a first determining unit, configured to determine whether the target interface call request carries a scene identifier;
a second determining unit, configured to determine, if the target interface call request does not carry the scene identifier, a call code corresponding to the target interface in a preset database;
and the marking unit is used for marking the scene identifier as a scene identifier corresponding to the service scene and the target interface if the target interface calling request carries the scene identifier.
9. An interface call apparatus for an application program, comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invoking the instructions in the memory to cause the application program's interface call device to perform the steps of the application program's interface call method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the interface call method of an application program according to any one of claims 1 to 6.
CN202210449992.0A 2022-04-27 2022-04-27 Interface calling method, device, equipment and storage medium of application program Pending CN114924783A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210449992.0A CN114924783A (en) 2022-04-27 2022-04-27 Interface calling method, device, equipment and storage medium of application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210449992.0A CN114924783A (en) 2022-04-27 2022-04-27 Interface calling method, device, equipment and storage medium of application program

Publications (1)

Publication Number Publication Date
CN114924783A true CN114924783A (en) 2022-08-19

Family

ID=82807464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210449992.0A Pending CN114924783A (en) 2022-04-27 2022-04-27 Interface calling method, device, equipment and storage medium of application program

Country Status (1)

Country Link
CN (1) CN114924783A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116540638A (en) * 2023-07-05 2023-08-04 成都瑞雪丰泰精密电子股份有限公司 Method, device and storage medium for post-processing CAM numerical control machining program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116540638A (en) * 2023-07-05 2023-08-04 成都瑞雪丰泰精密电子股份有限公司 Method, device and storage medium for post-processing CAM numerical control machining program
CN116540638B (en) * 2023-07-05 2023-09-05 成都瑞雪丰泰精密电子股份有限公司 Method, device and storage medium for post-processing CAM numerical control machining program

Similar Documents

Publication Publication Date Title
US20200092298A1 (en) Avoiding user session misclassification using configuration and activity fingerprints
CN111258725B (en) Data processing method, device, equipment and medium based on block chain
WO2021218328A1 (en) Multi-tenant access service implementation method, apparatus and device, and storage medium
CN111212075B (en) Service request processing method and device, electronic equipment and computer storage medium
CN110602052A (en) Micro-service processing method and server
US10778603B2 (en) Systems and methods for controlling access to broker resources
US10091179B2 (en) User authentication framework
CN101510881B (en) Method and device for providing web page
CN111290742A (en) Parameter verification method and device, electronic equipment and readable storage medium
US9922181B2 (en) Security model for network information service
CN103970758A (en) Database accessing system and method
WO2021013056A1 (en) Microservice-based data processing method and apparatus, and device and readable storage medium
CN111191221A (en) Method and device for configuring authority resources and computer readable storage medium
CN111143087A (en) Interface calling method and device, storage medium and server
CN111859368A (en) Weak password generation method, password detection method, device and electronic equipment
CN112165448B (en) Service processing method, device, system, computer equipment and storage medium
CN114924783A (en) Interface calling method, device, equipment and storage medium of application program
CN111241504B (en) Identity verification method, device, electronic equipment and storage medium
CN110233842B (en) Request verification method and related device
KR102362327B1 (en) Method and apparatus for providing virtual desktop environment based on biometric information of user
CN114489603A (en) Code generation method, apparatus, electronic device, medium, and product
CN113987035A (en) Block chain external data access method, device, system, equipment and medium
CN114816965A (en) Data verification method and device
CN116962170A (en) Management method of open interface, electronic device and storage medium
CN107517177B (en) Interface authorization method and device

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