File processing system and method based on VUE dependent injection
By adopting a file processing system based on VUE dependency injection in front-end development, the problem of high component coupling in JavaScript is solved, the accuracy and independence of file transmission are achieved, and the maintainability of the code and the flexibility of the application are improved.
Patent Information
- Application Number
- CN202411294749.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-21
AI Technical Summary
During the front-end software development process, component coupling problems in JavaScript make business logic complex and difficult to maintain, and high coupling during file transfer, affecting operation efficiency.
A file processing system based on VUE dependency injection is adopted. By separating the file management component, file injection component and file transfer component, the dependency injection mechanism is used to obtain the target dependent file from the file management component and transfer it to the file transfer component to achieve the accuracy of file transfer. and independence.
It reduces the coupling of business logic, improves the maintainability and testability of the code, ensures the accuracy and independence of file transmission, and improves the flexibility and scalability of applications.
Smart Images

Figure CN119336708A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the technical field of dependency injection applications, and in particular, to a file processing system and method based on VUE dependency injection. Background Art
[0002] In the front-end software development process, JavaScript is used to manage data display and business logic interaction processing. Component coupling based on the UI (User Interface) framework is two key issues. Developers will inevitably generate redundancy and cross-business logic coding in the process of implementing business iterations.
[0003] In the traditional file processing process, business logic is often created and managed directly within a component. For example, multiple business logics are created within the business component, and each business logic implements different data functions (such as file transfer, file retrieval, etc.) to realize file business transmission.
[0004] However, in the existing method, the related business logics are highly coupled, which affects the operation of the business logic and causes file transfer to be blocked. Summary of the invention
[0005] The embodiments described herein provide a file processing system and method based on VUE dependency injection, which overcomes the above-mentioned problems.
[0006] In a first aspect, according to the content of the present disclosure, a file processing system based on VUE dependency injection is provided, including: a file management component, a file injection component and a file transfer component, wherein the file management component, the file injection component and the file transfer component are all constructed based on the VUE framework;
[0007] The file management component is used to store multiple business dependency files, wherein the business dependency files include: business logic codes and identification variables corresponding to the business logic codes;
[0008] The file transfer component is used to send a dependent file injection request to the file injection component when detecting that the target business component triggers the file injection rule, wherein the dependent file injection request includes: a dependent file matching rule;
[0009] The file injection component is used to obtain the multiple business dependency files from the file management component, determine a target dependency file from the multiple business dependency files based on the dependency file matching rule included in the dependency file injection request, and send the target dependency file to the file transfer component;
[0010] The file transfer component is further used to transfer the target dependent file based on the dependent file response identifier corresponding to the target dependent file.
[0011] In a second aspect, according to the content of the present disclosure, a file processing method based on VUE dependency injection is provided, comprising:
[0012] When a target business component triggers a file injection rule, a plurality of business dependency files are obtained, wherein the business dependency files include: business logic code and identification variables corresponding to the business logic code;
[0013] Determine a target dependent file from the plurality of business dependent files based on a dependent file matching rule;
[0014] Based on the dependent file response identifier corresponding to the target dependent file, the target dependent file is transmitted.
[0015] In a third aspect, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the file processing method based on VUE dependency injection in any of the above embodiments are implemented.
[0016] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the file processing method based on VUE dependency injection in any of the above embodiments are implemented.
[0017] The file processing system based on VUE dependency injection provided by the embodiment of the present application includes: a file management component, a file injection component and a file transfer component, wherein the file management component, the file injection component and the file transfer component are all constructed based on the VUE framework; the file management component is used to store multiple business dependency files, wherein the business dependency files include: business logic code and identification variables corresponding to the business logic code; the file transfer component is used to send a dependency file injection request to the file injection component when it is detected that a target business component triggers a file injection rule, wherein the dependency file injection request includes: a dependency file matching rule; the file injection component is used to obtain multiple business dependency files from the file management component, and based on the dependency file matching rule included in the dependency file injection request, determine a target dependency file from the multiple business dependency files, and send the target dependency file to the file transfer component; the file transfer component is also used to transmit the target dependency file based on a dependency file response identifier corresponding to the target dependency file. In this way, by setting up a file management component, a file injection component and a file transfer component that are independent of the target business component, the file injection component obtains the target dependent file from the file management component and sends it to the file transfer component, which facilitates the file transfer component to effectively transmit the target dependent file. There is no coupling between the processing components during the file transfer process, which can facilitate the accurate transmission of the target dependent file.
[0018] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:
[0020] Figure 1 It is a structural diagram of a file processing system based on VUE dependency injection provided by the present invention.
[0021] Figure 2 It is a flowchart of a file processing method based on VUE dependency injection provided by the present invention.
[0022] Figure 3 It is a structural schematic diagram of a computer device provided by the present disclosure.
[0023] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.
[0025] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by a person skilled in the art to which the subject matter of the present disclosure belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the specification and the relevant art, and will not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are joined together directly or through one or more intermediate components.
[0026] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0027] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or a part of a component) from another component (or another part of a component).
[0028] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).
[0029] Processing page component logic in optionsAPI based on Vue2 framework is a common operation mode of front-end framework, but there are the following problems in the complex logic business coding with sustainable iteration.
[0030] Code dispersion: The options API disperses component logic in different options, such as 'data', 'mthods', 'computed', 'watch', etc. When the component business logic is complex and lacks maintenance, or there are backend data constants related to some business components; or there are several codes unrelated to the business logic scattered in various components, it is difficult to quickly find and understand the code related to a certain function.
[0031] Complex performance optimization: When there is an entry for business logic, or there are designs for the judgment logic exits of several related business branches, multiple business logics are crossed in the function; it is difficult to focus on the problem and adjust it during coding optimization, which may lead to maintenance difficulties.
[0032] Component scale expansion: In the process of multiple people compiling code together, the problem of code dispersion and the gradual increase of code volume over time in the long-term iteration process indirectly lead to the object configuration of the vue Options API becoming very large and complex, which reduces the readability and maintainability of the components.
[0033] Difficulty in testing: With component logic spread across multiple options, writing unit and integration tests becomes more complex and difficult to manage.
[0034] The existing approach often creates and manages business logic directly within a component, resulting in high coupling between related business logics, making them difficult to modify and expand. Because dependencies are hard-coded, it is difficult to replace or simulate dependencies during testing, which increases the complexity of testing and results in poor testability. It is difficult to dynamically configure and adjust dependencies at runtime, which limits the flexibility and scalability of the application and results in low configuration flexibility. When business logic relationships are complex, the code is difficult to maintain, and modifying one logic point may trigger a chain reaction, affecting the normal operation of the business logic and resulting in poor maintainability.
[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0036] Figure 1 is a structural diagram of a file processing system based on VUE dependency injection provided by an embodiment of the present disclosure, such as Figure 1 As shown, the file processing system based on VUE dependency injection includes: a file management component 110, a file injection component 120 and a file transmission component 130, and the file management component 110, the file injection component 120 and the file transmission component 130 are all constructed based on the VUE framework. The file management component 110 is connected to the file injection component 120, and the file injection component 120 is connected to the file transmission component 130.
[0037] The file management component 110 is used to store multiple business dependency files, and the business dependency files include: business logic codes and identification variables corresponding to the business logic codes.
[0038] Among them, the identification variable corresponding to the business logic code is the variable with certain business functions contained in the business logic code, such as function, module, etc.
[0039] The file transfer component 130 is used to send a dependent file injection request to the file injection component 120 when detecting that the target business component triggers the file injection rule. The dependent file injection request includes: a dependent file matching rule.
[0040] The file transmission component 130 is used for external transmission of dependent files. It obtains the dependent files to be transmitted from the file injection component 120 through file interaction with the file injection component 120 .
[0041] File injection rules can be used to describe business operation data in the target business component, such as user-triggered form submission events, form data query events, form execution loss of focus events, etc.
[0042] The dependent file matching rule may be used to limit the type of dependent files to be obtained, such as the dependent file matching rule may include: digital files, letter files, text files, etc. The dependent file matching rule may be set based on business requirements.
[0043] The file injection component 120 is used to obtain multiple business dependency files from the file management component 110, and based on the dependency file matching rules included in the dependency file injection request, determine the target dependency file from the multiple business dependency files, and send the target dependency file to the file transfer component 130.
[0044] The file injection component 120 obtains the business dependency file that matches the dependency file matching rule from the multiple business dependency files included in the file management component 110 by using the dependency file matching rule set by the file transfer component 130 .
[0045] In some embodiments, the dependent file matching rule is used to describe the dependent file matching identifier, and each business dependent file corresponds to a file category identifier. For example, the dependent file matching identifier can be a letter identifier A, and the file category identifier corresponding to the business dependent file can be a letter identifier A, a number identifier 6, etc.
[0046] The file injection component 120 is specifically used for:
[0047] Obtain the file category identifier corresponding to each business dependency file; match the dependency file matching identifier with the file category identifier corresponding to each business dependency file; and from multiple business dependency files, determine the business dependency file corresponding to the file category identifier that has a matching relationship with the dependency file matching identifier as the target dependency file.
[0048] For example, the file management component 110 includes multiple business dependent files, namely: business dependent file 1, business dependent file 2, and business dependent file 3. The dependent file matching identifier is letter identifier A, the file category identifier corresponding to business dependent file 1 is letter identifier A, the file category identifier corresponding to business dependent file 2 is digital identifier 6, and the file category identifier corresponding to business dependent file 3 is digital identifier 5. The file category identifier that has a matching relationship with the dependent file matching identifier is letter identifier A, and the corresponding business dependent file is business dependent file 1, so business dependent file 1 is the target dependent file.
[0049] Thus, by matching the dependency file matching identifier with the file category identifier corresponding to each business dependency file, the file injection component 120 can quickly obtain the target dependency file from multiple business dependency files.
[0050] The file transmission component 130 is further used to transmit the target dependent file based on the dependent file response identifier corresponding to the target dependent file.
[0051] The dependent file response identifier corresponding to the target dependent file is used to describe the data response area of the target dependent file.
[0052] In some embodiments, the file transfer component 130 is specifically configured to:
[0053] Match the data response area of the target dependency file with the data display area of the target business component to determine the transmission association relationship between the target dependency file and the target business component; if it is determined that there is a transmission association relationship between the target dependency file and the target business component, send the target dependency file to the target business component; if it is determined that there is no transmission association relationship between the target dependency file and the target business component, send the target dependency file to other business components that have a transmission association relationship with the target dependency file.
[0054] Among them, when it is determined that there is a transmission association relationship between the target dependent file and the target business component, it means that the target dependent file is transmitted to the target business component, which is convenient for the target business component to display the target dependent file in the corresponding data display area; when it is determined that there is a transmission association relationship between the target dependent file and other business components, it means that the target dependent file is transmitted to other business components, which is convenient for other business components to display the target dependent file in the corresponding data display area. Therefore, the file recipient of the target dependent file can be effectively determined through the dependent file response identifier of the target dependent file.
[0055] It should be noted that the file management component 110, the file injection component 120 and the file transmission component 130 are external components of the target business component, that is, the file management component 110 and the target business component are independent components, the file injection component 120 and the target business component are independent components, and the file transmission component 130 and the target business component are independent components. In other words, the file management component 110, the file injection component 120 and the file transmission component 130 are created outside the target business component.
[0056] For example, a js file of a collector (i.e., file injection component 120) is implemented, which will handle dependency collection and release: an object for receiving dependency files is created through JavaScriptAPI Map (an execution function). In this class, a registration is written to execute the collection method to obtain dependency instances (abstract descriptions of business dependency files) for the dependencies object. In the subsequent import logic, this method is executed at compile time; for example, when the business dependency file is located in the .. / xx folder, a method for reading the business file code and exporting all dependency classes can be implemented, and then all dependencies can be obtained by traversing all dependency classes and executing the following method to store them in the dependencies variable, such as Injector.register(dependencyName, dependency). In this class, a processing method is written to provide the middleware logic file (i.e., file management component) as an interface for processing dependencies. The input parameter target is the middleware, as well as other arg parameters. After the method is executed, a new class will be returned to configure more parameters for the middleware (i.e., file injection component), such as new target(deps.map((dep)=>this.get(dep)),...args). Write the getDependenciesKeys method in this class to pass the dependency instance in the dependencies variable to the middleware.
[0057] Implement a middleware js file, which is created to handle dependencies and execute dependency instance classes: First, declare the variable dependenciesmiddleware.dependencies=injector.getDependenciesKeys() in the constructor of the middleware class. Then implement a method called runTask in the class. When this method is executed, the execution result of the dependency will be output. A logic will be implemented inside this method. When all dependencies are hit, the traversal will be interrupted; for example: a variable called validateKeys is declared in the constructor method (constructor) of the dependency instance file class. The variable defines a constant value of "waring". At this time, if runTask receives the value of the input parameter key "waring" in the external method, the traversal will be interrupted when the static attribute validateKeys of the dependency in the traversal process is equal to the key, and the method in the dependency instance will be executed; and the parameters required to execute this method will be passed as needed, and the result will be thrown to the external function, such as result=dependency[methodsName](args).
[0058] Declare the above function as an injectCore(key) function in external js to execute, and throw the external function of this method, then it can be used in any vue component. For example, Function injectCore(key){…returnresult}.
[0059] Through the creation of the above components, when the UI component loses focus, the backend interface can be uniformly called to return the backend identifier, which can be used to execute different business methods or corresponding field rules. For example, when a method of the vue component executes an interface request, the value of the returned data is waring, and this identifier variable can be passed to the injectCore method to execute the corresponding business logic.
[0060] Compared with the mixin method of Vue, it has a clear source, and each dependency has its own maintainable variables, which has an advantage in dividing similar logical functions. And because the JavaScript Map API can store dependencies, it will not have a significant impact on performance. Without using the CompositionAPI of the Vue3 framework, this feature design can effectively solve the problems of Vue2OptionsAPI's complex logic and unclear directions.
[0061] The file processing system based on VUE dependency injection of this embodiment includes: a file management component, a file injection component and a file transfer component, and the file management component, the file injection component and the file transfer component are all constructed based on the VUE framework; the file management component is used to store multiple business dependency files, and the business dependency files include: business logic code and identification variables corresponding to the business logic code; the file transfer component is used to send a dependency file injection request to the file injection component when it is detected that the target business component triggers the file injection rule, and the dependency file injection request includes: dependency file matching rules; the file injection component is used to obtain multiple business dependency files from the file management component, and based on the dependency file matching rules included in the dependency file injection request, determine the target dependency file from the multiple business dependency files, and send the target dependency file to the file transfer component; the file transfer component is also used to transmit the target dependency file based on the dependency file response identifier corresponding to the target dependency file. In this way, by setting up a file management component, a file injection component and a file transfer component that are independent of the target business component, the file injection component obtains the target dependent file from the file management component and sends it to the file transfer component, which facilitates the file transfer component to effectively transmit the target dependent file. There is no coupling between the processing components during the file transfer process, which can facilitate the accurate transmission of the target dependent file.
[0062] In some embodiments, the file transfer component 130 is also used to detect whether the target business component triggers the file injection rule within a preset trigger period if it is determined that there is a transmission association relationship between the target dependent file and the target business component; if the target business component does not trigger the file injection rule within the preset trigger period, adjust the transmission state of the file transfer component to an idle state.
[0063] Here, whether the target business component triggers the file injection rule refers to the re-triggering behavior of the target business component on the file injection rule.
[0064] If the target business component does not trigger the file injection rule within the preset trigger period, it means that the target business component has no dependent file acquisition demand. At this time, by adjusting the transmission status of the file transfer component 130 to the idle state, the transmission status of the file transfer component 130 is updated in time to facilitate other business components to perform dependent file transmission.
[0065] In some embodiments, the file transfer component 130 is also used to obtain the file transfer permission corresponding to the target business component if it is determined that there is a transfer association relationship between the target dependent file and the target business component; detect whether the target dependent file exceeds the file transfer permission corresponding to the target business component; if the target dependent file exceeds the file transfer permission corresponding to the target business component, perform file adjustments on the target dependent file based on the file transfer permission corresponding to the target business component.
[0066] The file transfer permission corresponding to the target business component can be determined based on the component level of the target business component. For example, the higher the component level of the target business component, the higher the corresponding file transfer permission. The file transfer permission corresponding to the target business component can be used to limit the dependent files that the target business component can transfer when obtaining business dependent files.
[0067] The file transfer permissions corresponding to the target business component may include: field restriction identifiers that the target business component cannot transfer. When detecting file transfer permissions, the file transfer component 130 may be specifically used to: identify the file field identifier of each dependent file in the target dependent file; if the file field identifier is the same as the field restriction identifier, it is determined that the target dependent file exceeds the file transfer permissions corresponding to the target business component; if all file field identifiers are different from the field restriction identifiers, it is determined that the target dependent file does not exceed the file transfer permissions corresponding to the target business component.
[0068] When adjusting the target dependent file, the file transmission component 130 can be specifically used to delete the dependent file corresponding to the file field identifier that is the same as the field restriction identifier from the target dependent file, thereby facilitating effective guarantee of the transmission security of the dependent file.
[0069] In some embodiments, the file transfer component 130 is also used to obtain the file transfer permissions corresponding to other business components if it is determined that there is a transfer association relationship between the target dependent file and other business components; detect whether the target dependent file exceeds the file transfer permissions corresponding to other business components; if the target dependent file exceeds the file transfer permissions corresponding to other business components, adjust the target dependent file based on the file transfer permissions corresponding to other business components.
[0070] The file transfer permissions corresponding to other business components can be determined based on the component level of other business components, for example, the higher the component level of other business components, the higher the corresponding file transfer permissions. The file transfer permissions corresponding to other business components can be used to limit the dependent files that other business components can transfer when obtaining business dependent files.
[0071] The file transfer permissions corresponding to other business components may include: field restriction identifiers that other business components cannot transfer. When detecting file transfer permissions, the file transfer component 130 can be specifically used to: identify the file field identifier of each dependent file in the target dependent file; if the file field identifier is the same as the field restriction identifier, it is determined that the target dependent file exceeds the file transfer permissions corresponding to other business components; if all file field identifiers are different from the field restriction identifiers, it is determined that the target dependent file does not exceed the file transfer permissions corresponding to other business components.
[0072] When adjusting the target dependent file, the file transmission component 130 can be specifically used to delete the dependent file corresponding to the file field identifier that is the same as the field restriction identifier from the target dependent file, thereby facilitating effective guarantee of the transmission security of the dependent file.
[0073] In some embodiments, the file management component 110 is also used to detect the component storage time corresponding to each business-dependent file; store business-dependent files whose component storage time is greater than a first preset threshold in a file cache area; and delete business-dependent files whose regional storage time is greater than a second preset threshold from the file cache area.
[0074] The component storage duration corresponding to the business dependent file is the storage duration of the business dependent file in the file management component 110. The area storage duration corresponding to the business dependent file is the storage duration of the business dependent file in the file cache area.
[0075] Therefore, by limiting the storage time of business-dependent files, it is convenient to process the business-dependent files in a timely manner when the business-dependent files do not meet the storage time limit, thereby effectively ensuring the storage timeliness of the business-dependent files in the file management component 130.
[0076] In this embodiment, first, the injectCore method is implemented in the file that the business component imports and exports dependency injection; when the business component imports the injectCore method, the collector collects the business code under the dependent .xx file, and at this time, the internal variables of the injectCore method contain the business dependency code; the entry function interacts with the UI of the business component, or executes the relevant data returned by the call interface in the business logic execution of the business component, and passes the data identifier to injectCore; injectCore obtains the identification variable, combines it with the middleware method during execution, and hits the variable in the dependent code through the internal processing logic of the middleware method; when the class in the dependent logic file is hit, the hit method in the dependent class is executed, and the parameters passed from the middleware are obtained, the business logic of the dependent class is executed and the results are thrown to the business component; the business component can output configurable business logic in the UI component, expand the application scope of the function, improve the maintainability of the code, and do not change the functional improvements at the framework level.
[0077] In the process of creating external components in this embodiment, the efficiency of business iteration in coding is effectively solved through the dependency injection mode, especially under the vue2optionsAPI. v-for provides a method to quickly generate similar components, which is suitable for rapid iteration and prototyping; the code structure is simple, which is convenient for team members to quickly understand and make small changes, suitable for rapid iteration and adjustment. Through dependency injection, business logic can be independent of components, so that functions can be easily added, modified or replaced in later iterations; the separation of logic and view improves the testability and maintainability of components, which is suitable for iterative development of complex businesses.
[0078] Compared with the original vue framework, through the Json data structure, the v-for rendering business group based on the framework characteristics, the business logic design is coupled with the framework API. This function design is based on native js compilation, and the business code logic can be implemented in a variety of front-end frameworks (columns: react, jquery), which is convenient for reconstruction based on the old front-end framework for easier migration.
[0079] This functional design not only expands the form function, but also has a large expansion in the realization of business needs in various back-end interface return identifiers. For example: when the back-end returns a specified code, the output business depends on the file logic, and the corresponding function expansion can also be performed in the event of the component control, and it does not rely on the third-party front-end framework, and only requires the third-party front-end framework to update the response data.
[0080] This embodiment allows developers to effectively solve the above problems in the system by building middleware, collectors, and dependent logic files. First, the middleware is responsible for hitting the rules and processing the required dependent business logic code; in the dependent rule constants and the required parameters in the class, the collector is responsible for collecting dependent files and obtaining business logic code on demand through the middleware according to the functional scenario. It can significantly improve the flexibility, maintainability and testability of the code, solve the high coupling caused by the traditional coding management method of vue2, and enable developers to focus more on the implementation of business logic without having to worry about the workload generated by the coding process.
[0081] Among them, front-end developers visualize functions as code files. Business components are small modules that specialize in handling specific business logic or functions. They are the "building blocks" in the application. Each component is responsible for a specific task or function, including the interface style that needs to be displayed and more complex logic carriers.
[0082] The collector is essentially a logic code that is used to collect js files in a folder through abstract description, and to match the collected file code with the middleware (the method for matching the output file).
[0083] Middleware is essentially a logic code, which is described in an abstract way to implement traversal from the injector to find the hit rule dependency folder (business logic code js file), extract the target js file, pass parameters to the execution class (method function) in the target js file, and return the output result to the business component. Dependency instance is essentially a logic code, which carries each independent business logic code function through an abstract description.
[0084] Figure 2 A flowchart of a file processing method based on VUE dependency injection provided in this embodiment, the file processing method based on VUE dependency injection may include:
[0085] S210: When it is detected that the target business component triggers a file injection rule, multiple business dependency files are obtained.
[0086] The business dependency file includes: business logic code and identification variables corresponding to the business logic code. The identification variables corresponding to the business logic code are variables with certain business functions contained in the business logic code, such as functions, modules, etc.
[0087] S220. Determine a target dependent file from multiple business dependent files based on a dependent file matching rule.
[0088] The dependent file matching rule is used to describe the dependent file matching identifier, and each business dependent file corresponds to a file category identifier. For example, the dependent file matching identifier can be a letter identifier A, and the file category identifier corresponding to the business dependent file can be a letter identifier A, a number identifier 6, etc.
[0089] In some embodiments, based on the dependency file matching rule, determining the target dependency file from multiple business dependency files includes:
[0090] Obtain the file category identifier corresponding to each business dependency file; match the dependency file matching identifier with the file category identifier corresponding to each business dependency file; and from multiple business dependency files, determine the business dependency file corresponding to the file category identifier that has a matching relationship with the dependency file matching identifier as the target dependency file.
[0091] For example, the multiple business dependency files are business dependency file 1, business dependency file 2, and business dependency file 3. The dependency file matching identifier is letter identifier A, the file category identifier corresponding to business dependency file 1 is letter identifier A, the file category identifier corresponding to business dependency file 2 is digital identifier 6, and the file category identifier corresponding to business dependency file 3 is digital identifier 5. The file category identifier that has a matching relationship with the dependency file matching identifier is letter identifier A, and the corresponding business dependency file is business dependency file 1, so business dependency file 1 is the target dependency file.
[0092] Therefore, by matching the dependent file matching identifier with the file category identifier corresponding to each business dependent file, it is convenient to quickly obtain the target dependent file from multiple business dependent files.
[0093] S230. Based on the dependent file response identifier corresponding to the target dependent file, transmit the target dependent file.
[0094] The dependent file response identifier corresponding to the target dependent file is used to describe the data response area of the target dependent file.
[0095] In some embodiments, based on a dependent file response identifier corresponding to the target dependent file, transmitting the target dependent file includes:
[0096] Match the data response area of the target dependency file with the data display area of the target business component to determine the transmission association relationship between the target dependency file and the target business component; if it is determined that there is a transmission association relationship between the target dependency file and the target business component, send the target dependency file to the target business component so that the target business component displays the target dependency file in the corresponding data display area; if it is determined that there is no transmission association relationship between the target dependency file and the target business component, send the target dependency file to other business components that have a transmission association relationship with the target dependency file, so that other business components display the target dependency file in the corresponding data display area.
[0097] Among them, when it is determined that there is a transmission association relationship between the target dependent file and the target business component, it means that the target dependent file is transmitted to the target business component, which is convenient for the target business component to display the target dependent file in the corresponding data display area; when it is determined that there is a transmission association relationship between the target dependent file and other business components, it means that the target dependent file is transmitted to other business components, which is convenient for other business components to display the target dependent file in the corresponding data display area. Therefore, the file recipient of the target dependent file can be effectively determined through the dependent file response identifier of the target dependent file.
[0098] In some embodiments, if it is determined that there is a transfer association relationship between the target dependent file and the target business component, the file transfer permission corresponding to the target business component is obtained; it is detected whether the target dependent file exceeds the file transfer permission corresponding to the target business component; if the target dependent file exceeds the file transfer permission corresponding to the target business component, the target dependent file is adjusted based on the file transfer permission corresponding to the target business component.
[0099] The file transfer permission corresponding to the target business component can be determined based on the component level of the target business component. For example, the higher the component level of the target business component, the higher the corresponding file transfer permission. The file transfer permission corresponding to the target business component can be used to limit the dependent files that the target business component can transfer when obtaining business dependent files.
[0100] The file transfer permissions corresponding to the target business component may include: field restriction identifiers that the target business component cannot transfer. Detecting whether the target dependent file exceeds the file transfer permissions corresponding to the target business component may include: identifying the file field identifier of each dependent file in the target dependent file; if the file field identifier is the same as the field restriction identifier, determining that the target dependent file exceeds the file transfer permissions corresponding to the target business component; if all file field identifiers are different from the field restriction identifiers, determining that the target dependent file does not exceed the file transfer permissions corresponding to the target business component.
[0101] Adjusting the target dependent file based on the file transfer permission corresponding to the target business component may include: deleting the dependent file corresponding to the file field identifier that is the same as the field restriction identifier from the target dependent file, thereby facilitating effective security in ensuring the transmission of the dependent file.
[0102] In some embodiments, if it is determined that there is a transfer association relationship between the target dependent file and other business components, the file transfer permissions corresponding to the other business components are obtained; it is detected whether the target dependent file exceeds the file transfer permissions corresponding to other business components; if the target dependent file exceeds the file transfer permissions corresponding to other business components, the target dependent file is adjusted based on the file transfer permissions corresponding to other business components.
[0103] The file transfer permissions corresponding to other business components can be determined based on the component level of other business components, for example, the higher the component level of other business components, the higher the corresponding file transfer permissions. The file transfer permissions corresponding to other business components can be used to limit the dependent files that other business components can transfer when obtaining business dependent files.
[0104] The file transfer permissions corresponding to other business components may include: field restriction identifiers that other business components cannot transfer. Detecting whether the target dependent file exceeds the file transfer permissions corresponding to other business components may include: identifying the file field identifier of each dependent file in the target dependent file; if the file field identifier is the same as the field restriction identifier, then determining that the target dependent file exceeds the file transfer permissions corresponding to other business components; if all file field identifiers are different from the field restriction identifiers, then determining that the target dependent file does not exceed the file transfer permissions corresponding to other business components.
[0105] Adjusting the target dependent file based on the file transfer permissions corresponding to other business components may include: deleting the dependent file corresponding to the file field identifier that is the same as the field restriction identifier from the target dependent file, thereby facilitating effective security in ensuring the transmission of the dependent file.
[0106] In some embodiments, it also includes:
[0107] Detect the component storage time corresponding to each business dependency file; store the business dependency files whose component storage time is greater than a first preset threshold in a file cache area; and delete the business dependency files whose regional storage time is greater than a second preset threshold from the file cache area.
[0108] The component storage duration corresponding to the business dependent file is the storage duration of the business dependent file in the corresponding storage component, and the area storage duration corresponding to the business dependent file is the storage duration of the business dependent file in the file cache.
[0109] Therefore, by limiting the storage time of business-dependent files, it is convenient to process the business-dependent files in a timely manner when the business-dependent files do not meet the storage time limit, thereby effectively ensuring the storage timeliness of the business-dependent files.
[0110] The present application also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0111] The computer device includes a memory 310 and a processor 320 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with a memory 310 and a processor 320, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0112] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0113] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 310 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (FlashCard) equipped on the computer device. Of course, the memory 310 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 310 may also be used to temporarily store various data that have been output or are to be output.
[0114] The processor 320 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 310 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 320 is used to execute the program codes or instructions stored in the memory 310 or process data, such as running the program code of the above method.
[0115] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0116] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.
[0117] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.
[0118] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.
[0119] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0120] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0122] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
[0123] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A file processing system based on VUE dependency injection, characterized in that: include: A file management component, a file injection component and a file transfer component, wherein the file management component, the file injection component and the file transfer component are all constructed based on the VUE framework; The file management component is used to store multiple business dependency files, wherein the business dependency files include: business logic codes and identification variables corresponding to the business logic codes; The file transfer component is used to send a dependent file injection request to the file injection component when detecting that the target business component triggers the file injection rule, wherein the dependent file injection request includes: a dependent file matching rule; The file injection component is used to obtain the multiple business dependency files from the file management component, determine a target dependency file from the multiple business dependency files based on the dependency file matching rule included in the dependency file injection request, and send the target dependency file to the file transfer component; The file transfer component is further used to transfer the target dependent file based on the dependent file response identifier corresponding to the target dependent file.
2. The system according to claim 1, characterized in that The dependent file matching rule is used to describe the dependent file matching identifier, and each of the business dependent files corresponds to a file category identifier; The file injection component is specifically used for: Obtaining a file category identifier corresponding to each of the business dependent files; Matching the dependent file matching identifier with the file category identifier corresponding to each of the business dependent files; From the plurality of business dependency files, the business dependency file corresponding to the file category identifier having a matching relationship with the dependency file matching identifier is determined as the target dependency file.
3. The system according to claim 1, characterized in that The dependent file response identifier corresponding to the target dependent file is used to describe the data response area of the target dependent file; The file transfer component is specifically used for: Matching the data response area of the target dependency file with the data display area of the target business component to determine a transmission association relationship between the target dependency file and the target business component; If it is determined that there is a transmission association relationship between the target dependency file and the target business component, sending the target dependency file to the target business component so that the target business component displays the target dependency file in a corresponding data display area; If it is determined that there is no transmission association relationship between the target dependency file and the target business component, the target dependency file is sent to other business components that have a transmission association relationship with the target dependency file, so that the other business components display the target dependency file in the corresponding data display area.
4. The system according to claim 3, characterized in that The file transfer component is further used to detect whether the target business component triggers the file injection rule within a preset trigger period if it is determined that there is a transfer association relationship between the target dependent file and the target business component; If the target service component does not trigger the file injection rule within the preset trigger period, the transmission state of the file transmission component is adjusted to an idle state.
5. The system according to claim 3, characterized in that The file transfer component is also used to obtain the file transfer permission corresponding to the target business component if it is determined that there is a transfer association relationship between the target dependent file and the target business component; detect whether the target dependent file exceeds the file transfer permission corresponding to the target business component; if the target dependent file exceeds the file transfer permission corresponding to the target business component, perform file adjustments on the target dependent file based on the file transfer permission corresponding to the target business component.
6. The system according to claim 3, characterized in that The file transfer component is also used to obtain the file transfer permissions corresponding to the other business components if it is determined that there is a transfer association relationship between the target dependent file and the other business components; detect whether the target dependent file exceeds the file transfer permissions corresponding to the other business components; if the target dependent file exceeds the file transfer permissions corresponding to the other business components, perform file adjustments on the target dependent file based on the file transfer permissions corresponding to the other business components.
7. The system according to claim 1, characterized in that The file management component is further used to detect the component storage time corresponding to each of the business dependent files; and store the business dependent files whose component storage time is greater than a first preset threshold into the file cache area; The business dependent files whose regional storage time is greater than a second preset threshold are deleted from the file cache area.
8. A file processing method based on VUE dependency injection, characterized in that: include: When it is detected that the target business component triggers the file injection rule, a plurality of business dependency files are obtained, wherein the business dependency files include: business logic code and identification variables corresponding to the business logic code; Determine a target dependent file from the plurality of business dependent files based on a dependent file matching rule; Based on the dependent file response identifier corresponding to the target dependent file, the target dependent file is transmitted.
9. The method according to claim 8, characterized in that The dependent file matching rule is used to describe the dependent file matching identifier, and each of the business dependent files corresponds to a file category identifier; The determining of the target dependent file from the plurality of business dependent files based on the dependent file matching rule includes: Obtaining a file category identifier corresponding to each of the business dependent files; Matching the dependent file matching identifier with the file category identifier corresponding to each of the business dependent files; From the plurality of business dependency files, the business dependency file corresponding to the file category identifier having a matching relationship with the dependency file matching identifier is determined as the target dependency file.
10. The method according to claim 8, characterized in that Also includes: Detecting the storage duration of the component corresponding to each of the business dependency files; Storing the business dependent files whose component storage time is longer than a first preset threshold in a file cache area; The business dependent files whose regional storage time is greater than a second preset threshold are deleted from the file cache area.