Interface calling service method and device, storage medium and computer device
By calling service methods through interfaces, obtaining underlying data and building task flows, a service integration interface is generated, which solves the problem of extended development cycles caused by data processing complexity and achieves improved development efficiency that can quickly adapt to market needs.
Patent Information
- Application Number
- CN202410980686.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Due to the complexity of data processing and analysis in existing technologies, the development cycle of service applications is prolonged and cannot adapt to the rapid changes in market demand.
Provides an interface calling service method, which obtains the underlying data of each underlying service, creates a communication interface, encapsulates it into a reference library, builds a task flow, generates a service integration interface, and uses the service integration interface to perform calls and executions, avoiding the complex process of data processing.
It achieves the separation of underlying capabilities and business functions, improves development efficiency, can quickly adapt to changes in market demand, and simplifies the development process.
Smart Images

Figure CN118519798B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of interface calling technology, and in particular to an interface calling service method, apparatus, storage medium and computer equipment. Background Art
[0002] In traditional hardware and software integrated development environments, developers often rely directly on algorithm development kits or hardware module-specific development kits provided by manufacturers to build applications. While these development kits, while powerful, bridge business systems with underlying services, including rich interfaces and direct access to raw data, also present significant challenges.
[0003] Because the data in underlying services remains unprocessed and in its most raw state, developers need to filter the data when building service applications to ensure its accuracy and usability. Data filtering not only requires developers to possess deep expertise but also incurs significant learning and trial-and-error costs. In short, the complexity of data processing and analysis prolongs the development cycle of service applications, making them unable to adapt to the rapid changes in market demand. Summary of the Invention
[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defects in the prior art that the development cycle of service applications is prolonged due to the complexity of data processing and analysis, and cannot adapt to the rapid changes in market demand.
[0005] This application provides an interface calling service method, the method comprising:
[0006] Obtain the underlying data of each underlying service, and create a communication interface for each underlying service based on the underlying data;
[0007] Encapsulate the underlying data and communication interfaces of each underlying service to obtain the reference library corresponding to each underlying service;
[0008] Constructing task flows of various service applications in the business system according to various reference libraries, and generating service integration interfaces of the business system based on various task flows;
[0009] When the input parameters sent by the user are received, the service integration interface is used to determine the target task flow corresponding to the input parameters from each task flow, and the target task flow is called and executed based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface.
[0010] Optionally, the creating a communication interface for each underlying service based on each underlying data includes:
[0011] For each underlying service, read the interface method provided by the underlying service from the underlying data of the underlying service;
[0012] An interface definition file for the underlying service is generated according to the interface method, and the interface definition file is compiled to generate a communication interface for the underlying service.
[0013] Optionally, constructing the task flow of each service application in the business system according to each reference library includes:
[0014] Generate multiple subtasks based on each reference library and preset local logic; the subtasks are used to call the communication interface of the underlying service or execute local functions through the reference library;
[0015] For each service application in the business system, the business logic of the service application is determined, and the business logic is parsed to determine multiple subtasks corresponding to the business logic according to the parsing result, and the subtasks are combined to obtain the task flow of the service application.
[0016] Optionally, the determining the target task flow corresponding to the input parameter from each task flow by using the service integration interface includes:
[0017] Performing parameter parsing on the input parameters to obtain a parsing result, and performing parameter matching on the parsing result in the service integration interface to obtain a task flow whose startup parameters are consistent with the parsing result;
[0018] The input parameters are passed to the matched task flow to obtain a target task flow corresponding to the input parameters.
[0019] Optionally, the calling and executing the target task flow based on the input parameters through the service integration interface to obtain an execution result of the service integration interface according to the output includes:
[0020] Determine the calling logic of the target task flow, and pass the input parameters to each subtask of the target task flow in sequence according to the calling logic through the service integration interface for calling and execution until the execution result of any subtask meets the end condition, and output the execution result.
[0021] Optionally, the input parameter includes a face image; the subtasks of the target task flow include a face detection service, a liveness detection service, a distance detection service, a threshold judgment service, and a user identification service;
[0022] The input parameters are sequentially passed to each subtask of the target task flow according to the call logic through the service integration interface for call execution until the execution result of any subtask meets the end condition, and the execution result is output, including:
[0023] Inputting the facial image into the face detection service through the service integration interface to call the face detection service to perform image detection on the facial image to obtain a first detection result;
[0024] When the first detection result contains facial information, calling the liveness detection service to perform liveness detection on the facial image based on the first detection result to obtain a second detection result;
[0025] When the second detection result is a live body, calling the distance detection service to perform distance detection on the face image based on the second detection result to obtain a third detection result;
[0026] When the third detection result is qualified, calling the threshold judgment service to perform threshold matching on the face image based on the third detection result to obtain a face matching result;
[0027] When the face matching result is passed, the user identification service is called to identify the user ID in the face matching result in the user database to obtain the user identification result, and a success code is returned if the user identification result has data, so that the service integration interface outputs the success code through the interface callback;
[0028] If the first detection result does not contain facial information, the second detection result is not alive, the third detection result is unqualified, or the face matching result is not passed, a failure code is returned so that the service integration interface outputs the failure code through interface callback.
[0029] Optionally, the input parameter includes a monitoring signal of a card reader; the subtasks of the target task flow include a type identification service, an MCU data reading service, a serial port data reading service, and a card number parsing service;
[0030] The input parameters are sequentially passed to each subtask of the target task flow according to the call logic through the service integration interface for call execution until the execution result of any subtask meets the end condition, and the execution result is output, including:
[0031] Inputting the monitoring data into the type identification service through the service integration interface, so as to call the type identification service to perform signal analysis on the monitoring signal to obtain the type of the card reader;
[0032] When the card reader type is MCU, the MCU data reading service is called to start the MCU service, and instruction data is written to the MCU service so that the MCU service reads the card data when the card reader swipes the card to obtain the original data;
[0033] When the card reader type is a serial port, the serial port data reading service is called to initialize the serial port of the card reader, and when the card reader swipes the card, data detection is performed through the serial port to obtain the original data;
[0034] The card number parsing service is called to perform card number parsing on the original data to obtain card number data, so that the service integration interface outputs the card number data through an interface callback.
[0035] This application also provides an interface calling service device, including:
[0036] The interface creation module is used to obtain the underlying data of each underlying service and create a communication interface for each underlying service based on the underlying data;
[0037] The data encapsulation module is used to encapsulate the underlying data and communication interfaces of each underlying service and obtain the reference library corresponding to each underlying service;
[0038] An interface integration module is used to construct the task flow of each service application in the business system according to each reference library, and generate the service integration interface of the business system based on each task flow;
[0039] The interface calling module is used to use the service integration interface to determine the target task flow corresponding to the input parameters from each task flow when receiving the input parameters sent by the user, and to call and execute the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface.
[0040] The present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the interface calling service method as described in any of the above embodiments.
[0041] The present application also provides a computer device, comprising: one or more processors, and a memory;
[0042] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the interface calling service method as described in any one of the above embodiments are performed.
[0043] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0044] The interface calling service method, apparatus, storage medium and computer equipment provided in the present application can first obtain the underlying data of each underlying service and create a communication interface for each underlying service based on each underlying data before building a service application of a business system, so as to allow the underlying services to communicate efficiently between different processes and improve general capabilities; then the underlying data and communication interface of each underlying service can be encapsulated to obtain a reference library corresponding to each underlying service, so that each underlying service can be called through the reference library, thereby realizing the separation of underlying capabilities and business functions; therefore, when building a service application, the business system can build the task flow of each service application in the business system according to each reference library, and generate a service integration interface of the business system based on each task flow, so as to encapsulate the complex internal logic of each service application through the service integration interface, and only provide one interface to the outside world, thereby avoiding the complex process of data processing. For example, when the business system receives input parameters sent by the user, it can use the service integration interface to determine the target task flow corresponding to the input parameters from each task flow, and call and execute the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface. In this way, developers only need to configure or adjust the task flow in the service integration interface of the business system according to business needs, without having to worry about the internal implementation logic, so that they can adapt to the rapid changes in market demand. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 A flowchart of an interface calling service method provided in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of the structure of an interface calling service device provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0050] Because the data in underlying services remains unprocessed and in its most raw state, developers need to filter the data when building service applications to ensure its accuracy and usability. Data filtering not only requires developers to possess deep expertise but also incurs significant learning and trial-and-error costs. In short, the complexity of data processing and analysis prolongs the development cycle of service applications, making them unable to adapt to the rapid changes in market demand.
[0051] Based on this, this application proposes the following technical solutions, please refer to the following for details:
[0052] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of an interface call service method provided in an embodiment of the present application; the present application provides an interface call service method, which specifically includes the following:
[0053] S110: Obtain underlying data of each underlying service, and create a communication interface for each underlying service based on the underlying data.
[0054] In this step, before building the service application of the business system, the computer equipment can first determine all the underlying services that can be used to provide functional support for the service application, and then obtain the underlying data of each underlying service, and create a communication interface for each underlying service based on each underlying data, so as to allow the underlying services to communicate efficiently between different processes and improve the adaptability of the underlying services.
[0055] Low-level services, such as facial recognition algorithms, fingerprint algorithms, card services, and QR code services, provide basic functionality or data processing capabilities for higher-level applications. These services typically do not interact directly with users but instead serve as backend support for higher-level services or applications. Low-level data refers to the data stored within these low-level services and serves as the foundation for system operations and business logic. These data can include structured data, unstructured data, and real-time data streams, and are not limited here.
[0056] Specifically, computer devices can use AIDL (Android Interface Definition Language) to define the communication interface of each underlying service based on the underlying data. Because AIDL can clearly describe the methods and parameters provided by the underlying service and allows efficient communication between different processes, and each service application runs in its own process with independent memory space, service applications installed in the business system can communicate with each underlying service through the communication interface of each underlying service, thereby improving the development efficiency of service applications.
[0057] S120: Encapsulate the underlying data and communication interface of each underlying service to obtain a reference library corresponding to each underlying service.
[0058] In this step, after obtaining the underlying data and communication interface of each underlying service through step S110, the computer device can encapsulate the underlying data and communication interface of each underlying service to obtain the reference library corresponding to each underlying service, so that the service application can call each underlying service through the reference library, thereby realizing the separation of underlying capabilities and business functions.
[0059] It can be understood that a reference library is a component that packages the relevant resources and code for the underlying service. Specifically, it encapsulates the functionality or logic of the underlying service and provides a unified calling interface. This library can encapsulate data such as methods, functions, classes, and interfaces to achieve separation between underlying capabilities and business functions, enabling reuse across different service applications. Consequently, when developing different service applications, computer devices can directly call the underlying service through the reference library, eliminating the need to filter and edit the underlying data of the underlying service each time, thus enabling rapid adaptation to changing market demands.
[0060] S130: Constructing task flows of various service applications in the business system according to various reference libraries, and generating service integration interfaces of the business system based on various task flows.
[0061] In this step, after obtaining the reference libraries of each underlying service through step S120, the computer device can construct the task flows of each service application in the business system based on each reference library, and then generate the service integration interface of the business system based on each task flow. In this way, the complex internal logic of each service application within the business system can be uniformly encapsulated through the service integration interface, and only one interface is provided to the outside to avoid the complex process of data processing.
[0062] As you can understand, the reference library hides implementation details, providing a concise interface and enabling code reuse. Therefore, when building a service integration interface for a business system, a computer device can first identify the service applications to be installed in the business system. Then, based on the reference library of the underlying services that each service application needs to call, it can define the task flow for each service application. Finally, the computer device can integrate these task flows to create the service integration interface. Consequently, each task flow in the service integration interface performs the functions of a different service application, is independent of each other, and can be executed in parallel, thereby improving service application development efficiency.
[0063] Furthermore, developers can pre-create task flows corresponding to each service application based on each reference library. In this way, when the business system needs to install a new service application, the user can directly obtain the task flow corresponding to the service application, and then bind the task flow to the service integration interface to achieve the installation of the service application. If the function of the service application installed in the business system is updated, the task flow corresponding to the service application can be extracted from the service integration interface, and then the task flow can be logically adjusted based on the changed functional content of the service application to achieve the update of the service application. Therefore, this application can shorten the development cycle of service applications through the service integration interface, thereby adapting to the rapid changes in market demand.
[0064] S140: When receiving the input parameters sent by the user, the service integration interface is used to determine the target task flow corresponding to the input parameters from each task flow, and the target task flow is called and executed based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface.
[0065] In this step, after creating a service integration interface in the business system through S130, if the computer device receives the input parameters entered by the user in the business system, the target task flow corresponding to the input parameters can be determined from each task flow through the integration interface corresponding to the business system, and then the target task flow can be called and executed based on the input parameters through the service integration interface, and finally the execution result can be output through the callback of the service integration interface.
[0066] Specifically, each target task flow has corresponding startup parameters. Therefore, upon receiving the input parameters sent by the user, the computer device can use a pre-defined matching method to match the input parameters with the startup parameters to determine the target task flow corresponding to the input parameters from each task flow. The computer device can then automatically write the input parameters into the method provided by the target task flow, thereby calling the relevant underlying service to perform the corresponding function. When the target task flow executes successfully, the corresponding execution result will be returned through a callback in the service integration interface.
[0067] It is understandable that in this application, the computer device can efficiently utilize the service integration interface and the service call logic of the task flow to directly lock and execute its corresponding task flow based on the input parameters sent by the user, and return the corresponding execution result through callback in the service integration interface. This method can separate the underlying capabilities of the service application from the business functions. There is no need to develop the service application from the underlying data, nor to adapt the hardware conditions of the business system. It only needs to bind the task flow corresponding to the service application in the service integration interface of the business system and make an interface call to obtain the execution result corresponding to the input parameters.
[0068] In the above embodiment, before building the service application of the business system, the underlying data of each underlying service can be obtained first, and the communication interface of each underlying service can be created based on the underlying data to allow the underlying services to communicate efficiently between different processes and improve general capabilities; then the underlying data and communication interface of each underlying service can be encapsulated to obtain the reference library corresponding to each underlying service, so that each underlying service can be called through the reference library, thereby realizing the separation of underlying capabilities and business functions; therefore, when building the service application, the business system can build the task flow of each service application in the business system according to each reference library, and generate the service integration interface of the business system based on each task flow, so as to encapsulate the complex internal logic of each service application through the service integration interface, and only provide one interface to the outside world to avoid the complex process of data processing. For example, when the business system receives input parameters sent by the user, it can use the service integration interface to determine the target task flow corresponding to the input parameters from each task flow, and call and execute the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface. In this way, developers only need to configure or adjust the task flow in the service integration interface of the business system according to business needs, without having to worry about the internal implementation logic, so that they can adapt to the rapid changes in market demand.
[0069] In one embodiment, creating a communication interface for each underlying service based on each underlying data in step S110 may include:
[0070] S111: For each underlying service, read the interface method provided by the underlying service from the underlying data of the underlying service.
[0071] S112: Generate an interface definition file for the underlying service according to the interface method, and compile the interface definition file to generate a communication interface for the underlying service.
[0072] In this embodiment, when constructing the communication interface of each underlying service, for each underlying service, the computer device can read the interface method provided by the underlying service from the underlying data of the underlying service, and then generate an interface definition file for the underlying service based on its interface method, and compile the interface definition file to generate the communication interface of the underlying service. In this way, the computer device can call the underlying service method through the communication interface, thereby reducing the complexity of service application development.
[0073] It is understandable that the interface method in this application refers to the method defined in the interface in an object-oriented programming language, which may include a method name, parameter type, and return type. Among them, the method name refers to the identifier of the method, which can be used to uniquely identify the method in the corresponding underlying service in the interface; the parameter type refers to the type of external data received during the execution of the method, where the parameters can be zero or more; and the return type refers to the data type returned to the business system after the method is executed. If the method does not return any value, the return type is void. Therefore, through the interface definition file generated according to the interface method, this application can implement the method call of the underlying service.
[0074] Specifically, the computer device can first create an empty interface definition file. The path of the interface definition file should be consistent with the package name to ensure that the written file content can match the package name in the underlying service. Then, the computer device can use the AIDL syntax to define the interface in the interface definition file according to the interface method. The interface declares the method name, parameter type and return type provided by the underlying service, and then can mark the direction of each parameter in the interface definition file to make it clear whether the parameter is input, output or bidirectional, where the input parameter will be passed to the underlying service, and the output parameter will be returned by the underlying service to the corresponding business system. Finally, the computer device can compile the interface definition file that defines the interface method into the corresponding interface code to form a communication interface. The communication interface contains a Binder mechanism, so it can be used for inter-process communication between the underlying service and the service application.
[0075] In one embodiment, step S130 constructs the task flow of each service application in the business system according to each reference library, which may include:
[0076] S131: Generate multiple subtasks according to each reference library and preset local logic.
[0077] S132: For each service application in the business system, determine the business logic of the service application, and parse the business logic to determine multiple subtasks corresponding to the business logic according to the parsing result, and combine them to obtain the task flow of the service application.
[0078] In this embodiment, the computer device can generate multiple subtasks based on various reference libraries and preset local logic. The subtasks here can be used to call the communication interface of the underlying service or execute local functions through the reference library; therefore, for each service application in the business system, the computer device can determine the business logic of the service application and parse the business logic to determine multiple subtasks corresponding to the business logic based on the parsing results, and combine them to obtain the task flow of the service application.
[0079] Among them, local logic refers to the business logic or functions executed within the business system, rather than implemented through external services or interfaces. It can include operations and processing on local resources such as file systems, memory, databases, etc., without the need for network communication or external communication calls.
[0080] It is understandable that the computer device uses the parsed results of the service application's business logic to define how the service application responds to external requests, processes data, and interacts with other services, thereby breaking down the process into a series of specific, executable subtasks. These subtasks cover all operations of the service application, including calling the communication interface of the underlying service through a reference library to obtain or send data, and executing functions defined in the local logic, such as data processing, status updates, or rule verification. Each subtask is an indispensable part of implementing the business logic, and together they constitute the core functionality of the service application. Therefore, the computer device combines these subtasks in a specific order and logic to form a complete task flow, thereby ensuring that the service application can be executed smoothly according to the predetermined business logic.
[0081] It should be noted that in this application, the same subtask can be applied to multiple different task flows, and new functions can be expanded by freely combining different subtasks, so as to flexibly adapt to changes in business needs in the business system and support complex and diverse application scenarios.
[0082] In one embodiment, determining the target task flow corresponding to the input parameters from each task flow using the service integration interface in step S140 may include:
[0083] S142: Parsing the input parameters to obtain parsing results, and matching the parsing results with parameters in the service integration interface to obtain a task flow whose startup parameters are consistent with the parsing results.
[0084] S142: Pass the input parameters to the matched task flow to obtain a target task flow corresponding to the input parameters.
[0085] In this embodiment, when the computer device determines the target task flow corresponding to the input parameters, it can first perform parameter parsing on the input parameters to obtain the parsing results, and perform parameter matching on the parsing results in the service integration interface to obtain a task flow whose startup parameters are consistent with the parsing results. The computer device can then pass the input parameters to the matched task flow to obtain the target task flow corresponding to the input parameters, so as to achieve ready-to-use service applications in the business system without the need for underlying configuration.
[0086] Specifically, after the computer device receives the input parameters entered by the user in the business system, it can first verify the input parameters, including verifying whether the type, length, format, etc. of the input parameters meet expectations, so as to ensure the validity, integrity and security of the input parameters. When the verification is passed, the computer device can parse the input parameters into a format that can be recognized within the system, and then traverse the startup parameters of each task flow in the service integration interface to find the task flow that matches the input parameter conditions. Then, the computer device can pass the input parameters to the task flow so that the task flow can write the input parameters into its defined method to form a target task flow. Therefore, when the target task flow starts the execution process, it can call the underlying service or local logic based on the input parameters and execute the corresponding business logic.
[0087] In one embodiment, in step S140, the target task flow is called and executed based on the input parameters through the service integration interface to obtain the execution result of the service integration interface according to the output, which may include:
[0088] S143: Determine the calling logic of the target task flow, and pass the input parameters to each subtask of the target task flow in sequence according to the calling logic through the service integration interface for calling and executing, until the execution result of any subtask meets the end condition, and output the execution result.
[0089] In this embodiment, when calling to execute the target task flow, the computer device can first determine the calling logic of the target task flow, and pass the input parameters to the various subtasks of the target task flow in sequence according to the calling logic through the service integration interface for calling and executing, until the execution result of any subtask meets the end condition, and output the execution result, thereby ensuring the realization of the complete functions in the service application.
[0090] Understandably, the goal of the target task flow is to ensure that service applications accurately implement their designed functions through refined task decomposition and efficient process control. This improves the reliability and efficiency of business system operations and enables the effective management and execution of complex business logic in service applications.
[0091] Specifically, the call logic is the key to the service application being able to execute in the expected order and rules. Therefore, the computer device passes the input parameters to each subtask in the target task flow in sequence according to the call logic. This sequential transmission can ensure the logic of function execution. When the subtask receives the parameters passed by the computer device, it can perform its specific function or operation and output the corresponding execution result, so that the computer device can execute the result and pass the corresponding parameters to the next subtask or output it as the final execution result to realize the function of the service application. In this process, when the execution result of any subtask meets the preset end condition, such as execution completion, reaching a specific state, or triggering an error, the entire target task flow will stop executing and output the final execution result.
[0092] In one embodiment, the input parameters in step S143 may include a face image; the subtasks of the target task flow may include a face detection service, a liveness detection service, a distance detection service, a threshold determination service, and a user identification service; wherein, the input parameters are sequentially passed to each subtask of the target task flow according to the calling logic through the service integration interface for calling and executing until the execution result of any subtask meets the termination condition. The step of outputting the execution result may include:
[0093] S4311: Inputting the facial image into the face detection service through the service integration interface to call the face detection service to perform image detection on the facial image to obtain a first detection result.
[0094] S4312: When the first detection result contains facial information, call the liveness detection service to perform liveness detection on the facial image based on the first detection result to obtain a second detection result.
[0095] S4313: When the second detection result is a live body, call the distance detection service to perform distance detection on the face image based on the second detection result to obtain a third detection result.
[0096] S4314: When the third detection result is qualified, the threshold judgment service is called to perform threshold matching on the face image based on the third detection result to obtain a face matching result.
[0097] S4315: When the face matching result is passed, the user identification service is called to identify the user ID in the face matching result in the user database to obtain the user identification result, and a success code is returned when data exists in the user identification result, so that the service integration interface outputs the success code through the interface callback.
[0098] S4316: If the first detection result shows that there is no facial information, the second detection result is not alive, the third detection result is unqualified, or the face matching result is not passed, a failure code is returned so that the service integration interface outputs the failure code through the interface callback.
[0099] In this embodiment, after the face verification application connected with the access control in the business system is started, when a user arrives at the access control, the business system can obtain the corresponding face image, and match the target task flow corresponding to the face image from the service integration interface based on the face image. The sub-tasks in the target task flow can include a face detection service, a living body detection service, a distance detection service, a threshold judgment service, and a user identification service. Therefore, the computer device transmits the face image to the services corresponding to the sub-tasks through the sub-tasks in sequence for verification, and returns a success code if all the services pass the verification. In the verification process, if any service fails the verification, the execution of the sub-tasks is stopped, and a failure code is directly returned.
[0100] Specifically, the face detection module is mainly responsible for face detection on the face image. When there is face information in the detection result, it indicates that there is a person at the access control, and therefore the next sub-task can be executed to call the living body detection service for living body detection. The living body detection service is mainly responsible for judging whether the living body score in the face information is greater than a preset living body threshold. If yes, it indicates that the verification result of the living body detection service is a living body, and therefore the next sub-task can be executed to call the distance detection service for distance detection. The distance detection service is mainly responsible for detecting whether the distance between the person in the image and the access control is greater than a preset distance. If yes, it indicates that the distance between the person and the access control is moderate, and therefore the detection result is considered to be qualified. If no, it indicates that the distance between the person and the access control is too close, and therefore the detection result is considered to be unqualified. The threshold judgment service is mainly responsible for judging whether the comparison score of the face information reaches a matching threshold. If yes, it indicates that the matching result passes the detection, and therefore the image of the person can be used for identity recognition. If no, it indicates that the matching result fails the detection, and therefore the image of the person cannot be used for identity recognition. The user identification service is to judge whether the recognized user ID exists in the user database. If yes, it indicates that the person is a passable person with access rights, and therefore the verification of the user identification service passes. If no, it indicates that the person is an unknown person without access rights, and therefore the verification of the user identification service fails.
[0101] In one embodiment, the input parameter in step S143 can include a listening signal of a card reader; the sub-tasks of the target task flow can include a type identification service, an MCU data reading service, a serial port data reading service, and a card number parsing service; wherein the input parameter is sequentially transmitted to each sub-task of the target task flow for calling and execution through the service integration interface according to the calling logic, and the step of outputting the execution result until the execution result of any sub-task meets the end condition can include:
[0102] S4321: Input the monitoring data into the type identification service through the service integration interface to call the type identification service to perform signal analysis on the monitoring signal to obtain the type of the card reader.
[0103] S4322: When the card reader type is MCU, call the MCU data reading service to start the MCU service, and write instruction data to the MCU service so that the MCU service reads the card data when the card reader swipes the card to obtain the original data.
[0104] S4323: When the card reader type is a serial port, the serial port data reading service is called to initialize the serial port of the card reader, and when the card reader swipes the card, data detection is performed through the serial port to obtain the original data.
[0105] S4324: Call the card number parsing service to parse the original data to obtain the card number data, so that the service integration interface can output the card number data through the interface callback.
[0106] In this embodiment, when a card number parsing application connected to a card reader is enabled in a business system, the business system can monitor the card reader, generate monitoring data, and then match the corresponding target task flow from the service integration interface based on the monitoring data. The subtasks in this target task flow may include a type identification service, an MCU data reading service, a serial port data reading service, and a card number parsing service. Specifically, the computer device can first identify the card reader type using the type identification service. Types may include MCU and serial port. Therefore, based on the card reader type, the computer device can select the MCU data reading service or the serial port data reading service to read the raw data. The card number parsing service then parses the raw data to obtain the card number data corresponding to the card number.
[0107] It's understandable that MCU and serial port refer to different technical connection methods for card readers. An MCU, or microcontroller unit, integrates the CPU, RAM, ROM, timer, counter, and various I / O interfaces of a computer in a device onto a single chip, creating a computer-on-a-chip. A serial port, on the other hand, refers to an electronic interface standard that connects a computer to an external device via a data cable and exchanges data according to a specific protocol, enabling data communication between the computer and the external device.
[0108] Therefore, after the card number parsing application is turned on, the type identification service can first parse the monitoring data input by the business system to obtain the type of card reader. When the card reader type is MCU, the computer device can call the MCU data reading service to start the MCU service and write instruction data to the MCU service so that the MCU service generates a communication data packet and writes it to the card reader. In this way, when the card reader swipes the card, the card data can be directly stored in the communication data packet. The MCU service then reads the card data from the communication data packet to obtain the original data. Finally, the card number parsing service can be used to parse the card data corresponding to the original data, so that the service integration interface can output the card number data through the interface callback. When the card reader type is serial port, the computer device can call the serial port data reading service to initialize the serial port of the card reader and perform data detection through the serial port when the card reader swipes the card to obtain the original data. The card number parsing service can then be used to parse the card number data corresponding to the original data, so that the service integration interface can output the card number data through the interface callback.
[0109] The interface calling service device provided in an embodiment of the present application is described below. The interface calling service device described below and the interface calling service method described above can be referenced to each other.
[0110] In one embodiment, Figure 2 As shown, Figure 2 This is a schematic diagram of the structure of an interface call service device provided in an embodiment of the present application. The present application also provides an interface call service device, including an interface creation module 210, a data encapsulation module 220, an interface integration module 230, and an interface call module 240, specifically including the following:
[0111] The interface creation module 210 is used to obtain the underlying data of each underlying service and create a communication interface for each underlying service based on the underlying data.
[0112] The data encapsulation module 220 is used to encapsulate the underlying data and communication interface of each underlying service to obtain a reference library corresponding to each underlying service.
[0113] The interface integration module 230 is used to construct the task flow of each service application in the business system according to each reference library, and generate the service integration interface of the business system based on each task flow.
[0114] The interface calling module 240 is used to use the service integration interface to determine the target task flow corresponding to the input parameters from each task flow when receiving the input parameters sent by the user, and to call and execute the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface.
[0115] In the above embodiment, before building the service application of the business system, the underlying data of each underlying service can be obtained first, and the communication interface of each underlying service can be created based on the underlying data to allow the underlying services to communicate efficiently between different processes and improve general capabilities; then the underlying data and communication interface of each underlying service can be encapsulated to obtain the reference library corresponding to each underlying service, so that each underlying service can be called through the reference library, thereby realizing the separation of underlying capabilities and business functions; therefore, when building the service application, the business system can build the task flow of each service application in the business system according to each reference library, and generate the service integration interface of the business system based on each task flow, so as to encapsulate the complex internal logic of each service application through the service integration interface, and only provide one interface to the outside world to avoid the complex process of data processing. For example, when the business system receives input parameters sent by the user, it can use the service integration interface to determine the target task flow corresponding to the input parameters from each task flow, and call and execute the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface. In this way, developers only need to configure or adjust the task flow in the service integration interface of the business system according to business needs, without having to worry about the internal implementation logic, so that they can adapt to the rapid changes in market demand.
[0116] In one embodiment, the interface creation module 210 may include:
[0117] The method reading submodule is used to read the interface method provided by each underlying service from the underlying data of the underlying service.
[0118] The interface generation submodule is used to generate the interface definition file of the underlying service according to the interface method, and compile the interface definition file to generate the communication interface of the underlying service.
[0119] In one embodiment, the interface integration module 230 may include:
[0120] The subtask generation submodule is used to generate multiple subtasks based on various reference libraries and preset local logic.
[0121] The task flow combination submodule is used to determine the business logic of each service application in the business system, and parse the business logic to determine multiple subtasks corresponding to the business logic based on the parsing results, and combine them to obtain the task flow of the service application.
[0122] In one embodiment, the interface calling module 240 may include:
[0123] The parameter matching submodule is used to parse the input parameters, obtain the parsing results, and match the parsing results in the service integration interface to obtain a task flow whose startup parameters are consistent with the parsing results.
[0124] The task flow determination submodule is used to pass the input parameters to the matched task flow to obtain the target task flow corresponding to the input parameters.
[0125] In one embodiment, the interface calling module 240 may further include:
[0126] The task calling submodule is used to determine the calling logic of the target task flow, and pass the input parameters to each subtask of the target task flow in sequence according to the calling logic through the service integration interface for calling and execution until the execution result of any subtask meets the end condition and outputs the execution result.
[0127] In one embodiment, the task calling submodule may include:
[0128] The first detection unit is used to input the face image into the face detection service through the service integration interface, so as to call the face detection service to perform image detection on the face image and obtain a first detection result.
[0129] The second detection unit is configured to, when the first detection result contains facial information, call the liveness detection service to perform liveness detection on the facial image based on the first detection result to obtain a second detection result.
[0130] The third detection unit is configured to, when the second detection result is a live body, call the distance detection service to perform distance detection on the face image based on the second detection result to obtain a third detection result.
[0131] The threshold matching unit is used to call the threshold judgment service to perform threshold matching on the face image based on the third detection result when the third detection result is qualified, so as to obtain a face matching result.
[0132] The user identification unit is used to call the user identification service to identify the user ID in the face matching result in the user database when the face matching result is passed, obtain the user identification result, and return a success code when the user identification result has data, so that the service integration interface can output the success code through the interface callback.
[0133] The interface callback unit is used to return a failure code if the first detection result does not contain facial information, the second detection result is not alive, the third detection result is unqualified, or the face matching result is not passed, so that the service integration interface outputs the failure code through the interface callback.
[0134] In one embodiment, the task calling submodule may further include:
[0135] The signal parsing unit is used to input the monitoring data into the type identification service through the service integration interface, so as to call the type identification service to perform signal parsing on the monitoring signal and obtain the type of the card reader.
[0136] The first reading unit is used to call the MCU data reading service to start the MCU service when the card reader type is MCU, and write instruction data to the MCU service so that the MCU service reads the card data when the card reader swipes the card to obtain the original data.
[0137] The second reading unit is used to call the serial port data reading service to initialize the serial port of the card reader when the card reader type is a serial port, and perform data detection through the serial port when the card reader swipes the card to obtain the original data.
[0138] The data output unit is used to call the card number parsing service to parse the original data to obtain the card number data, so that the service integration interface can output the card number data through the interface callback.
[0139] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the interface calling service method as described in any of the above embodiments.
[0140] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the interface calling service method as described in any of the above embodiments.
[0141] Schematically, as Figure 3 As shown, Figure 3 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 can be provided as a server. Figure 3 Computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by memory 301 for storing instructions executable by processing component 302, such as an application. The application stored in memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 302 is configured to execute the instructions to perform the interface call service method of any of the above-mentioned embodiments.
[0142] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.
[0143] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0144] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0145] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0146] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An interface calling service method, characterized in that: The method comprises: Obtain the underlying data of each underlying service, and create a communication interface for each underlying service based on the underlying data; Encapsulate the underlying data and communication interfaces of each underlying service to obtain the reference library corresponding to each underlying service; Constructing task flows of various service applications in the business system based on various reference libraries, and generating a service integration interface of the business system based on various task flows; the service integration interface outputs the execution result through an interface callback; When receiving input parameters sent by the user, the service integration interface is used to determine the target task flow corresponding to the input parameters from each task flow, and the target task flow is called and executed based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface; The step of creating a communication interface for each underlying service based on each underlying data includes: For each underlying service, read the interface method provided by the underlying service from the underlying data of the underlying service; Generate an interface definition file for the underlying service according to the interface method, and compile the interface definition file to generate a communication interface for the underlying service; The task flow of constructing each service application in the business system according to each reference library includes: Generate multiple subtasks based on each reference library and preset local logic; the subtasks are used to call the communication interface of the underlying service or execute local functions through the reference library; For each service application in the business system, determine the business logic of the service application, and parse the business logic to determine multiple subtasks corresponding to the business logic based on the parsing results, and combine them to obtain a task flow for the service application; The calling and executing the target task flow based on the input parameters through the service integration interface to obtain the execution result output by the service integration interface includes: Determine the calling logic of the target task flow, and pass the input parameters to each subtask of the target task flow in sequence according to the calling logic through the service integration interface for calling and execution, until the execution result of any subtask meets the end condition, and output the execution result.
2. The interface calling service method according to claim 1, characterized in that: The determining the target task flow corresponding to the input parameter from each task flow by using the service integration interface includes: Performing parameter parsing on the input parameters to obtain a parsing result, and performing parameter matching on the parsing result in the service integration interface to obtain a task flow whose startup parameters are consistent with the parsing result; The input parameters are passed to the matched task flow to obtain a target task flow corresponding to the input parameters.
3. The interface calling service method according to claim 1, characterized in that: The input parameters include face images; the subtasks of the target task flow include face detection service, liveness detection service, distance detection service, threshold judgment service and user identification service; The input parameters are sequentially passed to each subtask of the target task flow according to the call logic through the service integration interface for call execution until the execution result of any subtask meets the end condition, and the execution result is output, including: Inputting the facial image into the face detection service through the service integration interface to call the face detection service to perform image detection on the facial image to obtain a first detection result; When the first detection result contains facial information, calling the liveness detection service to perform liveness detection on the facial image based on the first detection result to obtain a second detection result; When the second detection result is a live body, calling the distance detection service to perform distance detection on the face image based on the second detection result to obtain a third detection result; When the third detection result is qualified, calling the threshold judgment service to perform threshold matching on the face image based on the third detection result to obtain a face matching result; When the face matching result is passed, the user identification service is called to identify the user ID in the face matching result in the user database to obtain the user identification result, and a success code is returned if the user identification result has data, so that the service integration interface outputs the success code through the interface callback; If the first detection result does not contain facial information, the second detection result is not alive, the third detection result is unqualified, or the face matching result is not passed, a failure code is returned so that the service integration interface outputs the failure code through interface callback.
4. The interface calling service method according to claim 1, characterized in that: The input parameters include the monitoring signal of the card reader; the subtasks of the target task flow include type identification service, MCU data reading service, serial port data reading service and card number parsing service; The input parameters are sequentially passed to each subtask of the target task flow according to the call logic through the service integration interface for call execution until the execution result of any subtask meets the end condition, and the execution result is output, including: Inputting the monitoring data into the type identification service through the service integration interface to call the type identification service to perform signal analysis on the monitoring signal to obtain the type of the card reader; When the card reader type is MCU, the MCU data reading service is called to start the MCU service, and instruction data is written to the MCU service so that the MCU service reads the card data when the card reader swipes the card to obtain the original data; When the card reader type is a serial port, the serial port data reading service is called to initialize the serial port of the card reader, and when the card reader swipes the card, data detection is performed through the serial port to obtain the original data; The card number parsing service is called to perform card number parsing on the original data to obtain card number data, so that the service integration interface outputs the card number data through an interface callback.
5. An interface calling service device, characterized in that: include: The interface creation module is used to obtain the underlying data of each underlying service and create a communication interface for each underlying service based on the underlying data; The data encapsulation module is used to encapsulate the underlying data and communication interfaces of each underlying service and obtain the reference library corresponding to each underlying service; An interface integration module is used to construct the task flow of each service application in the business system according to each reference library, and generate the service integration interface of the business system based on each task flow; The service integration interface outputs the execution result through interface callback; An interface calling module is configured to, upon receiving input parameters sent by a user, determine a target task flow corresponding to the input parameters from various task flows using the service integration interface, and call and execute the target task flow based on the input parameters through the service integration interface to obtain an execution result output by the service integration interface; Wherein, the interface creation module includes: For each underlying service, read the interface method provided by the underlying service from the underlying data of the underlying service; Generate an interface definition file for the underlying service according to the interface method, and compile the interface definition file to generate a communication interface for the underlying service; The interface integration module includes: Generate multiple subtasks based on each reference library and preset local logic; the subtasks are used to call the communication interface of the underlying service or execute local functions through the reference library; For each service application in the business system, determine the business logic of the service application, and parse the business logic to determine multiple subtasks corresponding to the business logic based on the parsing results, and combine them to obtain a task flow for the service application; The interface calling module includes: Determine the calling logic of the target task flow, and pass the input parameters to each subtask of the target task flow in sequence according to the calling logic through the service integration interface for calling and execution, until the execution result of any subtask meets the end condition, and output the execution result.
6. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, enable the one or more processors to execute the steps of the interface calling service method according to any one of claims 1 to 4.
7. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, execute the steps of the interface calling service method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Abnormal information feedback method and device for service interface, equipment and storage medium
CN114443343A
Business processing method and rule service interface
CN115269220A