Business processing method and device based on multiple environments, electronic equipment and product

By identifying environment identifiers and loading adapter components, seamless switching of web applications between different environments is achieved, solving compatibility issues caused by environmental differences, reducing development and maintenance costs, and meeting the requirements of lightweight and high availability.

CN121833084APending Publication Date: 2026-04-10BEIJING MAICHI ELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING MAICHI ELECTRIC TECH CO LTD
Filing Date
2026-01-06
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing technologies, the differences between non-production and production environments for web applications lead to compatibility issues, causing behavioral discrepancies between development testing and production operation, and increasing development costs and maintenance complexity.

Method used

By identifying the environment identifier of the requesting end, loading the corresponding environment configuration and adapter components, seamless switching of web applications between non-production and production environments is achieved, avoiding the need to maintain two sets of implementation code for the same business logic.

Benefits of technology

It enables seamless switching between non-production and production environments, meets the lightweight requirements of the development phase, supports high availability in the production environment, and reduces development costs and maintenance complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833084A_ABST
    Figure CN121833084A_ABST
Patent Text Reader

Abstract

The invention discloses a business processing method and device based on multiple environments, electronic equipment and a product, and relates to the technical field of Web application business processing. Comprising the following steps: identifying a running environment type of a Web application requested by a request end based on an environment identifier carried in a starting instruction which is initiated by the request end and aims at the Web application; loading corresponding environment configuration based on the operation environment type of the Web application; instantiating an adapter component which the Web application externally depends on; packaging an environment identifier carried in the starting instruction, an environment configuration corresponding to the operation environment category and an adapter component of the Web application, and injecting a service code of the Web application into the packaged environment identifier, the packaged environment configuration and the packaged adapter component of the Web application; and based on the data distribution path corresponding to the operation environment category of the Web application, sending the injected service code of the Web application to a corresponding service logic processing end, so that the service logic processing end executes the injected service processing logic of the Web application. According to the method and the device, the development cost and the maintenance complexity of the Web application caused by environment migration can be prevented from being increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of Web application business processing technology, specifically relating to a business processing method, device, electronic device and product based on multiple environments. Background Technology

[0002] In modern web application development, there are significant differences between the non-production and production environments. During the development phase, to quickly verify functionality, development teams use lightweight technology stacks and simplified components (such as in-memory databases and simulated service interfaces) to reduce resource consumption and improve development efficiency. Meanwhile, the production environment relies on highly available professional services (such as distributed databases, microservice clusters, and third-party cloud services) to ensure performance and data security. While this "dual-track" architecture initially met the needs of rapid iteration, as business scales up, compatibility issues caused by environmental differences gradually become a bottleneck restricting project development.

[0003] Inconsistent environments directly lead to deviations in behavior between development testing and production operation. As a result, development teams have to maintain two sets of implementation code for the same business logic, migrate applications from non-production environments such as development and testing to the production environment, and rewrite on a large scale during the migration phase. This "reinventing the wheel" model not only increases manpower and time costs, but also exacerbates the complexity of system maintenance due to the chaotic code branch management caused by environment switching.

[0004] Therefore, how to provide an effective solution to avoid the increased development costs and maintenance complexity of web applications due to environment migration has become an urgent problem to be solved in existing technologies. Summary of the Invention

[0005] The purpose of this invention is to provide a business processing method, apparatus, electronic device, and product based on multiple environments to solve the aforementioned problems existing in the prior art.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a business processing method based on multiple environments, including: Based on the environment identifier carried in the startup command for the web application initiated by the requesting end, the runtime environment category of the web application requested by the requesting end is identified, and the runtime environment category is either non-production environment or production environment. Based on the runtime environment category of the web application, load the environment configuration of the web application that corresponds to the runtime environment category; Instantiate the adapter component that the web application depends on; The environment identifier carried in the startup command, the environment configuration corresponding to the running environment category, and the adapter component of the web application are encapsulated and injected into the business code of the web application; Based on the data distribution path corresponding to the runtime environment category of the Web application, the injected business code of the Web application is sent to the corresponding business logic processing end so that the business logic processing end can execute the business processing logic of the injected Web application.

[0007] In one possible design, before identifying the runtime environment category of the web application requested by the requesting client, the method further includes: Assign a process ID to the web application; Load the adapter components that the web application depends on; Record the startup timestamp of the web application and the environment identifier carried in the startup command; The environment identifier includes environment variables, configuration center labels, and / or cluster namespaces used to indicate different operating environments.

[0008] In one possible design, after identifying the runtime environment category of the web application requested by the requesting client, the method further includes: Verify the legality of the environmental label; Based on the runtime environment category of the web application, load the environment configuration of the web application that corresponds to the runtime environment category, including: After the legality verification of the environment identifier is passed, the environment configuration of the web application corresponding to the runtime environment category is loaded based on the runtime environment category of the web application. The environment configuration corresponding to the operating environment category includes basic environment configuration, business function configuration, and data security configuration.

[0009] In one possible design, the adapter components that the web application depends on externally include a data layer, which includes a database client and / or a Redis client.

[0010] In one possible design, the adapter components that the web application externally depends on also include a middleware layer and / or a third-party service layer, the middleware layer including a Kafka connector and / or a RabbitMQ connector.

[0011] In one possible design, the business logic processing end is a server cluster. The process of sending the injected business code of the web application to the corresponding business logic processing end based on the data distribution path corresponding to the runtime environment category of the web application includes: Based on the data distribution path corresponding to the runtime environment category of the Web application, the injected business code of the Web application is sent to multiple server nodes in the corresponding server cluster through a load balancer.

[0012] In one possible design, after sending the injected business code of the web application to the corresponding business logic processing end, the method further includes: Receive the execution result of the injected Web application from the business logic processing end; The execution result of the injected web application is encapsulated according to a unified response protocol and sent to the requesting end.

[0013] Secondly, the present invention provides a multi-environment-based service processing apparatus, comprising: The identification unit is used to identify the runtime environment category of the Web application requested by the requesting party based on the environment identifier carried in the startup command for the Web application initiated by the requesting party. The runtime environment category is either a non-production environment or a production environment. The loading unit is used to load the environment configuration of the Web application that corresponds to the runtime environment category, based on the runtime environment category of the Web application. An instantiation unit is used to instantiate the adapter components that the Web application depends on externally; The encapsulation and injection unit is used to encapsulate the environment identifier carried in the startup instruction, the environment configuration corresponding to the running environment category, and the adapter component of the Web application and inject them into the business code of the Web application. The sending unit is used to send the injected business code of the Web application to the corresponding business logic processing end based on the data distribution path corresponding to the runtime environment category of the Web application, so that the business logic processing end can execute the business processing logic of the injected Web application.

[0014] Thirdly, the present invention provides an electronic device comprising a memory, a processor, and a transceiver connected in sequence and communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the multi-environment-based service processing method as described in the first aspect or any possible design of the first aspect.

[0015] Fourthly, the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, perform the multi-environment-based business processing method described in the first aspect or any possible design of the first aspect.

[0016] Fifthly, the present invention provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform a multi-environment-based business processing method as described in the first aspect or any possible design of the first aspect.

[0017] Beneficial effects: This invention discloses a multi-environment-based business processing scheme that supports seamless switching between non-production and production environments. Specifically, this invention identifies the runtime environment category of the requested Web application based on the environment identifier carried in the startup command initiated by the requesting client for the Web application. The runtime environment category is either a non-production environment or a production environment. Based on the runtime environment category of the Web application, the invention loads the environment configuration of the Web application corresponding to the runtime environment category. Based on the external dependencies of the Web application, the invention initializes the adapter component of the Web application. Then, the environment identifier carried in the startup command, the environment configuration corresponding to the runtime environment category, and the adapter component of the Web application are encapsulated and injected into the business code of the Web application. Finally, based on the data distribution path corresponding to the runtime environment category of the Web application, the injected business code of the Web application is sent to the corresponding business logic processing terminal so that the business logic processing terminal executes the business processing logic of the injected Web application. In this way, seamless switching between non-production and production environments can be achieved as needed, satisfying the lightweight requirements of the development phase while supporting the high availability requirements of the production environment. There is no need to maintain two sets of implementation code for the same business logic, avoiding the increase in development costs and maintenance complexity of web applications due to environment migration, which facilitates practical application and promotion. Attached Figure Description

[0018] Figure 1 A flowchart illustrating a multi-environment-based service processing method provided in this application embodiment; Figure 2 A block diagram of a multi-environment-based service processing device provided in the embodiments of this application; Figure 3 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.

[0020] It should be understood that although the terms first, second, etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit, without departing from the scope of the exemplary embodiments of the invention.

[0021] It should be understood that the term "and / or" that may appear in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" that may appear in this document describes another relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the related objects before and after it are in an "or" relationship.

[0022] It should be understood that specific details are provided in the following description to facilitate a complete understanding of the exemplary embodiments. However, those skilled in the art will understand that the exemplary embodiments can be implemented without these specific details. For example, the system may be shown in block diagrams to avoid obscuring the example with unnecessary details. In other instances, well-known processes, structures, and techniques may be shown without unnecessary details to avoid obscuring the exemplary embodiments.

[0023] To avoid the increased development costs and maintenance complexity of web applications due to environment migration, this application provides a multi-environment business processing method, apparatus, electronic device, and product. This multi-environment business processing method, apparatus, electronic device, and product can support seamless switching between non-production and production environments, eliminating the need to maintain two sets of implementation code for the same business logic, and avoiding the increased development costs and maintenance complexity of web applications due to environment migration.

[0024] The multi-environment-based business processing method provided in this application can be applied to servers. It is understood that the execution entity described does not constitute a limitation on the embodiments of this application.

[0025] The following will provide a detailed description of the multi-environment-based service processing method provided in the embodiments of this application.

[0026] like Figure 1 The diagram shown is a flowchart of a multi-environment-based service processing method provided in the first aspect of the present application. The multi-environment-based service processing method may include, but is not limited to, the following steps S101-S105.

[0027] Step S101. Based on the environment identifier carried in the startup command for the Web application initiated by the requesting end, identify the runtime environment category of the Web application requested by the requesting end.

[0028] The operating environment category may be, but is not limited to, a non-production environment or a production environment.

[0029] The startup command for the web application initiated by the requesting end carries an environment identifier, which includes indicators for different operating environments. The environment identifier may include, but is not limited to, environment variables, configuration center labels, and / or cluster namespaces used to indicate different operating environments.

[0030] In one or more embodiments, before identifying the runtime environment category of the Web application requested by the requesting end, basic resource initialization may be performed, such as assigning a process ID (ProcessIdentifier) ​​to the Web application, loading adapter components that the Web application depends on externally (e.g., JVM virtual machine, Python interpreter, etc.), recording the startup timestamp of the Web application and the environment identifier carried in the startup instruction, etc., to facilitate subsequent tracking.

[0031] Step S102. Based on the runtime environment category of the Web application, load the environment configuration of the Web application that corresponds to the runtime environment category.

[0032] During the development phase, lightweight technology stacks and simplified components are typically used to quickly verify functionality, reducing resource consumption and improving development efficiency. Production environments, however, rely on highly available professional services to ensure performance and data security. Therefore, corresponding environment configurations can be set for different runtime environment categories. Furthermore, after identifying the runtime environment category of the web application requested by the client, the appropriate environment configuration for the web application can be loaded based on that category.

[0033] The environment configuration corresponding to the aforementioned runtime environment category includes basic environment configuration, business function configuration, and data security configuration. Basic environment configuration may include, but is not limited to, core parameters such as database connection strings and service registry addresses; business function configuration may include, but is not limited to, load function switches (such as "whether the new payment function is enabled") and business parameters such as third-party API (Application Programming Interface) keys; and data security configuration may include, but is not limited to, sensitive configurations such as encryption keys and permission whitelists.

[0034] In one or more embodiments, after identifying the runtime environment category of the web application requested by the requesting client, the legality of the environment identifier can be verified. Only after the legality verification of the environment identifier passes, the environment configuration of the web application corresponding to the runtime environment category is loaded based on the runtime environment category of the web application. If the legality verification of the environment identifier fails, the web application can be immediately terminated and an alarm message indicating an abnormal environment identifier can be generated.

[0035] Step S103. Instantiate the adapter component that is an external dependency of the web application.

[0036] The adapter components that a web application depends on externally include at least a data layer, and may also include a middleware layer and / or a third-party service layer. The data layer may include, but is not limited to, database clients and / or Redis clients; the middleware layer may include, but is not limited to, Kafka connectors and / or RabbitMQ connectors; and the third-party service layer may include, but is not limited to, APIs for payment, SMS, etc.

[0037] In one or more embodiments, the availability of adapter components that the web application depends on can also be verified. If the verification fails, it can be re-verified. After multiple verification failures, an alarm message indicating that the externally dependent adapter components are unavailable can be generated.

[0038] Step S104. Encapsulate the environment identifier carried in the startup command, the environment configuration corresponding to the running environment category, and the adapter component of the Web application, and inject them into the business code of the Web application.

[0039] Step S105. Based on the data distribution path corresponding to the runtime environment category of the Web application, send the injected Web application's business code to the corresponding business logic processing end so that the business logic processing end can execute the injected Web application's business processing logic.

[0040] Different business logic processing terminals can be configured to execute the business logic of a web application based on its different runtime environment categories, and corresponding data distribution paths can be set for each runtime environment category (for the business logic processing terminal). For example, for non-production environments (such as development, testing, and pre-production environments), a built-in server cluster can be used as the business logic processing terminal, while for production environments, a dedicated server cluster can be configured. After encapsulating the environment identifier carried in the startup command, the environment configuration corresponding to the runtime environment category, and the web application's adapter component, and injecting them into the web application's business code, the injected web application's business code can be sent to the corresponding business logic processing terminal according to the data distribution path corresponding to the web application's runtime environment category, so that the business logic processing terminal can execute the injected web application's business logic.

[0041] In one or more embodiments, when the business logic processing end is a server cluster, the injected business code of the web application can be sent to multiple server nodes in the corresponding server cluster through a load balancer based on the data distribution path corresponding to the runtime environment category of the web application, thereby avoiding overload of a single server node.

[0042] After the business logic processing end executes the injected business processing logic of the Web application, it can return the execution result of the injected Web application. At this time, the execution result of the injected Web application can be encapsulated according to the unified response protocol and sent to the requesting end.

[0043] After being encapsulated according to the unified response protocol, the execution result may include public fields and business fields. The public fields may include request_id (traceability identifier), code (status code, such as 200 = success, 500 = system error), timestamp (processing time), etc. The business fields may include data (normal result) or error_msg (error description).

[0044] In one or more embodiments, the execution result can support multiple output formats such as JSON, XML, and Protobuf, and can be automatically adapted through the Accept field of the request header of the request initiated by the requesting party, ensuring seamless connection between the front-end and back-end and across services.

[0045] The present invention provides a multi-environment-based business processing method. Based on the environment identifier carried in the startup command for a web application initiated by the requesting end, the method identifies the runtime environment category of the requested web application, which can be either a non-production environment or a production environment. Based on the runtime environment category, the method loads the environment configuration corresponding to that category. Then, based on the external dependencies of the web application, it initializes the adapter component of the web application. Next, it encapsulates the environment identifier carried in the startup command, the environment configuration corresponding to the runtime environment category, and the adapter component of the web application and injects them into the business code of the web application. Finally, based on the data distribution path corresponding to the runtime environment category of the web application, it sends the injected business code of the web application to the corresponding business logic processing end, so that the business logic processing end can execute the injected business processing logic of the web application. In this way, the production environment can be automatically identified, and seamless switching between non-production and production environments can be achieved as needed. This satisfies the lightweight requirements of the development phase while supporting the high availability requirements of the production environment. It eliminates the need to maintain two sets of implementation code for the same business logic, avoiding increased development costs and maintenance complexity of the web application due to environment migration, and facilitates practical application and promotion.

[0046] Please see Figure 2 The second aspect of this application provides a multi-environment-based service processing apparatus, which includes: The identification unit is used to identify the runtime environment category of the Web application requested by the requesting party based on the environment identifier carried in the startup command for the Web application initiated by the requesting party. The runtime environment category is either a non-production environment or a production environment. The loading unit is used to load the environment configuration of the Web application that corresponds to the runtime environment category, based on the runtime environment category of the Web application. An instantiation unit is used to instantiate the adapter components that the Web application depends on externally; The encapsulation and injection unit is used to encapsulate the environment identifier carried in the startup instruction, the environment configuration corresponding to the running environment category, and the adapter component of the Web application and inject them into the business code of the Web application. The sending unit is used to send the injected business code of the Web application to the corresponding business logic processing end based on the data distribution path corresponding to the runtime environment category of the Web application, so that the business logic processing end can execute the business processing logic of the injected Web application.

[0047] The working process, working details and technical effects of the multi-environment-based service processing device provided in the second aspect of this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.

[0048] Please see Figure 3 The third aspect of this application provides an electronic device, including a memory, a processor, and a transceiver that are sequentially and communicatively connected, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the multi-environment-based service processing method as described in the first aspect of the application.

[0049] Specifically, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out (FIFO) memory, and / or last-in-first-out (FILO) memory, etc.; the processor may not be limited to microprocessors of the STM32F105 series, ARM (Advanced RISC Machines), x86 architecture processors, or processors with integrated NPU (neural-network processing units); the transceiver may be, but is not limited to, WiFi (Wireless Fidelity) wireless transceivers, Bluetooth wireless transceivers, General Packet Radio Service (GPRS) wireless transceivers, ZigBee (a low-power LAN protocol based on the IEEE 802.15.4 standard), 3G transceivers, 4G transceivers, and / or 5G transceivers, etc.

[0050] This fourth aspect of the embodiment provides a computer-readable storage medium storing instructions comprising the multi-environment-based business processing method described in the first aspect of the embodiment. Specifically, the computer-readable storage medium stores instructions that, when executed on a computer, perform the multi-environment-based business processing method as described in the first aspect. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or Memory Sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0051] The fifth aspect of this embodiment provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the multi-environment-based business processing method as described in the first aspect of the embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0052] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A business processing method based on multiple environments, characterized in that, include: Based on the environment identifier carried in the startup command for the web application initiated by the requesting end, the runtime environment category of the web application requested by the requesting end is identified, and the runtime environment category is either non-production environment or production environment. Based on the runtime environment category of the web application, load the environment configuration of the web application that corresponds to the runtime environment category; Instantiate the adapter component that the web application depends on; The environment identifier carried in the startup command, the environment configuration corresponding to the running environment category, and the adapter component of the web application are encapsulated and injected into the business code of the web application; Based on the data distribution path corresponding to the runtime environment category of the Web application, the injected business code of the Web application is sent to the corresponding business logic processing end so that the business logic processing end can execute the business processing logic of the injected Web application.

2. The multi-environment-based business processing method according to claim 1, characterized in that, Before identifying the runtime environment category of the web application requested by the requesting client, the method further includes: Assign a process ID to the web application; Load the adapter components that the web application depends on; Record the startup timestamp of the web application and the environment identifier carried in the startup command; The environment identifier includes environment variables, configuration center labels, and / or cluster namespaces used to indicate different operating environments.

3. The multi-environment-based business processing method according to claim 1, characterized in that, After identifying the runtime environment category of the web application requested by the requesting client, the method further includes: Verify the legality of the environmental label; Based on the runtime environment category of the web application, load the environment configuration of the web application that corresponds to the runtime environment category, including: After the legality verification of the environment identifier is passed, the environment configuration of the web application corresponding to the runtime environment category is loaded based on the runtime environment category of the web application. The environment configuration corresponding to the operating environment category includes basic environment configuration, business function configuration, and data security configuration.

4. The multi-environment-based business processing method according to claim 1, characterized in that, The adapter components that the web application depends on externally include a data layer, which includes a database client and / or a Redis client.

5. The multi-environment-based service processing method according to claim 4, characterized in that, The adapter components that the web application depends on also include a middleware layer and / or a third-party service layer, wherein the middleware layer includes a Kafka connector and / or a RabbitMQ connector.

6. The multi-environment-based service processing method according to claim 1, characterized in that, The business logic processing terminal is a server cluster. The process of sending the injected business code of the web application to the corresponding business logic processing terminal based on the data distribution path corresponding to the runtime environment category of the web application includes: Based on the data distribution path corresponding to the runtime environment category of the Web application, the injected business code of the Web application is sent to multiple server nodes in the corresponding server cluster through a load balancer.

7. The multi-environment-based business processing method according to claim 1, characterized in that, After sending the injected business code of the web application to the corresponding business logic processing terminal, the method further includes: Receive the execution result of the injected Web application from the business logic processing end; The execution result of the injected web application is encapsulated according to a unified response protocol and sent to the requesting end.

8. A multi-environment-based business processing device, characterized in that, include: The identification unit is used to identify the runtime environment category of the Web application requested by the requesting party based on the environment identifier carried in the startup command for the Web application initiated by the requesting party. The runtime environment category is either a non-production environment or a production environment. The loading unit is used to load the environment configuration of the Web application that corresponds to the runtime environment category, based on the runtime environment category of the Web application. An instantiation unit is used to instantiate the adapter components that the Web application depends on externally; The encapsulation and injection unit is used to encapsulate the environment identifier carried in the startup instruction, the environment configuration corresponding to the running environment category, and the adapter component of the Web application and inject them into the business code of the Web application. The sending unit is used to send the injected business code of the Web application to the corresponding business logic processing end based on the data distribution path corresponding to the runtime environment category of the Web application, so that the business logic processing end can execute the business processing logic of the injected Web application.

9. An electronic device, characterized in that, The device includes a memory, a processor, and a transceiver that are sequentially and communicatively connected. The memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer programs and execute the multi-environment-based service processing method as described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or the instructions are executed by the computer, they implement the multi-environment-based business processing method as described in any one of claims 1 to 7.