CN114637554A - Interface calling method, device, equipment and storage medium - Google Patents

Interface calling method, device, equipment and storage medium Download PDF

Info

Publication number
CN114637554A
CN114637554A CN202210271252.2A CN202210271252A CN114637554A CN 114637554 A CN114637554 A CN 114637554A CN 202210271252 A CN202210271252 A CN 202210271252A CN 114637554 A CN114637554 A CN 114637554A
Authority
CN
China
Prior art keywords
uniform resource
interface
resource identifier
target
user
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.)
Granted
Application number
CN202210271252.2A
Other languages
Chinese (zh)
Other versions
CN114637554B (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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202210271252.2A priority Critical patent/CN114637554B/en
Publication of CN114637554A publication Critical patent/CN114637554A/en
Application granted granted Critical
Publication of CN114637554B publication Critical patent/CN114637554B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides an interface calling method, an interface calling device, interface calling equipment and a storage medium, wherein the method comprises the following steps: receiving user request information; the user request information comprises user label information and a user uniform resource identifier; adding the user label information to a preset position of a user uniform resource identifier to obtain an updated uniform resource identifier; matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; calling a target interface to execute a corresponding service logic of the target interface to obtain a first execution result; the target interface corresponds to a target uniform resource identifier; sending a first execution result to the user terminal; the method and the device for the application service can solve the problem that when the existing product software service provides the user customized application service, the correct service logic execution result cannot be fed back to the user.

Description

Interface calling method, device, equipment and storage medium
Technical Field
The application belongs to the technical field of internet, and particularly relates to an interface calling method, an interface calling device, interface calling equipment and a storage medium.
Background
The application service generally combines business and technology to build software to serve target customers, and the software application service is a product which can be produced and released in a large scale by standardizing and standardizing the technology and the service. In the research and development process of non-productized software application services, requirements proposed by demand parties in different industries are different, and requirements proposed by demand parties in different companies are different, so that the software application services are developed along with the requirements of customers in the research and development process, and finally, the software application services are thousands of people.
When the existing software service for production provides the user customized application service, the user customized interface code of the application is obtained by modifying the original standard interface code, the standard interface code structure is damaged, and a fault occurs when the interface is called, so that the correct business logic execution result can not be fed back to the user.
Disclosure of Invention
The embodiment of the application provides an interface calling method, an interface calling device, interface calling equipment and a storage medium, and can solve the problem that when an existing product software service provides a user customized application service, a correct service logic execution result cannot be fed back to the user.
In a first aspect, an embodiment of the present application provides an interface calling method, including:
receiving user request information; the user request information comprises user label information and a user uniform resource identifier;
adding the user label information to a preset position of a user uniform resource identifier to obtain an updated uniform resource identifier;
matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list;
calling a target interface to execute a corresponding service logic of the target interface to obtain a first execution result; the target interface corresponds to a target uniform resource identifier;
and sending the first execution result to the user terminal.
In one embodiment, before adding the user tag information to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier, the method further includes:
and acquiring a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service.
In one embodiment, prior to receiving the user request information, the method further comprises:
acquiring user tag information;
adding a new interface in the software service;
and adding user tag information at a preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.
In one embodiment, matching the target uniform resource identifier matching the updated uniform resource identifier from the preset uniform resource identifier list comprises:
comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm;
and determining the uniform resource identifier matched with the updated uniform resource identifier in the uniform resource identifier list as a target uniform resource identifier.
In one embodiment, the method further comprises:
storing user tag information in a thread context;
extracting user label information from the thread context under the condition that the target interface calls the lower layer interface;
extracting a plurality of implementation classes defined by a lower layer interface by calling a second preset interface;
determining a target implementation class from a plurality of implementation classes, wherein the implementation class tag annotation of the target implementation class is matched with the user tag information;
calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result;
and sending the second execution result to the target interface.
In one embodiment, the method further comprises:
and under the condition that the target implementation class does not exist, calling the standard implementation class to execute the service logic corresponding to the standard implementation class.
In one embodiment, prior to extracting user tag information from the thread context, the method further comprises:
and replacing original annotations in the abstract definition of the lower-layer interface with target implementation class annotation annotations, wherein the target implementation class annotation comprises standard implementation class annotation and customized implementation class annotation, the implementation class annotation comprises user tag information, the standard implementation class annotation corresponds to a standard implementation class, and the customized implementation class annotation corresponds to a target implementation class.
In a second aspect, an embodiment of the present application provides an interface invoking device, including:
the receiving module is used for receiving user request information; the user request information comprises user label information and a user uniform resource identifier;
the adding module is used for adding the user label information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier;
the matching module is used for matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list;
the execution module is used for calling the target interface to execute the corresponding business logic of the target interface to obtain a first execution result; the target interface corresponds to a target uniform resource identifier;
and the sending module is used for sending the first execution result to the user terminal.
In one embodiment, the apparatus further comprises an acquisition module;
the acquisition module is used for acquiring a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service before adding the user label information to a preset position of the user uniform resource identifier and obtaining the updated uniform resource identifier.
In one embodiment, the apparatus further comprises an acquisition module;
the acquisition module is used for acquiring user tag information before receiving user request information;
the adding module is also used for adding a new interface in the software service;
and the adding module is also used for adding user label information at the preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.
In an embodiment, the matching module is specifically configured to:
comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm;
and determining the uniform resource identifier matched with the updated uniform resource identifier in the uniform resource identifier list as a target uniform resource identifier.
In one embodiment, the device further comprises a storage module, an extraction module, a determination module and a calling module;
the storage module is used for storing the user tag information in the thread context;
the extraction module is used for extracting the user label information from the thread context under the condition that the target interface calls the lower layer interface;
the extraction module is also used for extracting a plurality of implementation classes defined by the lower layer interface by calling a second preset interface;
the determining module is used for determining a target implementation class from a plurality of implementation classes, and the implementation class mark annotation of the target implementation class is matched with the user tag information;
the calling module is used for calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result;
and the sending module is also used for sending the second execution result to the target interface.
In one embodiment, the calling module is further configured to:
and under the condition that the target implementation class does not exist, calling the standard implementation class to execute the service logic corresponding to the standard implementation class.
In one embodiment, prior to extracting user tag information from a thread context, the apparatus further comprises a replacement module;
and the replacing module is used for replacing the original annotation in the abstract definition of the lower layer interface with a target implementation class mark annotation, the target implementation class mark annotation comprises a standard implementation class mark annotation and a customized implementation class mark annotation, the implementation class mark annotation comprises user tag information, the standard implementation class mark annotation corresponds to the standard implementation class, and the customized implementation class mark annotation corresponds to the target implementation class.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the interface call method of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where an implementation program for information transfer is stored, and when the program is executed by a processor, the interface calling method of the first aspect is implemented.
In a fifth aspect, the present application provides a computer program product, and when executed by a processor of an electronic device, the instructions in the computer program product cause the electronic device to execute the interface calling method of the first aspect.
According to the interface calling method, the device, the equipment and the storage medium, after the user label information and the user uniform resource identifier are received, the user label information is added to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier, and then the target uniform resource identifier matched with the updated uniform resource identifier is matched from the preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users.
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 embodiments of the present application will be briefly described below, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an interface invoking device according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Features and exemplary embodiments of various aspects of the present application will be described in detail below, and in order to make objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by illustrating examples thereof.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The application service generally combines business and technology to build software to serve target customers, and the software application service is a product which can be produced and released in a large scale by standardizing and standardizing the technology and the service. In the research and development process of non-productized software application services, requirements proposed by demand parties in different industries are different, and requirements proposed by demand parties in different companies are different, so that the software application services are developed along with the requirements of customers in the research and development process, and finally, the software application services are thousands of people. However, in the research and development of the application service of the productized software, a product manager deeply researches the common requirements of a large number of demand groups, establishes a set of standardized and normalized processes on the basis, and guides users to execute the processes on the premise of meeting the requirements of the requirements. Therefore, reliability and stability requirements are pursued by the production software application service.
In the process of popularization of the software application service, due to the fact that different industry groups are oriented, industry comprehension abilities of product research personnel are different, industry deep mining abilities are different, industry dedication spirits are different, and formed standardized product requirement achievements are greatly different, so that the coverage of a solution of the software application service cannot reach 100% or 100%, the introduction of a customization requirement cannot be avoided, and at the moment, a product code needs to be changed to adapt to a new customization requirement.
The traditional product appointed modification mode is to add, modify and delete on the original code directly according to new requirements at the code level. The existing product transformation mode directly modifies the original code, and different logics are isolated by adopting logic encapsulation and IF ELSE grammar, so that the embedding of new requirements at the code level is realized.
Although the embedding mode can quickly respond to the customization requirement, the fast iteration is realized. Because of uncertain factors such as fuzzy demand, insufficient abstract production of the demand, short-time delivery pressure and the like of the new demand, the newly added code may become a one-time customized code and is seriously coupled with a standard product code, which is not beneficial to later maintenance. Moreover, different technicians have different abilities, habits and employment spirits, so that formed work results are very different, the original code structure is easy to damage, and a fault occurs during interface calling, so that a correct service logic execution result cannot be fed back to a user.
In order to solve the problem of the prior art, embodiments of the present application provide an interface calling method, apparatus, device, and storage medium. After receiving the user tag information and the user uniform resource identifier, the embodiment of the application adds the user tag information to the preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users. First, an interface calling method provided in the embodiment of the present application is described below.
Fig. 1 shows a flowchart of an interface calling method according to an embodiment of the present application. As shown in fig. 1, the method may include the steps of:
s110, receiving user request information.
The user request information may include user tag information and a user Uniform Resource Identifier (URI). The user tag information can identify different user terminals. The embodiment of the application can be applied to a World Wide Web (Web) server, and the Web server can receive user request information sent by a user terminal through an http protocol.
And S120, adding the user label information to a preset position of the user uniform resource identifier to obtain the updated uniform resource identifier.
After receiving the request, the Web server firstly enters the interceptor to extract the user request information carried in the request parameter, and extracts the user tag information from the user request information, wherein the user tag information can be preset according to user terminals of different companies or clients to which the user tag information belongs, and the user tag information is added to a preset position of the user uniform resource identifier and is further used for matching with the uniform resource identifier list.
And S130, matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list.
In one embodiment, S130: matching the target uniform resource identifier matched with the updated uniform resource identifier from the preset uniform resource identifier list may include:
and comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm.
And determining the uniform resource identifier matched with the updated uniform resource identifier in the uniform resource identifier list as a target uniform resource identifier.
The method comprises the steps that a preset uniform resource identifier list comprises a plurality of groups of uniform resource identifiers added with user tag information, based on the fact that the updated uniform resource identifiers are matched with the uniform resource identifier list, the uniform resource identifiers in the uniform resource identifier list consistent with the user tag information in the updated uniform resource identifiers can be quickly locked, all the uniform resource identifiers in the uniform resource identifier list are mapped with corresponding interfaces, and based on the mapping, a target interface corresponding to a user request can be quickly locked.
In one embodiment, at S110: before receiving the user request information, the method may further include:
and acquiring user tag information.
A new interface is added to the software service.
And adding user tag information at a preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.
In order to ensure that a target interface is determined quickly, before an application interface executes business logic, the interface in the application service is configured, specifically, user tag information is obtained firstly, then a new interface is added in the software service, and finally the user tag information is added at a preset position of a uniform resource identifier corresponding to the new interface to form a uniform resource identifier list. For example, if the framework of the application service is SpringMVC, the uniform resource identifier list is registered in the Spring IOC container through the requestmappinghandedmapping interface and cached in the local memory for application in S130 matching.
S140, calling the target interface to execute the corresponding service logic of the target interface to obtain a first execution result.
Wherein the target interface corresponds to the target uniform resource identifier. For example, in the SpringMVC architecture, business logic may be distributed to target interfaces through a dispatcher to execute the business logic.
S150, the first execution result is sent to the user terminal.
After calling the target interface to execute the corresponding service logic of the target interface to obtain the first execution result, the first execution result can be sent to the user terminal, and the correct service logic execution result is fed back to the user.
After receiving the user tag information and the user uniform resource identifier, the embodiment of the application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users.
In one embodiment, at S120: before the user tag information is added to the preset position of the user uniform resource identifier and the updated uniform resource identifier is obtained, the method may further include:
and acquiring a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service.
The uniform resource identifier list of the software service can be obtained from the preset container through a specific first preset interface. For example, if the framework of the application service is SpringMVC, the uniform resource identifier list may be registered in the Spring IOC container through the requestmappinghandedmapping interface and cached in the local memory, and the uniform resource identifier list may be acquired from the Spring IOC container through the requestmappinghandedmapping interface.
According to the embodiment of the application, the uniform resource identifier list of the software service is obtained from the preset container based on the first preset interface, so that the uniform resource identifier after subsequent updating is matched with the uniform resource identifier list conveniently, the target interface corresponding to the user request can be locked quickly, and the efficiency of returning the service logic execution result is high.
In one embodiment, the method may further comprise:
user tag information is stored in the thread context.
In the case where the target interface calls the underlying interface, the user tag information is extracted from the thread context.
And extracting a plurality of implementation classes defined by the lower layer interface by calling a second preset interface.
For example, taking a SpringMVC framework as an example, the second preset interface may be a SpringContext # getbasebytype interface.
A target implementation class is determined from a plurality of implementation classes.
Wherein the implementation class tag annotation of the target implementation class matches the user tag information. Taking the SpringMVC framework as an example, the target implementation class may be determined as follows: the encapsulated ServiceRouter router distributor calls a SpringContext # getBeanByType interface, extracts all implementation classes defined by lower interfaces at one time, and the implementation classes comprise a product standard implementation class and a customization implementation class. And then, carrying out hash matching on the user tag information and the mark annotation of the implementation class to match the unique implementation class, namely the target implementation class.
And calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result.
And sending the second execution result to the target interface.
The routing distributor can not acquire the user label information in the target interface and can not determine which implementation classes in the lower interface to be called, so that the user label information can be stored in the thread context to be conveniently acquired by the routing distributor in order to accurately call the lower interface, and the target implementation classes can be determined according to the routing distributor. After the target implementation class is determined from the multiple implementation classes, the target implementation class can be applied to execute the service logic corresponding to the target implementation class to obtain a second execution result, the second execution result is sent to the target interface, and the target interface can feed the second execution result back to the user terminal after receiving the second execution result.
According to the method and the device, the target implementation class is determined from the multiple implementation classes according to the user tag information, the target implementation class can be quickly locked under the condition that the target interface calls the lower-layer interface, the service logic corresponding to the target implementation class can be sent to the target interface after the target implementation class is applied to execute the service logic to obtain the second execution result, and efficient calling of the target interface for calling the lower-layer interface is achieved.
In one embodiment, the method may further comprise:
and under the condition that the target implementation class does not exist, calling the standard implementation class to execute the service logic corresponding to the standard implementation class.
If the target implementation class does not exist, the fact that the user request is not the customized implementation class or the customized implementation class of the user request is not preset is indicated, the service logic corresponding to the standard implementation class execution standard implementation class is called, and an alarm log is generated to remind a developer to determine whether the customized implementation class needs to be added or not.
In one embodiment, prior to extracting the user tag information from the thread context, the method may further comprise:
and replacing the original annotation in the abstract definition of the lower-layer interface with the target implementation class mark annotation.
The target implementation class tag annotation may include a standard implementation class tag annotation and a customized implementation class tag annotation, the implementation class tag annotation may include user tag information, the standard implementation class tag annotation corresponds to a standard implementation class, and the customized implementation class tag annotation corresponds to a target implementation class. The embodiment of the application distinguishes the standard implementation class from the customized implementation class in a tag annotation updating mode, codes of the original standard implementation class are not damaged, when the customized implementation class is realized, the customized implementation class can directly inherit the product standard implementation class, namely the standard implementation class can be directly realized, the customized implementation class can also be called, the standard implementation class and the customized implementation class are not interfered with each other, and the stability of application services is improved. Taking the springMVC framework as an example, the original annotation is @ Component annotation and @ Service annotation, and the target implementation class annotation is @ StandardComp annotation and @ PersonaliseComp annotation, wherein the former is the implementation class annotation of the product standard implementation definition interface, and the latter is the implementation class annotation of the customized implementation definition interface. The productized standard implementation class of the interface adds @ StandardComp to the class header for tagging, the custom implementation class adds @ personaliscomp to the class header, and adds user tag information, such as @ personaliscomp ("user tag information"), to the annotation parameter.
After receiving the user tag information and the user uniform resource identifier, the embodiment of the application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users. Through the embodiment, when the customized requirement is met, the newly added codes can be realized by isolating the original production standard through the newly added interfaces but sharing the uri and the same downstream interface definition, and only a few packaging block codes need to be added, so that the influence on the existing Web application service transformation is negligible, the purpose that the original interface and the newly added interface are not interfered is achieved, and the parallel service of the customized interface and the standard interface is realized.
Fig. 1 illustrates an interface calling method, and the following describes an apparatus provided in an embodiment of the present application with reference to fig. 2 and fig. 3.
Fig. 2 shows a schematic structural diagram of an interface invoking device according to an embodiment of the present application, where each module in the device shown in fig. 2 has a function of implementing each step in fig. 1, and can achieve its corresponding technical effect. As shown in fig. 2, the apparatus may include (in one embodiment, the apparatus may include):
and the receiving module is used for receiving the user request information. The user request information includes user tag information and a user uniform resource identifier.
And the adding module is used for adding the user label information to the preset position of the user uniform resource identifier to obtain the updated uniform resource identifier.
And the matching module is used for matching the target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list.
And the execution module is used for calling the target interface to execute the corresponding business logic of the target interface to obtain a first execution result. The target interface corresponds to a target uniform resource identifier.
And the sending module is used for sending the first execution result to the user terminal.
After receiving the user tag information and the user uniform resource identifier, the embodiment of the application adds the user tag information to the preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users.
In one embodiment, the apparatus further comprises an acquisition module.
The acquisition module is used for acquiring a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service before adding the user label information to a preset position of the user uniform resource identifier and obtaining the updated uniform resource identifier.
In one embodiment, the apparatus further comprises an acquisition module.
And the acquisition module is used for acquiring the user tag information before receiving the user request information.
And the adding module is also used for adding a new interface in the software service.
And the adding module is also used for adding user label information at the preset position of the uniform resource identifier corresponding to the new interface to obtain a uniform resource identifier list.
In an embodiment, the matching module is specifically configured to:
and comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm.
And determining the uniform resource identifier matched with the updated uniform resource identifier in the uniform resource identifier list as a target uniform resource identifier.
In one embodiment, the apparatus further comprises a storage module, an extraction module, a determination module, and a calling module.
And the storage module is used for storing the user tag information in the thread context.
And the extraction module is used for extracting the user label information from the thread context under the condition that the target interface calls the lower-layer interface.
And the extraction module is also used for extracting a plurality of implementation classes defined by the lower layer interface by calling a second preset interface.
And the determining module is used for determining a target implementation class from the multiple implementation classes, and the implementation class mark annotation of the target implementation class is matched with the user tag information.
And the calling module is used for calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result.
And the sending module is also used for sending the second execution result to the target interface.
In one embodiment, the calling module is further configured to:
and under the condition that the target implementation class does not exist, calling the standard implementation class to execute the service logic corresponding to the standard implementation class.
In one embodiment, the apparatus further comprises a replacement module prior to extracting the user tag information from the thread context.
And the replacing module is used for replacing the original annotation in the abstract definition of the lower layer interface with a target implementation class mark annotation, wherein the target implementation class mark annotation comprises a standard implementation class mark annotation and a customized implementation class mark annotation, the implementation class mark annotation comprises user tag information, the standard implementation class mark annotation corresponds to a standard implementation class, and the customized implementation class mark annotation corresponds to a target implementation class.
After receiving the user tag information and the user uniform resource identifier, the embodiment of the application adds the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier, and then matches a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list; executing the corresponding service logic of the target interface through the target interface corresponding to the target uniform resource identifier to obtain a first execution result and sending the first execution result to the user terminal; based on the updated uniform resource identifier and the uniform resource identifier list, the target interface corresponding to the user request can be quickly locked, and the efficiency of returning the service logic execution result is high; and because the target interface is a new interface added in the application service, the new interface is independent of the original standard interface in the application service, is not generated by modifying the original standard interface, and cannot damage the code structure of the original standard interface, so that the standard interface and the target interface of the application service can both feed back correct business logic execution results for users. Through the embodiment, when the customized requirements are met, the newly added codes can be realized by isolating the original product standard through the newly added interfaces but sharing the uri and the same downstream interface definition, the realization can be realized only by adding a plurality of packaging block codes, the influence on the existing Web application service transformation is negligible, the purpose that the original interface and the newly added interface are not interfered is achieved, and the parallel service of the customized interface and the standard interface is realized.
Fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 3, the apparatus may include a processor 301 and a memory 302 storing computer program instructions.
Specifically, the processor 301 may include a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present Application.
Memory 302 may include mass storage for data or instructions. By way of example, and not limitation, memory 302 may include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. In one example, memory 302 can include removable or non-removable (or fixed) media, or memory 302 is non-volatile solid-state memory. The memory 302 may be internal or external to the integrated gateway disaster recovery device.
In one example, the Memory 302 may be a Read Only Memory (ROM). In one example, the ROM may be mask programmed ROM, programmable ROM (prom), erasable prom (eprom), electrically erasable prom (eeprom), electrically rewritable ROM (earom), or flash memory, or a combination of two or more of these.
The processor 301 reads and executes the computer program instructions stored in the memory 302 to implement the method in the embodiment shown in fig. 1, and achieves the corresponding technical effect achieved by the embodiment shown in fig. 1 executing the method, which is not described herein again for brevity.
In one example, the electronic device can also include a communication interface 303 and a bus 310. As shown in fig. 3, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 to complete communication therebetween.
The communication interface 303 is mainly used for implementing communication between modules, apparatuses, units and/or devices in this embodiment.
Bus 310 includes hardware, software, or both to couple the components of the online data traffic billing device to each other. By way of example, and not limitation, a Bus may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus, FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) Bus, an infiniband interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a Micro Channel Architecture (MCA) Bus, a Peripheral Component Interconnect (PCI) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a video electronics standards association local (VLB) Bus, or other suitable Bus or a combination of two or more of these. Bus 310 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The electronic device may execute the interface calling method in the embodiment of the present application, so as to achieve the corresponding technical effect of the interface calling method described in fig. 1.
In addition, in combination with the interface calling method in the foregoing embodiment, the embodiment of the present application may provide a computer storage medium to implement. The computer storage medium having computer program instructions stored thereon; the computer program instructions, when executed by a processor, implement any of the interface call methods in the above embodiments.
It is to be understood that the present application is not limited to the particular arrangements and instrumentality described above and shown in the attached drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications, and additions or change the order between the steps after comprehending the spirit of the present application.
The functional blocks shown in the above-described structural block diagrams may be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic Circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the present application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Aspects of the present application are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based computer instructions which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As described above, only the specific embodiments of the present application are provided, and it can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the module and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered within the scope of the present application.

Claims (17)

1. An interface calling method, comprising:
receiving user request information; the user request information comprises user label information and a user uniform resource identifier;
adding the user label information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier;
matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list;
calling a target interface to execute a corresponding service logic of the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier; the target interface is a new interface added in the application service;
and sending the first execution result to the user terminal.
2. The interface invocation method according to claim 1, wherein, before adding the user tag information to the preset location of the user uniform resource identifier to obtain the updated uniform resource identifier, the method further comprises:
and acquiring a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service.
3. The interface invocation method of claim 1, wherein prior to receiving the user request information, the method further comprises:
acquiring user tag information;
adding a new interface in the application service;
and adding the user tag information at the preset position of the uniform resource identifier corresponding to the new interface to obtain the uniform resource identifier list.
4. The interface invocation method according to claim 1, wherein said matching a target uniform resource identifier from a preset list of uniform resource identifiers that matches said updated uniform resource identifier comprises:
comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm;
and determining the uniform resource identifier which is matched with the updated uniform resource identifier in the uniform resource identifier list as the target uniform resource identifier.
5. The interface call method of any one of claims 1-4, wherein the method further comprises:
storing the user tag information in a thread context;
under the condition that the target interface calls a lower-layer interface, extracting the user tag information from the thread context;
extracting a plurality of implementation classes defined by the lower layer interface by calling a second preset interface;
determining a target implementation class from the plurality of implementation classes, the implementation class markup annotations of the target implementation class matching the user tag information;
calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result;
and sending the second execution result to the target interface.
6. The interface call method as recited in claim 5, wherein said method further comprises:
and calling a standard implementation class to execute the service logic corresponding to the standard implementation class under the condition that the target implementation class does not exist.
7. The interface call method as recited in claim 6, wherein prior to extracting the user tag information from the thread context, the method further comprises:
replacing an original annotation in the abstract definition of the lower-layer interface with a target implementation class tag annotation, wherein the target implementation class tag annotation comprises a standard implementation class tag annotation and a customized implementation class tag annotation, the implementation class tag annotation comprises the user tag information, the standard implementation class tag annotation corresponds to the standard implementation class, and the customized implementation class tag annotation corresponds to the target implementation class.
8. An interface invoking device, comprising:
the receiving module is used for receiving user request information; the user request information comprises user label information and a user uniform resource identifier;
the adding module is used for adding the user label information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier;
the matching module is used for matching a target uniform resource identifier matched with the updated uniform resource identifier from a preset uniform resource identifier list;
the execution module is used for calling a target interface to execute the corresponding business logic of the target interface to obtain a first execution result; the target interface corresponds to the target uniform resource identifier; the target interface is a new interface added in the application service;
and the sending module is used for sending the first execution result to the user terminal.
9. The interface invocation device according to claim 8, wherein the device further includes an acquisition module;
the obtaining module is configured to obtain a uniform resource identifier list of the software service from a preset container through a first preset interface of the application service before adding the user tag information to a preset position of the user uniform resource identifier to obtain an updated uniform resource identifier.
10. The interface invocation device of claim 8, wherein the device further comprises an acquisition module;
the acquisition module is used for acquiring user tag information before receiving the user request information;
the adding module is also used for adding a new interface in the software service;
the adding module is further configured to add the user tag information to the preset position of the uniform resource identifier corresponding to the new interface to obtain the uniform resource identifier list.
11. The interface invoking device of claim 8, wherein the matching module is specifically configured to:
comparing the uniform resource identifier list with the updated uniform resource identifier through a preset hash algorithm;
and determining the uniform resource identifier which is matched with the updated uniform resource identifier in the uniform resource identifier list as the target uniform resource identifier.
12. The interface invocation device according to any one of claims 8-11, wherein the device further comprises a storage module, an extraction module, a determination module, and an invocation module;
the storage module is used for storing the user tag information in a thread context;
the extraction module is used for extracting the user tag information from the thread context under the condition that the target interface calls a lower-layer interface;
the extraction module is further used for extracting the plurality of implementation classes defined by the lower layer interface by calling a second preset interface;
the determining module is configured to determine a target implementation class from the multiple implementation classes, where an implementation class tag annotation of the target implementation class matches the user tag information;
the calling module is used for calling the target implementation class to execute the service logic corresponding to the target implementation class to obtain a second execution result;
the sending module is further configured to send the second execution result to the target interface.
13. The interface invocation device of claim 12, wherein the invocation module is further operable to:
and calling a standard implementation class to execute the service logic corresponding to the standard implementation class under the condition that the target implementation class does not exist.
14. The interface invocation device according to claim 13, wherein prior to extracting the user tag information from the thread context, the device further includes a replacement module;
the replacing module is configured to replace an original annotation in the abstract definition of the lower interface with a target implementation class tag annotation, where the target implementation class tag annotation includes a standard implementation class tag annotation and a customized implementation class tag annotation, the implementation class tag annotation includes the user tag information, the standard implementation class tag annotation corresponds to the standard implementation class, and the customized implementation class tag annotation corresponds to the target implementation class.
15. An electronic device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the interface call method according to any one of claims 1 to 7.
16. A computer-readable storage medium, on which an information transfer implementation program is stored, which, when executed by a processor, implements the interface call method according to any one of claims 1 to 7.
17. A computer program product, wherein instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the interface call method of any of claims 1 to 7.
CN202210271252.2A 2022-03-18 2022-03-18 Interface calling method, device, equipment and storage medium Active CN114637554B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210271252.2A CN114637554B (en) 2022-03-18 2022-03-18 Interface calling method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210271252.2A CN114637554B (en) 2022-03-18 2022-03-18 Interface calling method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114637554A true CN114637554A (en) 2022-06-17
CN114637554B CN114637554B (en) 2024-08-30

Family

ID=81950666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210271252.2A Active CN114637554B (en) 2022-03-18 2022-03-18 Interface calling method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114637554B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116506523A (en) * 2023-06-21 2023-07-28 之江实验室 Unified communication method suitable for multiple protocols

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255513A (en) * 2017-12-28 2018-07-06 平安科技(深圳)有限公司 Electronic device, the data-interface based on springmvc and its illustrate automatic generation method and storage medium
CN109286633A (en) * 2018-10-26 2019-01-29 深圳市华云中盛科技有限公司 Single sign-on method, device, computer equipment and storage medium
CN111314306A (en) * 2020-01-17 2020-06-19 网易(杭州)网络有限公司 Interface access method and device, electronic equipment and storage medium
US20210349955A1 (en) * 2020-05-11 2021-11-11 Phillips Edison Grocery Center Operating Partnership I, L.P. Systems and methods for real estate data collection, normalization, and visualization
CN113867913A (en) * 2021-09-27 2021-12-31 平安国际智慧城市科技股份有限公司 Business request processing method, device, equipment and storage medium for microservice

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255513A (en) * 2017-12-28 2018-07-06 平安科技(深圳)有限公司 Electronic device, the data-interface based on springmvc and its illustrate automatic generation method and storage medium
CN109286633A (en) * 2018-10-26 2019-01-29 深圳市华云中盛科技有限公司 Single sign-on method, device, computer equipment and storage medium
CN111314306A (en) * 2020-01-17 2020-06-19 网易(杭州)网络有限公司 Interface access method and device, electronic equipment and storage medium
US20210349955A1 (en) * 2020-05-11 2021-11-11 Phillips Edison Grocery Center Operating Partnership I, L.P. Systems and methods for real estate data collection, normalization, and visualization
CN113867913A (en) * 2021-09-27 2021-12-31 平安国际智慧城市科技股份有限公司 Business request processing method, device, equipment and storage medium for microservice

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116506523A (en) * 2023-06-21 2023-07-28 之江实验室 Unified communication method suitable for multiple protocols
CN116506523B (en) * 2023-06-21 2023-09-19 之江实验室 Unified communication method suitable for multiple protocols

Also Published As

Publication number Publication date
CN114637554B (en) 2024-08-30

Similar Documents

Publication Publication Date Title
CN110602056B (en) Service parameter transmission method and device
CN111787171B (en) Automatic outbound method, device, electronic equipment and computer readable storage medium
CN108235303A (en) Method, apparatus, equipment and the medium of the shared flow user of identification
CN113364746A (en) Equipment identification method, device, equipment and computer storage medium
CN114637554B (en) Interface calling method, device, equipment and storage medium
CN104081421B (en) Method of pairing electronic apparatus and user account within on-line service
CN113064906B (en) Binlog log data adaptive migration method and system
CN113986924A (en) Intelligent data filling method, device, equipment and storage medium
CN113742235A (en) Method and device for checking codes
CN115858320A (en) Operation log recording method, apparatus, medium and product
CN113704000B (en) Service access optimization method, device, equipment and medium
CN112000713A (en) Data processing method, device, equipment and medium
CN115168919A (en) Method, device, equipment, storage medium and program product for determining equipment fingerprint
CN114239486A (en) Interface description document generation method, device, equipment and storage medium
CN109873908B (en) Junk call identification recognition method and device, computer equipment and storage medium
CN112468340A (en) Pre-audit business data configuration system for multiple tenants
CN114500542A (en) Service flow distribution method, device, equipment and computer storage medium
CN114205213B (en) Fault pushing method and device, storage medium and electronic equipment
CN114598588B (en) Server fault determination method and device and terminal equipment
CN114327602B (en) Information processing method, device, electronic equipment and storage medium
CN113298468B (en) Logistics data processing method and device, medium and electronic equipment
CN107704606B (en) Universal extraction method for instant chat protocol elements based on custom tag language
CN114707967A (en) Service processing method and device, electronic equipment and computer readable medium
CN115658026A (en) Service processing method, device, equipment and storage medium
CN116862388A (en) Production method, device, software material clearing end, continuous integration end and 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