CN116055463A - Method and device for realizing open interface - Google Patents

Method and device for realizing open interface Download PDF

Info

Publication number
CN116055463A
CN116055463A CN202310150455.0A CN202310150455A CN116055463A CN 116055463 A CN116055463 A CN 116055463A CN 202310150455 A CN202310150455 A CN 202310150455A CN 116055463 A CN116055463 A CN 116055463A
Authority
CN
China
Prior art keywords
open interface
target
logic
customization
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310150455.0A
Other languages
Chinese (zh)
Inventor
何辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202310150455.0A priority Critical patent/CN116055463A/en
Publication of CN116055463A publication Critical patent/CN116055463A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/313Logic programming, e.g. PROLOG programming language
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to a method and a device for realizing an open interface, wherein the method for realizing the open interface comprises the following steps: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information. Based on this, the realization of providing an open interface enables it to timely meet the changing demands of a plurality of external partners.

Description

Method and device for realizing open interface
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for implementing an open interface.
Background
In the internet, the open platform can package the service provided by the open platform into a series of data interfaces, and the data interfaces are released to the external partner, and the external partner can use the resources of the open platform or expand the functions of the open platform by utilizing the open interfaces so as to support the service of the external partner. The open interface is typically an API (application fear rogramming interface, application programming interface) or a function.
However, since the requirements of the external partner are constantly changing in the prior art, in order to adapt to the requirements of the external partner, the open platform needs to modify the original open interface or add a new open interface, and thus, it is generally necessary to constantly develop a new interface to meet the requirements of the external partner. For example, a general order details query interface, there are 10 fields in the order details currently, however, the a vendor needs to logically operate some of the 10 fields through a certain service logic to obtain another 3 values, that is, the order details originally have 10 fields, then dynamically calculate another 3 fields according to the service logic of the a vendor, and provide a total of 13 fields to the a vendor. However, for the B vendor, 2 additional fields are required in addition to the 10 fields, and the 2 additional fields can be calculated by various business logic in the 10 fields. Thus, for the phenomenon described above, two new URL address interfaces need to be newly developed for A, B suppliers for them to call in the face of the ever changing business appeal of suppliers to order details.
Therefore, how to provide an open interface to meet the changing demands of multiple external partners in time is a current research direction.
Disclosure of Invention
The invention provides a method and a device for realizing an open interface, which are used for solving the problem that in the prior art, the requirement of a plurality of external partners for continuously changing is difficult to be met through one open interface, and realizing the purpose of providing the open interface so that the requirement of the plurality of external partners for continuously changing can be met in time.
A method for implementing an open interface, the method comprising: the open interface is realized based on a general logic realization module and a custom logic realization module, the general logic realization module is used for realizing general logic in the open interface, the custom logic realization module is used for realizing custom logic in the open interface, and the method comprises the following steps: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information.
In one embodiment, the custom logic implementation module corresponding to the target open interface is implemented based on a java language programming compiler (java), and correspondingly, based on the network address corresponding to the call request, determines and executes an implementation code of the custom logic of the target custom client about the target open interface through the custom logic implementation module corresponding to the target open interface, to obtain second field information, where the second field information includes: determining the realization code of the customized logic of the target customized client about the target open interface from a storage medium through a customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request; compiling the realization codes of the customization logic of the target customization client about the target open interface into entity class objects through java, and executing the entity class objects according to the input parameters of the entity class objects to obtain second field information.
In one embodiment, before determining and executing, by the custom logic implementation module corresponding to the target open interface, implementation code of custom logic of the target custom client with respect to the target open interface based on the network address corresponding to the call request, the method further includes: displaying a configuration interface of the custom logic of the target open interface; and receiving an implementation code of the target customization client on the customization logic of the target open interface and a network address corresponding to the call request through a configuration interface of the customization logic of the target open interface, and storing the implementation code in a preset storage medium.
In one embodiment, after displaying the configuration interface of the custom logic of the target open interface, the method further comprises: and receiving a Java software development kit version number through a configuration interface of the custom logic of the target open interface, and storing the Java software development kit version number in a preset storage medium.
In one embodiment, compiling, by java, implementation code of the custom logic of the target custom client with respect to the target open interface into an entity class object includes: and compiling the realization codes of the target customization client customization logic related to the target open interface according to the Java language software development kit version number stored in the storage medium.
In one embodiment, compiling, by java, implementation code of the custom logic of the target custom client with respect to the target open interface into an entity class object includes: and automatically adjusting lambda expressions and do-while loops in implementation codes of the target customization client customization logic related to the target open interface.
In one embodiment, compiling, by java, implementation code of the custom logic of the target custom client with respect to the target open interface into an entity class object includes: loading Java source files of realization codes of the custom logic of the target custom client about a target open interface; performing lexical analysis, grammar analysis and symbol table filling on the java source file to construct an abstract grammar tree; generating a binary file according to the byte code specification of java based on the constructed abstract syntax tree; based on the binary file, loading by a ClassLoader Class loader to obtain a Class file; and creating a new instance object by reflecting the Class object in the Class file.
An apparatus for implementing an open interface, the apparatus comprising: the receiving module is used for receiving a call request from a target customization client for a target open interface and acquiring a network address corresponding to the call request; the determining module is used for determining corresponding first field information based on the universal logic implementation module corresponding to the target open interface; the processing module is used for determining and executing the realization code of the customized logic of the target customized client about the target open interface through the customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and the response module is used for responding to the call request according to the first field information and the second field information.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the method of implementing an open interface as described above.
A storage medium storing computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of a method of implementing an open interface as described above.
According to the method and the device for realizing the open interface, common business logic of different target customization clients about the target open interface is realized through the universal logic-based realization module, and customized logic specific to different target customization clients is realized through the customization logic realization module, so that when business requirements of different target customization clients overlap with the existing open interfaces, the existing open interfaces can be recycled, redundancy of codes is reduced, subsequent maintenance is facilitated, and meanwhile, customized business requirements of the target customization clients can be realized without additionally adding a new open interface according to different business requirements of new target customization clients.
Drawings
FIG. 1 is a schematic block diagram of an open interface implementation method in the prior art;
FIG. 2 is an environmental diagram of an implementation of a method of implementing an open interface provided in one embodiment;
FIG. 3 is one of the flow diagrams of the implementation method of the open interface in one embodiment;
FIG. 4 is a second flow chart of a method for implementing an open interface in one embodiment;
FIG. 5 is one of the schematic block diagrams of a method of implementing an open interface in one embodiment;
FIG. 6 is a second schematic block diagram of a method of implementing an open interface in one embodiment;
FIG. 7 is a block diagram of an implementation of an open interface in one embodiment;
fig. 8 is a schematic diagram of an electronic device in one embodiment.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
It is to be noted that unless otherwise defined, technical or scientific terms used herein should be taken in a general sense as understood by one of ordinary skill in the art to which the present invention belongs. The terms "first," "second," and the like, as used herein, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", etc. are used merely to indicate relative positional relationships, which may also be changed when the absolute position of the object to be described is changed.
For ease of understanding, the technical terms to which the present invention relates will be explained first.
(1) Entity class objects (instances of entity classes) are used to save and update information about some phenomena, such as: an event, a person or some real-life object. Entity classes are often permanent, with their attributes and relationships being long-felt, sometimes even throughout the lifetime of the system. An entity class object is typically not specific to a particular use case implementation; sometimes, one entity class object is not even dedicated to the system itself. The values of its attributes and relationships are typically specified by the principal angles. Entity class objects may also be used in performing tasks within the system.
For ease of understanding, the technical problems existing in the prior art are described in connection with order processing business scenarios. As shown in fig. 1, in the order processing system, since the service requirements of different suppliers to the order details are different, it is necessary to develop corresponding interfaces to satisfy the service requirements of different suppliers, respectively. The corresponding business requirements of the three suppliers A, B and C are shown in fig. 1, for example, a general order detail query interface is originally provided, 10 fields are originally in the order detail currently, however, the supplier a needs other 3 fields besides the 10 fields, that is, the order detail originally has 10 fields, then the other 3 fields need to be calculated according to the business complaint of the supplier a on the order detail, and the total 13 fields are provided to the supplier a. Then, for the B vendor, 2 additional fields are needed in addition to the 10 fields, and the 2 additional fields can be calculated by various business logic in the 10 fields. For the C vendor, in addition to the 10 fields, another 4 fields are required, and the other 4 fields can be calculated by various business logic in the 10 fields. Thus, for the above phenomenon, in the face of the business appeal of the suppliers for the change of the order details, it is necessary to newly develop 3 interfaces for the a supplier, the B supplier and the C supplier, respectively, order details 1, order details 2 and order details 3, and then provide the corresponding uniform resource location system (uniform resource locator, URL) addresses, i.e., URL1, URL2 and URL3, to the a supplier, the B supplier and the C supplier according to the corresponding uniform resource location system (uniform resource locator, URL 3) addresses when the a supplier, the B supplier and the C supplier issue requests to obtain the processing results corresponding to the order details 1 and the order details 2 and the order details 3, respectively. However, since the logic of order details 1, 2 and 3 is basically the same, the repeated codes are too many, and the maintenance is not easy. And, various appeal of external suppliers make the order details interface unable to be processed uniformly. In addition, every new vendor added later, the order system is required to customize a set of order details interfaces to the external vendors. Therefore, in order to solve the above problems, a method for implementing an open interface according to the present invention is proposed.
The method and apparatus for implementing the open interface of the present invention are described below with reference to fig. 2-8.
Fig. 2 is an implementation environment diagram of an implementation method of an open interface provided in one embodiment, including a computer device 210 and a terminal device 220.
The computer device 210 is a device for implementing an open interface, where the computer device 210 includes a general logic implementation module and a custom logic implementation module, where the general logic implementation module is used to implement general logic in a target open interface, and the custom logic implementation module is used to implement custom logic in the target open interface, where the computer device 210 may receive a call request from the terminal device 220 for the target open interface, obtain a network address corresponding to the call request, determine corresponding first field information based on the general logic implementation module corresponding to the target open interface, determine and execute an implementation code of the corresponding custom logic through the custom logic implementation module corresponding to the target open interface based on the network address corresponding to the call request, and obtain second field information, and respond to the call request according to the first field information and the second field information. The target open interface may be, for example, an interface for implementing order detail query.
It should be noted that, the terminal device 220 and the computer device 210 may be smart phones, tablet computers, notebook computers, desktop computers, and the like, but are not limited thereto. The computer device 210 and the terminal device 220 may be connected by bluetooth, universal serial bus (Universal Serial Bus, USB) or other communication connection, which is not limited herein.
As shown in fig. 3, in one embodiment, a method for implementing an open interface is provided, where the method for implementing an open interface may be performed by the computer device 210. Specifically, as shown in fig. 3, the implementation method of the open interface provided by the present invention may include the following steps:
step 310, receiving a call request from a target customization client to a target open interface, and obtaining a network address corresponding to the call request.
It can be understood that in the invention, the call request of the client to the target open interface is customized for different targets, and the target open interface can realize corresponding different functions.
In addition, because the network addresses corresponding to different call requests are unique, namely the URLs corresponding to different call requests are unique, the realization logic of the target open interface required by the corresponding target customization client can be determined based on the network addresses corresponding to different call requests, namely the URLs corresponding to different call requests, and then the corresponding functions of the target open interface can be realized according to the realization logic of the target open interface required by the target customization client.
The realization logic of the target open interface required by the target customization client comprises general logic corresponding to the target open interface and customization logic of the target open interface required by the target customization client. The general logic corresponding to the target open interface is the business processing logic commonly required by a plurality of external partners; the target open interface customization logic required by the target customization client is business customization logic specific to the target open interface by the target customization client.
Step 320, determining corresponding first field information based on the generic logic implementation module corresponding to the target open interface.
It can be understood that the general logic implementation module corresponding to the target open interface is configured to implement general logic in the open interface, so that the first field information can be understood as field information calculated according to the general logic in the target open interface.
And 330, determining and executing the realization code of the customized logic of the target customized client about the target open interface through the customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request, and obtaining the second field information.
As described above, since the network addresses corresponding to the different call requests are unique, that is, the URLs corresponding to the different call requests are unique, the implementation logic of the target open interface required by the corresponding target custom client can be determined based on the network addresses corresponding to the different call requests, that is, the URLs corresponding to the different call requests, and then the implementation code of the custom logic of the target custom client about the custom logic of the target open interface is determined and executed according to the custom logic implementation module corresponding to the target open interface required by the target custom client, so that the corresponding function of the custom logic of the target open interface is implemented.
It may be understood that the custom logic implementation module corresponding to the target open interface is configured to implement custom logic of the target open interface required by the target custom client, and therefore, the second field information may be understood as field information calculated according to the custom logic of the target open interface required by the target custom client.
Step 340, responding to the call request according to the first field information and the second field information.
According to the method for realizing the open interface, common business logic of different target customization clients about the target open interface is realized based on the universal logic realizing module, and customization logic specific to different target customization clients is realized through the customization logic realizing module, so that when business requirements of different target customization clients overlap with the existing open interface, the existing open interface can be reused, redundancy of codes is reduced, subsequent maintenance is facilitated, and meanwhile, customized business requirements of the target customization clients can be realized without additionally adding a new open interface according to different business requirements of new target customization clients.
In one embodiment, as shown in fig. 4, the custom logic implementation module corresponding to the target open interface is based on java implementation, and accordingly, based on the network address corresponding to the call request, the custom logic implementation module corresponding to the target open interface determines and executes the implementation code of the custom logic of the target custom client about the target open interface to obtain the second field information, and includes the following steps:
step 410, a configuration interface of the custom logic of the target open interface is displayed.
The configuration interface of the customization logic of the target open interface is used for configuring the customization logic of the target customization client about the target open interface and the network address corresponding to the call request to the target open interface sent by the target customization client.
Step 420, receiving, through a configuration interface of the custom logic of the target open interface, an implementation code of the custom logic of the target custom client about the target open interface and a network address corresponding to the call request, and storing the implementation code and the network address in a preset storage medium.
It can be understood that the custom logic corresponding to different target custom clients is different, so that when the target custom clients are newly added each time, the implementation codes of the custom logic of the target custom clients about the target open interface and the network addresses corresponding to the call requests of the target custom clients can be stored in the preset storage medium, so that the network addresses corresponding to the call requests of the target custom clients about the target open interface can be received subsequently, the implementation codes of the custom logic of the target custom clients about the target open interface can be determined, and the custom logic functions of the target open interface can be realized according to the implementation codes of the custom logic of the target custom clients about the target open interface, so that a new interface does not need to be packaged separately for the newly added target custom clients. In particular, reference may be made to the following description of fig. 6, which will not be described in detail here.
And 430, determining the realization code of the customized logic of the target customized client about the target open interface from the storage medium through the customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request.
The custom logic implementation module corresponding to the target open interface may be a plug-in.
And 440, compiling the realization codes of the customization logic of the target customization client about the target open interface into entity class objects through java, and executing the entity class objects according to the input parameters of the entity class objects to obtain second field information.
It will be appreciated that in one embodiment, the input parameters of the entity class object may be information of some fields in the first field processing information.
Specifically, compiling the implementation code of the customization logic of the target customization client about the target open interface into the entity class object through java can be achieved by the following steps: loading Java source files of realization codes of the custom logic of the target custom client about the target open interface; performing lexical analysis, grammar analysis and symbol table filling on the java source file to construct an abstract grammar tree; generating a binary file according to the byte code specification of java based on the constructed abstract syntax tree; based on the binary file, loading by a ClassLoader Class loader to obtain a Class file; and creating a new instance object by reflecting the Class object in the Class file.
In one embodiment, before determining and executing, by the custom logic implementation module corresponding to the target open interface, implementation code of the custom logic of the target custom client with respect to the target open interface based on the network address corresponding to the call request, the method further includes: in response to a user's operation, a software development kit version number (jdk version number) of the Java language is saved in a preset storage medium.
It will be appreciated that this step may be performed concurrently with step 410 described above. And if the step is executed, compiling the implementation code of the customization logic of the target customization client about the target open interface into an entity class object through java, wherein the entity class object comprises:
and compiling the realization codes of the target customization client customization logic related to the target open interface according to the Java language software development kit version number stored in the storage medium.
It can be appreciated that by setting the corresponding jdk version, the implementation code of the custom logic of the target custom client about the target open interface can be compiled according to the corresponding jdk version, so as to facilitate compatibility testing.
In one embodiment, compiling, by java, implementation code of the custom logic of the target custom client with respect to the target open interface into an entity class object includes:
the lambda expression in the implementation code of the custom logic of the target custom client with respect to the target open interface is automatically adjusted.
It can be appreciated that by automatically adjusting the lambda expression and the do-while loop in the code for the target customization client to implement the customization logic of the target open interface, the situation that the code cannot be compiled due to the lambda expression and the do-while loop in the code can be avoided, which is beneficial to smooth compiling of the code.
It can be further understood that before the step, the implementation code of the customization logic of the target customization client about the target open interface is compiled into the entity class object through java, and the Chinese fonts in the implementation code can be processed through the base64 module, so that disorder codes in the Chinese transmission process in the implementation code can be avoided.
Fig. 5 is another schematic flow chart of an implementation method of the open interface provided by the present invention. As shown in fig. 5, based on the implementation method of the open interface provided by the present invention, the corresponding processing flow in fig. 1 may be:
in the order processing system, call requests of three suppliers A, B and C for a target open interface are received, URL addresses URL1, URL2 and URL3 corresponding to the call requests of the three suppliers A, B and C for the order details of the target open interface are respectively obtained, custom logic codes of the target open interface, corresponding to order details of the three suppliers, are determined A, B and C according to a custom logic implementation module in the order details target open interface according to the URL1, URL2 and URL3, and order business results corresponding to the three suppliers A, B and C are respectively obtained through processing according to general processing logic of a general logic implementation module in the order details target open interface and custom logic codes of the order details target open interface, corresponding to the three suppliers A, B and C.
Fig. 6 is another schematic flow chart of an implementation method of the open interface provided by the present invention. As shown in fig. 6, a developer may configure, on a page of a computer device, URL address "URL" corresponding to a target open interface call request sent by a target customization client, implementation code "of customization logic of the target customization client about the target open interface, and jdk version" jdkVersion ", and store the URL address" URL "and the implementation code" and jdkVersion "in a preset storage medium. The storage medium may be, for example, mysql, oracle databases. Thus, corresponding information is conveniently obtained from a preset storage medium when needed later, and the customization logic is realized.
The device for realizing the open interface provided by the invention is described below, and the device for realizing the open interface described below and the method for realizing the open interface described above are correspondingly referred to each other.
Fig. 7 is a schematic block diagram of an implementation device of an open interface provided by the present invention. As shown in fig. 7, the implementation device of an open interface provided by the present invention includes:
the receiving module 710 is configured to receive a call request from a target customization client for a target open interface, and obtain a network address corresponding to the call request;
a determining module 720, configured to determine corresponding first field information based on a generic logic implementation module corresponding to the target open interface;
the processing module 730 is configured to determine and execute, based on the network address corresponding to the call request, an implementation code of a custom logic of the target custom client with respect to the target open interface through a custom logic implementation module corresponding to the target open interface, so as to obtain second field information;
and a response module 740, configured to respond to the call request according to the first field information and the second field information.
The realization device of the open interface provided by the invention realizes common business logic of different target customization clients about the target open interface through the universal logic realization module, and realizes the customization logic specific to different target customization clients through the customization logic realization module, thereby realizing that when the business requirements of different target customization clients overlap with the prior open interface, the prior open interface can be reused, reducing the redundancy of codes, facilitating the subsequent maintenance, and simultaneously realizing the customized business requirements of the target customization clients without additionally adding a new open interface according to the different business requirements of the new target customization clients.
In one embodiment, the processing module 730 includes:
the determining unit is used for determining the realization code of the customized logic of the target customized client about the target open interface from the storage medium through the customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request;
and the processing unit is used for compiling the realization codes of the customization logic of the target customization client about the target open interface into entity class objects through java, and executing the entity class objects according to the input parameters of the entity class objects to obtain second field information.
In one embodiment, the apparatus further comprises:
the display module is used for displaying a configuration interface of the custom logic of the target open interface;
the first receiving module and the first storing module are used for receiving the realization codes of the target customization client on the customization logic of the target open interface and the network address corresponding to the call request through the configuration interface of the customization logic of the target open interface, and storing the realization codes in a preset storage medium.
In one embodiment, the apparatus further comprises:
the second receiving module and the second storing module receive the Java software development kit version number through the configuration interface of the custom logic of the target open interface and store the Java software development kit version number in a preset storage medium.
In one embodiment, the processing unit includes:
and the compiling unit is used for compiling the realization codes of the target customization client customization logic about the target open interface according to the Java language software development kit version number stored in the storage medium.
In one embodiment, the processing unit includes:
and the adjusting unit is used for automatically adjusting lambda expressions and do-while loops in the implementation codes of the target customization client customization logic related to the target open interface.
In one embodiment, the processing unit includes:
a first loading unit, configured to load a Java source file of implementation code of the custom logic of the target custom client with respect to the target open interface;
the construction unit is used for performing lexical analysis, grammar analysis and symbol table filling on the java source file to construct an abstract grammar tree;
the generation unit is used for generating a binary file according to the java byte code specification based on the constructed abstract syntax tree;
the second loading unit is used for loading the Class files through a Class loader based on the binary files;
and the creating unit is used for creating a new instance object by reflecting the Class object in the Class file.
In one embodiment, a computer device is presented, the computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information.
Fig. 8 illustrates a physical structure diagram of an electronic device, as shown in fig. 8, which may include: processor 810, communication interface (Communications Interface) 820, memory 830, and communication bus 840, wherein processor 810, communication interface 820, memory 830 accomplish communication with each other through communication bus 840. The processor 810 may call logic instructions in the memory 830 to execute the method for implementing an open interface provided by the present invention, where the method for implementing an open interface includes: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information.
Further, the logic instructions in the memory 830 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method for implementing an open interface provided by the present invention, wherein the method for implementing an open interface comprises: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information.
In still another aspect, the present invention further provides a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor, is implemented to perform the method for implementing an open interface provided by the present invention, where the method for implementing an open interface includes: receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request; determining corresponding first field information based on a general logic implementation module corresponding to a target open interface; determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information; and responding to the call request according to the first field information and the second field information.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The implementation method of the open interface is characterized in that the open interface is implemented based on a general logic implementation module and a custom logic implementation module, the general logic implementation module is used for implementing general logic in the open interface, and the custom logic implementation module is used for implementing custom logic in the open interface, and the method comprises the following steps:
receiving a call request from a target customization client for a target open interface, and acquiring a network address corresponding to the call request;
determining corresponding first field information based on a general logic implementation module corresponding to a target open interface;
determining and executing a customized logic implementation code of a target customized client about the target open interface through a customized logic implementation module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information;
and responding to the call request according to the first field information and the second field information.
2. The method for implementing the open interface according to claim 1, wherein the custom logic implementing module corresponding to the target open interface is implemented based on java, and correspondingly, the determining and executing, by the custom logic implementing module corresponding to the target open interface, the implementation code of the custom logic of the target custom client with respect to the target open interface based on the network address corresponding to the call request, to obtain the second field information includes:
determining the realization code of the customized logic of the target customized client about the target open interface from a storage medium through a customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request;
compiling the implementation code into an entity class object through java, and executing the entity class object according to the input parameters of the entity class object to obtain second field information.
3. The method for implementing an open interface according to claim 2, wherein before determining and executing, by the custom logic implementing module corresponding to the target open interface, the implementation code of the custom logic of the target custom client with respect to the target open interface based on the network address corresponding to the call request, the method further comprises:
displaying a configuration interface of the custom logic of the target open interface;
and receiving an implementation code of the target customization client on the customization logic of the target open interface and a network address corresponding to the call request through a configuration interface of the customization logic of the target open interface, and storing the implementation code in a preset storage medium.
4. The method of implementing an open interface of claim 3, wherein after displaying the configuration interface of the custom logic of the target open interface, the method further comprises:
and receiving a Java software development kit version number through a configuration interface of the custom logic of the target open interface, and storing the Java software development kit version number in a preset storage medium.
5. The method for implementing an open interface according to claim 4, wherein compiling, by java, implementation code of the target customization client's customization logic for the target open interface into an entity class object includes:
and compiling the realization codes of the target customization client customization logic related to the target open interface according to the Java language software development kit version number stored in the storage medium.
6. The method for implementing an open interface according to claim 2, wherein compiling, by java, implementation code of the target customization client's customization logic about the target open interface into an entity class object includes:
and automatically adjusting lambda expressions and do-while loops in implementation codes of the target customization client customization logic related to the target open interface.
7. The method for implementing an open interface according to claim 2, wherein compiling, by java, implementation code of the target customization client's customization logic about the target open interface into an entity class object includes:
loading Java source files of realization codes of the custom logic of the target custom client about a target open interface;
performing lexical analysis, grammar analysis and symbol table filling on the java source file to construct an abstract grammar tree;
generating a binary file according to the byte code specification of java based on the constructed abstract syntax tree;
based on the binary file, loading by a ClassLoader Class loader to obtain a Class file;
and creating a new instance object by reflecting the Class object in the Class file.
8. An apparatus for implementing an open interface, the apparatus comprising:
the receiving module is used for receiving a call request from a target customization client for a target open interface and acquiring a network address corresponding to the call request;
the determining module is used for determining corresponding first field information based on the universal logic implementation module corresponding to the target open interface;
the processing module is used for determining and executing the realization code of the customized logic of the target customized client about the target open interface through the customized logic realization module corresponding to the target open interface based on the network address corresponding to the call request to obtain second field information;
and the response module is used for responding to the call request according to the first field information and the second field information.
9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the method of implementing an open interface as claimed in any one of claims 1 to 7.
10. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of implementing an open interface as claimed in any one of claims 1 to 7.
CN202310150455.0A 2023-02-09 2023-02-09 Method and device for realizing open interface Pending CN116055463A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310150455.0A CN116055463A (en) 2023-02-09 2023-02-09 Method and device for realizing open interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310150455.0A CN116055463A (en) 2023-02-09 2023-02-09 Method and device for realizing open interface

Publications (1)

Publication Number Publication Date
CN116055463A true CN116055463A (en) 2023-05-02

Family

ID=86113423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310150455.0A Pending CN116055463A (en) 2023-02-09 2023-02-09 Method and device for realizing open interface

Country Status (1)

Country Link
CN (1) CN116055463A (en)

Similar Documents

Publication Publication Date Title
EP3876116B1 (en) Method and apparatus for running mini program, electronic device, and storage medium
CN109976667B (en) Mirror image management method, device and system
CN106569856B (en) A kind of loading method and device of application view resource file
US11474810B2 (en) Run-time application modification
CN113312037A (en) Data processing method, device and equipment applied to microservice and storage medium
CN114816401B (en) Interface element positioning method, electronic equipment and storage medium
CN112765023A (en) Test case generation method and device
CN112328301B (en) Method and device for maintaining consistency of operating environments, storage medium and electronic equipment
CN112930530B (en) Client application for network application execution
CN108197024B (en) Embedded browser debugging method, debugging terminal and computer readable storage medium
CN114443076A (en) Mirror image construction method, device, equipment and storage medium
CN111079048A (en) Page loading method and device
CN112948018B (en) Dynamic library loading method, device, equipment and medium for applet
CN111158777B (en) Component calling method, device and computer readable storage medium
CN117234582A (en) Project code processing method and device, electronic equipment and storage medium
CN110599112B (en) Network page development and maintenance method and device
CN113779122B (en) Method and device for exporting data
WO2023273028A1 (en) Transaction processing method and related product
CN116055463A (en) Method and device for realizing open interface
US20220012050A1 (en) Mini program batch processing method and apparatus, electronic device, and readable storage medium
CN112104544B (en) Method and device for sending dynamic mail based on Freemarker
US20220300574A1 (en) Caching for Single Page Web Applications
CN111859403A (en) Method and device for determining dependency vulnerability, electronic equipment and storage medium
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device
CN113032004A (en) Method, apparatus and program product for managing development jobs in a development environment

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