Front-end-based request processing method, device, terminal, and storage medium

Through the use of preset scripts and tools to uniformly process Ajax requests of front-end projects, the problems of resource waste and errors in global modifications are solved, and security and efficiency are achieved.

CN118916055BActive Publication Date: 2025-09-16PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411060002.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2025-09-16
Estimated Expiration
2044-08-02

AI Technical Summary

Technical Problem

When making global modifications to existing front-end frameworks, especially when adding unified security verification logic or integrating tracking systems, there are problems of resource waste and runtime errors. They cannot be directly defined globally and are prone to duplicate definitions.

Method used

The Ajax method is logically processed through the preset high-order functions of the preset script, including encryption and decryption and embedding of tracking information, generating a unified object and then requesting the method. It is then built using the Esbuild packaging tool and package management tool to generate a compatible library function file.

Benefits of technology

It achieves secure processing of request parameters, efficient construction and loading of resources, simplifies code maintenance, improves code maintainability and scalability, and avoids duplicate definitions and runtime errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916055B_ABST
    Figure CN118916055B_ABST
Patent Text Reader

Abstract

The present invention provides a front-end-based request processing method, device, terminal and storage medium, the method comprising: obtaining a request method for updating a front-end project; performing logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; redefining the processed request method through the preset script to obtain a unified object request method; constructing the unified object request method to generate a corresponding library function file; the present invention realizes secure processing of request parameters, efficient construction and loading of resources, and dynamic function expansion through unified processing, security enhancement and efficient construction process for Ajax requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a front-end-based request processing method, device, terminal and storage medium. Background Art

[0002] In the current world of internet front-end development, the component-based development model and rich ecosystems of front-end frameworks like Vue and React have become the preferred choice for many projects. To compile complex project structures into browser-readable code, developers generally use packaging tools like Webpack and Rollup to integrate, compress, and optimize various resources, ultimately generating easy-to-deploy bundle files.

[0003] When a project requires iteration, especially when functional adjustments are needed across the entire project or across a large number of pages, it's necessary to add unified security validation logic to all Ajax requests or integrate a new tracking system to collect user behavior data. However, many applications based on mature front-end frameworks don't directly expose global entry points for developers to make these global modifications. This is especially true when the front-end framework itself is highly encapsulated or the project structure is complex. This can only be addressed through plugins in the webpack tool. These plugins must be externalized to each page, leading to repeated definitions of global methods, wasted resources, and even runtime errors. Summary of the Invention

[0004] The purpose of the embodiments of the present invention is to provide a front-end-based request processing method, device, terminal and storage medium to solve the technical problem that the existing request method definition cannot be directly defined globally and is prone to repeated definition.

[0005] In a first aspect, the present invention provides a front-end-based request processing method, comprising:

[0006] Get the request method used to update the front-end project;

[0007] Performing logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function;

[0008] Redefine the processed request method through the preset script to obtain a unified object request method;

[0009] The request method after the unified object is constructed to generate a corresponding library function file.

[0010] In an optional embodiment, the method further comprises:

[0011] Obtaining an initialization request for the front-end project;

[0012] Inject the preset script into the front-end project.

[0013] In an optional embodiment, performing logical processing on all Ajax methods in the request method by using a preset high-order function of the preset script to obtain a processed request method includes:

[0014] Encrypt and decrypt the input and output parameters of the request method respectively through the first preset function to obtain the corresponding processed request method;

[0015] The embedded point information is embedded through the second preset function to obtain the corresponding processed request method.

[0016] In an optional implementation manner, constructing the request method after unifying the object includes:

[0017] The request method after unifying the objects is constructed using the Esbuild packaging tool.

[0018] In an optional embodiment, the method further comprises:

[0019] Execute the preset build task according to the library function file through the preset package management tool to obtain the corresponding build result;

[0020] The build result is loaded into the front-end project as a static resource.

[0021] In an optional embodiment, executing the construction task according to the library function file by using a preset package management tool includes:

[0022] The preset construction task of the library function file is executed using the pre-script of the preset package management tool.

[0023] In a second aspect, the present invention provides a front-end-based request processing device, the device comprising:

[0024] The acquisition module is used to obtain the request method for updating the front-end project;

[0025] A processing module is configured to perform logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function;

[0026] A definition module, configured to redefine the processed request method through the preset script to obtain a unified object request method;

[0027] The construction module is used to construct the request method after the unified object to generate a corresponding library function file.

[0028] In an optional embodiment, the processing module includes:

[0029] a processing unit, configured to encrypt and decrypt the input and output parameters of the request method respectively using the first preset function to obtain a corresponding processed request method;

[0030] Embedding unit: used to embed the tracking point information through the second preset function to obtain the corresponding processed request method.

[0031] In a third aspect, the present invention provides a terminal comprising a memory and a processor, wherein the memory stores a front-end-based request processing program, and the front-end-based request processing program executes the front-end-based request processing method described in the aforementioned embodiment when the processor is running.

[0032] In a fourth aspect, the present invention provides a computer storage medium storing a front-end-based request processing program, which executes the front-end-based request processing method described in the aforementioned embodiment when running on a processor.

[0033] The present invention adopts the above technical solution to achieve the following effects:

[0034] The present invention obtains a request method for updating a front-end project; performs logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; redefines the processed request method through the preset script to obtain a unified object request method; constructs the unified object request method to generate a corresponding library function file; the present invention realizes secure processing of request parameters, efficient construction and loading of resources, and dynamic function expansion through unified processing, security enhancement and efficient construction process for Ajax requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0036] Figure 1A schematic diagram of a process flow of a front-end-based request processing method provided by an embodiment of the present invention;

[0037] Figure 2 This is another flowchart of a front-end-based request processing method provided by an embodiment of the present invention;

[0038] Figure 3 This is another flowchart of a front-end-based request processing method provided by an embodiment of the present invention;

[0039] Figure 4 This is another flow chart of a front-end-based request processing method provided by an embodiment of the present invention;

[0040] Figure 5 This is a schematic diagram of the structure of a front-end-based request processing device provided by an embodiment of the present invention;

[0041] Figure 6 It is a structural diagram of a terminal provided by an embodiment of the present invention.

[0042] Icons: 500 - front-end-based request processing device; 501 - acquisition module; 502 - processing module; 503 - definition module; 504 - construction module; 600 - terminal; 601 - processor; 602 - transceiver;

[0043] 603-Memory. DETAILED DESCRIPTION

[0044] The technical solutions of the present invention will be described clearly and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.

[0045] The components of the present invention generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the figures is not intended to limit the scope of the claimed invention, but rather merely represents selected embodiments of the invention. All other embodiments derived by those skilled in the art based on the embodiments of the present invention without inventive effort are intended to be within the scope of the present invention.

[0046] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or the possibility of adding one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0047] Furthermore, the terms “first,” “second,” “third,” etc., are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0048] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present invention pertain. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present invention.

[0049] At present, obtaining users' vital signs data through wearable devices on the market is relatively direct and complicated. It is not only not conducive to users directly discovering data anomalies and changes, but also unable to provide easy-to-understand result analysis and early warnings.

[0050] In response to the above technical problems, an embodiment of the present invention provides a front-end-based request processing method, device, terminal and storage medium, the purpose of which is to solve the technical problem that the existing request method definition cannot be directly defined globally and is prone to repeated definition.

[0051] Example 1

[0052] like Figure 1 As described above, the embodiment of the present invention provides a front-end-based request processing method, including steps S100 to S400, and each step is described below.

[0053] Step S100: Obtain a request method for updating a front-end project.

[0054] In this embodiment, the front-end-based request processing method is applied to a terminal, which includes but is not limited to: computers, mobile terminals and other devices; the terminal is provided with a training migration platform for front-end-based request processing.

[0055] Preferably, the front-end project can be a front-end framework project such as Vue, React, which has a series of preset code libraries, components and guide collections, or a front-end-free project that does not rely on mature frameworks and directly uses native Web technologies (HTML, CSS, JavaScript) for page construction and interactive logic implementation. The request method includes the request method that needs to be updated for all single-page or multi-page applications in the front-end project, where the update includes but is not limited to update operations such as obtaining data, updating data or submitting forms.

[0056] In this embodiment, in the front-end project development, when the project development needs to make an update request, a request method for updating the front-end project is obtained. Preferably, the front-end project uses Ajax requests to implement update requests. Therefore, the main thing is to obtain the Ajax request for updating the front-end project, thereby optimizing the request process.

[0057] like Figure 2 As described above, S100 obtains a request method for updating a front-end project, and the following steps are also included before that:

[0058] Step S500: Obtain an initialization request for the front-end project.

[0059] Step S600: inject the preset script into the front-end project.

[0060] Preferably, when a front-end project is being developed, an initialization request is obtained during the development process, thereby injecting a preset script into the front-end project, providing pre-tasks for subsequent updates, and realizing independent expansion of functions.

[0061] In this embodiment, by obtaining the initialization request of the front-end project under development, the script is injected into the front-end project to provide front-end loading and improve optimization efficiency.

[0062] Step S200: Performing logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function.

[0063] Preferably, the preset script executes a custom method in the script through the _ajaxBefore function, which mainly refers to the _ajaxBefore function that uniformly preprocesses Ajax requests in the front-end project, and enhances or controls the behavior of the request by inserting a custom logic method. The preset high-order function is a high-order function used to enhance or modify the Ajax request method, which can realize the logical processing of the request, wherein the first preset function refers to a high-order function used for encryption and decryption operations on request parameters (input parameters) and response data (output parameters), and the second preset function refers to a high-order function used to embed buried point information, which respectively represent processing logic at different levels. By combining the preset high-order functions, all Ajax methods in the request method are logically processed, including encryption and decryption of input and output parameters, injection of buried point information and other logical processing, to obtain the processed request method, thereby efficiently responding to complex request processing logic and realizing the unification and enhancement of the request method. In this embodiment, the preferred logical processing is encryption and decryption of input and output parameters, injection of buried point information and other logical processing.

[0064] In this embodiment, redefining all Ajax methods by presetting high-order functions can be achieved by loading the following custom functions into the presetting script:

[0065] const_ajaxBefore=function(callback)

[0066] {return async(...args)=>

[0067] {await callback(...args)

[0068] this(...args)}}

[0069] The preset script is loaded when the project is initialized. By executing the preset function and custom function in the high-order function _ajaxBefore, the Ajax request method performs logical processing such as encryption and decryption of input and output parameters, injection of embedded information, etc., thereby redefining all Ajax objects.

[0070] In this embodiment, the _ajaxBefore function is used as a preset hook to provide a centralized way to manage and enhance Ajax requests. Then, by customizing the method in the _ajaxBefore function, encryption and decryption operations of request parameters (input parameters) and response data (output parameters) and / or embedding of tracking point information are implemented, thereby simplifying development work and ensuring the comprehensiveness and consistency of data collection.

[0071] like Figure 3 Specifically, in one implementation of this embodiment, step S200 includes the following:

[0072] Step S210: encrypting and decrypting the input and output parameters of the request method using the first preset function to obtain a corresponding processed request method;

[0073] Step S220: embed the tracking point information through the second preset function to obtain the corresponding processed request method.

[0074] In this embodiment, the first preset function is a function used for encryption and decryption operations in the preset script, and the second preset function is a function used to embed tracking information in the preset script. The encryption and decryption operations of the request parameters (input parameters) and the response data (output parameters) are implemented through the first preset function, which is usually used to protect sensitive information, such as user credentials, financial transaction data, etc. For example, sensitive data in the request body can be encrypted before sending the request to ensure that the data is not easily stolen during transmission; at the same time, after receiving the response, the data is decrypted so that the application can use the data safely. Then, the tracking information is embedded through the second preset function. Tracking refers to inserting code at key locations in the application to collect user behavior data for subsequent analysis of user habits, optimization of product functions, etc. Embedding tracking information means automatically adding some tracking codes or specific parameters before each Ajax request is initiated to record the context information of the request, such as the request URL, timestamp, user ID, etc., so as to protect the security of the request data, and effectively collect and analyze the interaction data between the user and the application, thereby optimizing the user experience and application performance.

[0075] Step S300: redefine the processed request method through the preset script to obtain a unified object request method.

[0076] In this embodiment, redefining the processed request method refers to modifying the global Ajax object through a preset script, that is, modifying the global window.$.ajax object. Specifically, by executing the _ajaxBefore function, it is ensured that each Ajax request is logically processed by the preset script, thereby uniformly redefining each Ajax request and obtaining the request method after the unified object. This not only enhances the security and functionality of the front-end project request, but also simplifies code maintenance through unified processing logic, realizes the unification and enhancement of the request method, and improves the maintainability and extensibility of the code.

[0077] Step S400: construct the request method after unifying the objects to generate a corresponding library function file.

[0078] In this embodiment, the construction operation means that in order to ensure that the browser environment can correctly load and execute the request method after being processed by the preset script unified object, the request method after the unified object needs to be packaged into a browser-compatible file, thereby handling the dependencies of different method specifications and ensuring the compatibility and maintainability of the code.

[0079] Specifically, in one implementation of this embodiment, step S400 includes the following:

[0080] Step S410: Build the request method after unifying the objects using the Esbuild packaging tool.

[0081] As a preferred method, the lightweight packaging tool Esbuild is used to output the request method after the unified object, which realizes the independence and efficiency of the packaging construction, thereby providing a pre-task for generating the corresponding library function file and realizing the independent expansion of functions.

[0082] Because the global singleton pattern is used, this resource is not injected repeatedly and is executed only during Ajax loading. In the single-page mode shown below, page1, page2,...pageN all use the same window.$.ajax. Injecting global functions makes the script purer and more efficient, avoiding the side effects of multiple loading.

[0083] In this embodiment, since the use of preset high-order functions to process Ajax request methods requires the introduction of new dependencies (such as libraries that comply with ESM or CommonJS specifications) to assist in processing these business logics, when the business logic processing relies on libraries that comply with ESM (ECMAScript module) specifications or CommonJS specifications, direct use in a browser environment may encounter compatibility issues. Therefore, the Node package management tool is used to package the introduced new dependencies together with the processed Ajax request methods into a single file compatible with the current project environment (whether ESM or CommonJS), thereby ensuring the normal operation of the code. The Esbuild fast build packaging tool is used to package the request methods after unification of objects into files compatible with different browsers, which can further improve the code's running efficiency and loading speed while ensuring the compatibility of the code.

[0084] like Figure 4 Specifically, in one implementation of this embodiment, step S400 further includes the following:

[0085] Step S420: Execute a preset construction task according to the library function file through a preset package management tool to obtain a corresponding construction result.

[0086] Step S430: Load the construction result into the front-end project as a static resource.

[0087] Preferably, the preset package management tool includes but is not limited to the Node package management tool npm.

[0088] In this embodiment, a preset package management tool is used to execute preset build tasks, specifically parsing the project configuration file, identifying the required library function files and their dependencies, and executing the build tasks based on the parsing results, thereby maximizing performance and loading speed, simplifying the integration process of third-party libraries or custom library function files in the front-end project, and ensuring resource consistency and optimal performance through standardized build processes, thereby solving efficiency and quality issues in front-end resource management and build integration, and promoting the advancement of front-end development technology.

[0089] Specifically, in one implementation of this embodiment, step S420 includes the following:

[0090] Step S421: Utilize the pre-script of the preset package management tool to execute the preset construction task of the library function file.

[0091] Preferably, the pre-script prescript of the Node package management tool npm is used to execute the building task of the library function file. The building task refers to building the library function file according to the library function file, the project type into which the library function file is loaded, and the corresponding project environment.

[0092] In this example, the unified object-based Ajax request methods are effectively integrated into the project through the npm package management tool, ensuring high code performance, compatibility, and ease of maintenance. This ensures that no changes are made to the business-layer logic code. This allows for unified processing of all request methods without changing the original front-end project build process, while ensuring functional independence and efficiency. This not only reduces intrusion into existing code but also achieves low-code processing, backward compatibility, and elegant upgrades. Furthermore, the unified object-based Ajax request methods are built and deployed along with the project, improving code organization and maintainability.

[0093] In one implementation of this embodiment, the specific implementation steps in the front-end project can be: first, redefine the global Ajax request method by presetting a high-order function, the preset script is loaded when the front-end project is initialized, and the custom method is executed in the _ajaxBefore function. The custom method includes logic processing such as encryption and decryption of input and output parameters, injection of embedded information, and finally redefines the Ajax object on the global window. Among them, when encountering dependencies on the ESM specification or the CommonJS specification during logical processing, the library function is packaged and built using the fast and lightweight packaging tool Esbuild to generate ajax.bundle.js. Esbuild has built-in code compression and can generate efficient production environment code without additional tools. It is simple to configure and realizes the independence and efficiency of the function. The preset script provides a pre-task for generating ajax.bundle.js, realizing the independent expansion of the function. Since the global singleton mode is used, it is guaranteed that resources will not be injected repeatedly and are only executed when Ajax is loaded, making the script purer and more efficient, avoiding the side effects caused by multiple loading. Finally, the pre-hook prescript of Node's package management tool - npm is used to execute the building task of the library function. The building task will be completed before the main building process of the front-end project is executed, and finally it will be loaded as a static resource after the Ajax request method is loaded. Since the solution of the present invention is completed outside the original framework project building process, when all single-page or multi-page applications request ajax, the corresponding injected resources are only loaded once, that is, ajax.bundle.js. And it does not involve changes in the business layer logic code. In this way, it can achieve unified processing of all request methods without being separated from the original framework project building process, while ensuring the independence and efficiency of the functions. The impact of intervention on existing code is reduced.

[0094] The present invention adopts the above technical solution to achieve the following effects:

[0095] The present invention obtains a request method for updating a front-end project; performs logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; redefines the processed request method through the preset script to obtain a unified object request method; constructs the unified object request method to generate a corresponding library function file; the present invention realizes secure processing of request parameters, efficient construction and loading of resources, and dynamic function expansion through unified processing, security enhancement and efficient construction process for Ajax requests.

[0096] Example 2

[0097] In addition, the present application provides a front-end-based request processing device 500, the functional module diagram of which is shown in FIG. Figure 5 As shown, the front-end-based request processing device 500 includes:

[0098] Acquisition module 501, used to obtain a request method for asynchronously updating a front-end project;

[0099] Processing module 502: configured to perform logical processing on all Ajax methods in the request method using a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function;

[0100] A definition module 503 is configured to redefine the processed request method using the preset script to obtain a unified request method.

[0101] The construction module 504 is used to construct the request method after unifying the objects to generate a corresponding library function file.

[0102] Specifically, in one implementation of this embodiment, the processing module 502 includes:

[0103] a processing unit, configured to encrypt and decrypt the input and output parameters of the request method respectively using the first preset function to obtain a corresponding processed request method;

[0104] Embedding unit: used to embed the tracking point information through the second preset function to obtain the corresponding processed request method.

[0105] The front-end-based request processing device 500 provided in this embodiment can implement a front-end-based request processing method provided in Example 1, and will not be described again here to avoid repetition.

[0106] Example 3

[0107] In addition, an embodiment of the present application provides a terminal, including a memory and a processor, wherein the memory stores a front-end-based request processing program, and when the front-end-based request processing program runs on the processor, it executes the front-end-based request processing method provided in Example 1.

[0108] For details, see Figure 6The terminal 600 includes: a transceiver 602, a bus interface and a processor 601, and the processor 601 is used to: obtain a request method for updating a front-end project; perform logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; redefine the processed request method through the preset script to obtain a unified object request method; construct the unified object request method to generate a corresponding library function file.

[0109] In one embodiment, the processor 601 is further configured to: obtain an initialization request of the front-end project; and inject the preset script into the front-end project.

[0110] In one embodiment, the processor 601 is also used to: encrypt and decrypt the input and output parameters of the request method respectively through the first preset function to obtain the corresponding processed request method; embed the embedded point information through the second preset function to obtain the corresponding processed request method.

[0111] In one embodiment, the processor 601 is further configured to: construct the request method after unifying the objects by using an Esbuild packaging tool.

[0112] In one embodiment, the processor 601 is further configured to: execute a preset build task according to the library function file through a preset package management tool to obtain a corresponding build result; and load the build result into the front-end project as a static resource.

[0113] In one embodiment, the processor 601 is further configured to: execute the preset construction task of the library function file using a pre-script of the preset package management tool.

[0114] In the embodiment of the present invention, the terminal 600 further includes a memory 603. Figure 6 In the embodiment, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 601 and memory represented by memory 603. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 602 can be multiple components, that is, including a transmitter and a receiver, providing a unit for communicating with various other devices over a transmission medium. The processor 601 is responsible for managing the bus architecture and general processing, and the memory 603 can store data used by the processor 601 when performing operations.

[0115] The terminal 600 provided in the embodiment of the present invention can execute the steps of the front-end-based request processing method provided in the above-mentioned method embodiment 1, which will not be described again here to avoid repetition.

[0116] The terminal provided in this embodiment obtains a request method for updating a front-end project; performs logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; redefines the processed request method through the preset script to obtain a unified object request method; constructs the unified object request method to generate a corresponding library function file, and realizes secure processing of request parameters, efficient construction and loading of resources, and dynamic function expansion through unified processing, security enhancement and efficient construction process for Ajax requests.

[0117] Example 4

[0118] The present application also provides a computer storage medium, which stores a front-end-based request processing program. When the front-end-based request processing program is executed by a processor, it implements a front-end-based request processing method provided in Example 1.

[0119] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, the indirect coupling or communication connection of the device or unit may be electrical, mechanical or other forms.

[0120] In addition, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0121] Furthermore, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0122] It should be noted that if the function is implemented in the form of a software function module 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 invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0123] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.

[0124] The foregoing description is merely an embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Those skilled in the art will readily appreciate that the present invention is susceptible to various modifications and variations. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A front-end-based request processing method, characterized in that: include: Get the request method used to update the front-end project; Performing logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; Redefine the processed request method through the preset script to obtain a unified object request method; Construct the request method after unifying the objects to generate the corresponding library function file: The logic processing of all Ajax methods in the request method by the preset high-order function of the preset script to obtain the processed request method includes: Encrypt and decrypt the input and output parameters of the request method respectively through the first preset function to obtain the corresponding processed request method; The embedded point information is embedded through the second preset function to obtain the corresponding processed request method.

2. The front-end-based request processing method according to claim 1, characterized in that: The method also includes: Obtaining an initialization request for the front-end project; Inject the preset script into the front-end project.

3. The front-end-based request processing method according to claim 2, characterized in that: The request method after unifying the objects is constructed, including: The request method after unifying the objects is constructed using the Esbuild packaging tool.

4. The front-end-based request processing method according to claim 3, characterized in that: The method further comprises: Execute the preset build task according to the library function file through the preset package management tool to obtain the corresponding build result; The build result is loaded into the front-end project as a static resource.

5. The front-end-based request processing method according to claim 4, characterized in that: The executing the construction task according to the library function file by using a preset package management tool includes: The preset construction task of the library function file is executed using the pre-script of the preset package management tool.

6. A front-end-based request processing device, characterized in that: The device comprises: The acquisition module is used to obtain the request method for updating the front-end project; A processing module is configured to perform logical processing on all Ajax methods in the request method through a preset high-order function of a preset script to obtain a processed request method, wherein the preset high-order function includes a first preset function and a second preset function; A definition module, configured to redefine the processed request method through the preset script to obtain a unified object request method; A construction module is used to construct the request method after the unified object to generate a corresponding library function file; The processing module includes: a processing unit, configured to encrypt and decrypt the input and output parameters of the request method respectively using the first preset function to obtain a corresponding processed request method; Embedding unit: used to embed the tracking point information through the second preset function to obtain the corresponding processed request method.

7. A terminal, characterized in that: It includes a memory and a processor, the memory stores a front-end-based request processing program, and the front-end-based request processing program executes the front-end-based request processing method according to any one of claims 1 to 5 when the processor is running.

8. A computer storage medium, characterized in that The computer storage medium stores a front-end-based request processing program, which executes the front-end-based request processing method according to any one of claims 1 to 5 when running on a processor.

Citation Information

Patent Citations

  • Ajax request merging processing method, system and device and storage medium

    CN113641512A

  • Providing globalization functionalities for javascript applications

    US20080082965A1