Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides an interface generation method. Fig. 1 is a schematic flow chart of an interface generation method according to an embodiment of the present invention. The method may be performed by an apparatus, which may be implemented by software and/or hardware.
In this embodiment, the interface generation method includes:
s110, generating an instruction according to an interface, and logging in a project management platform through a configuration file; wherein the content of the first and second substances,
the configuration file comprises login information of the project management platform, information of the data to be acquired and a project space to which the data to be acquired belongs; the project management platform comprises project spaces, project space coding lists corresponding to the project spaces, and each project space comprises a group data coding list.
Specifically, front-end (e.g., front-end interface such as Web page or app) items need to be implemented through an interface provided by a back-end (e.g., some data storage platform). Wherein, the project management platform is a back-end project. A plurality of project spaces are stored in the project management platform, and each project space is divided into a plurality of groups of data; each group of data has different types of interfaces for transmitting data, so that the project space is sorted in a project space coding list mode for facilitating the front end to acquire data, and similarly, the group of data in each project space is also sorted in a group data coding list mode.
When a front-end project needs to acquire certain data from a back-end project, a data interface needs to be established with specific group data in a project management platform, and corresponding data is acquired through the data interface. The front end generates an interface generation instruction through page operation, simultaneously writes information of data to be acquired and login information of the project management platform into a configuration file, and the processor acquires the interface generation instruction and logs in the project management platform through the login information of the management platform in the configuration file.
As an optional embodiment of the present invention, the storing the configuration file in the blockchain, and according to the interface generation instruction, logging in the project management platform through the configuration file includes:
according to the interface generation instruction, acquiring a configuration file and starting a preset login platform script;
a preset login platform script logs in the project management platform by reading login information of the project management platform in the configuration file; the login information comprises a user name and a login password corresponding to the user name.
Specifically, in order to enable an automatic login project management platform, a login platform script is preset. And when the processor receives the interface generation instruction, starting the preset login platform script, and reading the login information of the project management platform in the configuration file by the started preset login platform script so as to realize automatic login of the project management platform.
And S120, acquiring a code of the same item space as the affiliated item space of the data to be acquired from the item space code list, and taking the code as a target item space code.
Specifically, each item space and the code of the item space corresponding to each item space are recorded in the item space code list, the item space to which the data to be acquired belongs is compared with each item space in the item space code list to obtain the item space identical to the item space to which the data belongs, wherein the comparison can be completed by comparing the name of the item space or a preset item space code, for example, if the item space to which the data to be acquired belongs is an item space a, the item space a is found from the item space code list according to the item space a, the code of the item space a is acquired, and the code is taken as a target item space code, that is, the code represents the data to be acquired in the target item space.
As an alternative embodiment of the present invention, acquiring a code of a project space identical to a belonging project space of data to be acquired from a project space code list, and taking the code as a target project space code includes:
determining an item space coding list with authority from the item space coding list according to a preset authority;
and acquiring the code of the item space which is the same as the affiliated item space of the data to be acquired from the authorized item space code list, and taking the code as the target item space code.
Specifically, the front end uses the back end data, some of which are authorized and some of which are not authorized, so as to ensure the safety of the back end data, the authorization needs to be preset, for example, when a certain front end acquires data to be acquired, if the project space to which the data to be acquired belongs is not authorized, the data acquisition can be performed only after the authorization is acquired; the preset authority comprises an authority item space, and the authority item space and a corresponding item space code are determined from the item space code list, so that an authority item space code list is formed. The method comprises the steps of comparing the item space to which the data to be acquired belongs with the item space with the authority in the item space code list with the authority, selecting the item space which is the same as the item space to which the data to be acquired belongs through comparing the item space name or the code and the like, acquiring the corresponding code, and taking the code as the target item space code.
And S130, acquiring a group data code list from the target item space corresponding to the target item space code according to the target item space code, and using the group data code list as a target group data code list.
Specifically, the processor acquires a target group data code list from the target project space according to the target project space code, wherein each project space is provided with a data interface for acquiring the group data code list, and the group data code list is acquired from the target project space through the interface.
As an alternative embodiment of the present invention, according to the target item space code, acquiring the group data code list from the target item space corresponding to the target item space code, as the target group data code list, includes:
taking the target project space code as the input parameter of the data interface of the target project space, and calling the data interface of the target project space;
acquiring target project space data from a target project space through a data interface of the target project space; wherein the target project space data comprises a group data encoding list;
analyzing the target project space data to obtain analyzed target project space data;
and acquiring a group data code list from the analyzed target project space data as a target group data code list.
Specifically, a target project space code is used as a reference of a data interface of a target project space, so that the data interface of the target project space is called, data is acquired from the target project space through the data interface, the acquired data at least comprises a target group data code list, the acquired data needs to be analyzed in order to facilitate the storage of the data by a project management platform, the analyzed target project space data is obtained after the data is analyzed, and then a group data code list is acquired from the analyzed target project space data and is used as the target group data code list.
S140, determining a target group data code corresponding to the information of the data to be acquired from the target group data code list as a target code; wherein the target group data encoding list includes information of the target group data and an encoding of the target group data corresponding to the information of the target group data.
Specifically, the information of the data to be acquired is compared with the information of the target group data in the target group data code list, the information of the target group data which is the same as the information of the data to be acquired is acquired, and the code corresponding to the information of the target group data is acquired, so that the target code is obtained, that is, the target group data is indicated as the data to be acquired.
As an optional embodiment of the present invention, determining a target group data code corresponding to information of data to be acquired from a target group data code list, as the target code, includes:
acquiring information of target group data which is the same as the information of the data to be acquired from the target group data coding list as information for determining the target group data;
according to the information of the determination target group data, the code of the target group data corresponding to the information of the determination target group data is acquired as the target code.
Specifically, the name or the preset code of the data to be acquired is compared with the information of the target group data, and then the information of the target group data includes the name or the preset code and can be set according to the actual situation. And after comparison, acquiring the information of the target group data which is the same as the information of the data to be acquired as the information for determining the target group data, and acquiring the code of the target group data corresponding to the information for determining the target group data as the target code.
S150, according to the target code, requesting an interface corresponding to the target group data, and acquiring interface definition information from the interface.
Specifically, the target code is used as an entry parameter in an HTTP request mode, a request is made for an interface of target group data corresponding to the target code, and when the request is successful, interface definition information is acquired from the interface of the target group data.
As an alternative embodiment of the present invention, requesting an interface corresponding to the target group data according to the target code, and acquiring the interface definition information from the interface includes:
requesting all interfaces of corresponding target group data according to the target code;
and calling all interfaces of the target group data by taking the interface codes of all interfaces of the target group data as the access parameters, and acquiring interface definition information in each called interface.
Specifically, in order to facilitate the front end to obtain data by using different interfaces, each group of data may have a plurality of different types of interfaces, for example, an api interface, a gourp interface, a list interface, and the like. Requesting all types of interfaces of target group data by taking the target code as an entry parameter; and each interface is provided with an interface code, all interfaces of the target group data are called by taking the interface code of each interface as an input parameter, and interface definition information in each called interface is obtained.
And S160, generating an interface for acquiring the data to be acquired according to the interface definition information.
Specifically, the processor returns the acquired interface definition information to the front end, loads the interface definition information into a local interface file of the front end, and establishes an interface for acquiring the data to be acquired with the back end through the local interface file.
As an optional embodiment of the present invention, generating an interface for acquiring data to be acquired according to the interface definition information includes:
extracting a main field from the interface definition information;
analyzing the main field to obtain analysis interface information; the interface analysis information comprises an interface parameter input field, an interface parameter output field, types of various fields and whether the various fields need attributes or not;
and generating an interface for acquiring the data to be acquired according to the analysis interface information.
Specifically, the interface definition information is used for generating data of a front-end and a back-end new interface, and for the convenience of data information storage, the interface definition information needs to be subjected to data analysis processing to obtain analyzed interface information after the data analysis processing, and the analyzed interface information at least includes basic information for generating the new interface, such as an interface parameter field, types of various fields, whether various fields need attributes, and the like. And returning the analyzed interface information to the front end, loading the analyzed interface information into a local file, and generating an interface for acquiring the data to be acquired.
Fig. 2 is a functional block diagram of an interface generation apparatus according to an embodiment of the present invention.
The interface generating apparatus 200 of the present invention may be installed in an electronic device. According to the implemented functions, the interface generating device may include a platform login module 210, a target project space code obtaining module 220, a target group data code list obtaining module 230, a target code obtaining module 240, an interface definition information obtaining module 250, and an interface generating module 260. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the platform login module 210 is used for generating an instruction according to the interface and logging in the project management platform through the configuration file; the configuration file comprises login information of a project management platform, information of data to be acquired and a project space to which the data to be acquired belongs; the project management platform comprises project spaces, project space coding lists corresponding to the project spaces, and each project space comprises a group data coding list.
Specifically, front-end (e.g., front-end interface such as Web page or app) items need to be implemented through an interface provided by a back-end (e.g., some data storage platform). Wherein, the project management platform is a back-end project. A plurality of project spaces are stored in the project management platform, and each project space is divided into a plurality of groups of data; each group of data has different types of interfaces for transmitting data, so that the project space is sorted in a project space coding list mode for facilitating the front end to acquire data, and similarly, the group of data in each project space is also sorted in a group data coding list mode.
When a front-end project needs to acquire certain data from a back-end project, a data interface needs to be established with specific group data in a project management platform, and corresponding data is acquired through the data interface. The front end generates an interface generation instruction through page operation, simultaneously writes information of data to be acquired and login information of the project management platform into a configuration file, and the processor acquires the interface generation instruction and logs in the project management platform through the login information of the management platform in the configuration file.
As an optional embodiment of the present invention, the storing the configuration file in the blockchain, and according to the interface generation instruction, logging in the project management platform through the configuration file includes:
according to the interface generation instruction, acquiring a configuration file and starting a preset login platform script;
a preset login platform script logs in the project management platform by reading login information of the project management platform in the configuration file; the login information comprises a user name and a login password corresponding to the user name.
Specifically, in order to enable an automatic login project management platform, a login platform script is preset. And when the processor receives the interface generation instruction, starting the preset login platform script, and reading the login information of the project management platform in the configuration file by the started preset login platform script so as to realize automatic login of the project management platform.
And a target item space code obtaining module 220, configured to obtain, from the item space code list, a code of an item space that is the same as the item space to which the data to be obtained belongs, and use the code as a target item space code.
Specifically, each item space and the code of the item space corresponding to each item space are recorded in the item space code list, the item space to which the data to be acquired belongs is compared with each item space in the item space code list to obtain the item space identical to the item space to which the data belongs, wherein the comparison can be completed by comparing the name of the item space or a preset item space code, for example, if the item space to which the data to be acquired belongs is an item space a, the item space a is found from the item space code list according to the item space a, the code of the item space a is acquired, and the code is taken as a target item space code, that is, the code represents the data to be acquired in the target item space.
As an alternative embodiment of the present invention, acquiring a code of a project space identical to a belonging project space of data to be acquired from a project space code list, and taking the code as a target project space code includes:
determining an item space coding list with authority from the item space coding list according to a preset authority;
and acquiring the code of the item space which is the same as the affiliated item space of the data to be acquired from the authorized item space code list, and taking the code as the target item space code.
Specifically, the front end uses the back end data, some of which are authorized and some of which are not authorized, so as to ensure the safety of the back end data, the authorization needs to be preset, for example, when a certain front end acquires data to be acquired, if the project space to which the data to be acquired belongs is not authorized, the data acquisition can be performed only after the authorization is acquired; the preset authority comprises an authority item space, and the authority item space and a corresponding item space code are determined from the item space code list, so that an authority item space code list is formed. The method comprises the steps of comparing the item space to which the data to be acquired belongs with the item space with the authority in the item space code list with the authority, selecting the item space which is the same as the item space to which the data to be acquired belongs through comparing the item space name or the code and the like, acquiring the corresponding code, and taking the code as the target item space code.
And a target group data code list obtaining module 230, configured to obtain the group data code list from the target item space corresponding to the target item space code as the target group data code list.
Specifically, the processor acquires a target group data code list from the target project space according to the target project space code, wherein each project space is provided with a data interface for acquiring the group data code list, and the group data code list is acquired from the target project space through the interface.
As an alternative embodiment of the present invention, according to the target item space code, acquiring the group data code list from the target item space corresponding to the target item space code, as the target group data code list, includes:
taking the target project space code as the input parameter of the data interface of the target project space, and calling the data interface of the target project space;
acquiring target project space data from a target project space through a data interface of the target project space; wherein the target project space data comprises a group data encoding list;
analyzing the target project space data to obtain analyzed target project space data;
and acquiring a group data code list from the analyzed target project space data as a target group data code list.
Specifically, a target project space code is used as a reference of a data interface of a target project space, so that the data interface of the target project space is called, data is acquired from the target project space through the data interface, the acquired data at least comprises a target group data code list, the acquired data needs to be analyzed in order to facilitate the storage of the data by a project management platform, the analyzed target project space data is obtained after the data is analyzed, and then a group data code list is acquired from the analyzed target project space data and is used as the target group data code list.
A target code obtaining module 240, configured to determine, from the target group data code list, a target group data code corresponding to information of the data to be obtained as a target code; wherein the target group data encoding list includes information of the target group data and an encoding of the target group data corresponding to the information of the target group data.
Specifically, the information of the data to be acquired is compared with the information of the target group data in the target group data code list, the information of the target group data which is the same as the information of the data to be acquired is acquired, and the code corresponding to the information of the target group data is acquired, so that the target code is obtained, that is, the target group data is indicated as the data to be acquired.
As an optional embodiment of the present invention, determining a target group data code corresponding to information of data to be acquired from a target group data code list, as the target code, includes:
acquiring information of target group data which is the same as the information of the data to be acquired from the target group data coding list as information for determining the target group data;
according to the information of the determination target group data, the code of the target group data corresponding to the information of the determination target group data is acquired as the target code.
Specifically, the name or the preset code of the data to be acquired is compared with the information of the target group data, and then the information of the target group data includes the name or the preset code and can be set according to the actual situation. And after comparison, acquiring the information of the target group data which is the same as the information of the data to be acquired as the information for determining the target group data, and acquiring the code of the target group data corresponding to the information for determining the target group data as the target code.
An interface definition information obtaining module 250, configured to request an interface corresponding to the target group data according to the target code, and obtain interface definition information from the interface.
Specifically, the target code is used as an entry parameter in an HTTP request mode, a request is made for an interface of target group data corresponding to the target code, and when the request is successful, interface definition information is acquired from the interface of the target group data.
As an alternative embodiment of the present invention, requesting an interface corresponding to the target group data according to the target code, and acquiring the interface definition information from the interface includes:
requesting all interfaces of corresponding target group data according to the target code;
and calling all interfaces of the target group data by taking the interface codes of all interfaces of the target group data as the access parameters, and acquiring interface definition information in each called interface.
Specifically, in order to facilitate the front end to obtain data by using different interfaces, each group of data may have a plurality of different types of interfaces, for example, an api interface, a gourp interface, a list interface, and the like. Requesting all types of interfaces of target group data by taking the target code as an entry parameter; and each interface is provided with an interface code, all interfaces of the target group data are called by taking the interface code of each interface as an input parameter, and interface definition information in each called interface is obtained.
And the interface generating module 260 is configured to generate an interface for acquiring the data to be acquired according to the interface definition information.
Specifically, the processor returns the acquired interface definition information to the front end, loads the interface definition information into a local interface file of the front end, and establishes an interface for acquiring the data to be acquired with the back end through the local interface file.
As an optional embodiment of the present invention, generating an interface for acquiring data to be acquired according to the interface definition information includes:
extracting a main field from the interface definition information;
analyzing the main field to obtain analysis interface information; the interface analysis information comprises an interface parameter input field, an interface parameter output field, types of various fields and whether the various fields need attributes or not;
and generating an interface for acquiring the data to be acquired according to the analysis interface information.
Specifically, the interface definition information is used for generating data of a front-end and a back-end new interface, and for the convenience of data information storage, the interface definition information needs to be subjected to data analysis processing to obtain analyzed interface information after the data analysis processing, and the analyzed interface information at least includes basic information for generating the new interface, such as an interface parameter field, types of various fields, whether various fields need attributes, and the like. And returning the analyzed interface information to the front end, loading the analyzed interface information into a local file, and generating an interface for acquiring the data to be acquired.
Fig. 3 is a schematic structural diagram of an electronic device implementing an interface generation method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as an interface generation program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of an interface generation program, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., interface generation programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The interface generation program 12 stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, can implement:
according to the interface generation instruction, logging in a project management platform through a configuration file; wherein the content of the first and second substances,
the configuration file comprises login information of the project management platform, information of the data to be acquired and a project space to which the data to be acquired belongs; the project management platform comprises project spaces and project space coding lists corresponding to the project spaces, wherein each project space comprises a group data coding list;
acquiring a code of a project space which is the same as the affiliated project space of the data to be acquired from the project space code list, and taking the code as a target project space code;
acquiring a group data code list from a target project space corresponding to the target project space code according to the target project space code, and using the group data code list as a target group data code list;
determining a target group data code corresponding to the information of the data to be acquired from the target group data code list as a target code; the target group data coding list comprises information of the target group data and codes of the target group data corresponding to the information of the target group data;
according to the target code, requesting an interface corresponding to the target group data, and acquiring interface definition information from the interface;
and generating an interface for acquiring the data to be acquired according to the interface definition information.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again. It is emphasized that the configuration file may also be stored in a node of a blockchain in order to further ensure privacy and security of the configuration file.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.