CN111343221A - Service processing method and device under command mode based on universal interface framework - Google Patents

Service processing method and device under command mode based on universal interface framework Download PDF

Info

Publication number
CN111343221A
CN111343221A CN201811554276.9A CN201811554276A CN111343221A CN 111343221 A CN111343221 A CN 111343221A CN 201811554276 A CN201811554276 A CN 201811554276A CN 111343221 A CN111343221 A CN 111343221A
Authority
CN
China
Prior art keywords
service
request command
service request
interface
universal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811554276.9A
Other languages
Chinese (zh)
Inventor
刘刚
庞晓
闫绍华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201811554276.9A priority Critical patent/CN111343221A/en
Publication of CN111343221A publication Critical patent/CN111343221A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/12Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
    • G06F13/122Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware performs an I/O function other than control of data transfer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/12Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
    • G06F13/124Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine
    • G06F13/128Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine for dedicated transfers to a network

Abstract

The invention provides a service processing method and a service processing device in a command mode based on a universal interface framework. The method comprises the following steps: receiving a service request command sent by a service client; analyzing the service request command and identifying the type of the service request command; determining a universal interface in the universal interface frame to which the service client needs to be connected according to the type of the service request command; calling the determined universal interface to process the service request command to obtain a processing result; and returning the processing result to the service client. The invention enables different service clients to realize interface butt joint through the same universal interface framework, and uniformly processes and controls the request command sent by the service client through the command mode, thereby fully supporting the calling of different service clients to different universal interfaces in the universal interface framework and improving the interface butt joint efficiency and the service working efficiency.

Description

Service processing method and device under command mode based on universal interface framework
Technical Field
The invention relates to the technical field of internet, in particular to a service processing method and device based on a universal interface framework in a command mode, a computer storage medium and computing equipment.
Background
When processing a service requested by a client to a server, it is necessary to establish a docking between front-end interfaces provided by the client and the server. In the prior art, the scheme adopted for the butt joint of the client and the front-end interface is as follows: each client is independently docked and different clients dock with their respective different interfaces. The scheme causes the complex procedure of the interface butt joint between the client and the front end, the low efficiency of the interface butt joint and the low efficiency of the business work. Moreover, more codes are needed for realizing docking, and the workload of developers is increased.
Disclosure of Invention
In view of the above, the present invention has been made to provide a method and apparatus for processing a service in a generic interface framework based command mode, a computer storage medium and a computing device that overcome or at least partially solve the above problems.
According to an aspect of the embodiments of the present invention, a method for processing a service in a command mode based on a universal interface framework is provided, where the universal interface framework includes one or more universal interfaces, and the method includes:
receiving a service request command sent by a service client;
analyzing the service request command and identifying the type of the service request command;
determining a universal interface in the universal interface frame to which the service client needs to be connected according to the type of the service request command;
calling the determined universal interface to process the service request command to obtain a processing result;
and returning the processing result to the service client.
Optionally, the generic interface framework pre-defines a correspondence between the one or more generic interfaces and a plurality of service clients;
after receiving a service request command sent by a service client, the method further comprises:
judging whether the service client sending the service request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of service clients predefined in the universal interface framework;
if not, the flow is ended.
Optionally, before parsing the service request command, the method further includes:
and carrying out security check on the received service request command.
Optionally, performing security check on the received service request command includes:
and filtering special characters in the service request command by using a regular expression.
Optionally, before parsing the service request command, the method further includes:
and checking the service parameters contained in the service request command.
Optionally, the service parameter includes a data field name and/or a time range.
Optionally, determining a generic interface in the generic interface framework to which the service client needs to be docked according to the category of the service request command includes:
and matching a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
Optionally, before the determined generic interface is called to process the service request command, the method further includes:
and finding the position of the determined universal interface in the universal interface frame through the index, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
Optionally, the service request command carries version information of the service client;
before the determined generic interface is called to process the service request command, the method further comprises:
judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame or not according to the version information of the service client carried by the service request command;
if not, the service request command is converted into a specified general format.
Optionally, the category of the service request command includes any one of the following:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
According to another aspect of the embodiments of the present invention, there is also provided a service processing apparatus in a command mode based on a universal interface framework, where the universal interface framework includes one or more universal interfaces, and the apparatus includes:
the command receiving module is suitable for receiving a service request command sent by a service client;
the command analysis module is suitable for analyzing the service request command and identifying the type of the service request command;
the interface determining module is suitable for determining a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command;
the interface calling module is suitable for calling the determined universal interface to process the service request command to obtain a processing result; and
and the result returning module is suitable for returning the processing result to the service client.
Optionally, the generic interface framework pre-defines a correspondence between the one or more generic interfaces and a plurality of service clients;
the device further comprises:
the corresponding relation judging module is suitable for judging whether the business client side sending the business request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of business client sides which is predefined in the universal interface framework after the command receiving module receives the business request command sent by the business client side;
if not, the flow is ended.
Optionally, the apparatus further comprises:
and the safety checking module is suitable for carrying out safety checking on the received service request command before the command analysis module analyzes the service request command.
Optionally, the security check module is further adapted to:
and filtering special characters in the service request command by using a regular expression.
Optionally, the apparatus further comprises:
and the parameter checking module is suitable for checking the service parameters contained in the service request command before the command analysis module analyzes the service request command.
Optionally, the service parameter includes a data field name and/or a time range.
Optionally, the interface determination module is further adapted to:
and matching a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
Optionally, the apparatus further comprises:
and the index routing module is suitable for finding the position of the determined universal interface in the universal interface frame through an index before the interface calling module calls the determined universal interface to process the service request command, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
Optionally, the service request command carries version information of the service client;
the device further comprises:
the version judging module is suitable for judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame or not according to the version information of the service client carried by the service request command before the interface calling module calls the determined universal interface to process the service request command;
if not, the service request command is converted into a specified general format.
Optionally, the category of the service request command includes any one of the following:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
According to yet another aspect of the embodiments of the present invention, there is also provided a computer storage medium storing computer program code which, when run on a computing device, causes the computing device to execute a business process method in a generic interface framework based command mode according to any of the above.
According to still another aspect of the embodiments of the present invention, there is also provided a computing device including:
a processor; and
a memory storing computer program code;
the computer program code, when executed by the processor, causes the computing device to perform a method of transaction processing in a generic interface framework based command mode according to any of the preceding.
According to the method and the device for processing the service in the command mode based on the universal interface framework, after the service request command sent by the service client is received, the service request command is firstly analyzed, the type of the service request command is identified, the universal interface in the universal interface framework to which the service client needs to be connected is further determined according to the type of the service request command, the determined universal interface is finally called to process the service request command to obtain a processing result, and the processing result is returned to the service client. The scheme of the embodiment of the invention enables different service clients to realize interface butt joint through the same universal interface frame, solves the problem of complicated procedures caused by the fact that different service clients need to butt joint different interfaces at the front end in the prior art, and greatly improves interface butt joint efficiency and service working efficiency. Meanwhile, the request commands sent by the service clients are uniformly processed and controlled through the command mode, the calling of different service clients to different universal interfaces in the universal interface framework is fully supported, the decoupling between the client sending the request and the interface executing the request is realized, and the compatibility and the adaptation among the clients can be flexibly supported.
Furthermore, by carrying out security verification and/or service parameter verification on the received service request command, attacks such as SQL injection and XSS are prevented, and the security is improved. Furthermore, when the version of the service client sending the service request command is judged to be different from the version of the universal interface to be butted, the service request command is converted into a uniform specified universal format, so that the format difference between the service request commands sent by the clients with different versions is eliminated, and the compatibility of the clients with different versions, particularly the clients with low versions is realized.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart of a method for processing a service in a command mode based on a universal interface framework according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for processing a service in a command mode based on a universal interface framework according to another embodiment of the present invention;
fig. 3 shows a specific implementation scenario of a service processing method in a command mode based on a generic interface framework according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a service processing apparatus in a command mode based on a universal interface framework according to an embodiment of the present invention; and
fig. 5 is a schematic structural diagram of a service processing apparatus in a command mode based on a universal interface framework according to another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In the prior art, when a service requested by a client to a server is processed, each client needs to be independently docked with a front-end interface, that is, different clients need to be docked with different front-end interfaces corresponding to the clients, which causes the docking of the client interfaces to be complex, more codes required for implementing the docking, and low working efficiency.
In order to solve the above technical problem, an embodiment of the present invention provides a service processing method in a command mode based on a universal interface framework. Fig. 1 is a flowchart illustrating a method for processing a service in a command mode based on a universal interface framework, wherein the universal interface framework comprises one or more universal interfaces according to an embodiment of the present invention.
A Command Pattern (Command Pattern) is a data-driven design Pattern that encapsulates a request as a Command into an object and passes it to a calling object. The call object finds the appropriate object that can process the command and passes the command to the corresponding object, which executes the command. The command mode realizes loose coupling between a request sender (caller) and a request receiver (executor), and is suitable for occasions where the system needs to decouple the request sender and the request receiver so that the request sender and the request receiver do not interact directly.
The generic interface framework may be generated by: firstly, abstracting a plurality of interfaces facing different service clients according to interface functions to obtain one or more universal interfaces, wherein the interfaces with the same function are abstracted into the same universal interface; then, packaging one or more abstracted universal interfaces into a universal interface framework; and compiling and packaging the universal interface framework, and then releasing to the front end.
In a specific implementation of the universal interface framework, the encapsulation may be performed by javascript front-end technology, and the compilation and packaging may be performed by webpack. At this time, the front-end universal interface framework may be provided in the form of front-end jsdk (software development Kit).
Further, after the universal interface framework is packaged and before the universal interface framework is released, code obfuscation and/or encryption operation can be performed on the universal interface framework through webpack, and the security of the front-end code is further improved.
Referring to fig. 1, a method for processing a service in a command mode based on a generic interface framework according to an embodiment of the present invention at least includes the following steps S102 to S110.
Step S102, receiving a service request command sent by a service client.
And step S104, analyzing the service request command and identifying the type of the service request command.
And step S106, determining a universal interface in a universal interface frame to which the service client needs to be connected according to the type of the service request command.
And step S108, calling the determined universal interface to process the service request command to obtain a processing result.
And step S110, returning the processing result to the service client.
The service processing method based on the universal interface framework in the command mode provided by the embodiment of the invention enables different service clients to realize interface butt joint through the same universal interface framework, solves the problem of complicated programs caused by the fact that different interfaces need to be butted at the front end of different service clients in the prior art, and greatly improves interface butt joint efficiency and service working efficiency. Meanwhile, the request commands sent by the service clients are uniformly processed and controlled through the command mode, the calling of different service clients to different universal interfaces in the universal interface framework is fully supported, the decoupling between the client sending the request and the interface executing the request is realized, and the compatibility and the adaptation among the clients can be flexibly supported.
The service client mentioned in step S102 may include a client of a mobile phone assistant, a mobile phone guard, a clearing master, a separating master, a beauty camera, a WeChat, a micro blog, a browser, and the like, which is not limited in this respect.
In the command mode, the service request command sent by the service client can be abstracted into an object by the command interface, so that the request of each service client is uniformly processed.
In an optional embodiment of the present invention, the generic interface framework pre-defines the correspondence between one or more generic interfaces included therein and a plurality of service clients. At this time, after receiving the service request command sent by the service client, the service processing method in the command mode based on the generic interface framework according to the embodiment of the present invention may further include the following steps:
judging whether a service client sending a service request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of service clients predefined in the universal interface framework;
if not, ending the process;
if yes, the subsequent steps are continuously executed.
In practical applications, the correspondence may be defined by establishing an association between each of the one or more generic interfaces and a unique identifier of the corresponding service client.
In step S104 above, the category of the service request command may be parsed and identified by calling a preset Utils tool component.
In a specific application scenario, the universal interface framework of the embodiment of the present invention includes one or more universal interfaces that may include at least one of the following: the system comprises an initialization interface init, a login interface login, a logout interface logout, a client information acquisition interface getClientInfo, a sharing interface share, a client interaction interface setNativeTitle, a download interface download, a pause interface pause, a delete download interface deleteDownload, a general module interface common, a tool interface Utils, a debugging interface Debug and the like. Accordingly, the category of the service request command may include any one of the following: initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug. It should be noted that the category names of the service request commands are merely exemplary, and the present invention is not limited thereto.
In step S106, the generic interface to which the service client needs to be connected is determined according to the identified category of the service request command.
In an optional embodiment of the present invention, step S106 may be further implemented as:
and matching the universal interface to be butted by the service client according to the identified class of the service request command and the mapping relation between the pre-configured command class and the universal interface.
For example, when the type of the service request command is identified as login, the generic interface to which the service client needs to be docked is matched as the login interface login in the generic interface framework according to the mapping relationship between the pre-configured login type and the login interface login.
After determining the universal interface to be docked by the service client, step S108 is executed, and the determined universal interface is called to process the service request command.
In order to improve the efficiency of interface calling and processing, in an optional embodiment of the present invention, before the step of calling the determined generic interface to process the service request command, the method may further include the following steps:
and finding the position of the determined universal interface in the universal interface frame through the index, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
The index referred to herein may be a set containing the identity of each universal interface in the universal interface framework and its corresponding location.
In the business processing flow under the internet, web attacks are prevented, and the safety of a front end is ensured, which is a problem that needs to be paid attention urgently.
In order to further improve the security, in an optional embodiment of the present invention, before parsing the service request command, the method further includes the following steps:
and carrying out security check on the received service request command from the service client. In particular, it may be verified whether the received service request command conforms to a predetermined format, causes an erroneous blocking, contains malicious code, etc.
Further, in a preferred embodiment, regular expressions may be used to filter special characters in the service request command to implement security checks.
Special characters as referred to herein may refer to illegal characters, i.e., certain characters that cannot appear within a predetermined rule.
By filtering special characters (such as incoming parameters) in the service request command by using the regular expression, vulnerabilities such as SQL injection, XSS (Cross Site Scripting) and the like can be effectively prevented.
In another optional embodiment of the present invention, before parsing the service request command, the following steps may be further included:
and checking service parameters contained in the received service request command from the service client.
The service parameters mentioned herein may include data field names and/or time ranges, etc.
The validity of the service request command is verified by checking the service parameters contained in the service request command, so that the safety is further improved.
Preferably, before parsing the service request command, security check may be performed on the service request command received from the service client, and check service parameters included in the service request command. The sequence of the security check step and the service parameter check step is not limited, and the security check step may be performed first and then the service parameter check step may be performed, or vice versa.
In addition, in practical applications, the versions of the business clients and/or plug-ins used by the business users are often different. For example, when a user fails to upgrade a service client in time, the service client used by the user may be a low-version client. For service clients of different versions, formats of service request commands (or referred to as messages) sent by the service clients are different, which may cause that some service request commands with different formats cannot be effectively executed, thereby affecting the overall service processing efficiency.
In order to shield format differences of service request commands sent by clients of different versions and further eliminate influence on overall service processing, in an optional embodiment of the present invention, the service request command sent by the service client carries version information of the service client. At this time, before the determined generic interface is called to process the service request command, the following steps may be further included:
judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame or not according to the version information of the service client carried by the service request command;
if not, converting the service request command into a specified general format;
if yes, continuing to perform the subsequent steps.
By converting the service request command into a uniform specified universal format when the version of the service client sending the service request command is judged to be different from the version of the universal interface to be butted, the format difference between the service request commands sent by the clients with different versions is eliminated, and therefore the compatibility of the clients with different versions, particularly the clients with low versions is realized.
In the above, various implementation manners of each link of the embodiment shown in fig. 1 are introduced, and the implementation process of the service processing method in the command mode based on the universal interface framework according to the present invention will be described in detail through specific embodiments.
Fig. 2 is a flowchart illustrating a method for processing a service in a command mode based on a universal interface framework according to an embodiment of the present invention. In this embodiment, the universal interface framework includes one or more universal interfaces, and the correspondence between the one or more universal interfaces and the plurality of service clients is predefined. The one or more generic interfaces include at least one of: the system comprises an initialization interface init, a login interface login, a logout interface logout, a client information acquisition interface getClientInfo, a sharing interface share, a client interaction interface setNativeTitle, a download interface download, a pause interface pause, a delete download interface deleteDownload, a general module interface common, a tool interface Utils and a debugging interface Debug.
Referring to fig. 2, the method may include at least the following steps S202 to S220.
Step S202, a service request command sent by a service client is received, wherein the service request command carries version information of the service client.
Step S204, according to the corresponding relation between one or more pre-defined universal interfaces and a plurality of service clients in the universal interface frame, judging whether the service client sending the service request command has the corresponding relation with one or more universal interfaces in the universal interface frame; if not, ending the process; if yes, go to step S206.
Step S206, performing security check on the service request command.
Specifically, the regular expression is used to filter the special characters in the service request command.
Step S208, the service parameters included in the service request command are checked.
Where the service parameters include a data field name and/or a time range.
Step S210, parsing the service request command, and identifying the category of the service request command.
In this step, the category of the service request command includes any one of the following:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
Step S212, according to the category of the service request command and the mapping relation between the pre-configured command category and the universal interface, matching out the universal interface in the universal interface framework to which the service client needs to be connected.
Step S214, finding the position of the determined universal interface in the universal interface frame through the index, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
Step S216, judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame according to the version information of the service client carried by the service request command; if not, after converting the service request command into a specified general format, executing step S218; if yes, go directly to step S218.
Step S218, the determined generic interface is called to process the service request command, and a processing result is obtained.
Step S220, returning the processing result to the service client.
Fig. 3 shows a specific implementation scenario of a service processing method in a command mode based on a generic interface framework according to an embodiment of the present invention.
Referring to FIG. 3, the generic interface framework includes the following generic interfaces: the system comprises an initialization interface init, a login interface login, a logout interface logout, a client information acquisition interface getClientInfo, a sharing interface share, a client interaction interface setNativeTitle, a download interface download, a pause interface pause, a delete download interface deleteDownload, a general module interface common, a tool interface Utils and a debugging interface Debug. Service request commands sent by service clients (service client a, service client B, service client C, service clients D, …) are abstracted into objects through a command interface CMD, and then are transmitted to a service processing distributor Manager for uniformly processing the service request commands. After receiving the service request command, Manager calls a tool component Utils to analyze and identify the type of the service request command, and further determines a universal interface in a universal interface framework to which the service client needs to be connected. Then, Manager finds the position of the determined universal interface in the universal interface frame by the index, establishes a route for transmitting the service request command to the universal interface, and forwards the service request command to the universal interface. And then, the Manager calls the determined universal interface to process the service request command, and returns the obtained processing result to the service client through the route.
The embodiment of the invention enables different service clients to realize interface butt joint through the same universal interface framework, and uniformly processes and controls the request command sent by the service client through the command mode, thereby fully supporting the calling of different service clients to different universal interfaces in the universal interface framework, and improving the interface butt joint efficiency and the service working efficiency.
Based on the same inventive concept, the embodiment of the present invention further provides a service processing apparatus in a command mode based on a universal interface framework, which is used to support the service processing method in the command mode based on the universal interface framework provided by any one of the above embodiments or a combination thereof. Fig. 4 is a schematic structural diagram of a service processing apparatus in a command mode based on a universal interface framework, where the universal interface framework includes one or more universal interfaces according to an embodiment of the present invention. Referring to fig. 4, the apparatus may include at least: a command receiving module 410, a command parsing module 420, an interface determining module 430, an interface calling module 440, and a result returning module 450.
The functions of the components or devices of the service processing apparatus in the command mode based on the universal interface framework and the connection relationship between the components are described:
the command receiving module 410 is adapted to receive a service request command sent by a service client.
The command parsing module 420 is connected to the command receiving module 410 and adapted to parse the service request command and identify a category of the service request command.
And the interface determining module 430 is connected with the command parsing module 420 and is adapted to determine a universal interface in a universal interface framework to which the service client needs to be connected according to the type of the service request command.
And the interface calling module 440 is connected with the interface determining module 430 and is adapted to call the determined general interface to process the service request command, so as to obtain a processing result.
And the result returning module 450 is connected with the interface calling module 440 and is suitable for returning the processing result to the service client.
In an optional embodiment of the present invention, the generic interface framework pre-defines the correspondence between the one or more generic interfaces and the plurality of service clients. At this time, referring to fig. 5, the service processing apparatus in the command mode based on the universal interface framework may further include a correspondence relation determining module 460. The corresponding relation determining module 460 may be connected to the command receiving module 410, and is adapted to determine, after the command receiving module 410 receives the service request command sent by the service client, whether the service client sending the service request command has a corresponding relation with one or more common interfaces in the common interface framework according to a predefined corresponding relation between the one or more common interfaces and a plurality of service clients in the common interface framework; if not, the flow is ended.
In an alternative embodiment of the present invention, referring to fig. 5, the service processing apparatus in the command mode based on the universal interface framework may further include a security check module 470. The security check module 470 is adapted to perform security check on the received service request command before the command parsing module 420 parses the service request command.
Further, the security check module 470 is further adapted to:
and filtering special characters in the service request command by using a regular expression.
In an alternative embodiment of the present invention, referring to fig. 5, the service processing apparatus in the command mode based on the universal interface framework may further include a parameter checking module 480. The parameter checking module 480 is adapted to check the service parameters contained in the service request command before the command parsing module 420 parses the service request command.
Further, the service parameter may include a data field name and/or a time range, etc.
In an optional embodiment of the invention, the interface determination module 430 is further adapted to:
and matching a universal interface in a universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
In an alternative embodiment of the present invention, referring to fig. 5, the service processing apparatus in the command mode based on the universal interface framework may further include an index routing module 490. The index routing module 490 is adapted to find the location of the determined generic interface in the generic interface framework by the index, establish a route for passing the service request command to the generic interface, and forward the service request command to the generic interface before the interface calling module 440 calls the determined generic interface to process the service request command.
In an optional embodiment of the present invention, the service request command sent by the service client carries version information of the service client. At this time, referring to fig. 5, the service processing apparatus in the command mode based on the universal interface framework may further include a version judgment module 500. The version judgment module 500 is adapted to judge whether the version of the service client is the same as the version of the universal interface in the matched universal interface frame according to the version information of the service client carried by the service request command before the interface calling module 440 calls the determined universal interface to process the service request command; if not, the service request command is converted into a specified general format.
In an alternative embodiment of the invention, the category of the service request command comprises any one of the following:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
It should be noted that fig. 5 only illustrates the structure of the service processing apparatus and the connection relationship of each component in the command mode based on the universal interface framework according to an embodiment of the present invention. Those skilled in the art will understand that in practical applications, the correspondence determining module 460, the security checking module 470, the parameter checking module 480, the index routing module 490 and/or the version determining module 500 may be adaptively selected and set according to actual requirements.
Based on the same inventive concept, the embodiment of the invention also provides a computer storage medium. The computer storage medium stores computer program code which, when run on a computing device, causes the computing device to perform a method of transaction processing in a generic interface framework based command mode according to any one or combination of the above embodiments.
Based on the same inventive concept, the embodiment of the invention also provides the computing equipment. The computing device may include:
a processor; and
a memory storing computer program code;
the computer program code, when executed by a processor, causes the computing device to perform a method of business processing in a generic interface framework based command mode according to any of the embodiments described above or a combination thereof.
According to any one or a combination of multiple optional embodiments, the embodiment of the present invention can achieve the following advantages:
according to the method and the device for processing the service in the command mode based on the universal interface framework, after the service request command sent by the service client is received, the service request command is firstly analyzed, the type of the service request command is identified, the universal interface in the universal interface framework to which the service client needs to be connected is further determined according to the type of the service request command, the determined universal interface is finally called to process the service request command to obtain a processing result, and the processing result is returned to the service client. The scheme of the embodiment of the invention enables different service clients to realize interface butt joint through the same universal interface frame, solves the problem of complicated procedures caused by the fact that different service clients need to butt joint different interfaces at the front end in the prior art, and greatly improves interface butt joint efficiency and service working efficiency. Meanwhile, the request commands sent by the service clients are uniformly processed and controlled through the command mode, the calling of different service clients to different universal interfaces in the universal interface framework is fully supported, the decoupling between the client sending the request and the interface executing the request is realized, and the compatibility and the adaptation among the clients can be flexibly supported.
Furthermore, by carrying out security verification and/or service parameter verification on the received service request command, attacks such as SQL injection and XSS are prevented, and the security is improved. Furthermore, when the version of the service client sending the service request command is judged to be different from the version of the universal interface to be butted, the service request command is converted into a uniform specified universal format, so that the format difference between the service request commands sent by the clients with different versions is eliminated, and the compatibility of the clients with different versions, particularly the clients with low versions is realized.
It is clear to those skilled in the art that the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and for the sake of brevity, further description is omitted here.
In addition, the functional units in the embodiments of the present invention may be physically independent of each other, two or more functional units may be integrated together, or all the functional units may be integrated in one processing unit. The integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.
Those of ordinary skill in the art will understand that: the integrated functional units, if implemented in software and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computing device (e.g., a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention when the instructions are executed. And the aforementioned storage medium includes: u disk, removable hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disk, and other various media capable of storing program code.
Alternatively, all or part of the steps of implementing the foregoing method embodiments may be implemented by hardware (such as a computing device, e.g., a personal computer, a server, or a network device) associated with program instructions, which may be stored in a computer-readable storage medium, and when the program instructions are executed by a processor of the computing device, the computing device executes all or part of the steps of the method according to the embodiments of the present invention.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments can be modified or some or all of the technical features can be equivalently replaced within the spirit and principle of the present invention; such modifications or substitutions do not depart from the scope of the present invention.
According to an aspect of the embodiments of the present invention, a1. a service processing method in a command mode based on a generic interface framework is provided, where the generic interface framework includes one or more generic interfaces, and the method includes:
receiving a service request command sent by a service client;
analyzing the service request command and identifying the type of the service request command;
determining a universal interface in the universal interface frame to which the service client needs to be connected according to the type of the service request command;
calling the determined universal interface to process the service request command to obtain a processing result;
and returning the processing result to the service client.
A2. The method according to a1, wherein the generic interface framework pre-defines the correspondence between the generic interface or interfaces and a plurality of business clients;
after receiving a service request command sent by a service client, the method further comprises:
judging whether the service client sending the service request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of service clients predefined in the universal interface framework;
if not, the flow is ended.
A3. The method according to a1, wherein before parsing the service request command, further comprising:
and carrying out security check on the received service request command.
A4. The method according to a3, wherein performing security check on the received service request command includes:
and filtering special characters in the service request command by using a regular expression.
A5. The method of a1 or A3, wherein, prior to parsing the service request command, further comprising:
and checking the service parameters contained in the service request command.
A6. The method according to a5, wherein the traffic parameters include data field names and/or time ranges.
A7. The method according to a1, wherein determining a generic interface in the generic interface framework to which the service client needs to interface according to the category of the service request command includes:
and matching a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
A8. The method according to a1, wherein before the calling the determined generic interface to process the service request command, the method further comprises:
and finding the position of the determined universal interface in the universal interface frame through the index, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
A9. The method according to a1, wherein the service request command carries version information of the service client;
before the determined generic interface is called to process the service request command, the method further comprises the following steps:
judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame or not according to the version information of the service client carried by the service request command;
if not, the service request command is converted into a specified general format.
A10. The method of any of a1-a9, wherein the category of the service request command includes any of:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
According to another aspect of the embodiments of the present invention, there is also provided a service processing apparatus in a command mode based on a generic interface framework, where the generic interface framework includes one or more generic interfaces, the apparatus includes:
the command receiving module is suitable for receiving a service request command sent by a service client;
the command analysis module is suitable for analyzing the service request command and identifying the type of the service request command;
the interface determining module is suitable for determining a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command;
the interface calling module is suitable for calling the determined universal interface to process the service request command to obtain a processing result; and
and the result returning module is suitable for returning the processing result to the service client.
B12. The device according to B11, wherein the generic interface framework pre-defines the correspondence between the one or more generic interfaces and a plurality of business clients;
the device further comprises:
the corresponding relation judging module is suitable for judging whether the business client side sending the business request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of business client sides which is predefined in the universal interface framework after the command receiving module receives the business request command sent by the business client side;
if not, the flow is ended.
B13. The apparatus of B11, further comprising:
and the safety checking module is suitable for carrying out safety checking on the received service request command before the command analysis module analyzes the service request command.
B14. The apparatus of B13, wherein the security check module is further adapted to:
and filtering special characters in the service request command by using a regular expression.
B15. The apparatus of B11 or B13, further comprising:
and the parameter checking module is suitable for checking the service parameters contained in the service request command before the command analysis module analyzes the service request command.
B16. The apparatus of B15, wherein the traffic parameters include a data field name and/or a time range.
B17. The apparatus of B11, wherein the interface determination module is further adapted to:
and matching a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
B18. The apparatus of B11, further comprising:
and the index routing module is suitable for finding the position of the determined universal interface in the universal interface frame through an index before the interface calling module calls the determined universal interface to process the service request command, establishing a route for transmitting the service request command to the universal interface, and forwarding the service request command to the universal interface.
B19. The apparatus according to B11, wherein the service request command carries version information of the service client;
the device further comprises:
the version judging module is suitable for judging whether the version of the service client is the same as the version of the matched universal interface in the universal interface frame or not according to the version information of the service client carried by the service request command before the interface calling module calls the determined universal interface to process the service request command;
if not, the service request command is converted into a specified general format.
B20. The apparatus of any of B11-B19, wherein the category of the service request command includes any of:
initializing init, logging in logic, logging out log, obtaining getClientInfo by client information, sharing share, interacting setNativeTitle by the client, downloading download, pausing pause, deleting download delete download, general common, tools Utils and debugging Debug.
There is also provided, in accordance with yet another aspect of an embodiment of the present invention, c21 a computer storage medium storing computer program code which, when run on a computing device, causes the computing device to perform a method of business processing in a generic interface framework based command mode in accordance with any of a1-a 10.
There is also provided, in accordance with yet another aspect of an embodiment of the present invention, apparatus for computing, including:
a processor; and
a memory storing computer program code;
the computer program code, when executed by the processor, causes the computing device to perform a method of business processing in a generic interface framework based command mode according to any of A1-A10.

Claims (10)

1. A method for processing a service in a command mode based on a generic interface framework, the generic interface framework comprising one or more generic interfaces, the method comprising:
receiving a service request command sent by a service client;
analyzing the service request command and identifying the type of the service request command;
determining a universal interface in the universal interface frame to which the service client needs to be connected according to the type of the service request command;
calling the determined universal interface to process the service request command to obtain a processing result;
and returning the processing result to the service client.
2. The method of claim 1, wherein the generic interface framework pre-defines the correspondence between the one or more generic interfaces and a plurality of business clients;
after receiving a service request command sent by a service client, the method further comprises:
judging whether the service client sending the service request command has a corresponding relation with one or more universal interfaces in the universal interface framework or not according to the corresponding relation between the one or more universal interfaces and a plurality of service clients predefined in the universal interface framework;
if not, the flow is ended.
3. The method of claim 1, wherein prior to parsing the service request command, further comprising:
and carrying out security check on the received service request command.
4. The method of claim 3, wherein performing a security check on the received service request command comprises:
and filtering special characters in the service request command by using a regular expression.
5. The method of claim 1 or 3, wherein prior to parsing the service request command, further comprising:
and checking the service parameters contained in the service request command.
6. The method of claim 5, wherein the traffic parameters comprise a data field name and/or a time range.
7. The method of claim 1, wherein determining a generic interface in the generic interface framework to which the service client needs to interface according to the category of the service request command comprises:
and matching a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command and the mapping relation between the pre-configured command type and the universal interface.
8. A transaction device in a command mode based on a generic interface framework, the generic interface framework comprising one or more generic interfaces, the device comprising:
the command receiving module is suitable for receiving a service request command sent by a service client;
the command analysis module is suitable for analyzing the service request command and identifying the type of the service request command;
the interface determining module is suitable for determining a universal interface in the universal interface framework to which the service client needs to be connected according to the type of the service request command;
the interface calling module is suitable for calling the determined universal interface to process the service request command to obtain a processing result; and
and the result returning module is suitable for returning the processing result to the service client.
9. A computer storage medium storing computer program code which, when run on a computing device, causes the computing device to perform a method of transaction processing in a generic interface framework based command mode according to any of claims 1-7.
10. A computing device, comprising:
a processor; and
a memory storing computer program code;
the computer program code, when executed by the processor, causes the computing device to perform a method of transaction processing in a generic interface framework based command mode according to any of claims 1-7.
CN201811554276.9A 2018-12-18 2018-12-18 Service processing method and device under command mode based on universal interface framework Pending CN111343221A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811554276.9A CN111343221A (en) 2018-12-18 2018-12-18 Service processing method and device under command mode based on universal interface framework

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811554276.9A CN111343221A (en) 2018-12-18 2018-12-18 Service processing method and device under command mode based on universal interface framework

Publications (1)

Publication Number Publication Date
CN111343221A true CN111343221A (en) 2020-06-26

Family

ID=71185142

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811554276.9A Pending CN111343221A (en) 2018-12-18 2018-12-18 Service processing method and device under command mode based on universal interface framework

Country Status (1)

Country Link
CN (1) CN111343221A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667324A (en) * 2020-12-30 2021-04-16 凌云光技术股份有限公司 Method and device for calling command class in command mode
CN114915462A (en) * 2022-04-29 2022-08-16 中国电信股份有限公司 Cross-site request forgery attack defense method and device, electronic device and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1526455A2 (en) * 2003-10-24 2005-04-27 Hewlett-Packard Development Company, L.P. Interface module
US20080301703A1 (en) * 2007-05-31 2008-12-04 Nixon Mark J Apparatus and methods to access information associated with a process control system
CN102736910A (en) * 2011-05-11 2012-10-17 新奥特(北京)视频技术有限公司 Plugin-based general command interface definition method
US20150295983A1 (en) * 2014-04-09 2015-10-15 International Business Machines Corporation Generation of representational state transfer interface from application programming interfaces
CN105657868A (en) * 2016-01-29 2016-06-08 努比亚技术有限公司 Mobile terminal and interface control method thereof
CN107291455A (en) * 2017-05-27 2017-10-24 北京思特奇信息技术股份有限公司 A kind of method and system that transferred account service is realized based on factory mode

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1526455A2 (en) * 2003-10-24 2005-04-27 Hewlett-Packard Development Company, L.P. Interface module
US20080301703A1 (en) * 2007-05-31 2008-12-04 Nixon Mark J Apparatus and methods to access information associated with a process control system
CN102736910A (en) * 2011-05-11 2012-10-17 新奥特(北京)视频技术有限公司 Plugin-based general command interface definition method
US20150295983A1 (en) * 2014-04-09 2015-10-15 International Business Machines Corporation Generation of representational state transfer interface from application programming interfaces
CN105657868A (en) * 2016-01-29 2016-06-08 努比亚技术有限公司 Mobile terminal and interface control method thereof
CN107291455A (en) * 2017-05-27 2017-10-24 北京思特奇信息技术股份有限公司 A kind of method and system that transferred account service is realized based on factory mode

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ADAM NABER等: "Universal, Open Source, Myoelectric Interface for Assistive Devices", 《2018 15TH INTERNATIONAL CONFERENCE ON CONTROL, AUTOMATION, ROBOTICS AND VISION (ICARCV)》 *
李家星;: "嵌入式系统和FPGA的总线控制器的设计实现", 微计算机信息, no. 02 *
陈祖现: "分布式信号采集阵列节点软件设计", 《中国优秀硕士论文电子期刊网》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667324A (en) * 2020-12-30 2021-04-16 凌云光技术股份有限公司 Method and device for calling command class in command mode
CN112667324B (en) * 2020-12-30 2023-12-05 凌云光技术股份有限公司 Method and device for calling command class in command mode
CN114915462A (en) * 2022-04-29 2022-08-16 中国电信股份有限公司 Cross-site request forgery attack defense method and device, electronic device and medium
CN114915462B (en) * 2022-04-29 2023-09-08 中国电信股份有限公司 Cross-station request forgery attack defense method and device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
JP6912469B2 (en) Access request conversion method and device
US20190141022A1 (en) On-premise and off-premise communication
CN111062024B (en) Application login method and device
CN108228444B (en) Test method and device
CN107835228B (en) Instruction processing method and device based on dynamic generalized routing
KR20180063240A (en) Systems and methods for building, optimizing, and implementing an infrastructure in a cloud-based computing environment
CN111212142A (en) Service processing method, integrated open docking platform and computer storage medium
CN111818035B (en) Permission verification method and device based on API gateway
CN110602043A (en) API gateway implementation system and method for mobile application
CN111343221A (en) Service processing method and device under command mode based on universal interface framework
JP2005352673A (en) Illegal access monitoring program, device and method
Burket et al. Making didfail succeed: Enhancing the cert static taint analyzer for android app sets
CN112764726A (en) Data synthesis method and device
CN110049106B (en) Service request processing system and method
CN112153012A (en) Multi-terminal contact access method, device and storage medium
CN111274461A (en) Data auditing method, data auditing device and storage medium
CN112579093B (en) Information pushing method and device and related equipment
CN115543479A (en) Interface calling analysis method and device suitable for dynamic parameters
CN111049795B (en) Method and device for detecting sensitive data unencrypted vulnerability of distributed Web application
CN114675989A (en) Data verification method and device, electronic equipment and storage medium
CN115174192A (en) Application security protection method and device, electronic equipment and storage medium
CN114006939A (en) Message pushing method and device
US10904215B2 (en) Database firewall for use by an application using a database connection pool
CN112118114B (en) Digital signature method and system supporting full browser
CN114118073A (en) Data tracking method and device

Legal Events

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