CN111581578B - Interface request processing method and device - Google Patents

Interface request processing method and device Download PDF

Info

Publication number
CN111581578B
CN111581578B CN202010386400.6A CN202010386400A CN111581578B CN 111581578 B CN111581578 B CN 111581578B CN 202010386400 A CN202010386400 A CN 202010386400A CN 111581578 B CN111581578 B CN 111581578B
Authority
CN
China
Prior art keywords
interface
function
target
decorator
calling
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
CN202010386400.6A
Other languages
Chinese (zh)
Other versions
CN111581578A (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.)
Zhengzhou Xizhi Information Technology Co ltd
Original Assignee
Zhengzhou Xizhi Information 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 Zhengzhou Xizhi Information Technology Co ltd filed Critical Zhengzhou Xizhi Information Technology Co ltd
Priority to CN202010386400.6A priority Critical patent/CN111581578B/en
Publication of CN111581578A publication Critical patent/CN111581578A/en
Application granted granted Critical
Publication of CN111581578B publication Critical patent/CN111581578B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Abstract

The application provides an interface request processing method and device, wherein the method comprises the following steps: receiving an interface calling request sent by a browser, wherein the interface calling request is used for requesting to call an interface corresponding to an element in a webpage; obtaining an interface parameter value carried in the interface calling request, wherein the interface parameter value is used for representing a target interface which is requested to be called by the browser; determining a target view function in a decorator for invoking the target interface based on the interface parameter values; running the target view function decorated by the decorator to obtain interface data of the target interface; and returning the interface data to the browser so that the browser loads the element corresponding to the target interface in the webpage based on the interface data. The method and the device can realize the increase of the interface function in the interface calling process on the premise of not modifying the view function of the interface.

Description

Interface request processing method and device
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a method and an apparatus for processing an interface request.
Background
The browser may obtain the web page data from the server and present the web page data in the browser.
In general, a page of a web page is composed of a plurality of elements, for example, there may be a list or details in the page of the web page. Because the web page has many constituent elements, if the browser loads the web page after the server feeds back all the page data of the web page, the web page loading is inevitably slow, and the web page display effect is poor. In order to improve the webpage display effect, it is a trend to request the server to call the interfaces corresponding to the elements of the webpage in batches through the browser. After the browser requests the server to call the interface corresponding to an element in the webpage, if the browser receives interface data corresponding to the element returned by the server, the browser can load the element in the webpage based on the interface data, so that the time for a user to wait for the webpage to be displayed is reduced, and the webpage display effect is improved.
After the browser requests the server to call the interface corresponding to a certain element, the server determines a view function which needs to be executed to call the interface, and retrieves data of the interface by executing the view function. However, in practical applications, it is often necessary to add some uniform functions to the interfaces corresponding to the elements in the server, and in such a case, the view functions corresponding to the interfaces of the elements need to be modified. Because the number of view functions corresponding to each interface in the server is large, the complexity of modifying the view functions one by one is high, and much time is inevitably consumed.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for processing an interface request, so as to add a corresponding function to an interface and implement the corresponding function in an interface calling process on the premise that a view function of the interface does not need to be modified.
In order to achieve the above purpose, the present application provides the following technical solutions:
in one aspect, the present application provides an interface request processing method, including:
receiving an interface calling request sent by a browser, wherein the interface calling request is used for requesting to call an interface corresponding to an element in a webpage;
obtaining an interface parameter value carried in the interface calling request, wherein the interface parameter value is used for representing a target interface called by the browser request;
determining a target view function in a decorator for calling the target interface based on the interface parameter value;
running the target view function decorated by the decorator to obtain interface data of the target interface;
and returning the interface data to the browser so that the browser loads the element corresponding to the target interface in the webpage based on the interface data.
Preferably, before the determining, based on the interface parameter value, an object view function in the decorator for calling the object interface, the method further includes:
calling and operating a preset unified positioning function, wherein the unified positioning function is used for positioning view functions corresponding to different interfaces in the server;
the determining a target view function in a decorator for invoking the target interface based on the interface parameter values comprises:
and determining a target view function used for calling the target interface in the decorator based on the interface parameter value through the unified positioning function.
Preferably, the calling and running a preset unified positioning function includes:
calling and running a preset unified positioning function under the condition that the analyzed interface parameter information carried in the interface calling request is interface parameter information of a set type;
the obtaining of the interface parameter value carried in the interface calling request includes:
and obtaining the interface parameter value contained in the interface parameter information.
Preferably, the decorator stores names of view functions corresponding to different interfaces and names of function modules where the view functions are located;
the determining a target view function in a decorator for invoking the target interface based on the interface parameter values comprises:
and determining the target view function from the target function module in the decorator based on the name of the target function module represented by the interface parameter value and the name of the target view function in the target function module.
Preferably, before the receiving the interface call request sent by the browser, the method further includes:
loading the decorator in a memory;
the running the objective view function decorated using the decorator, comprising:
and operating the target view function decorated by the decorator in the memory.
In another aspect, the present application further provides an interface request processing apparatus, including:
the device comprises a request receiving unit, a request processing unit and a processing unit, wherein the request receiving unit is used for receiving an interface calling request sent by a browser, and the interface calling request is used for requesting to call an interface corresponding to an element in a webpage;
a parameter obtaining unit, configured to obtain an interface parameter value carried in the interface calling request, where the interface parameter value is used to represent a target interface that the browser requests to call;
the function positioning unit is used for determining a target view function used for calling the target interface in the decorator based on the interface parameter value;
a function running unit, configured to run the target view function decorated by the decorator, to obtain interface data of the target interface;
and the data returning unit is used for returning the interface data to the browser so that the browser loads the element corresponding to the target interface in the webpage based on the interface data.
Preferably, the method further comprises the following steps:
a general function calling unit, configured to call and run a preset uniform positioning function before the function positioning unit determines a target view function in the decorator, where the target view function is used to call the target interface, and the uniform positioning function is used to position view functions corresponding to different interfaces in the server;
the function positioning unit is specifically configured to determine, based on the interface parameter value, a target view function in the decorator for calling the target interface through the unified positioning function.
Preferably, the universal function calling unit is specifically configured to call and run a preset unified positioning function when the interface parameter information carried in the interface calling request is analyzed to be the interface parameter information of the set type;
the parameter obtaining unit is specifically configured to obtain an interface parameter value included in the interface parameter information.
Preferably, when determining, based on the interface parameter values, a target view function used for calling the target interface in the decorator, the function positioning unit specifically determines, based on a name of a target function module represented by the interface parameter values and a name of the target view function in the target function module, the target view function from within the target function module in the decorator, where names of view functions corresponding to different interfaces and a name of a function module where the view function is located are stored in the decorator.
Preferably, the method further comprises the following steps:
the preloading unit is used for loading the decorator in a memory before the request receiving unit receives the interface calling request sent by the browser;
the function execution unit is specifically configured to execute the target view function decorated by the decorator in the memory.
According to the technical scheme, the decorator is used for decorating view functions of different interfaces, and after the server receives an interface calling request sent by the browser, a target view function corresponding to the interface requested to be called by the browser can be determined from the decorator according to interface parameter values carried in the interface calling request. Under the condition that the server needs to add a certain function to each interface, the server can only add codes of corresponding functions in the decorator without modifying view functions corresponding to each interface, correspondingly, after determining the target view function corresponding to the interface, which is requested to be called by the browser, in the decorator, the interface calling with the corresponding functions can be realized by operating the target view function decorated by the decorator, so that on the premise of not modifying the view functions of each interface, the corresponding functions can be added to each interface, the corresponding functions are realized in the interface calling process, and the complexity and the time consumption caused by modifying the view functions are greatly reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart illustrating an embodiment of an interface request processing method according to the present application;
FIG. 2 is a flow chart illustrating a method for processing an interface request according to another embodiment of the present application;
fig. 3 is a schematic diagram illustrating a component structure of an interface request processing apparatus according to the present application.
Detailed Description
The method and the device for calling the interfaces of the elements in the webpage are suitable for a scene that the browser requests the server to call the interfaces of the elements in the webpage, and through the method and the device for calling the interfaces of the webpage, under the condition that a certain function needs to be added to each interface of each webpage in the server, view functions of each interface do not need to be modified, complexity of adding a certain function to the interface is greatly reduced, and time consumed is naturally reduced.
The server mentioned in the present application may be an independent server, or may also be a server cluster, a distributed server, or a server in a cloud platform, and the like, which is not limited herein.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, which shows a flowchart of an embodiment of the interface request processing method according to the present application, the method of the present embodiment may be applied to any type of server mentioned above.
The method of the embodiment comprises the following steps:
s101, receiving an interface calling request sent by a browser.
The interface calling request is used for requesting to call an interface corresponding to an element in the webpage.
In the embodiment of the present application, each element in the web page corresponds to an interface of the server system, and the data of the element in the web page can be acquired by calling the interface of the element in the web page.
For example, assume that a web page requested to be presented by a browser contains a list and a table. Then the browser may send an interface to the server that calls the list in the web page to request data for the list and to facilitate presentation of the form in the web page. Correspondingly, the browser can also request to call an interface corresponding to the form in the web page to obtain data of the form, so that the form is presented in the web page.
It will be appreciated that the browser may send one or more interface call requests for different elements of the web page at a time, but the operational procedures performed for each interface that is called by the request are the same.
And S102, obtaining the interface parameter value carried in the interface calling request.
The interface parameter value is used for representing a target interface which is called by the browser request. For the sake of distinction, the interface requested to be called by the interface call request is referred to as a target interface.
S103, determining a target view function in the decorator for calling the target interface based on the interface parameter value.
The decorator is essentially a python function, which can add additional functions to other functions without changing any code. Python is a cross-platform computer programming language, and is a high-level scripting language combining interpretability, compilability, interactivity and object-oriented.
That is, the decorator is a function for expanding the original function, and aims to add a new function to the function without changing the original function name (or class name). The function of the decorator is peculiar in that its return value is also a function that embeds the original function.
On the basis, the server side of the application can decorate the view function of each interface by using the decorator, and therefore, the decorator can obtain the view function of each decorated interface.
The decorator can be provided with codes for realizing corresponding functions according to the functions newly added for each interface as required so as to decorate the view functions of each interface in the decorator. Correspondingly, the code for realizing the corresponding function in the decorator is combined with the view function of the interface, so that the corresponding function can be added to the interface.
For example, assuming that the execution duration of the view function of each interface needs to be counted, on the basis that the view function of each interface is stored in the decorator, a function code for counting the execution duration of each view function is newly added in the decorator, so that the duration required by the interface call can be obtained while the interface call is realized by executing the view function through the decorator.
It can be understood that, since the view function is located in the decorator in the present application, the view function will generally be located in a certain function module of the decorator, and therefore, when locating the view function of the interface, it is necessary to determine which view function of which function module of the decorator the view function of the interface is. Specifically, names of view functions corresponding to different interfaces and names of function modules where the view functions are located are stored in the decorator.
Correspondingly, the interface parameter value carried by the interface calling request in the application is different from the parameter information carried by the existing interface calling request. In the embodiment of the present application, the interface parameter value is a character string composed of a name of a target view function corresponding to a target interface requested to be called by a browser and a name of a target function module in which the target function is located. On the basis, the application can determine the target view function from the target function module in the decorator based on the name of the target function module represented by the interface parameter value and the name of the target view function in the target function module.
For example, a view function 1 corresponding to the interface 1 is stored in the decorator, the function name of the view function 1 is a function aa, and the view function 1 is in the function module a; the view function 2 corresponding to the interface 2 is stored in the decorator, the function name of the view function 2 is the function bb, and the view function 2 is in the function module B. On the basis, the decorator may store the view function of each interface in the form of a key value, for example, the key of view function 1 is function aa, function module a, and the value is the view function 1. The same is true for view function 2. On this basis, if the browser needs to call the interface 1, the interface parameter value carried in the interface call request sent by the browser should be a key of the view function 1, for example, the interface parameter value may be a character string composed of the function aa and the functional module a, and accordingly, based on the interface parameter value, each key-value pair may be queried, so as to locate the view function 1 in the functional module a.
It can be understood that the server determines that the view function of the interface needs to be based on the routing rule, and since the view functions of different interfaces are different, different routing rules are set for different interfaces respectively, and then multiple routing rules need to be maintained. For example, if a server has 100 interfaces, 100 routing rules may need to be set to locate the view functions of the 100 interfaces respectively, which increases the complexity of developing and maintaining the routing rules by developers.
In one example, in order to reduce the number of routes that the server needs to maintain, the present application configures the same routing rule for all interfaces, where in the routing rule, any interface points to the same uniform positioning function, and the uniform positioning function is used to position view functions corresponding to different interfaces in the server. Therefore, the server side only needs to maintain one routing rule no matter the number of interfaces in the server side. The routing rule defines that the interface call request points to a universal unified positioning function.
Correspondingly, the preset unified positioning function can be called and operated in response to the interface calling request. On the basis, the corresponding target view function in the decorator can be determined through the unified positioning function based on the interface parameter value. The process of locating the target view function through the unified locating function is similar to that described above, and will not be described herein again.
As an optional manner, in order to distinguish that the interface call request is a call request of a view function requiring positioning of an interface through a general uniform positioning function, in the present application, interface parameter information carried by the interface call request is interface parameter information of a set type, where the interface parameter information includes the aforementioned interface parameter value. For example, the interface parameter information may carry, in addition to the interface parameter value, identification information for representing that the interface parameter information is interface parameter information of a set type.
Correspondingly, under the condition that the interface parameter information carried in the interface calling request is analyzed to be the interface parameter information of the set type, the preset unified positioning function is called and operated. The following description will be made in detail with reference to an embodiment, which is not repeated herein.
S104, running the target view function decorated by the decorator to obtain the interface data of the target interface.
It can be understood that the view function in the decorator is the view function decorated by the decorator, and therefore, the target view function is the view function decorated by the decorator, in this case, while the target view function decorated by the decorator is executed, other function codes (i.e. function codes corresponding to other functions added to the interface) used for decorating the target view function in the decorator are also called and executed synchronously, so that in the process of calling the interface, other functions added to the interface are implemented.
For example, still taking the previous example that the call duration of each interface needs to be counted, a timing code for counting the execution duration of the view function may exist in the decorator, and on this basis, when the target view function using the decorator is run, the timing code is started, the execution start time of the target view function is recorded, and finally the execution end time of the target view function is recorded, so as to obtain the call duration of the interface.
The interface data of the target interface is data obtained by operating a target view function of the decorator, and the interface data is data required by the browser to display an element corresponding to the target interface.
As an optional manner, the server of the present application may load the decorator in the memory in advance, and in this case, the server may directly run the target view function decorated by the decorator in the memory.
And S105, returning the interface data to the browser, so that the browser loads the element corresponding to the target interface in the webpage based on the interface data.
In the embodiment of the application, the browser can load the corresponding element in the webpage based on the interface data only after obtaining the interface data of the interface corresponding to the element in the webpage returned by the server, and does not need to wait for the interface data of all the elements in the whole webpage to return and load the element.
Therefore, in the scheme of the application, the decorator is used for decorating view functions of different interfaces, and after the server receives an interface calling request sent by the browser, a target view function corresponding to the interface requested to be called by the browser can be determined from the decorator according to an interface parameter value carried in the interface calling request. Under the condition that the server needs to add a certain function to each interface, the server can only add codes of corresponding functions in the decorator without modifying view functions corresponding to each interface, correspondingly, after determining the target view function corresponding to the interface requested to be called by the browser in the decorator, the interface calling with the corresponding functions can be realized by operating the target view function decorated by the decorator, so that the corresponding functions can be added to each interface on the premise of not modifying the view functions of each interface, and the complexity and the time consumption caused by modifying the view functions are greatly reduced.
Meanwhile, the view functions of the interfaces are stored in the decorator, and the function annotations of the view functions of the interfaces can be directly obtained through the decorator, so that the view function related function annotations can be directly derived from the decorator and used for generating development documents required to be maintained by developers and provided for front-end developers such as browsers, the developers do not need to independently write or adjust the development documents after developing or modifying the view functions, and the complexity of generating and maintaining the development documents is reduced.
For convenience of understanding, the interface request processing method of the present application is described below by taking a case of the present application as an example. For example, referring to fig. 2, which shows a flowchart of another embodiment of the interface request processing method of the present application, the method of the present embodiment is applied to the aforementioned server.
The method of the embodiment may include:
s201, loading a decorator in the memory.
The decorator stores the view functions of different interfaces and the related information such as the names of the view functions.
It should be noted that, this step S201 is not a step that is necessarily performed by the interface call request, and is only performed in advance by the server before processing the interface call request, and this step may be performed only once, and need not be performed each time before receiving the interface call request.
S202, receiving an interface calling request sent by the browser.
The interface calling request is used for requesting to call an interface corresponding to an element in the webpage.
And S203, under the condition that the interface parameter information carried in the interface calling request is analyzed to be the interface parameter information of the set type, obtaining the interface parameter value contained in the interface parameter information, and calling and operating the preset unified positioning function.
The interface parameter information is information related to the calling interface carried in the interface calling request. For example, the interface parameter information includes the interface parameter value, and may also carry a specific identifier, where the specific identifier may represent that the interface parameter information is interface parameter information of a set type.
For example, taking an interface of a browser that needs to call a list in a web page as an example to explain:
the original interface call request may be: http:// www.a a.com/list, where "list" in the interface call request represents a path. The path may directly characterize the route corresponding to the interface, e.g., list corresponds to view function 1. The routes of different interfaces are different, and different routes need to be configured for different interfaces.
The same route can be configured for any interface call request: for example, api corresponds to a uniform positioning function. Correspondingly, the interface call request for calling the interface of the list in the web page is as follows: http:// www.a a. Com/api? The method = list, where "apimedhod = list" is interface path and parameter information, and according to a path "api" in the interface path and parameter information, the interface call request may be determined to be an interface call request that needs to be processed by a universal unified locator function. On the basis, a unified positioning function can be called, and a corresponding view function is matched from the decorator according to the interface path and the 'method = list' carried in the parameter information.
S204, determining a target view function corresponding to the interface parameter value in the decorator through the unified positioning function.
For example, the target view function is determined from the target function module in the decorator according to the name of the target function module represented by the interface parameter value and the name of the target view function in the target function module. For details, reference is made to the related descriptions of the foregoing embodiments, which are not described herein again.
S205, operating the target view function decorated by the decorator in the memory to obtain the interface data of the target interface.
S206, returning the interface data to the browser, so that the browser loads the elements corresponding to the target interface in the webpage based on the interface data.
The above steps S205 and S206 can refer to the related description of the previous embodiment, and are not described herein again.
In this embodiment, in addition to the beneficial effects mentioned in the foregoing embodiments, in this embodiment, since the interface parameter information carried by the interface invocation request is not the route required for invoking the interface, the risk of exposing the route is reduced, and the security of the route required for invoking each interface in the server is improved.
The application also provides an interface request processing device corresponding to the interface request processing method.
As shown in fig. 3, which is a schematic diagram illustrating a component structure of an embodiment of an interface request processing apparatus according to the present application, the apparatus of the present embodiment may be applied to a server.
The apparatus of this embodiment may include at least: a request receiving unit 301, a parameter obtaining unit 302, a function locating unit 303, a function executing unit 304, and a data returning unit 305.
The request receiving unit 301 is configured to receive an interface call request sent by a browser, where the interface call request is used to request to call an interface corresponding to an element in a web page;
a parameter obtaining unit 302, configured to obtain an interface parameter value carried in the interface calling request, where the interface parameter value is used to represent a target interface that the browser requests to call;
a function positioning unit 303, configured to determine, based on the interface parameter value, a target view function in the decorator for invoking the target interface;
a function executing unit 304, configured to execute the target view function decorated by using the decorator, and obtain interface data of the target interface;
a data returning unit 305, configured to return the interface data to the browser, so that the browser loads an element corresponding to the target interface in the web page based on the interface data.
In one possible implementation, the apparatus may further include:
a general function calling unit, configured to call and run a preset uniform positioning function before the function positioning unit determines a target view function in the decorator, where the target view function is used to call the target interface, and the uniform positioning function is used to position view functions corresponding to different interfaces in the server;
the function positioning unit is specifically configured to determine, based on the interface parameter value, a target view function in the decorator for calling the target interface through the unified positioning function.
Optionally, the universal function call unit is specifically configured to call and run a preset unified positioning function when the interface parameter information carried in the interface call request is analyzed to be interface parameter information of a set type;
the parameter obtaining unit is specifically configured to obtain an interface parameter value included in the interface parameter information.
In another possible implementation manner, in an embodiment of any one of the above apparatus, when the function positioning unit determines, based on the interface parameter value, an object view function in the decorator for invoking the object interface, specifically:
and determining the target view function from the target function module in the decorator based on the name of the target function module represented by the interface parameter value and the name of the target view function in the target function module, wherein the names of the view functions corresponding to different interfaces and the name of the function module in which the view function is positioned are stored in the decorator.
In yet another possible implementation manner, the apparatus may further include:
the preloading unit is used for loading the decorator in a memory before the request receiving unit receives the interface calling request sent by the browser;
correspondingly, the function running unit is specifically configured to run the target view function decorated by the decorator in the memory.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be embodied in other specific forms without departing from the spirit or scope of the present application. The present embodiment is an exemplary example only, and should not be taken as limiting, and the specific disclosure should not be taken as limiting the purpose of the application. For example, the division of the unit or the sub-unit is only one logical function division, and there may be another division manner in actual implementation, for example, a plurality of units or a plurality of sub-units are combined together. In addition, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
In addition, the systems and methods described, as well as the schematic illustrations of various embodiments, can be combined or integrated with other systems, modules, techniques, or methods without departing from the scope of this application. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The foregoing is directed to embodiments of the present invention, and it is understood that various modifications and improvements can be made by those skilled in the art without departing from the spirit of the invention.

Claims (6)

1. An interface request processing method, comprising:
receiving an interface calling request sent by a browser, wherein the interface calling request is used for requesting to call an interface corresponding to an element in a webpage;
obtaining an interface parameter value carried in the interface calling request, wherein the interface parameter value is used for representing a target interface which is requested to be called by the browser; the interface parameter value is a character string consisting of the name of a target view function corresponding to a target interface requested to be called by the browser and the name of a target function module where the target function is located;
determining a target view function in a decorator for calling the target interface based on the interface parameter value;
running the target view function decorated by the decorator to obtain interface data of the target interface;
returning the interface data to the browser so that the browser loads an element corresponding to the target interface in the webpage based on the interface data;
before the determining, based on the interface parameter value, a target view function in a decorator for calling the target interface, the method further includes: calling and operating a preset unified positioning function, wherein the unified positioning function is used for positioning view functions corresponding to different interfaces in a server; the determining a target view function in a decorator for invoking the target interface based on the interface parameter values comprises: determining a target view function in a decorator for calling the target interface based on the interface parameter value through the unified positioning function;
the decorator stores the names of view functions corresponding to different interfaces and the name of a functional module where the view function is located; the determining a target view function in a decorator for invoking the target interface based on the interface parameter values comprises: a character string composed of the name of the target function module characterized by the interface parameter value and the name of the target view function in the target function module; and determining the target view function from the target function module in the decorator according to the character string.
2. The method of claim 1, wherein said invoking and running a preset unified locator function comprises:
calling and running a preset unified positioning function under the condition that the analyzed interface parameter information carried in the interface calling request is interface parameter information of a set type;
the obtaining of the interface parameter value carried in the interface calling request includes:
and obtaining the interface parameter value contained in the interface parameter information.
3. The method according to claim 1, before the receiving the interface call request sent by the browser, further comprising:
loading the decorator in a memory;
the running the objective view function decorated using the decorator, comprising:
and operating the target view function decorated by the decorator in the memory.
4. An interface request processing apparatus, comprising:
the device comprises a request receiving unit, a request processing unit and a processing unit, wherein the request receiving unit is used for receiving an interface calling request sent by a browser, and the interface calling request is used for requesting to call an interface corresponding to an element in a webpage;
a parameter obtaining unit, configured to obtain an interface parameter value carried in the interface calling request, where the interface parameter value is used to represent a target interface that the browser requests to call;
the function positioning unit is used for determining a target view function used for calling the target interface in the decorator based on the interface parameter value; the interface parameter value is a character string consisting of the name of a target view function corresponding to a target interface requested to be called by the browser and the name of a target function module where the target function is located;
a function running unit, configured to run the target view function decorated by the decorator, to obtain interface data of the target interface;
a data returning unit, configured to return the interface data to the browser, so that the browser loads, in the web page, an element corresponding to the target interface based on the interface data;
further comprising: the universal function calling unit is used for calling and running a preset unified positioning function before the function positioning unit determines a target view function used for calling the target interface in the decorator, and the unified positioning function is used for positioning view functions corresponding to different interfaces in a server;
the function positioning unit is specifically configured to determine, based on the interface parameter value, a target view function in the decorator for calling the target interface through the unified positioning function;
when the function positioning unit determines a target view function used for calling the target interface in the decorator based on the interface parameter value, specifically, a character string composed of a name of a target function module represented by the interface parameter value and a name of the target view function in the target function module; and determining the target view function from the target function module in the decorator according to the character string, wherein the names of the view functions corresponding to different interfaces and the name of the function module where the view function is located are stored in the decorator.
5. The apparatus according to claim 4, wherein the generic function call unit is specifically configured to call and run a preset unified location function when the interface parameter information carried in the interface call request is analyzed as interface parameter information of a set type;
the parameter obtaining unit is specifically configured to obtain an interface parameter value included in the interface parameter information.
6. The apparatus of claim 4, further comprising:
the preloading unit is used for loading the decorator in a memory before the request receiving unit receives the interface calling request sent by the browser;
the function running unit is specifically configured to run the target view function decorated by the decorator in the memory.
CN202010386400.6A 2020-05-09 2020-05-09 Interface request processing method and device Active CN111581578B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010386400.6A CN111581578B (en) 2020-05-09 2020-05-09 Interface request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010386400.6A CN111581578B (en) 2020-05-09 2020-05-09 Interface request processing method and device

Publications (2)

Publication Number Publication Date
CN111581578A CN111581578A (en) 2020-08-25
CN111581578B true CN111581578B (en) 2022-11-29

Family

ID=72112127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010386400.6A Active CN111581578B (en) 2020-05-09 2020-05-09 Interface request processing method and device

Country Status (1)

Country Link
CN (1) CN111581578B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612546A (en) * 2020-12-24 2021-04-06 广州虎牙科技有限公司 Page loading method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866383A (en) * 2015-05-29 2015-08-26 北京金山安全软件有限公司 Interface calling method and device and terminal
AU2017203170A1 (en) * 2011-06-30 2017-06-15 Aconex Limited Improved Information management systems and methods
AU2017100556A4 (en) * 2016-06-12 2017-06-15 Apple Inc. User interfaces for transactions
CN108694040A (en) * 2017-02-15 2018-10-23 百度在线网络技术(北京)有限公司 Calling processing method and device, communication system
CN108897610A (en) * 2018-06-15 2018-11-27 上海陆家嘴国际金融资产交易市场股份有限公司 Method for scheduling task, device, computer equipment and storage medium
CN109347914A (en) * 2018-09-13 2019-02-15 郑州云海信息技术有限公司 A kind of method and device of the processing browse request based on Python Flask and decorator

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104503752A (en) * 2014-12-17 2015-04-08 青岛海信电器股份有限公司 Method and device for controlling webpage to call system functions in intelligent equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2017203170A1 (en) * 2011-06-30 2017-06-15 Aconex Limited Improved Information management systems and methods
CN104866383A (en) * 2015-05-29 2015-08-26 北京金山安全软件有限公司 Interface calling method and device and terminal
AU2017100556A4 (en) * 2016-06-12 2017-06-15 Apple Inc. User interfaces for transactions
CN108694040A (en) * 2017-02-15 2018-10-23 百度在线网络技术(北京)有限公司 Calling processing method and device, communication system
CN108897610A (en) * 2018-06-15 2018-11-27 上海陆家嘴国际金融资产交易市场股份有限公司 Method for scheduling task, device, computer equipment and storage medium
CN109347914A (en) * 2018-09-13 2019-02-15 郑州云海信息技术有限公司 A kind of method and device of the processing browse request based on Python Flask and decorator

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Decorator AOP框架的一卡通管理系统;李纯玉等;《计算机系统应用》;20090815(第08期);第137-141页 *

Also Published As

Publication number Publication date
CN111581578A (en) 2020-08-25

Similar Documents

Publication Publication Date Title
EP3876116B1 (en) Method and apparatus for running mini program, electronic device, and storage medium
CN106462407B (en) Code services for language independent scheduling
US9983892B2 (en) Deep linking to mobile application states through programmatic replay of user interface events
CN109391509A (en) A kind of method, system and the application server of more new application
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
CN108776587B (en) Data acquisition method and device, computer equipment and storage medium
CN110365724B (en) Task processing method and device and electronic equipment
CN102096582A (en) Off-line gadget integration development environment
AU2017245437B2 (en) Thin client for mapping system
CN110941779A (en) Page loading method and device, storage medium and electronic equipment
CN111581578B (en) Interface request processing method and device
CN113448650A (en) Live broadcast function plug-in loading method, device, equipment and storage medium
CN113626512A (en) Data processing method, device, equipment and readable storage medium
CN112068879A (en) Method and device for constructing client application development framework based on configuration
CN116776030A (en) Gray release method, device, computer equipment and storage medium
CN111158777A (en) Component calling method and device and computer readable storage medium
CN110633162A (en) Remote call implementation method and device, computer equipment and storage medium
CN111488286B (en) Method and device for independently developing Android modules
US11726818B1 (en) System for executing tasks in different programming languages
CN113704120A (en) Data transmission method, device, equipment and storage medium
CN110262846A (en) Interface loading method, system, computer equipment and storage medium based on module
CN112714148A (en) Interface configuration method, device, equipment and medium
CN112764802A (en) Business logic customization method and device, electronic equipment and storage medium
CN112000313A (en) Request response method, device, equipment and storage medium
CN113239328B (en) Service function acquisition method and device, electronic equipment and storage medium

Legal Events

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