Disclosure of Invention
Therefore, the invention aims to provide an event execution method and device and electronic equipment, which are convenient for subsequent maintenance and function expansion and reduce code complexity by independently opening an interface module and a module for realizing business logic.
Based on the above object, the present invention provides an event execution method, including:
constructing an event pool, wherein the event pool comprises event execution interface identifiers and corresponding event identifiers;
calling an event execution interface when the event is executed on the interface;
Searching the event pool according to the event execution interface identifier corresponding to the event execution interface, acquiring a corresponding event identifier, determining an event to be executed according to the event identifier, and executing service logic corresponding to the event.
Optionally, the method further comprises:
the event pool comprises an event execution interface identifier, and an event identifier and dynamic attribute information corresponding to the event execution interface identifier;
setting attribute information on the interface, executing an event, and calling the event execution interface, wherein the event execution interface carries the attribute information;
Searching the event pool according to the event execution interface identifier corresponding to the event execution interface, acquiring a corresponding event identifier, updating dynamic attribute information corresponding to the event identifier according to attribute information carried by the event execution interface, determining an event to be executed according to the event identifier, and executing business logic corresponding to the event according to the updated dynamic attribute information.
Optionally, the method further comprises: and determining a bottom layer interface to be called from a control layer according to the service logic, and calling the bottom layer interface to realize specific service logic.
Optionally, the method further comprises: and determining a bottom layer interface to be called from a control layer according to the service logic, and calling the bottom layer interface to realize specific service logic according to the updated dynamic attribute information.
The embodiment of the invention also provides an event execution device, which comprises:
The event pool module is used for storing event execution interface identifiers and event identifiers corresponding to the event execution interface identifiers;
the interface module is used for executing an event on the interface and calling the event execution interface;
And the execution module is used for searching the event pool module according to the event execution interface identifier corresponding to the event execution interface, acquiring a corresponding event identifier, determining an event to be executed according to the event identifier, and executing service logic corresponding to the event.
Optionally, the apparatus further includes:
the event pool module is used for storing the event execution interface identifier, the event identifier corresponding to the event execution interface identifier and the dynamic attribute information;
The interface module is used for setting attribute information on the interface, executing an event, calling the event execution interface, wherein the event execution interface carries the attribute information;
And the execution module is used for searching the event pool module according to the event execution interface identifier corresponding to the event execution interface, acquiring a corresponding event identifier, updating the dynamic attribute information corresponding to the event identifier according to the attribute information carried by the event execution interface, determining an event to be executed according to the event identifier, and executing service logic corresponding to the event according to the updated dynamic attribute information.
Optionally, the apparatus further includes:
The control layer is used for storing the service logic identification and the corresponding bottom layer interface;
and the bottom layer interface module is used for storing the bottom layer interface and the corresponding business logic codes.
The invention also discloses an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method when executing the program.
From the above, it can be seen that the event execution method and device, and the electronic device provided by the invention construct an event pool, which includes an event execution interface identifier and a corresponding event identifier; calling an event execution interface when the event is executed on the interface; searching an event pool according to the event execution interface identification corresponding to the event execution interface, acquiring a corresponding event identification, determining an event to be executed according to the event identification, and executing service logic corresponding to the event. The invention separates the functional module for realizing the interface and the functional module for executing the business logic independently, thereby facilitating the later maintenance and the function expansion and reducing the complexity and the redundancy of codes.
Detailed Description
The present invention will be further described in detail below with reference to specific embodiments and with reference to the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present invention, and the following embodiments are not described one by one.
FIG. 1 is a flow chart of a method according to an embodiment of the invention. As shown in the figure, the event execution method disclosed in the embodiment of the present invention includes:
S10: constructing an event pool, wherein the event pool comprises event execution interface identifiers and corresponding event identifiers;
s11: calling an event execution interface when the event is executed on the interface;
S12: searching an event pool according to the event execution interface identification corresponding to the event execution interface, acquiring a corresponding event identification, determining an event to be executed according to the event identification, and executing service logic corresponding to the event.
As shown in the figure, in the embodiment of the invention, the functional module for realizing the interface is independent from the functional module for realizing the business logic. An event pool is constructed, the corresponding relation between event execution interface identifiers and the event identifiers is stored in the event pool, the interface is only used for executing events (for example, clicking a specific function key), the event execution interface is triggered and called, then the corresponding event identifiers are searched and obtained from the event pool according to the event execution interface identifiers, service logic to be executed is determined according to the event identifiers, a bottom interface to be called is determined from a control layer according to the service logic, and the bottom interface is called to realize specific service logic.
If the interface sets attribute information, the event execution interface carries attribute parameters, and the event execution method further comprises the following steps:
s20: constructing an event pool, wherein the event pool comprises an event execution interface identifier, and corresponding event identifiers and dynamic attribute information;
s21: setting attribute information on an interface, executing an event, and calling an event execution interface, wherein the event execution interface carries the set attribute information;
S22: searching an event pool according to the event execution interface identifier corresponding to the event execution interface, acquiring a corresponding event identifier, updating dynamic attribute information corresponding to the event identifier according to attribute information carried by the event execution interface, determining an event to be executed according to the event identifier, and executing service logic corresponding to the event according to the updated dynamic attribute information.
In the embodiment of the invention, the event executing interface identifier and the corresponding relation and dynamic attribute information of the event identifier are stored in the event pool, the attribute information is set through the interface, the event executing interface is triggered and invoked, and the event executing interface carries the set attribute information; and then, searching and acquiring a corresponding event identifier from an event pool according to the calling event execution interface identifier, updating dynamic attribute information corresponding to the event identifier according to attribute information carried by the event execution interface, determining service logic to be executed according to the event identifier, determining a bottom layer interface to be called from a control layer according to the service logic, and calling the bottom layer interface to realize specific service logic according to the dynamic attribute information.
For example, setting the color attribute of the object to be blue and the width to be 10 units on the interface, clicking the determination button, calling the event execution interface, searching the event pool according to the event execution interface identification, obtaining the event identification to be executed, setting the dynamic attribute information of the event identification to be blue and the width to be 10 units, determining the service logic to be executed according to the event identification, ending the execution, setting the color to be blue and setting the width to be 10 units.
Fig. 2 is a schematic diagram of a device structure according to an embodiment of the present invention. As shown in the drawings, an event execution device provided by an embodiment of the present invention includes:
The event pool module is used for storing event execution interface identifiers and event identifiers corresponding to the event execution interface identifiers;
the interface module is used for executing an event on the interface and calling the event execution interface;
and the execution module is used for searching the event pool module according to the event execution interface identification corresponding to the event execution interface, acquiring the corresponding event identification, determining the event to be executed according to the event identification and executing the service logic corresponding to the event.
If the interface sets attribute information, the event execution interface carries attribute parameters, and the event execution device further comprises:
the event pool module is used for storing event execution interface identifiers and corresponding event identifiers and dynamic attribute information;
The interface module is used for setting attribute information on the interface, executing an event, and calling an event execution interface, wherein the event execution interface carries the set attribute information;
The execution module is used for searching the event pool module according to the event execution interface identification corresponding to the event execution interface, acquiring the corresponding event identification, updating the dynamic attribute information corresponding to the event identification according to the attribute information carried by the event execution interface, determining the event to be executed according to the event identification, and executing the business logic corresponding to the event according to the updated dynamic attribute information.
For specific execution of the business logic, the event execution device further comprises:
The control layer is used for storing the service logic identification and the corresponding bottom layer interface;
and the bottom layer interface module is used for storing the bottom layer interface and the corresponding business logic codes.
After the service logic to be executed is determined according to the event identification, the bottom layer interface to be called is determined from the control layer according to the service logic identification corresponding to the service logic, and the bottom layer interface is called to execute the corresponding service logic code so as to realize specific service logic. If the attribute information is set, determining service logic to be executed according to the event identification, determining a bottom layer interface to be called from a control layer according to the service logic identification corresponding to the service logic, and calling the bottom layer interface to execute service logic codes according to the updated dynamic attribute information so as to realize specific service logic.
Based on the above object, the embodiment of the present invention further provides an embodiment of an apparatus for executing the event execution method. The device comprises:
one or more processors and memory.
The apparatus for performing the event performing method may further include: input means and output means.
The processor, memory, input devices, and output devices may be connected by a bus or other means.
The memory is used as a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions/modules corresponding to the event execution method in the embodiments of the present invention. The processor executes various functional applications of the server and data processing by running nonvolatile software programs, instructions and modules stored in the memory, that is, implements the event execution method of the above-described method embodiments.
The memory may include a memory program area and a memory data area, wherein the memory program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of a device performing the event execution method, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory optionally includes memory remotely located with respect to the processor, the remote memory being connectable to the membership user action monitoring device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means may receive input numeric or character information and generate key signal inputs related to user settings and function control of the device performing the event execution method. The output means may comprise a display device such as a display screen.
The one or more modules are stored in the memory that, when executed by the one or more processors, perform the event execution method of any of the method embodiments described above. The technical effects of the embodiment of the device for executing the event execution method are the same as or similar to those of any of the method embodiments.
The embodiment of the invention also provides a non-transitory computer storage medium, which stores computer executable instructions that can execute the method for processing the list item operation in any of the method embodiments. Embodiments of the non-transitory computer storage medium have technical effects identical or similar to any of the method embodiments described above.
Finally, it should be noted that, as will be appreciated by those skilled in the art, all or part of the procedures in implementing the methods of the embodiments described above may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the program may include the procedures of the embodiments of the methods described above when executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), or the like. The technical effects of the computer program embodiments are the same as or similar to any of the method embodiments described above.
In addition, typically, the devices, apparatuses and the like described in the present disclosure may be various electronic terminal apparatuses, such as mobile phones, personal Digital Assistants (PDAs), tablet computers (PADs), smart televisions, and the like, and may also be large-sized terminal apparatuses, such as servers, and the like, so the protection scope of the present disclosure should not be limited to a specific type of device, apparatus, and the like. The client described in the present disclosure may be applied to any of the above electronic terminal devices in the form of electronic hardware, computer software, or a combination of both.
Furthermore, the method according to the present disclosure may also be implemented as a computer program executed by a CPU, which may be stored in a computer-readable storage medium. The above-described functions defined in the methods of the present disclosure are performed when the computer program is executed by a CPU.
Furthermore, the above-described method steps and system units may also be implemented using a controller and a computer-readable storage medium storing a computer program for causing the controller to implement the above-described steps or unit functions.
Further, it should be appreciated that the computer-readable storage medium (e.g., memory) described herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of example and not limitation, RAM may be available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and direct RambusRAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
The device of the foregoing embodiment is configured to implement the corresponding method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the disclosure, including the claims, is limited to these examples; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the invention, the steps may be implemented in any order and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure the invention. Furthermore, the devices may be shown in block diagram form in order to avoid obscuring the invention, and also in view of the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the present invention is to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the invention, it should be apparent to one skilled in the art that the invention can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The embodiments of the invention are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the present invention should be included in the scope of the present invention.