Background
In a cloud computing management platform, there are usually some modules that need to change functions by reading configuration files. For example, the license version number can be reminded and alarmed of the remaining time according to the date; the virtual machine management configuration file is used for filling a configuration memory, a CPU and the like of some hardware information for the virtual machine by reading the configuration file. In the functional module for changing by reading the configuration file, if the configuration file needs to change the function according to the perpetual calendar time, the user needs to manually modify the configuration file, which results in low efficiency and poor usability.
Therefore, how to solve the above problems is a great concern for those skilled in the art.
Disclosure of Invention
The application aims to provide a method and a system for configuring a functional module, an electronic device and a computer readable storage medium, which improve the usability and the working efficiency of the module.
In order to achieve the above object, the present application provides a method for configuring a functional module, including:
acquiring a target configuration file written for the functional module in advance;
extracting functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and corresponding calendar information, and writing the packaged configuration information into a calendar plug-in;
when the functional module runs, target configuration information corresponding to the current time node is obtained by reading the packaged configuration information in the calendar plug-in;
and updating the functional module by using the target configuration information so as to enable the functional module to realize the function corresponding to the target configuration information.
Optionally, the obtaining of the target configuration file written for the functional module in advance includes:
acquiring an initial configuration file corresponding to the functional module;
and returning the initial configuration file to the user terminal so that the user terminal adds the configuration information of the functional modules corresponding to the nodes at different times in the initial configuration file to obtain the target configuration file.
Optionally, the updating the functional module by using the target configuration information to enable the functional module to implement the function corresponding to the target configuration information includes:
if the target configuration information comprises the calling limit of the virtual resource, the original calling limit is modified into the target calling limit corresponding to the target configuration information;
after receiving a call request aiming at the virtual resource, judging whether an actual call quota corresponding to the call request exceeds the target call quota;
if so, returning first prompt information exceeding the calling quota, and forbidding to respond to the calling request;
and if not, allowing the response to the calling request.
Optionally, after the modifying the original calling quota to the target calling quota corresponding to the target configuration information, the method further includes:
and returning second prompt information to the user of the functional module, wherein the second prompt information is used for prompting resource calling quota adjustment.
Optionally, the method further includes:
receiving a setting instruction aiming at the update cycle of the functional module configuration;
and acquiring an updating time period according to the setting instruction so as to read the packaged configuration information in the calendar plug-in at regular time according to the updating time period.
Optionally, when the function module runs, the obtaining of the target configuration information corresponding to the current time node by reading the encapsulated configuration information in the calendar plug-in includes:
when the functional module runs, judging whether the corresponding updating time period exists or not;
if yes, reading the encapsulated configuration information in the calendar plug-in at regular time according to the updating time period so as to obtain target configuration information corresponding to the current time node;
if not, the encapsulated configuration information in the calendar plug-in is read regularly according to a default time period so as to obtain the target configuration information corresponding to the current time node.
To achieve the above object, the present application provides a function module configuration system, including:
the file acquisition module is used for acquiring a target configuration file written for the functional module in advance;
the configuration binding module is used for extracting the functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and the corresponding calendar information, and writing the packaged configuration information into a calendar plug-in;
the configuration reading module is used for reading the encapsulated configuration information in the calendar plug-in when the functional module runs to acquire target configuration information corresponding to the current time node;
and the function updating module is used for updating the function module by using the target configuration information so as to enable the function module to realize the function corresponding to the target configuration information.
Optionally, the method further includes:
the instruction receiving module is used for receiving a setting instruction for configuring an update cycle for the functional module;
and the period acquisition module is used for acquiring an updating time period according to the setting instruction so as to read the encapsulated configuration information in the calendar plug-in at regular time according to the updating time period.
To achieve the above object, the present application provides an electronic device including:
a memory for storing a computer program;
a processor for implementing the steps of any one of the functional module configuration methods disclosed in the foregoing when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of any one of the functional module configuration methods disclosed in the foregoing.
According to the above scheme, the method for configuring the functional module provided by the application comprises the following steps: acquiring a target configuration file written for the functional module in advance; extracting functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and corresponding calendar information, and writing the packaged configuration information into a calendar plug-in; when the functional module runs, target configuration information corresponding to the current time node is obtained by reading the packaged configuration information in the calendar plug-in; and updating the functional module by using the target configuration information so as to enable the functional module to realize the function corresponding to the target configuration information. According to the method, the configuration information corresponding to different time nodes is written in the target configuration file in advance, after the target configuration file is obtained, the configuration information and the corresponding calendar information can be bound and packaged, the packaged information comprises daily date information and daily functional module configuration information, when the functional module runs, the functional module configuration can be updated according to the date information through the calendar plug-in, the functional module is automatically updated, the configuration file does not need to be manually modified at the appointed time, and the module usability and the working efficiency are effectively improved.
The application also discloses a functional module configuration system, an electronic device and a computer readable storage medium, which can also realize the technical effects.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, the function module for changing by reading the configuration file requires a user to manually modify the configuration file if the configuration file needs to change the function according to the perpetual calendar time, which results in low efficiency and poor usability.
Therefore, the embodiment of the application discloses a method for configuring a functional module, which effectively improves the usability and the working efficiency of the module.
Referring to fig. 1, a method for configuring a functional module disclosed in the embodiment of the present application includes:
s101: acquiring a target configuration file written for the functional module in advance;
in the embodiment of the present application, a target configuration file written for the function module in advance may be first obtained, where the target configuration file is specifically used to configure the function and the like that the function module can implement, and in the specific implementation, the configuration file may specifically adopt an XML (extensible Markup language) format.
As a possible implementation manner, the process of acquiring the target configuration file written for the functional module in advance may specifically include: acquiring an initial configuration file corresponding to the functional module; and returning the initial configuration file to the user terminal so that the user terminal adds the configuration information of the functional modules corresponding to the different time nodes in the initial configuration file to obtain a target configuration file. That is, the initial configuration file may include initial values of various configuration information of the function module. And a developer can modify and update the initial configuration file through the user terminal, and write the configuration information of the functional modules corresponding to different time nodes into the initial configuration file to obtain a target configuration file comprising the configuration information according to time.
As another possible implementation manner, the process of acquiring the target configuration file written for the functional module in advance may specifically include: the required target configuration file is obtained by means of copying from an external storage device. That is, the external storage device may be used to copy the target configuration file from the preset device, and then copy the target configuration file in the external storage device to the current device, thereby implementing file acquisition.
S102: extracting functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and corresponding calendar information, and writing the packaged configuration information into a calendar plug-in;
in this step, the functional module configuration information corresponding to different time nodes may be extracted from the target configuration file obtained in the above step, and then the functional module configuration information and the corresponding calendar information are bound and encapsulated to obtain encapsulated configuration information, and the encapsulated configuration information is written into the calendar plugin.
It should be noted that, in this step, the function module configuration information may be extracted from the target configuration file in a keyword extraction manner. And binding and packaging the function module configuration information and the corresponding calendar information, namely, the bound configuration information comprises date information and a configuration file corresponding to the date, and writing the packaged configuration information into the calendar plug-in through an interface.
S103: when the functional module runs, target configuration information corresponding to the current time node is obtained by reading the packaged configuration information in the calendar plug-in;
in specific implementation, when the functional module is running, the target configuration information corresponding to the current time node can be acquired by reading the encapsulated configuration information in the calendar plug-in.
In a preferred implementation manner, the embodiment of the present application may further receive a setting instruction for configuring an update cycle for the functional module; and acquiring an updating time period according to the setting instruction so as to read the packaged configuration information in the calendar plug-in at regular time according to the updating time period. That is, the user can set the update time period according to the actual requirement, and the subsequent functional module can obtain the configuration at regular time according to the set update time period to perform the regular update.
Specifically, when the function module runs, it may be determined whether the corresponding update time period exists, that is, whether a time period set by a user exists. If the current time node exists, the encapsulated configuration information in the calendar plug-in can be read regularly according to the updating time period so as to obtain the target configuration information corresponding to the current time node; if the current time node does not exist, the encapsulated configuration information in the calendar plug-in can be read regularly according to the default time period so as to obtain the target configuration information corresponding to the current time node.
S104: and updating the functional module by using the target configuration information so as to enable the functional module to realize the function corresponding to the target configuration information.
It can be understood that after the target configuration information is acquired, the function module can be updated by using the target configuration information, and the updated function module can realize the function corresponding to the target configuration file.
According to the above scheme, the method for configuring the functional module provided by the application comprises the following steps: acquiring a target configuration file written for the functional module in advance; extracting functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and corresponding calendar information, and writing the packaged configuration information into a calendar plug-in; when the functional module runs, target configuration information corresponding to the current time node is obtained by reading the packaged configuration information in the calendar plug-in; and updating the functional module by using the target configuration information so as to enable the functional module to realize the function corresponding to the target configuration information. According to the method, the configuration information corresponding to different time nodes is written in the target configuration file in advance, after the target configuration file is obtained, the configuration information and the corresponding calendar information can be bound and packaged, the packaged information comprises daily date information and daily functional module configuration information, when the functional module runs, the functional module configuration can be updated according to the date information through the calendar plug-in, the functional module is automatically updated, the configuration file does not need to be manually modified at the appointed time, and the module usability and the working efficiency are effectively improved.
The embodiment of the present application discloses a specific method for configuring a functional module, and compared with the previous embodiment, the present embodiment further describes and optimizes the technical solution. Referring to fig. 2, specifically:
s201: acquiring a target configuration file written for the functional module in advance;
s202: extracting functional module configuration information corresponding to different time nodes in the target configuration file, binding and packaging the functional module configuration information and corresponding calendar information, and writing the packaged configuration information into a calendar plug-in;
s203: when the functional module runs, target configuration information corresponding to the current time node is obtained by reading the packaged configuration information in the calendar plug-in;
s204: if the target configuration information comprises the calling limit of the virtual resource, the original calling limit is modified into the target calling limit corresponding to the target configuration information;
in this embodiment of the application, the target configuration information may specifically be a calling limit of the virtual resource, that is, the calling limit of the virtual resource may be adjusted in real time according to a specific date. If the target configuration information comprises the calling limit of the virtual resource, the original calling limit can be modified into the target calling limit corresponding to the target configuration information. For example, the WeChat Red envelope limit may be adjusted based on the actual date.
S205: after receiving a call request aiming at the virtual resource, judging whether an actual call quota corresponding to the call request exceeds the target call quota; if yes, go to step S206; if not, go to step S207;
s206: returning first prompt information exceeding the calling quota, and forbidding to respond to the calling request;
s207: allowing a response to the invocation request.
After the calling quota of the virtual resource is modified, if a calling request for the virtual resource is received within the time range defined by the calendar information, it needs to be determined whether the actual calling quota corresponding to the current calling request exceeds the target calling quota. If yes, forbidding to respond to the calling request, and returning first prompt information exceeding the calling limit; if not, then the response to the current invocation request is allowed.
As a preferred implementation manner, after the original calling quota is modified to the target calling quota corresponding to the target configuration information, the embodiment of the application may further return second prompt information to the user of the function module, where the second prompt information is used to prompt the user to adjust the resource calling quota, and the user may obtain information about quota adjustment before initiating the call request, so as to facilitate direct use of a new function or initiation of a call request meeting the current quota, thereby improving user experience.
The following describes a configuration method of a functional module provided in an embodiment of the present application through a specific implementation scenario.
Specifically, for a functional module that often needs to change configuration information, a configuration file in an XML format may be written in advance, and the configuration file is read in an initialization process of the functional module, and initial values of various types of configuration information are defined in the configuration file, and the initial values are distinguished according to current date information in a calendar.
For some reason, it is necessary to change the configuration information of the function module to a specific value on a special date, for example, a WeChat red packet, the maximum limit is usually set to 200, and the configuration information can be changed to 520 on a specified date, that is, the configuration information is changed according to the calendar information, and the calendar information is updated every day, so that the calendar information can be expanded according to the configuration information every day, that is, the configuration information every day is written into the calendar information, and the data information returned by acquiring the calendar information is enriched.
It can be understood that the initial calendar information may only contain date information, the calendar information is extended through an interface of the calendar plug-in, and the encapsulated calendar information is structured by the date information and specific configuration information corresponding to each day. Therefore, when the system updates the function module every day, the system only needs to read the configuration information in the function module at the time of updating the date and update the system.
In addition, since many functions in the system require occasional updating of configuration information, which may be different every day, the calendar needs to be read every day to update the configuration information of the functions. In a specific implementation, the update period can be specifically set according to the update frequency of the configuration information, and if the configuration does not need to be changed according to fine time such as hours, the configuration can be directly updated according to the date information, namely, the configuration is automatically updated every zero point.
In the following, a functional module configuration system provided in an embodiment of the present application is introduced, and a functional module configuration system described below and a functional module configuration method described above may be referred to each other.
Referring to fig. 3, a functional module configuration system provided in an embodiment of the present application includes:
a file obtaining module 301, configured to obtain a target configuration file written for the function module in advance;
a configuration binding module 302, configured to extract function module configuration information corresponding to different time nodes in the target configuration file, bind and package the function module configuration information and corresponding calendar information, and write the packaged configuration information into a calendar plugin;
a configuration reading module 303, configured to, when the function module runs, obtain target configuration information corresponding to a current time node by reading the encapsulated configuration information in the calendar plug-in;
a function updating module 304, configured to update the function module with the target configuration information, so that the function module realizes a function corresponding to the target configuration information.
The specific implementation processes of the modules 301 to 304 can refer to the corresponding contents disclosed in the foregoing embodiments, and are not described herein again.
On the basis of the foregoing embodiment, as a preferred implementation, the functional module configuration system provided in the embodiment of the present application may further include:
the instruction receiving module is used for receiving a setting instruction for configuring an update cycle for the functional module;
and the period acquisition module is used for acquiring an updating time period according to the setting instruction so as to read the encapsulated configuration information in the calendar plug-in at regular time according to the updating time period.
The present application further provides an electronic device, and as shown in fig. 4, an electronic device provided in an embodiment of the present application includes:
a memory 100 for storing a computer program;
the processor 200, when executing the computer program, may implement the steps provided by the above embodiments.
Specifically, the memory 100 includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for the operating system and the computer-readable instructions in the non-volatile storage medium to run. The processor 200 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and provides computing and controlling capability for the electronic device, and when executing the computer program stored in the memory 100, the method for configuring the functional module disclosed in any of the foregoing embodiments may be implemented.
On the basis of the above embodiment, as a preferred implementation, referring to fig. 5, the electronic device further includes:
and an input interface 300 connected to the processor 200, for acquiring computer programs, parameters and instructions imported from the outside, and storing the computer programs, parameters and instructions into the memory 100 under the control of the processor 200. The input interface 300 may be connected to an input device for receiving parameters or instructions manually input by a user. The input device may be a touch layer covered on a display screen, or a button, a track ball or a touch pad arranged on a terminal shell, or a keyboard, a touch pad or a mouse, etc.
And a display unit 400 connected to the processor 200 for displaying data processed by the processor 200 and for displaying a visualized user interface. The display unit 400 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like.
And a network port 500 connected to the processor 200 for performing communication connection with each external terminal device. The communication technology adopted by the communication connection can be a wired communication technology or a wireless communication technology, such as a mobile high definition link (MHL) technology, a Universal Serial Bus (USB), a High Definition Multimedia Interface (HDMI), a wireless fidelity (WiFi), a bluetooth communication technology, a low power consumption bluetooth communication technology, an ieee802.11 s-based communication technology, and the like.
While FIG. 5 shows only an electronic device having the assembly 100 and 500, those skilled in the art will appreciate that the configuration shown in FIG. 5 does not constitute a limitation of the electronic device, and may include fewer or more components than shown, or some components may be combined, or a different arrangement of components.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk. The storage medium stores thereon a computer program which, when executed by a processor, implements the functional module configuration method disclosed in any of the foregoing embodiments.
According to the method and the device, the configuration information corresponding to different time nodes is written in the target configuration file in advance, after the target configuration file is obtained, the configuration information and the corresponding calendar information can be bound and packaged, the packaged information comprises daily date information and daily functional module configuration information, when the functional module runs, the functional module configuration can be updated according to the date information through the calendar plug-in, the function updating of the functional module is automatically realized, the configuration file does not need to be manually modified at the appointed time, and the module usability and the working efficiency are effectively improved.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.