Script variable management method, device and equipment and computer readable storage medium
By using HashMap to automatically replace custom variables with their corresponding values in the script variable management devices of banks and other financial institutions, the inefficiency caused by manually setting custom variable values is solved, and the execution efficiency of business operations is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEBANK (CHINA)
- Filing Date
- 2019-07-19
- Publication Date
- 2026-05-29
AI Technical Summary
In the business operations of banks and other financial institutions, manually setting custom variable values leads to low script execution efficiency and affects the efficiency of business operations.
By querying a preset HashMap to obtain the value of the custom variable when a script submission request is received, and automatically replacing the custom variable in the script, the system achieves automated management of custom variables.
It improves the efficiency of setting script variable values, further enhances the execution efficiency of business operations, reduces manual operations by users, and simplifies the process of assigning values to custom variables, especially in batch tasks of financial institutions.
Smart Images

Figure CN110362339B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data technology in financial technology (Fintech), and more particularly to script variable management methods, apparatus, devices, and computer-readable storage media. Background Technology
[0002] With the development of computer technology, more and more technologies (big data, distributed systems, blockchain, artificial intelligence, etc.) are being applied in the financial field, and the traditional financial industry is gradually transforming into financial technology (Fintech).
[0003] Taking banking institutions as an example, they have hundreds or thousands of business systems, hundreds of millions of users, and massive amounts of business data. These institutions utilize distributed clusters to execute massive business operations. Specifically, they set up script variable management devices that receive scripts related to business operations. If a script contains custom variables, the user needs to manually set the values of these variables before each script execution. After the custom variable values are set, the script variable management device sends the script to the distributed cluster for execution, thus enabling the business operation to run. However, manually setting variable values is not only inefficient but also reduces the overall efficiency of business operation execution. Summary of the Invention
[0004] The main objective of this invention is to propose a script variable management method, apparatus, device, and computer-readable storage medium, which aims to solve the technical problem that when a script containing custom variables is run, the user needs to manually set the corresponding variable values of the custom variables in the script, resulting in reduced execution efficiency of business operations.
[0005] To achieve the above objectives, the present invention provides a script variable management method, which includes the following steps:
[0006] Upon receiving a script submission request, obtain the target script corresponding to the script submission request, and the target custom variables contained in the target script;
[0007] Query the preset HashMap to obtain the target key-value pair corresponding to the target custom variable, and the target variable value in the target key-value pair;
[0008] Replace the target custom variable with the target variable value, and then submit the target script for execution.
[0009] Optionally, before the step of obtaining the target script corresponding to the script submission request and the target custom variables contained in the target script upon receiving the script submission request, the method includes:
[0010] When script information is updated, retrieve the updated script and configuration information;
[0011] Parse the script and the configuration information, extract the custom variables and their corresponding variable values from the script and the configuration information, and save the custom variables and their values as key-value pairs to a preset HashMap.
[0012] Optionally, the configuration information includes script configuration information and system configuration information;
[0013] The steps of parsing the script and configuration information, extracting custom variables and their corresponding values from the script and configuration information, and saving the custom variables and their values as key-value pairs to a preset HashMap include:
[0014] Parse the script to obtain the first custom variable in the script and the first variable value corresponding to the first custom variable. Save the first custom variable and the first variable value as a first key-value pair to a preset HashMap.
[0015] Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap;
[0016] Parse the system configuration information to obtain the third custom variable in the system configuration information and the third variable value corresponding to the third custom variable. Save the third custom variable and the third variable value as a third key-value pair to the preset HashMap.
[0017] Optionally, the step of parsing the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and saving the second custom variable and the second variable value as a second key-value pair to the preset HashMap includes:
[0018] Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and use the second custom variable and the second variable value as the second key-value pair;
[0019] Determine whether a pre-stored key-value pair that matches the second key-value pair exists in the preset HashMap;
[0020] If there is no pre-stored key-value pair matching the second key-value pair in the preset HashMap, then the second key-value pair is saved to the preset HashMap.
[0021] Optionally, the step of determining whether a pre-stored key-value pair matching the second key-value pair exists in the preset HashMap includes:
[0022] The second custom variable and the second variable value in the second key-value pair are compared with the custom variable and variable value of each pre-stored key-value pair in the preset HashMap;
[0023] If there is no pre-stored custom variable that is the same as the second custom variable, and there is no pre-stored variable value that is the same as the second variable value, then it is determined that there is no pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0024] If there exists a pre-stored custom variable that is the same as the second custom variable, and / or there exists a pre-stored variable value that is the same as the second variable value, then it is determined that there exists a pre-stored key-value pair in the preset HashMap that matches the second key-value pair.
[0025] Optionally, after the steps of parsing the script and the configuration information, extracting the custom variables and their corresponding values from the script and the configuration information, and saving the custom variables and their values as key-value pairs to a preset HashMap, the method includes:
[0026] Obtain the source information of the key-value pair, and set the priority of the key-value pair according to the source information of the key-value pair;
[0027] The step of replacing the target custom variable with the target variable value and submitting the target script for execution includes:
[0028] If the number of target key-value pairs is at least two, then obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and submit the target script for execution.
[0029] Optionally, the steps of querying a preset HashMap to obtain the target key-value pair corresponding to the target custom variable and the target variable value in the target key-value pair, replacing the target custom variable with the target variable value, and submitting the target script for execution include:
[0030] Replace the target custom variable with the target variable value, and perform a security check on the replaced target script;
[0031] Once the target script passes security verification, the target script will be submitted for execution.
[0032] Furthermore, to achieve the above objectives, the present invention also provides a script variable management device, the script variable management device comprising:
[0033] The variable acquisition module is used to acquire the target script corresponding to the script submission request and the target custom variables contained in the target script when a script submission request is received.
[0034] The query and retrieval module is used to query a preset HashMap to retrieve the target key-value pair corresponding to the target custom variable, and the target variable value in the target key-value pair;
[0035] The replacement submission module is used to replace the target custom variable with the target variable value and submit the target script for execution.
[0036] Optionally, the script variable management device includes:
[0037] The detection and acquisition module is used to acquire updated script and configuration information when script information is detected to be updated.
[0038] The parsing and saving module is used to parse the script and the configuration information, extract the custom variables and the variable values corresponding to the custom variables from the script and the configuration information, and save the custom variables and the variable values as key-value pairs to a preset HashMap;
[0039] Optionally, the parsing and saving module includes:
[0040] The first parsing submodule is used to parse the script, obtain the first custom variable in the script, and the first variable value corresponding to the first custom variable, and save the first custom variable and the first variable value as a first key-value pair to a preset HashMap;
[0041] The second parsing submodule is used to parse the script configuration information, obtain the second custom variable in the script configuration information, and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap;
[0042] The third parsing submodule is used to parse the system configuration information, obtain the third custom variable in the system configuration information, and the third variable value corresponding to the third custom variable, and save the third custom variable and the third variable value as a third key-value pair to the preset HashMap.
[0043] Optionally, the second parsing submodule includes:
[0044] The variable parsing unit is used to parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and to use the second custom variable and the second variable value as a second key-value pair;
[0045] The key-value pair determination unit is used to determine whether there is a pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0046] The key-value pair storage unit is used to save the second key-value pair to the preset HashMap if there is no pre-stored key-value pair that matches the second key-value pair in the preset HashMap.
[0047] Optionally, the key-value pair determination unit is further configured to:
[0048] The second custom variable and the second variable value in the second key-value pair are compared with the custom variable and variable value of each pre-stored key-value pair in the preset HashMap;
[0049] If there is no pre-stored custom variable that is the same as the second custom variable, and there is no pre-stored variable value that is the same as the second variable value, then it is determined that there is no pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0050] If there exists a pre-stored custom variable that is the same as the second custom variable, and / or there exists a pre-stored variable value that is the same as the second variable value, then it is determined that there exists a pre-stored key-value pair in the preset HashMap that matches the second key-value pair.
[0051] Optionally, the script variable management device includes:
[0052] A priority setting module is used to obtain the source information of the key-value pair and set the priority of the key-value pair according to the source information of the key-value pair;
[0053] The replacement submission module is also used for:
[0054] If the number of target key-value pairs is at least two, then obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and submit the target script for execution.
[0055] Optionally, the replacement submission module includes:
[0056] The replacement verification unit is used to replace the target custom variable with the target variable value and perform security verification on the replaced target script.
[0057] The script submission unit is used to submit the target script for execution when the target script passes the security verification.
[0058] In addition, to achieve the above objectives, the present invention also provides a script variable management device, the script variable management device comprising: a memory, a processor, and a script variable management program stored in the memory and executable on the processor, wherein the script variable management program, when executed by the processor, implements the steps of the script variable management method as described above.
[0059] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a script variable management program, which, when executed by a processor, implements the steps of the script variable management method as described above.
[0060] This invention provides a script variable management method, apparatus, device, and computer-readable storage medium. In this embodiment, upon receiving a script submission request, the system obtains the target script corresponding to the submission request and the target custom variables contained within the target script. Then, it queries a preset HashMap to obtain the target key-value pairs corresponding to the target custom variables and the target variable values within those pairs. The system replaces the target custom variables with the target variable values and submits the target script for execution. This invention parses the target script, obtains the target custom variables contained within it, and replaces them with their corresponding target variable values. This eliminates the need for users to manually set the target variable values in the script, improving the efficiency of script variable value setting and further enhancing the execution efficiency of business operations. Attached Figure Description
[0061] Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention;
[0062] Figure 2 This is a flowchart illustrating the first embodiment of the script variable management method of the present invention;
[0063] Figure 3 This is a flowchart illustrating the second embodiment of the script variable management method of the present invention;
[0064] Figure 4 This is a schematic diagram of the functional modules of an embodiment of the script variable management device of the present invention.
[0065] 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
[0066] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0067] like Figure 1 As shown, Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention.
[0068] In this embodiment of the invention, the script variable management device can be a terminal or a server, such as... Figure 1 As shown, the script variable management device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0069] Those skilled in the art will understand that Figure 1 The device structure shown does not constitute a limitation on the device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0070] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a script variable management program.
[0071] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the backend server and communicate with the backend server; the user interface 1003 is mainly used to connect to the client (user terminal) and communicate with the client; and the processor 1001 can be used to call the script variable management program stored in the memory 1005 and execute the operations in the script variable management method described below.
[0072] Based on the above hardware structure, an embodiment of the script variable management method of the present invention is proposed, including:
[0073] Upon receiving a script submission request, obtain the target script corresponding to the script submission request, and the target custom variables contained in the target script;
[0074] Query the preset HashMap to obtain the target key-value pair corresponding to the target custom variable, and the target variable value in the target key-value pair;
[0075] Replace the target custom variable with the target variable value, and then submit the target script for execution.
[0076] In this embodiment, the script variable management device has a pre-set HashMap. This pre-set HashMap stores custom variables and their corresponding values. Specifically, the script variable management device uses a HashMap provided by the JDK to store custom variables and their corresponding values. The JDK is the Java Development Kit, which includes the Java runtime environment (JVM + Java system libraries) and Java tools. HashMap refers to an implementation of the Map interface based on a hash table. HashMap provides all optional mapping operations, using null values and null keys. Specifically, it includes:
[0077] Step S01: When script information is updated, obtain the updated script and configuration information;
[0078] This embodiment of the script variable management method is applied to a script variable management device. The script variable management device can be understood as a business operation control platform in front of a distributed cluster. The client uploads a script or script-related configuration information to the script variable management device. The script variable management device parses and processes the script and configuration information, and submits the processed script to the distributed cluster for execution of business operations. For example, the script variable management device is set up in a financial institution (financial institutions include banks, insurance companies, or securities firms, etc.). Taking a bank as an example, the script variable management device for a bank monitors script information updates in real time to uniformly replace custom variables in the script with their values. Specifically:
[0079] The script variable management device monitors changes in script information in real time. Script information includes scripts and script-related configuration information. Specifically, the device monitors the number of scripts to determine if script information has been updated. For example, when a user uploads a script to the device via a client, the device receives the script sent by the client, and the number of scripts changes, indicating a script information update. In addition, the device monitors newly added configuration information on the page. For example, when a user enters new script configuration information on the script configuration page or new system configuration information on the system configuration page, the device detects an update to the script information.
[0080] When the script variable management device detects an update to the script information, it obtains the updated script and configuration information. The configuration information includes script configuration information and system configuration information (system configuration information refers to custom variable information at the system level).
[0081] In this embodiment, users can set custom variables and their values in the script according to their usage habits. Users can also set custom variables and their values in the configuration page. The script variable management device monitors the script and script-related information in real time and obtains updated script and configuration information, making the operation more convenient for users.
[0082] Step S02: Parse the script and the configuration information, extract the custom variables and their corresponding variable values from the script and the configuration information, and save the custom variables and their values as key-value pairs to a preset HashMap.
[0083] In this embodiment, the script variable management device parses the script and configuration information, extracts the custom variables in the script, and the corresponding variable values; the script variable management device extracts the custom variables in the configuration information, and the corresponding variable values, and saves them to a preset HashMap. Specifically:
[0084] The script writes custom variables and their corresponding values according to a fixed format. The script variable management device parses the custom variables in the script according to the fixed format, and puts the key (variable value) and value (custom variable) in the script into a hashMap. For example, the fixed format is set x = July 10, 2019. If set x = "10" appears in the script, the script variable management device will treat "x" as a custom variable and "10" as the corresponding variable value. The script variable management device saves the custom variable and its corresponding variable value as a key-value pair to the preset hashMap.
[0085] After parsing the custom variables in the script, the script variable management device parses the configuration information on the configuration page, obtains the custom variables and their values from the configuration information, and treats the custom variable and its value as a key-value pair. The script variable management device then checks whether the key-value pair is already stored in the preset hashmap. If the key-value pair is already stored in the preset hashmap, it is not inserted; otherwise, the script variable management device saves the key-value pair to the preset hashmap.
[0086] It is understood that the type of custom variable and the type of variable value are not specifically limited in this embodiment. That is, the custom variable and variable value can be one or more of string type, numeric type, date type and collection type. This embodiment supports users to set different types of custom variables and variable values.
[0087] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the script variable management method of the present invention. The method includes:
[0088] Step S10: Upon receiving a script submission request, obtain the target script corresponding to the script submission request and the target custom variables contained in the target script.
[0089] The script variable management device receives script submission requests. The triggering method for script submission requests is not specifically limited. That is, script submission requests can be triggered actively by the user. For example, the user uploads a script through the client and clicks "submit" to trigger the script submission request, and the client sends the script submission request to the script variable management device. In addition, script submission requests can also be triggered automatically by the script variable management device. For example, when the script variable management device receives a script uploaded by the client, it automatically triggers the script submission request.
[0090] When a script submission request is received, the script variable management device obtains the target script corresponding to the script submission request, parses the target script, and obtains the target custom variables contained in the target script.
[0091] Step S20: Query the preset HashMap to obtain the target key-value pair corresponding to the target custom variable and the target variable value in the target key-value pair.
[0092] The script variable management device queries a preset HashMap and retrieves the target key-value pair corresponding to the target custom variable. That is, the script variable management device compares the target custom variable with the custom variables in each key-value pair in the preset HashMap, retrieves the key-value pair containing the target custom variable as the target key-value pair, and retrieves the target variable value in the target key-value pair.
[0093] Step S30: Replace the target custom variable with the target variable value, and submit the target script for execution.
[0094] The script variable management device replaces custom variables in the script with target variable values. For example, if the target custom variable is "date", the script variable management device replaces "date" with "July 16, 2019" and submits the target script for execution. In this embodiment of the invention, by parsing the target script, obtaining the target custom variables contained in the target script, and replacing the target custom variables in the target script with their corresponding target variable values, the user does not need to manually set the target variable values corresponding to the target custom variables in the script, thus improving the efficiency of script variable value setting and further improving the execution efficiency of business operations.
[0095] Applying the technical solution in this embodiment to financial institutions, for example, financial institutions often run batch tasks in the early morning. If today is June 20, 2019, and they need data from June 19, 2019, without dynamic replacement, users would need to change the data from June 18, 2019 to June 19, 2019, increasing their workload. The technical solution in this embodiment allows for automatic replacement of custom variables, eliminating the need for users to manually assign values, thus simplifying the user experience.
[0096] Further, refer to Figure 3 Based on the first embodiment of the script variable management method of the present invention, a second embodiment of the script variable management method of the present invention is proposed.
[0097] This embodiment is a refinement of step S02 in the first embodiment. The difference between this embodiment and the first embodiment is that:
[0098] Step S021: Parse the script to obtain the first custom variable in the script and the first variable value corresponding to the first custom variable, and save the first custom variable and the first variable value as a first key-value pair to a preset HashMap;
[0099] The script variable management device parses the script to obtain the first custom variable in the script and the first variable value corresponding to the first custom variable. The script variable management device uses the first custom variable and the first variable value corresponding to the first custom variable as the first key-value pair and saves the first key-value pair to the preset HashMap.
[0100] Step S022: Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap;
[0101] Specifically, step S022 includes:
[0102] Step a1: Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and use the second custom variable and the second variable value as a second key-value pair;
[0103] Step a2: Determine whether there exists a pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0104] Step a3: If there is no pre-stored key-value pair matching the second key-value pair in the preset HashMap, then the second key-value pair is saved to the preset HashMap.
[0105] That is, the script variable management device parses the script configuration information to obtain the second custom variable and its corresponding value. The device then uses the second custom variable and its corresponding value as a second key-value pair. The device compares the second custom variable and its value in the second key-value pair with the custom variables and their values in each pre-stored key-value pair in a preset HashMap. Based on the comparison result, it determines whether to save the second key-value pair.
[0106] If there is no pre-stored custom variable that is the same as the second custom variable, and there is no pre-stored variable value that is the same as the value of the second variable, then it is determined that there is no pre-stored key-value pair in the preset HashMap that matches the second key-value pair; the script variable management device saves the second key-value pair to the preset HashMap;
[0107] If a pre-stored custom variable that is identical to the second custom variable exists, and / or a pre-stored variable value that is identical to the second variable value exists, then it is determined that a pre-stored key-value pair that matches the second key-value pair exists in the preset HashMap, and the script variable management device deletes the second key-value pair to avoid duplicate saving.
[0108] In this embodiment, the script variable management device can parse the script configuration information in the script configuration page, which facilitates the configuration of user-defined variables and their corresponding variable values.
[0109] Step S023: Parse the system configuration information to obtain the third custom variable in the system configuration information and the third variable value corresponding to the third custom variable. Save the third custom variable and the third variable value as a third key-value pair to the preset HashMap.
[0110] Specifically, step S023 includes:
[0111] Step b1: Parse the system configuration information to obtain the third custom variable in the system configuration information and the third variable value corresponding to the third custom variable, and use the third custom variable and the third variable value as a third key-value pair;
[0112] Step a2: Determine whether there is a pre-stored key-value pair in the preset HashMap that matches the third key-value pair;
[0113] Step a3: If there is no pre-stored key-value pair matching the third key-value pair in the preset HashMap, then the third key-value pair is saved to the preset HashMap.
[0114] That is, the script variable management device parses the system configuration information to obtain the third custom variable and its corresponding value. The script variable management device uses the third custom variable and its value as a third key-value pair. It then compares the third custom variable and its value in the third key-value pair with the custom variables and their values in each pre-stored key-value pair in a preset HashMap. Based on the comparison result, it determines whether to save the third key-value pair.
[0115] If there is no pre-stored custom variable that is the same as the third custom variable, and there is no pre-stored variable value that is the same as the third variable value, the script variable management device determines that there is no pre-stored key-value pair in the preset HashMap that matches the third key-value pair; the script variable management device saves the third key-value pair to the preset HashMap;
[0116] If a pre-stored custom variable that is identical to the third custom variable exists, and / or a pre-stored variable value that is identical to the value of the third variable exists, then it is determined that a pre-stored key-value pair matching the third key-value pair exists in the preset HashMap, and the script variable management device deletes the third key-value pair to avoid duplicate saving.
[0117] In this embodiment, the script variable management device can parse the system configuration information in the system configuration page, so that users can set the configuration of custom variables in the script and the corresponding variable values at the same time as setting the system configuration information, which facilitates user operation.
[0118] In this embodiment, the script variable management device can detect and parse custom variables in scripts, as well as custom variables in script configuration information and system configuration information. When setting custom variables, it is inevitable that the same custom variable and its corresponding variable value will be set repeatedly. That is, the target custom variable A corresponds to the variable value 1, which is set once in the script, once in the script configuration information on the script configuration page, or once in the system configuration information on the system configuration page. In this case, if the second custom variable in the script configuration information or the third custom variable in the system configuration information is directly saved to the preset HashMap, the phenomenon of repeated saving may occur. In this embodiment, the preset HashMap is queried before saving the second and third custom variables, which can effectively avoid the situation of the same custom variable being saved repeatedly.
[0119] Furthermore, based on the above embodiments of the script variable management method of the present invention, a third embodiment of the script variable management method of the present invention is proposed.
[0120] This embodiment is the step following step S02 in the first embodiment. The difference between this embodiment and the above embodiment is that:
[0121] Obtain the source information of the key-value pair, and set the priority of the key-value pair according to the source information.
[0122] In this embodiment, the script variable management device obtains the source information of key-value pairs. The key-value pairs may originate from scripts, script configuration pages, and system configuration pages. The script variable management device sets the priority of key-value pairs according to their source information. Specifically, the script variable management device may set the priority of key-value pairs originating from scripts to the highest level, key-value pairs originating from script configuration pages (or script configuration information) to the next highest level, and key-value pairs originating from system configuration pages (or system configuration information) to the lowest level.
[0123] That is, in this embodiment, considering that the same custom variable may have different values in different situations, the script management device saves them to a preset HashMap. For example, if a custom variable A is set in the script and the corresponding variable value is a1; if a custom variable A is set in the script configuration information and the corresponding variable value is a2; if a custom variable A is set in the system configuration information and the corresponding variable value is a3, the script management device saves A-a1, A-a2, and A-a3 as different key-value pairs. Based on the source information of the key-value pairs, the script management device sets the priority of A-a1 to the highest, the priority of A-a2 to the medium, and the priority of A-a3 to the lowest.
[0124] Based on the priority settings, this embodiment refines step S30 in the first embodiment, including:
[0125] If the number of target key-value pairs is at least two, then obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and submit the target script for execution.
[0126] In this embodiment, the script variable management device queries a preset HashMap to obtain the target key-value pair corresponding to the target custom variable; the script variable management device determines whether there are multiple target key-value pairs, that is, the same type of custom variable may be set with different variable values in different application scenarios, and the preset HashMap combines a custom variable with a variable value to form multiple key-value pairs; if there is only one target key-value pair, the script variable management device replaces the custom variable with the target variable value and submits the target script for execution.
[0127] If there are at least two target key-value pairs, the script variable management device retrieves the target variable value from the target key-value pair with the highest priority, replaces the custom variable with the target variable value, and submits the target script for execution.
[0128] In this embodiment, the default HashMap supports defining the same type of custom variables and setting different variable values in different business scenarios. When replacing custom variables in the script, the script variable management device will replace the custom variables in the script with the variable values in the key-value pairs with the highest priority according to the priority of each key-value pair. In this embodiment, both the flexible setting of custom variables and the reasonable replacement of custom variables can be guaranteed.
[0129] Furthermore, based on the above embodiments of the script variable management method of the present invention, a fourth embodiment of the script variable management method of the present invention is proposed.
[0130] This embodiment can be combined with any other embodiment. This embodiment is a refinement of step S30 in the first embodiment. The difference between this embodiment and the above embodiments is that:
[0131] Replace the target custom variable with the target variable value, and perform a security check on the replaced target script; if the target script passes the security check, submit the target script for execution.
[0132] Specifically, the script variable management device queries a preset HashMap to obtain the target key-value pair corresponding to the target custom variable, and the target variable value within the target key-value pair. The script variable management device then replaces the custom variable with the target variable value. After converting the custom variable in the script into variable values, the script variable management device parses the target script to determine its execution instructions. If the risk of the execution instructions is higher than a set risk value, the target script is deemed invalid and security verification fails. If the risk of the execution instructions is less than or equal to the set risk value, the target script is deemed valid and security verification passes. If the target script's security verification passes, the script variable management device submits the target script for execution; if the target script's security verification fails, the script variable management device intercepts the target script.
[0133] Existing technologies cannot parse scripts, thus failing to verify their security. In this embodiment, script parsing effectively determines whether the target script is legitimate, thereby ensuring the security of business operations.
[0134] Reference Figure 4 This invention also provides a script variable management device, the script variable management device comprising:
[0135] The variable acquisition module 10 is used to acquire the target script corresponding to the script submission request and the target custom variables contained in the target script when a script submission request is received.
[0136] The query and retrieval module 20 is used to query a preset HashMap to obtain the target key-value pair corresponding to the target custom variable and the target variable value in the target key-value pair;
[0137] The replacement submission module 30 is used to replace the target custom variable with the target variable value and submit the target script for execution.
[0138] Optionally, the script variable management device includes:
[0139] The detection and acquisition module is used to acquire updated script and configuration information when script information is detected to be updated.
[0140] The parsing and saving module is used to parse the script and the configuration information, extract the custom variables and the variable values corresponding to the custom variables from the script and the configuration information, and save the custom variables and the variable values as key-value pairs to a preset HashMap;
[0141] In one embodiment, the parsing and saving module includes:
[0142] The first parsing submodule is used to parse the script, obtain the first custom variable in the script, and the first variable value corresponding to the first custom variable, and save the first custom variable and the first variable value as a first key-value pair to a preset HashMap;
[0143] The second parsing submodule is used to parse the script configuration information, obtain the second custom variable in the script configuration information, and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap;
[0144] The third parsing submodule is used to parse the system configuration information, obtain the third custom variable in the system configuration information, and the third variable value corresponding to the third custom variable, and save the third custom variable and the third variable value as a third key-value pair to the preset HashMap.
[0145] In one embodiment, the second parsing submodule includes:
[0146] The variable parsing unit is used to parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and to use the second custom variable and the second variable value as a second key-value pair;
[0147] The key-value pair determination unit is used to determine whether there is a pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0148] The key-value pair storage unit is used to save the second key-value pair to the preset HashMap if there is no pre-stored key-value pair that matches the second key-value pair in the preset HashMap.
[0149] In one embodiment, the key-value pair determination unit is further configured to:
[0150] The second custom variable and the second variable value in the second key-value pair are compared with the custom variable and variable value of each pre-stored key-value pair in the preset HashMap;
[0151] If there is no pre-stored custom variable that is the same as the second custom variable, and there is no pre-stored variable value that is the same as the second variable value, then it is determined that there is no pre-stored key-value pair in the preset HashMap that matches the second key-value pair;
[0152] If there exists a pre-stored custom variable that is the same as the second custom variable, and / or there exists a pre-stored variable value that is the same as the second variable value, then it is determined that there exists a pre-stored key-value pair in the preset HashMap that matches the second key-value pair.
[0153] In one embodiment, the script variable management device includes:
[0154] A priority setting module is used to obtain the source information of the key-value pair and set the priority of the key-value pair according to the source information of the key-value pair;
[0155] The replacement submission module 30 is also used for:
[0156] If the number of target key-value pairs is at least two, then obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and submit the target script for execution.
[0157] In one embodiment, the replacement submission module 30 includes:
[0158] The replacement verification unit is used to replace the target custom variable with the target variable value and perform security verification on the replaced target script;
[0159] The script submission unit is used to submit the target script for execution when the target script passes the security verification.
[0160] The methods executed by the above-mentioned program modules can be referred to in the various embodiments of the script variable management method of the present invention, and will not be repeated here.
[0161] The present invention also provides a computer-readable storage medium.
[0162] The present invention provides a computer-readable storage medium storing a script variable management program, which, when executed by a processor, implements the steps of the script variable management method described above.
[0163] The method implemented when the script variable management program running on the processor is executed can be referred to in various embodiments of the script variable management method of the present invention, and will not be repeated here.
[0164] 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 system 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 system. 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 system that includes that element.
[0165] 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.
[0166] 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, 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 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.
[0167] 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 script variable management method, characterized in that, The script variable management method includes the following steps: When script information is updated, the updated script and configuration information are obtained; the configuration information includes script configuration information and system configuration information. Parse the script to obtain the first custom variable in the script and the first variable value corresponding to the first custom variable. Save the first custom variable and the first variable value as a first key-value pair to a preset HashMap. Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap; Parse the system configuration information to obtain the third custom variable in the system configuration information and the third variable value corresponding to the third custom variable, and save the third custom variable and the third variable value as a third key-value pair to the preset HashMap; Upon receiving a script submission request, obtain the target script corresponding to the script submission request, and the target custom variables contained in the target script; Obtain the source information of the key-value pair, and set the priority of the key-value pair according to the source information of the key-value pair; Query the preset HashMap to obtain the target key-value pair corresponding to the target custom variable, and the target variable value in the target key-value pair; If the number of target key-value pairs is at least two, then obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and determine the execution instructions of the target script based on the replaced target script; When the risk of the executed instruction is less than or equal to the set risk value, the legality and security verification of the target script is deemed to have passed; Once the target script passes security verification, the target script will be submitted for execution.
2. The script variable management method as described in claim 1, characterized in that, The step of parsing the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and saving the second custom variable and the second variable value as a second key-value pair to the preset HashMap includes: Parse the script configuration information to obtain the second custom variable in the script configuration information and the second variable value corresponding to the second custom variable, and use the second custom variable and the second variable value as the second key-value pair; Determine whether a pre-stored key-value pair that matches the second key-value pair exists in the preset HashMap; If there is no pre-stored key-value pair matching the second key-value pair in the preset HashMap, then the second key-value pair is saved to the preset HashMap.
3. The script variable management method as described in claim 2, characterized in that, The step of determining whether a pre-stored key-value pair matching the second key-value pair exists in the preset HashMap includes: The second custom variable and the second variable value in the second key-value pair are compared with the custom variable and variable value of each pre-stored key-value pair in the preset HashMap; If there is no pre-stored custom variable that is the same as the second custom variable, and there is no pre-stored variable value that is the same as the second variable value, then it is determined that there is no pre-stored key-value pair in the preset HashMap that matches the second key-value pair; If there exists a pre-stored custom variable that is the same as the second custom variable, and / or there exists a pre-stored variable value that is the same as the second variable value, then it is determined that there exists a pre-stored key-value pair in the preset HashMap that matches the second key-value pair.
4. A script variable management device, characterized in that, The script variable management device includes: The detection and acquisition module is used to acquire updated script and configuration information when script information is detected to be updated; the configuration information includes script configuration information and system configuration information. The first parsing submodule is used to parse the script, obtain the first custom variable in the script, and the first variable value corresponding to the first custom variable, and save the first custom variable and the first variable value as a first key-value pair to a preset HashMap; The second parsing submodule is used to parse the script configuration information, obtain the second custom variable in the script configuration information, and the second variable value corresponding to the second custom variable, and save the second custom variable and the second variable value as a second key-value pair to the preset HashMap; The third parsing submodule is used to parse the system configuration information, obtain the third custom variable in the system configuration information, and the third variable value corresponding to the third custom variable, and save the third custom variable and the third variable value as a third key-value pair to the preset HashMap; The variable acquisition module is used to acquire, upon receiving a script submission request, the target script corresponding to the script submission request and the target custom variables contained in the target script; acquire the source information of the key-value pairs, and set the priority of the key-value pairs according to the source information of the key-value pairs; The query and retrieval module is used to query a preset HashMap to retrieve the target key-value pair corresponding to the target custom variable, and the target variable value in the target key-value pair; The replacement submission module is used to, if the number of target key-value pairs is at least two, obtain the target variable value from the target key-value pair with the highest priority, replace the target custom variable with the target variable value, and determine the execution instruction of the target script based on the replaced target script; if the risk of the execution instruction is less than or equal to a set risk value, determine that the legality and security verification of the target script has passed; and if the security verification of the target script has passed, submit the target script for execution.
5. A script variable management device, characterized in that, The script variable management device includes: a memory, a processor, and a script variable management program stored in the memory and executable on the processor. When the script variable management program is executed by the processor, it implements the steps of the script variable management method as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a script variable management program, which, when executed by a processor, implements the steps of the script variable management method as described in any one of claims 1 to 3.