Rule file updating method, terminal device, and storage medium

By replacing the rule files in the system with target template files, the performance issues caused by escaping special characters in system code in existing technologies are resolved, achieving efficient and secure rule file updates.

CN111679847BActive Publication Date: 2026-04-14SHENZHEN TCL DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN TCL DIGITAL TECH CO LTD
Filing Date
2020-05-26
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies involve escaping special characters in system code, which can negatively impact system performance.

Method used

By responding to the client's rule change request, obtaining the rule information to be generated, replacing the rule information to be replaced with the target template file, generating the target rule file, and replacing the original rule file with the target rule file, the system can achieve the goal of not needing to directly replace, concatenate, or escape strings in the system code.

Benefits of technology

It improves the efficiency and security of rule file updates, avoids burdening system performance, and ensures normal system operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111679847B_ABST
    Figure CN111679847B_ABST
Patent Text Reader

Abstract

The application discloses a rule file updating method, comprising the following steps: in response to a rule change request sent by a client, obtaining to-be-generated rule information in the rule change request and a target template file corresponding to the to-be-generated rule information, replacing to-be-replaced rule information in the target template file with the to-be-generated rule information to obtain a target rule file, and replacing an original rule file with the same rule name as the target rule file with the target rule file. The application also discloses a terminal device and a storage medium. By using the template file, the application does not need to directly replace, splice and escape strings of the original rule file to be changed in the system, but generates a new target rule file through the template file, and replaces the original rule file with the target rule file, so that the normal operation of the system is not affected, and the application has the beneficial effects of high efficiency and safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method for updating rule files, a terminal device, and a storage medium. Background Technology

[0002] During software system development, due to the variability of business rules, many systems use rule engines to separate business rules from system code, so that system code does not need to be rewritten when using business rules.

[0003] Business rules are stored in the rule engine as rule files. When modifying a rule file, placeholders are usually used to replace some fields in the original rule file in the rule engine, and then the rule compilation method in the rule engine is called to replace the content at the placeholders. When the rule file being modified is complex, special characters in the system code need to be escaped, which puts a burden on the system and thus affects system performance.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide a method for updating rule files, which aims to solve the technical problem in the prior art where escaping special characters in system code burdens the system and thus affects system performance.

[0006] To address the above problems, embodiments of the present invention provide a method for updating rule files, comprising the following:

[0007] In response to a rule change request sent by the client, obtain the rule information to be generated from the rule change request;

[0008] Obtain the target template file corresponding to the rule information to be generated;

[0009] Replace the rule information to be replaced in the target template file with the rule information to be generated to obtain the target rule file;

[0010] The original rule file is replaced with the target rule file, wherein the target rule file has the same rule name as the original rule file.

[0011] Optionally, the step of replacing the rule information to be replaced in the target template file with the rule information to be generated to obtain the target rule file includes:

[0012] Obtain the rule information to be replaced from the target template file;

[0013] The rule name, execution condition, and execution command in the rule information to be replaced are replaced with the rule name, execution condition, and execution command in the rule information to be generated, so as to obtain the target rule file.

[0014] Optionally, the step of replacing the rule name, execution condition, and execution command in the rule information to be replaced with the rule name, execution condition, and execution command in the rule information to be generated includes:

[0015] The rule name, execution condition, and tag field corresponding to the execution command in the rule information to be replaced are obtained respectively, wherein the tag field in the rule information to be replaced corresponds to the tag field in the rule information to be generated;

[0016] Replace the rule name, execution condition, and execution command in the rule information to be replaced with the same rule name, execution condition, and execution command in the tag field of the rule information to be generated.

[0017] Optionally, the step of obtaining the target template file corresponding to the rule information to be generated includes:

[0018] Obtain the rule name from the rule information to be generated;

[0019] The target template file is obtained based on the rule name.

[0020] Optionally, the step of obtaining the rule information to be generated in the rule change request includes:

[0021] Determine the tag field in the rule change request and the rule information tagged with the tag field;

[0022] The tag field and the rule information tagged by the tag field are used as the rule information to be generated.

[0023] Optionally, the method for updating the rule file further includes:

[0024] Obtain the rule information from the rule file to be modified;

[0025] Replace the rule information in the rule file to be changed with a preset rule name, a preset execution condition list, and a preset execution command list;

[0026] The preset rule name, the preset execution condition list, and the preset execution command list are labeled to obtain the labeled rule information;

[0027] The preset execution condition list and the preset execution command list are traversed to generate a template file.

[0028] Optionally, after the step of replacing the original rule file with the target rule file, the method further includes:

[0029] Receive business data input from the client;

[0030] If the business data meets the execution conditions in the target rule file, then the execution command corresponding to the execution conditions in the target rule file is executed.

[0031] Optionally, the method further includes, after the step of replacing the original rule file with the target rule file, the method further includes:

[0032] Send a response message indicating that the rule change has been completed to the client.

[0033] In addition, to solve the above problems, embodiments of the present invention also provide a terminal device, the terminal device including a processor, a memory, and a rule file update program stored in the memory and executable on the processor, wherein when the rule file update program is executed by the processor, it implements the steps of the rule file update method as described above.

[0034] This invention also provides a computer-readable storage medium storing a rule file update program, which, when executed by a processor, implements the steps of the rule file update method described above.

[0035] This invention proposes a method for updating rule files. In response to a rule change request sent by a client, the method obtains the rule information to be generated and the corresponding target template file from the request. The method then replaces the rule information to be generated in the target template file with the new rule information to be replaced, thus obtaining a target rule file. This target rule file replaces the original rule file with the same rule name as the target rule file. By using a template file, there is no need to directly replace, concatenate, or escape strings in the original rule file to be changed in the system. Instead, a new target rule file is generated from the template file, and the target rule file replaces the original rule file. This does not affect the normal operation of the system, thus providing efficient and secure benefits. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of the present invention;

[0037] Figure 2 This is a flowchart illustrating the first embodiment of the rule file update method of the present invention;

[0038] Figure 3 This is a flowchart illustrating the second embodiment of the rule file update method of the present invention;

[0039] Figure 4 This is a flowchart illustrating the third embodiment of the rule file update method of the present invention;

[0040] Figure 5 This is a flowchart illustrating the fourth embodiment of the rule file update method of the present invention.

[0041] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0042] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0043] The main solution of this invention is as follows: in response to a rule change request sent by a client, obtain the rule information to be generated in the rule change request; obtain the target template file corresponding to the rule information to be generated; replace the rule information to be replaced in the target template file with the rule information to be generated to obtain a target rule file; replace the original rule file with the target rule file, wherein the rule name of the target rule file is the same as that of the original rule file.

[0044] The existing technology involves escaping special characters in system code, which burdens the system and affects its performance.

[0045] This invention provides a solution that, in response to a rule change request sent by a client, obtains the rule information to be generated and the corresponding target template file from the rule change request. The rule information to be replaced in the target template file is then replaced with the rule information to be generated, resulting in a target rule file. This target rule file replaces the original rule file with the same rule name as the target rule file. By using a template file, there is no need to directly replace, concatenate, or escape strings in the original rule file to be changed in the system. Instead, a new target rule file is generated from the template file, and the target rule file replaces the original rule file. This does not affect the normal operation of the system, thus providing efficient and secure benefits.

[0046] like Figure 1 As shown, Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of the present invention.

[0047] The executing entity of this invention can be a mobile or non-mobile terminal device such as a PC or desktop computer.

[0048] like Figure 1As shown, the terminal device may include: a processor 1001, such as a CPU; a communication bus 1002; a memory 1003; and a user interface 1004. The communication bus 1002 is used to establish communication between these components. The memory 1003 may be high-speed RAM or non-volatile memory, such as disk storage. Optionally, the memory 1003 may also be a storage device independent of the aforementioned processor 1001. The user interface 1004 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1004 may also include a standard wired interface or a wireless interface.

[0049] Those skilled in the art will understand that Figure 1 The structure of the terminal device shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0050] like Figure 1 As shown, the user interface 1004 is mainly used to connect to the client (user end) and communicate data with the client; the memory 1003, as a computer storage medium, may include the operating system and the rule file update program.

[0051] Based on the structure of the aforementioned terminal, a first embodiment of the present invention is proposed, with reference to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the rule file update method of the present invention. The rule file update method includes the following steps:

[0052] Step S100: In response to the rule change request sent by the client, obtain the rule information to be generated in the rule change request;

[0053] Due to the variability of business rules, the rules in the rule files also need to be adjusted and transformed. Directly changing the rule files in the system through the rule engine and using the substitution method requires string concatenation and escaping of the system code, which may lead to thread unsafety and memory overflow issues, easily burdening the system and affecting its performance.

[0054] In this embodiment, a template engine is introduced, which stores various types of template files for generating rule files in the system.

[0055] Optionally, the system can encapsulate methods involved in the processes of obtaining templates, replacing, and inserting rules into the rule engine, such as the getTemplate method, insert method, and process method, into a rule generation object, such as a TemplateProcess object, and provide rule generation services to clients in a singleton pattern. Optionally, the system can provide an API interface, such as a RESTful API interface, to provide rule generation services to external parties.

[0056] The system responds to rule change requests sent by clients, such as other systems or terminals. These rule change requests are sent to the system in the form of data packets. A rule change request is a request for the system to update the rule file, and it includes the rule information to be generated. The rule information to be generated can be the updated rule information from the rule file.

[0057] Optionally, the rule change request includes an Object object. The Object object may include rule information to be generated and ordinary strings. The rule information to be generated may be a string annotated by an identifier field. The rule information to be generated may include the rule name. Optionally, the rule information to be generated may also include execution conditions and execution commands. Optionally, the rule information to be generated may also include the values ​​of corresponding attributes, such as the value of the attribute 'name'.

[0058] As an optional implementation, step S100 includes:

[0059] Determine the tag field in the rule change request and the rule information tagged with the tag field;

[0060] The tag field and the rule information tagged by the tag field are used as the rule information to be generated.

[0061] The tag field is the markup language in the rule change request, and may include tag characters and tag text, such as...

[0062] The rule information, defined as "${rulename}", includes the rule name, execution conditions, and execution command. The rule name refers to the name of the rule file, used to identify the rule file; for example, the target rule file might be named "rule1". When the system receives a rule change request, it parses the flag field from the request, along with the rule information marked by that flag field, such as `{"rulename":"rule"}`. The system then uses the flag field and the rule information marked by it as the rule information to be generated.

[0063] Optionally, the system retrieves JSON data from the rule change request. This JSON data is assembled by the client, with marker fields added at the locations requiring change. The system can then identify the rule information to be written to the target template file based on these marker fields.

[0064] Optionally, the system deserializes the JSON data, converting it into code such as JavaScript to obtain an Object. The Object includes a plain string, tag fields, and rule information tagged by the tag fields. The rule information to be generated is extracted using the syntax in the template engine and written into the target template file to generate the target rule file.

[0065] The object contains the rule name. The system's template engine can retrieve the corresponding target template file based on the rule name. Optionally, the template file can be named according to the rule name to facilitate quick location of the corresponding template file.

[0066] Step S200: Obtain the target template file corresponding to the rule information to be generated;

[0067] The target template file is a template file in the system's template engine, used to generate rule files. The target template file is the template file corresponding to the rule information to be generated. The system can call the `getTemplate` method to obtain the target template file corresponding to the rule information to be generated. Optionally, the target rule file corresponds to the rule file in the rule engine, and the rule name of the rule file generated based on the target rule file corresponds to the rule name of the rule file in the rule engine. Optionally, the system can assign the target template file to an Object object based on the type or corresponding class of the Object object.

[0068] It should be noted that this embodiment is applied in the scenario of changing the rule files in the rule engine, and the rule files to be changed have a one-to-one correspondence with the template files in the template engine.

[0069] As an optional implementation, step S200 includes:

[0070] Obtain the rule name from the rule information to be generated;

[0071] The target template file is obtained based on the rule name.

[0072] The system retrieves the rule name from the rule information to be generated and then obtains the corresponding target template file based on that name. Different template files correspond to rule files with different rule names. The system can store the rule names of the generated rule files for each template file, allowing the retrieval of the target template file based on the rule name in the rule information to be generated. Retrieving the target template file by rule name is simple to implement and convenient to search.

[0073] Step S300: Replace the rule information to be replaced in the target template file with the rule information to be generated to obtain the target rule file;

[0074] The target template file includes ordinary strings and rules to be replaced. The ordinary strings may include fixed execution conditions, fixed execution commands, and conjunctions.

[0075] The rule information marked in the target template file may include the rule name, a list of execution conditions, and a list of execution commands. The marked rule information can be marked using tags such as ${}.

[0076] Replace each rule in the target template file with the rule to be generated to obtain the target rule file.

[0077] It should be noted that the rule information to be generated must have the same value as the rule information to be replaced in the target template file. For example, if the rule information in the target template file contains person.name, then the rule information to be generated must have the corresponding value for the name attribute.

[0078] Optionally, regular expressions can be used to identify ordinary strings and rule information to be replaced in the target template file, and obtain the corresponding rule name, execution condition or execution command in the rule information to be replaced. Then, the rule name, execution condition or execution command corresponding to the rule information to be replaced can be extracted from the rule information to be generated, and the rule information to be replaced can be replaced with the corresponding rule information to be generated.

[0079] Step S400: Replace the original rule file with the target rule file, wherein the target rule file has the same rule name as the original rule file.

[0080] Since the target template file corresponds to the rule file in the rule engine, to prevent system errors, the original rule file in the rule engine is replaced with the target rule file. The target rule file and the original rule file have the same rule name. The original rule file is the rule file that needs to be updated in the system and is used to store rule information. The system can call the rule information in the rule file to execute corresponding commands. The rule name refers to the name of the rule file, used to identify the rule file; for example, the rule name of the target rule file is rule1.

[0081] It should be noted that only one rule file can be generated by using the same template file. This is because the rule names of the rule files generated by using the same template file are the same. The system will automatically replace the rule file with the same rule name in the rule engine with the newly generated rule file to avoid system errors.

[0082] As an optional implementation, after step S400, the method further includes:

[0083] Send a response message indicating that the rule change has been completed to the client.

[0084] After completing the rule file modification, the system sends a response message indicating that the rule file modification is complete to the client, thus avoiding the client repeatedly sending rule change requests and affecting system performance.

[0085] In this embodiment, in response to a rule change request sent by the client, the system obtains the rule information to be generated and the target template file corresponding to the rule information to be generated in the rule change request. The rule information to be replaced in the target template file is replaced with the rule information to be generated to obtain the target rule file. The original rule file with the same rule name as the target rule file is replaced by the target rule file. By using the template file, it is not necessary to directly replace, concatenate, or escape strings in the original rule file to be changed in the system. Instead, a new target rule file is generated through the template file, and the target rule file replaces the original rule file. This does not affect the normal operation of the system, thus having the beneficial effects of high efficiency and security.

[0086] Based on the first embodiment described above, referring to... Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the rule file update method of the present invention. Step S300 includes:

[0087] Step S310: Obtain the rule information to be replaced in the target template file;

[0088] Step S320: Replace the rule name, execution condition, and execution command in the rule information to be replaced with the rule name, execution condition, and execution command in the rule information to be generated, so as to obtain the target rule file.

[0089] The rule information to be generated includes the rule name, execution conditions, and execution command. The system can use regular expressions to decompose the ordinary strings and rule information in the target template file. Simultaneously, it can also identify the rule name, execution conditions, and execution command in the rule information to be generated. It then replaces the rule information to be replaced in the template file with the corresponding rule name, execution conditions, and execution command, generating executable statements to obtain the target rule file. The rule information to be replaced is the rule information in the target template file that needs to be changed.

[0090] Optionally, the rule information to be replaced in the template file may include marked rule names (e.g., rulename), marked execution condition lists (e.g., conditionlist), and marked execution command lists (e.g., commandlist). The marked rule information in the target template file is replaced with the corresponding rule information in the changed object; for example, the marked rule name is replaced with the rule name in the changed object, the marked execution condition list is replaced with the execution conditions in the changed object, and the marked execution command list is replaced with the execution commands in the changed object.

[0091] Understandably, the ordinary strings in the target template file are not modified, and the fixed execution conditions and fixed execution commands in the target template file are retained. In this way, only the rule information that needs to be changed is replaced, which can improve the update efficiency of the rule file.

[0092] As an optional implementation, step S320 includes:

[0093] The rule name, execution condition, and tag field corresponding to the execution command in the rule information to be replaced are obtained respectively, wherein the tag field in the rule information to be replaced corresponds to the tag field in the rule information to be generated;

[0094] Replace the rule name, execution condition, and execution command in the rule information to be replaced with the same rule name, execution condition, and execution command in the tag field of the rule information to be generated.

[0095] Execution condition refers to a conditional statement, such as condition a, indoor temperature is greater than 25℃; execution command refers to a command statement, such as command a, turn on the air conditioner's air supply mode.

[0096] The process involves retrieving the tag fields corresponding to the rule name, execution condition, and execution command from the target template file. The tag fields in the rule information to be replaced correspond to those in the rule information to be generated. The rule name in the rule information to be replaced is replaced with the same rule name as the tag field in the rule information to be generated; the execution condition in the rule information to be replaced is replaced with the same execution condition as the tag field in the rule information to be generated; and the execution command in the rule information to be replaced is replaced with the same execution command as the tag field in the rule information to be generated. This ensures a one-to-one correspondence between the tagged rule information and the rule information to be generated, achieving the beneficial effect of precise changes.

[0097] In this embodiment, by replacing the rule name, execution condition, and execution command of the rule information to be replaced in the target template file one by one with the rule name, execution condition, and execution command corresponding to the rule information to be generated, only the rule information to be replaced in the target template file is changed, while the parts of the target template file that do not need to be changed are retained. The replacement is carried out one by one according to the marker field, which has the beneficial effect of reducing erroneous replacement and improving the stability of the updated rule file.

[0098] Based on any of the above embodiments, refer to Figure 4 , Figure 4 This is a flowchart illustrating a third embodiment of the rule file update method of the present invention. The rule file update method further includes:

[0099] Step S500: Obtain the rule information from the rule file to be changed;

[0100] Step S600: Replace the rule information in the rule file to be changed with a preset rule name, a preset execution condition list, and a preset execution command list;

[0101] Step S700: Mark the preset rule name, the preset execution condition list, and the preset execution command list to obtain the marked rule information;

[0102] Step S800: Traverse the preset execution condition list and the preset execution command list to generate a template file.

[0103] First, replace the rule information in the rule file with the preset rule name, preset execution condition list (conditionlist), and preset execution command list (commandlist). The preset rule name refers to the rule name of the newly generated rule file based on the template file generated from the rule file to be modified; it can be the same as the rule name in the rule file to be modified. The preset execution condition list represents the execution conditions that need to be changed in the rule file to be modified, such as conditionlist. The preset execution command list represents the execution commands that need to be changed in the rule file to be modified, such as commandlist.

[0104] Understandably, the filename in the rule file to be modified is replaced with a preset rule name, such as `rulename`. All execution conditions and commands that need to be changed in the rule information of the rule file are replaced with a preset list of execution conditions and a preset list of execution commands. Markers such as "${}" are added to the start and end points of the preset rule name, the preset list of execution conditions, and the preset list of execution commands to obtain the marked rule information. Then, the template syntax in the template engine is used to loop through the preset list of execution conditions and the preset list of execution commands to create a new template file based on the rule file to be modified. Optionally, the `list conditionlist as condition` and `list commandlist as command` statements can be used to list the execution conditions and commands corresponding to the marked fields in the modified object one by one.

[0105] The template file is used to generate the rule file, which includes plain strings, tag fields, and rule information marked by the tag fields.

[0106] Optionally, the system can obtain the input and output streams in the newly generated template file by using the getTemplate(String filename) method in the template engine, and store the template file in the template engine for later use.

[0107] In this embodiment, by rewriting the rule file that needs to be changed into a template file, the necessary execution conditions and execution commands, or other necessary attributes in the rule file to be changed can be retained. The parts that need to be changed are marked to obtain the template file. After receiving the change object input by the client, the changes can be easily made according to the template file, which has the beneficial effects of being simple and fast.

[0108] Based on any of the above embodiments, refer to Figure 5 , Figure 5This is a flowchart illustrating the fourth embodiment of the rule file update method of the present invention. After step S400, the method further includes:

[0109] Step S900: Receive service data input from the client;

[0110] Step S1000: If the business data meets the execution conditions in the target rule file, then execute the execution command corresponding to the execution conditions in the target rule file.

[0111] The system can receive business data input from the client via an API interface, serialize the business data to obtain a data object, and call the insert method in the rule engine to insert the data object into the rule engine. In the rule engine, the system iterates through the rule information in the rule file based on the data object. Business data can be data provided by the client to the system for execution, and the system can execute corresponding instructions based on the business data. For example, if the business data includes an indoor temperature of 29 degrees Celsius and an indoor humidity of 60%, the system calls the rule file in the rule engine. If the execution condition in the rule file is an indoor temperature higher than 25 degrees Celsius and an indoor humidity lower than 80%, the corresponding execution command is to turn on the air conditioner's cooling mode and start the humidifier's humidification function.

[0112] If the data object corresponding to the business data meets the execution conditions of the target rule file mentioned above, then the execution command corresponding to the execution conditions in the target rule file will be executed.

[0113] Optionally, the system can be used in conjunction with other systems to invoke rules in the rule file.

[0114] In this embodiment, by receiving business data input from the client, and when the business data meets the execution conditions in the target rule conditions, the execution command corresponding to the execution conditions in the target rule file is executed. This achieves the beneficial effect of calling the modified target rule file through the rule engine, which has good system compatibility and does not affect system performance.

[0115] Furthermore, this embodiment of the invention also provides a terminal device, which includes a processor, a memory, and a rule file update program stored in the memory and executable on the processor. When the rule file update program is executed by the processor, it implements the content of the rule file update method embodiment described above.

[0116] This invention also provides a computer-readable storage medium storing a rule file update program. When the rule file update program is executed by a processor, it implements the content of the rule file update method embodiment described above.

[0117] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0118] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0120] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for updating a rule file, characterized in that, The method for updating the rule file includes the following steps: In response to a rule change request sent by a client, determine the tag field in the rule change request and the rule information tagged with the tag field; The tag field and the rule information tagged by the tag field are used as the rule information to be generated, wherein the rule information to be generated is the rule information in the rule file after the rule information has been updated; Obtain the rule name from the rule information to be generated, and obtain the target template file based on the rule name. A template engine is introduced, which stores multiple types of template files. Only one rule file can be generated by using the same template file. If the rule files generated by using the same template file have the same rule name, the newly generated rule file needs to replace the rule file with the same rule name in the rule engine. The rule name refers to the name of the rule file and is used to refer to the rule file. Replace the rule information to be replaced in the target template file with the rule information to be generated to obtain the target rule file; The original rule file is replaced with the target rule file, wherein the target rule file and the original rule file have the same rule name; Receive business data input from the client; If the business data meets the execution conditions in the target rule file, then the execution command corresponding to the execution conditions in the target rule file is executed; The step of replacing the rule information to be replaced in the target template file with the rule information to be generated to obtain the target rule file includes: Obtain the rule information to be replaced from the target template file; The rule name, execution condition, and execution command in the rule information to be replaced are replaced with the rule name, execution condition, and execution command in the rule information to be generated to obtain the target rule file. Specifically, the tag fields corresponding to the rule name, execution condition, and execution command in the rule information to be replaced are obtained, and the tag fields in the rule information to be replaced correspond to the tag fields in the rule information to be generated. The rule name, execution condition, and execution command in the rule information to be replaced are replaced with the same rule name, execution condition, and execution command as the tag fields in the rule information to be generated. Specifically, the rule name in the rule information to be replaced is replaced with a rule name that matches the tag field in the rule information to be generated; the execution condition in the rule information to be replaced is replaced with an execution condition that matches the tag field in the rule information to be generated; and the execution command in the rule information to be replaced is replaced with an execution command that matches the tag field in the rule information to be generated.

2. The method for updating rule files as described in claim 1, characterized in that, The method for updating the rule file also includes: Obtain the rule information from the rule file to be modified; Replace the rule information in the rule file to be changed with a preset rule name, a preset execution condition list, and a preset execution command list; The preset rule name, the preset execution condition list, and the preset execution command list are labeled to obtain the labeled rule information; The preset execution condition list and the preset execution command list are traversed to generate a template file.

3. The method for updating a rule file as described in any one of claims 1-2, characterized in that, After the step of replacing the original rule file with the target rule file, the method further includes: Send a response message indicating that the rule change has been completed to the client.

4. A terminal device, characterized in that, The terminal device includes a processor, a memory, and a rule file update program stored in the memory and executable on the processor. When the rule file update program is executed by the processor, it implements the steps of the rule file update method as described in any one of claims 1 to 3.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an update program for a rule file, which, when executed by a processor, implements the steps of the rule file update method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Rule generation method and device, computer device and storage medium

    CN109445842A

  • Service governance rule configuration method, device and system and electronic equipment

    CN110324167A