Service logic packaging method and device
By converting the linkage scenario information into executable code packages and compressing the installation packages, the cumbersome problem of the linkage business scenario development process between multiple operating platforms is solved, and the effect of simplifying the development process and improving development efficiency is achieved.
Patent Information
- Application Number
- CN202311308060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2043-10-10
AI Technical Summary
In the linked business scenarios between multiple operating platforms, developers need to participate in a large number of development processes that are not related to the specific business logic, resulting in cumbersome development process and low development efficiency.
By responding to linkage scenario information, the corresponding business logic is determined and converted into executable code packages, and the code packages are then compressed to generate installation packages to simplify the development process and improve development efficiency.
This method can simplify the development process, improve development efficiency, enable developers to focus more on the development process of specific business logic, and make the business logic suitable for multiple operating platforms.
Smart Images

Figure CN119806611A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a method and device for business logic encapsulation. Background Art
[0002] Multiple platforms often have interconnected business scenarios. For example, clicking a product link in an app redirects users to a mini-program to place an order. Developers must adapt and develop for each platform involved in these interconnected business scenarios. Development for these scenarios is customized, and the development process for each interconnected business scenario is relatively independent. This requires repetitive building of the business framework and executing the entire development process, involving numerous development steps unrelated to the specific business logic.
[0003] In the process of implementing the present invention, the inventors discovered that the prior art has at least the following problems:
[0004] Developers need to participate in a large number of development processes that are unrelated to specific business logic, resulting in a cumbersome development process and low development efficiency for linked business scenarios. Summary of the Invention
[0005] In view of this, an embodiment of the present invention provides a method and apparatus for business logic encapsulation, which can simplify the development process and improve development efficiency.
[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a method for business logic encapsulation is provided, comprising:
[0007] In response to receiving the linkage scenario information, determining a business logic corresponding to the linkage scenario information, wherein the business logic is used to provide a linkage service between multiple operating platforms;
[0008] Converting the business logic into an executable code package;
[0009] The executable code package is compressed to generate an installation package for the business logic.
[0010] Optionally, converting the business logic into an executable code package includes:
[0011] Determining basic toolkits corresponding to multiple operating platforms associated with the business logic;
[0012] According to the association relationship between the business logic and the multiple operating platforms, introducing the basic toolkit into the business logic;
[0013] According to the pre-set mapping relationship conversion template, the business logic introduced into the basic toolkit is converted into executable code;
[0014] The executable code is packaged to generate an executable code package.
[0015] Optionally, determining basic toolkits corresponding to multiple operating platforms associated with the business logic includes:
[0016] Determining whether the operating platform associated with the business logic belongs to a preset operating platform set;
[0017] In the case that the operating platform associated with the business logic does not belong to a preset operating platform set, a platform identifier of the operating platform is obtained, and a basic toolkit of the operating platform is determined according to the platform identifier.
[0018] Optionally, the method further includes:
[0019] In response to receiving the add request, rendering a pre-set configuration page; the configuration page is used to fill in configuration information;
[0020] In response to receiving the configuration information, the target linkage scene information included in the configuration information is rendered to a preset display page; the display page is used to select the linkage scene to be packaged.
[0021] Optionally, the method further includes:
[0022] In response to receiving the pre-release address, uploading the installation package to the pre-release address;
[0023] Determining whether the installation package passes verification according to the pre-release address;
[0024] In response to the installation package passing the verification and receiving the online address, the installation package is uploaded to the online address; the online address is used to download the installation package.
[0025] Optionally, when the installation package passes the verification, the method further includes:
[0026] In response to receiving the push request, determining a push format and a push address for the installation package, converting the installation package according to the push format, and pushing the converted installation package to the push address;
[0027] In response to receiving the deployment request, the installation package after the format conversion is obtained from the push address, and the installation package after the format conversion is deployed to the corresponding target project.
[0028] Optionally, compressing the executable code package includes:
[0029] In response to determining that the executable code complies with a preset code integration rule and that the executable code matches a preset code template structure, the executable code package is compressed.
[0030] According to a second aspect of an embodiment of the present invention, a device for service logic encapsulation is provided, including:
[0031] a determination module, configured to determine, in response to receiving linkage scenario information, a business logic corresponding to the linkage scenario information, wherein the business logic is configured to provide linkage services between multiple operating platforms;
[0032] A packaging module, used to convert the business logic into an executable code package;
[0033] The compression module is used to compress the executable code package to generate an installation package for the business logic.
[0034] Optionally, converting the business logic into an executable code package includes:
[0035] Determining basic toolkits corresponding to multiple operating platforms associated with the business logic;
[0036] According to the association relationship between the business logic and the multiple operating platforms, introducing the basic toolkit into the business logic;
[0037] According to the pre-set mapping relationship conversion template, the business logic introduced into the basic toolkit is converted into executable code;
[0038] The executable code is packaged to generate an executable code package.
[0039] Optionally, determining basic toolkits corresponding to multiple operating platforms associated with the business logic includes:
[0040] Determining whether the operating platform associated with the business logic belongs to a preset operating platform set;
[0041] In the case that the operating platform associated with the business logic does not belong to a preset operating platform set, a platform identifier of the operating platform is obtained, and a basic toolkit of the operating platform is determined according to the platform identifier.
[0042] Optionally, the device further comprises:
[0043] A configuration module, configured to render a preset configuration page in response to receiving an add request; the configuration page is used to fill in configuration information;
[0044] The display module is used to render the target linkage scene information included in the configuration information to a preset display page in response to receiving the configuration information; the display page is used to select the linkage scene to be packaged.
[0045] Optionally, the device further comprises:
[0046] an uploading module, configured to upload the installation package to the pre-release address in response to receiving the pre-release address;
[0047] A verification module, configured to determine whether the installation package has passed verification according to the pre-release address;
[0048] The online module is used to upload the installation package to the online address in response to the installation package passing the verification and receiving the online address; the online address is used to download the installation package.
[0049] Optionally, the device further comprises:
[0050] a push module configured to, in response to receiving a push request, determine a push format and a push address for the installation package, convert the installation package according to the push format, and push the converted installation package to the push address;
[0051] The deployment module is configured to, in response to receiving a deployment request, obtain the installation package after the format conversion from the push address, and deploy the installation package after the format conversion to a corresponding target project.
[0052] Optionally, compressing the executable code package includes:
[0053] In response to determining that the executable code complies with a preset code integration rule and that the executable code matches a preset code template structure, the executable code package is compressed.
[0054] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0055] one or more processors;
[0056] a storage device for storing one or more programs,
[0057] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0058] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0059] One embodiment of the above invention has the following advantages or beneficial effects: based on the linkage scenario information, the business logic is packaged and compressed to generate an installation package suitable for multiple operating platforms, which can simplify the development process, improve development efficiency, and enable developers to focus more on the development process of specific business logic; based on the relationship between the business logic and the operating platform, a unified packaged basic toolkit is introduced into the business logic, which can give the business logic basic public service capabilities, realize unified calling of the business call layer and differentiated execution of the basic service layer; based on the platform identifier of the operating platform, the corresponding basic toolkit is searched, which can make the business logic applicable to more operating platforms, not limited to the pre-set operating platform set; rendering the configuration page and displaying the linkage scenario information can provide developers with a visual configuration method and linkage scenario screening method, further improving development efficiency; providing multiple ways to download the installation package, such as online download address and npm source station download, can make users more convenient to obtain the installation package and facilitate the sharing and dissemination of the installation package; integration rule detection and template structure detection of the executable code package can ensure that the installation package complies with the integration rules and template structure, making the installation package applicable to multiple operating platforms.
[0060] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0062] Figure 1 is a schematic diagram of the main process of the method for business logic encapsulation according to an embodiment of the present invention;
[0063] Figure 2 It is a schematic diagram of the overall process of business logic encapsulation according to a reference embodiment of the present invention;
[0064] Figure 3 is a schematic diagram of a configuration page according to a reference embodiment of the present invention;
[0065] Figure 4 is a schematic diagram of a display page according to a reference embodiment of the present invention;
[0066] Figure 5 1 is a schematic diagram of the main process of a method for business logic encapsulation according to a reference embodiment of the present invention;
[0067] Figure 6 is a schematic diagram of the main process of a method for business logic encapsulation according to another reference embodiment of the present invention;
[0068] Figure 7is a schematic diagram of main modules of a device for service logic encapsulation according to an embodiment of the present invention;
[0069] Figure 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0070] Figure 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0071] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0072] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0073] Multiple platforms often have interconnected business scenarios. For example, clicking a product link in an app redirects users to a mini-program to place an order. Developers must adapt and develop for each platform involved in these interconnected business scenarios. Development for these scenarios is customized, and the development process for each interconnected business scenario is relatively independent. This requires repetitive building of the business framework and executing the entire development process, involving numerous development steps unrelated to the specific business logic.
[0074] Developers need to participate in a large number of development processes that are unrelated to specific business logic, resulting in a cumbersome development process and low development efficiency for linked business scenarios.
[0075] In view of this, according to a first aspect of an embodiment of the present invention, a method for business logic encapsulation is provided.
[0076] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for encapsulating business logic according to an embodiment of the present invention. Figure 1 As shown, the method for business logic encapsulation according to an embodiment of the present invention mainly includes the following steps S101 to S103.
[0077] Step S101 : In response to receiving linkage scenario information, determining a business logic corresponding to the linkage scenario information, wherein the business logic is used to provide linkage services between multiple operating platforms.
[0078] Linkage scenarios are formed by connecting identical or interconnected business scenarios across various product platforms, including mini-programs, H5 pages, and applications (i.e., apps). Identical business scenarios include being able to view products and orders within mini-programs, H5 pages, or apps. Interconnected business scenarios include clicking a product link from product A1's app to view product details within product A2's mini-program. Linkage scenario information describes scenarios where business linkages exist between multiple platforms. This includes information about jumping from an app to a mini-program's product details page, jumping from a mini-program to an H5 page, sharing a mini-program's product link to an app, and adding products to a shopping cart on an H5 page.
[0079] After receiving the linkage scenario information, the business logic associated with the linkage scenario information is searched. The business logic associated with the linkage scenario information is pre-configured by the developer, and the linkage scenario information and the business logic are stored in association. For example, in the business logic set written by the developer, the corresponding business logic is searched based on the scene title or scene code of the linkage scenario information. The business logic associated with the linkage scenario information is business logic applicable to multiple operating platforms and is used to process linkage business requests between multiple operating platforms. Specifically, the business logic associated with the linkage scenario information has multiple sections, each of which is applicable to a specific operating platform and is used to process linkage business requests on a specific operating platform.
[0080] Figure 2 This is a schematic diagram of the overall process of business logic encapsulation according to a reference embodiment of the present invention. For example, Figure 2 As shown, the execution body of the embodiment of the present invention includes: a multi-terminal conversion module, a multi-terminal configuration module, a multi-operation platform matching module, a native terminal business module, a packaging module, a compression module, an online download module and other modules. The developer registers the multi-terminal conversion module and enters the linkage scene information, operating platform and business logic in the multi-terminal configuration filling module, and stores the configuration information filled in by the developer. After receiving the linkage scene information, the execution body of the embodiment of the present invention matches in the H5 scene matching module, the mini program scene matching module and the App native scene matching module to find the business logic corresponding to the linkage scene.
[0081] For example, the scene title of the received linkage scene information is "Jump to product details", the scene description is "Each operating platform jumps to the product details page", and the scene code is "#001". According to the above scene title, the corresponding business logic is searched. The operating platforms that this business logic is applicable to include: the applet of product A1, the application of product A1, the applet of product A2, the embedded webview end and browser end of product A2, etc.
[0082] Based on the linkage scenario information, the business logic applicable to the same linkage scenario and multiple operating platforms can be quickly determined, which facilitates improving the packaging efficiency and accuracy of the business logic.
[0083] Step S102: convert the business logic into an executable code package.
[0084] After determining the business logic corresponding to the linkage scenario information, the business logic is compiled. Specifically, the business logic undergoes lexical analysis, syntax analysis, and semantic analysis. The compiled business logic is then packaged into an executable code package that can be executed by multiple operating platforms.
[0085] According to a reference embodiment of the present invention, when converting the business logic into an executable code package, the underlying public service is first called to determine the multiple operating platforms associated with the business logic, that is, which operating platforms the business logic is applicable to. After determining the operating platform, the basic toolkit corresponding to the multiple operating platforms associated with the business logic is determined, that is, the SDK (Software Development Kit). The basic toolkit is the underlying business logic library unique to each operating platform. For example, the applet of product B1 and the application of product B2 each have their own corresponding basic toolkits. When the applet of product B1 processes a page jump request, it needs to call the corresponding business method in the basic toolkit. In the absence of the basic toolkit, the jump request cannot be processed. According to the association between the business logic and the multiple operating platforms, the basic toolkit of each operating platform is determined, and the basic toolkit corresponding to each operating platform is introduced into the business logic.
[0086] Based on a pre-set mapping conversion template, the business logic introduced into the basic toolkit is converted into executable code. This template includes how multiple operating platforms handle business requests and execute business logic in each linkage scenario. For example, different operating platforms handle the business request "jump from the product list page to the product details page" differently. The mapping conversion template determines how each operating platform executes the business logic. The business logic is then converted according to the mapping conversion target, converting the business logic into code that can be executed by the operating platform, i.e., the executable code. After obtaining the executable code, it is packaged to generate an executable code package.
[0087] For example, Figure 2 As shown, the business logic is transferred to the packaging module, which includes multiple functions such as a conversion and packaging engine, a multi-terminal SDK import service, a mapping relationship parsing tool, a basic public underlying service, and a mapping relationship conversion template. The basic public underlying service determines which operating platforms the business logic is applicable to. The multi-terminal SDK import service then determines the basic toolkits corresponding to the multiple operating platforms and imports the basic toolkits into the business logic. The parsing mapping tool and the mapping relationship conversion template then convert the business logic imported into the basic toolkit into executable code. Finally, the conversion and packaging engine packages the executable code to produce an executable code package.
[0088] Basic public underlying services are refined and encapsulated for consistency across various application scenarios and operating platforms. They provide common underlying functionality, such as tracking, redirection, and sharing. They also include business triggering methods for different operating platforms, such as redirecting to product details and adding items to a shopping cart. This ultimately enables unified business call processing at the business call layer and differentiated business processing with basic public underlying services.
[0089] After multiple processes such as calling underlying public services, introducing basic toolkits, converting mapping relationships, and packaging executable code, an executable code package suitable for multiple operating platforms is obtained. The executable code package also has the capabilities of a basic toolkit, simplifying the business logic encapsulation process, reducing developers' R&D costs, and allowing developers to focus more on business logic development for specific business scenarios.
[0090] According to another reference embodiment of the present invention, a running platform set is pre-set, and the running platform set is a collection of running platforms, that is, the running platforms that the execution subject of the embodiment of the present invention can handle by default, for example, the name of the running platform is added to the running platform set or the platform identifier of the running platform is added to the running platform set, and a unique running platform can be determined based on the name or platform identifier of the running platform. When determining the basic toolkit corresponding to multiple running platforms associated with the business logic, it is judged whether each running platform associated with the business logic belongs to the pre-set running platform set, that is, it is judged whether the running platform set includes each running platform associated with the business logic; if the running platform associated with the business logic does not belong to the pre-set running platform set, it means that the running platform set does not include the running platform, and then the platform identifier of the running platform is obtained. Specifically, the platform identifier of the running platform is input by the developer, and the corresponding platform identifier is determined based on the name of the running platform. The basic toolkit of the running platform is determined based on the platform identifier, for example, the basic toolkit of the running platform is obtained from the corresponding mirror resource station based on the platform identifier.
[0091] The platform identifier has the function of identifying the operating platform. Specifically, during the actual execution of the business logic, the operating platform is first identified based on the platform identifier, and then the corresponding basic toolkit, business logic, etc. are called to process the corresponding request.
[0092] Exemplarily, the pre-set operating platform set includes: mini-programs, applications of product C1, mini-programs, applications, H5 pages and browser terminals of product C2, etc. The operating platforms associated with the business logic include: mini-programs of product C3. Since the operating platform does not belong to the pre-set operating platform set, the platform identifier is determined according to the name of the operating platform, and then the corresponding basic toolkit is searched according to the platform identifier.
[0093] When the operating platform does not belong to the operating platform set, the platform identifier is used to identify the operating platform, which can dynamically expand the operating platform applicable to the execution subject of the embodiment of the present invention, making it convenient for developers to actively supplement the operating platforms that are not supported by default by the execution subject of the embodiment of the present invention, thereby improving the flexibility of business logic encapsulation and the developer's user experience.
[0094] Step S103: compress the executable code package to generate an installation package for the business logic.
[0095] After obtaining the executable code package, the executable code package is compressed to obtain the business logic installation package. Exemplarily, the executable code package is compressed using a pre-configured code compression tool, such as the code compression tool UglifyJS to compress JavaScript code, the code compression tool cssnano to compress CSS code, and the code compression plug-in HtmlWebpackPlugin to compress HTML code. Another exemplary embodiment is to use an online code compression tool to compress the executable code package online, call the online code compression interface, and receive the business logic installation package returned by the online code compression interface.
[0096] For example, Figure 2 As shown, the executable code package is transferred to the compression module, which includes: compression integrated detection rule service, compression configuration structure template, compression engine, platform upload service, platform publishing service, etc. The compression integrated detection rule service and compression configuration structure template first detect the executable code package. If it passes the detection, the compression engine compresses the executable code package to obtain the installation package of the business logic.
[0097] By compressing the executable code package, the installation package of the business logic can be quickly obtained, the packaging process of the business logic can be completed, and the packaging efficiency of the business logic can be improved.
[0098] According to a reference embodiment of the present invention, the method further includes: in response to receiving an add request, rendering a pre-set configuration page, where the configuration page is used to enter configuration information. Specifically, the configuration information is used to encapsulate business logic. The configuration information on the configuration page includes linkage scenario information, operating platform information, business logic, etc. The operating platform information includes default operating platform information and developer-defined operating platform information. The configuration page is rendered, allowing the developer to enter the above configuration information on the configuration page.
[0099] Figure 3 This is a schematic diagram of a configuration page according to a reference embodiment of the present invention. For example, a developer sends an add request to the execution body of the embodiment of the present invention, requesting to add configuration information. After receiving the add request, the execution body of the embodiment of the present invention renders the following Figure 3The configuration page shown. Specifically, the configuration page includes linkage scene information such as scene title and scene description, and operating platform information of multiple operating platforms such as product 1 applet end and product 2 applet end, for developers to check, and the selected operating platform is associated with the corresponding linkage scene information. After each operating platform, the developer can fill in the corresponding business logic, such as jump logic, sharing logic, purchase logic, etc. The right side of the configuration page includes the developer's customized operating platform information (operating platform name and platform identification) and the corresponding business logic. When the operating platform that the developer needs to add is not among the operating platforms listed on the left, the developer can fill in the customized operating platform information on the right. After the developer has filled in the configuration information of the configuration page, click the "OK" button in the lower right corner of the configuration page to send the linkage scene information, operating platform information, business logic and other configuration information on the configuration page to the execution subject of the embodiment of the present invention.
[0100] In response to receiving the configuration information, the target linkage scene information included in the configuration information is rendered to a pre-set display page. The display page is used to select the linkage scenes that need to be packaged. For example, the target linkage scene information is displayed in a table on the display page. The developer can select the linkage scenes that need to be packaged on the display page and package the configuration information corresponding to the linkage scenes together, so that the packaging result is applicable to the linkage scenes corresponding to multiple configuration information.
[0101] Figure 4 Schematic diagram of a display page according to a reference embodiment of the present invention. Figure 4 As shown, each record in the table is a linkage scene information, including: scene title, scene description, standard operating environment, custom operating environment, etc. Click the "Edit" button in the operation bar to edit the corresponding linkage scene information and the business logic associated with the linkage scene information. Click the "Delete" button in the operation bar to delete the linkage scene information so that it is not displayed on the display page. Click the option box in front of the linkage scene information and click the "Compile and Package" button at the top of the display page to compile, package, and perform other operations on the business logic associated with the selected linkage scene information to obtain an executable code package. One or more linkage scene information can be checked at a time. Click the "Add Scene" button in the upper left corner of the display page, and a pop-up window will appear. Figure 3 The configuration page shown is for developers to configure linkage scene information and business logic.
[0102] According to another exemplary embodiment of the present invention, the method further includes: in response to receiving a pre-release address, uploading an installation package for the business logic to the pre-release address. The installation package has a status, and the status of the installation package uploaded to the pre-release address is converted from "compressed" to "pre-released." The execution entity of the embodiment of the present invention determines whether the installation package has passed verification based on the pre-release address. For example, the execution entity of the embodiment of the present invention downloads the installation package from the pre-release address and determines whether the installation package can be installed normally. If the installation package is downloaded and can be installed normally, the installation package is determined to have passed verification. A developer or tester can also determine whether the installation package has passed verification based on the pre-release address. For example, a developer downloads the installation package from the pre-release address and installs and tests it. After the developer verifies the installation package, the verification result is sent to the execution entity of the embodiment of the present invention, and the verification result may include a pass or fail. If the installation package passes verification, in response to receiving the online address, the installation package is uploaded to the online address. The online address is a public network address that is accessible to all users, that is, everyone can download the installation package through the online address, while the pre-release address has access restrictions, allowing access only to a limited number of people, such as developers and testers.
[0103] Exemplarily, Table 1 is a list of basic information of the installation package. As shown in Table 1, the basic information of the installation package includes: theme (i.e., the main purpose of the installation package), packaging time, operating platform, download method, status, etc. Before uploading the installation package to the pre-release address, developers and testers can only download the installation package from the basic information list. After uploading the installation package to the pre-release address, developers and testers can click on the "JS address" in the basic information list to obtain the pre-release address, and then download the installation package from the pre-release address. The developer clicks the "Online" button in the basic information list and provides the corresponding online address, then the installation package can be uploaded to the upload address and the status of the installation package can be converted from "pre-release" to "online". For another example, the pre-release address of the installation package is: https: / / beta-api.com, and the online address of the installation package is: https: / / api.com, which are different.
[0104] Table 1
[0105]
[0106]
[0107] For example, Figure 2As shown, after obtaining the installation package, the compression module's platform upload service will release the package to a small range via an internal server according to the pre-release address, allowing developers and testers to access it. After the installation package passes verification, the compression module's platform release service will push the installation package to an external server according to the online address and release it online, allowing all users to access it. Users can obtain the installation package through the online download module.
[0108] Through pre-release addresses and online addresses, access to and downloading of installation packages can be effectively controlled, which makes it easier to verify installation packages, grant access rights to specific developers or users, and classify and manage installation packages in different states, thereby improving the management efficiency of installation packages.
[0109] According to another reference embodiment of the present invention, if the installation package passes verification, the method further includes parsing the received push request to determine the push format and push address required by the user. A push request is a request to proactively push the installation package to the user. The user may also set the installation package acquisition mode to "Push" before generating the installation package. After determining that the installation package has passed verification, the execution entity of this embodiment of the present invention directly pushes the installation package to the user according to the acquisition mode set by the user.
[0110] The push format is the format of the installation package the user expects to receive. The installation package is converted to conform to the push format. For example, the push format is the "npm (node package manager) package" format. npm is a code package management tool, and code packages managed by npm are npm packages. If the installation package does not conform to the "npm package" format, the installation package is converted to an npm package. The push address is the address where the user expects to receive the installation package. For example, the push address is the user's npm source site (i.e., a private npm site created by the user). After determining that the installation package conforms to the push format, the npm package is pushed to the user's npm source site, and the user can download the npm package from their own npm source site. For example, as shown in Table 1, after the npm package is pushed to the user's npm source site, the npm package download address will be displayed in the basic information list of the installation package. Click "npm address" in the basic information list to obtain the npm address of the installation package and download the installation package through the npm address. As another example, the npm source site is also divided into private source sites and public source sites. The private source site is used to store npm packages in the "pre-release" state, and the public source site is used to store npm packages in the "online" state (i.e., verified).
[0111] For example, Figure 2As shown, the platform publishing service of the compression module sends the npm package to the npm private source station or the npm public source station on Github, wherein the npm package of the npm private source station is different from the npm package of the npm public source station. For example, the release version of the npm package of the npm private source station is a test version (beta version), such as 0.2.10-beta.8, and the release version of the npm package of the npm public source station is a formal version, such as 0.2.10.
[0112] The execution entity of an embodiment of the present invention parses a received deployment request, determines the target installation package and target project corresponding to the deployment request, determines the push address of the target installation package, retrieves the target installation package from the push address, and deploys the retrieved target installation package in the target project. For example, the execution entity may install the target installation package in the target project, introduce the target installation package into various business scenarios of the target project, and call methods included in the target installation package.
[0113] Pushing installation packages to users according to the push format and push address can provide more and more flexible storage, sharing and downloading methods for installation packages, making it easier for users to obtain installation packages, share and disseminate installation packages, and meet users' various installation package acquisition needs.
[0114] According to another reference embodiment of the present invention, before compressing the executable code package, the executable code is subjected to integration rule detection. The integration rules for different operating platforms are different. The integration rules include: file name detection, directory structure detection, file size detection, target word detection, packaging method check, executable code package source detection, etc. After the executable code package passes all integration rule detections, it is determined that the executable code complies with the pre-set code integration rules.
[0115] Before compressing the executable code package, the code template structure detection is performed on the executable code to determine whether the code structure of the executable code matches the code template structure. For example, whether there is a class package introduction, whether the location of methods and properties meets the requirements, whether method calls and parameter references meet the requirements, etc. After the executable code passes all code template structure detections, it is determined that the executable code matches the pre-set code template structure.
[0116] For example, the executable code package has a 10-letter file name and a file size of 128KB. Integration rule detection is performed on the executable code package, and the results show that the file name length of the executable code package meets the requirements, the size does not exceed the specified threshold, no target words are detected, and the packaging method is qualified. Therefore, the executable code package is determined to meet the code integration rules. If it is determined that the executable code meets the preset code integration rules and that the executable code matches the preset code template structure, the executable code is compressed.
[0117] Performing integration rule detection and code template structure detection on the executable code package can ensure that the installation package complies with the integration rules and template structure, making the installation package applicable to multiple operating platforms.
[0118] Figure 5 FIG. 1 is a schematic diagram of the main process of a method for encapsulating business logic according to a reference embodiment of the present invention. Figure 5 As shown, the method for encapsulating business logic may include:
[0119] Step S501, in response to receiving linkage scenario information, determining the business logic corresponding to the linkage scenario information, where the business logic is used to provide linkage services between multiple operating platforms;
[0120] Step S502, determining basic toolkits corresponding to multiple operating platforms associated with the business logic;
[0121] Step S503: introducing the basic toolkit into the business logic according to the association between the business logic and the multiple operating platforms;
[0122] Step S504: converting the business logic introduced into the basic toolkit into executable code according to a preset mapping relationship conversion template;
[0123] Step S505: Pack the executable code to generate an executable code package;
[0124] Step S506: compress the executable code package to generate an installation package for the business logic.
[0125] The specific implementation content of the method for encapsulating business logic in the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned method for encapsulating business logic, so the repeated content will not be described again here.
[0126] Figure 6 FIG. 1 is a schematic diagram of the main process of a method for encapsulating business logic according to another reference embodiment of the present invention. Figure 6 As shown, the method for encapsulating business logic may include:
[0127] Step S601, in response to receiving the add request, rendering a preset configuration page;
[0128] Step S602, in response to receiving the configuration information, rendering the target linkage scene information included in the configuration information to a preset display page;
[0129] Step S603, in response to receiving the linkage scenario information, determining the business logic corresponding to the linkage scenario information, where the business logic is used to provide linkage services between multiple operating platforms;
[0130] Step S604: converting the business logic into an executable code package;
[0131] Step S605, determine whether the executable code package complies with the code integration rules, if so, jump to step S606, otherwise jump to step S601;
[0132] Step S606: compress the executable code package to generate an installation package for the business logic;
[0133] Step S607: Upload the installation package to the received pre-release address;
[0134] Step S608, determine whether the installation package passes the verification, if so, jump to step S609, otherwise jump to step S601;
[0135] Step S609: In response to receiving the online address, the installation package is uploaded to the online address.
[0136] The specific implementation content of the business logic encapsulation method of another reference embodiment of the present invention has been described in detail in the business logic encapsulation method described above, so the repeated content will not be described again here.
[0137] According to a second aspect of an embodiment of the present invention, a device for business logic encapsulation is provided.
[0138] Figure 7 Schematic diagram of the main modules of the device for business logic encapsulation according to an embodiment of the present invention, such as Figure 7 As shown, the service logic encapsulation device 700 mainly includes:
[0139] Determining module 701, for determining, in response to receiving linkage scenario information, the business logic corresponding to the linkage scenario information, wherein the business logic is used to provide linkage services between multiple operating platforms;
[0140] The packaging module 702 is used to convert the business logic into an executable code package;
[0141] The compression module 703 is used to compress the executable code package to generate an installation package for the business logic.
[0142] According to a reference embodiment of the present invention, converting the business logic into an executable code package includes:
[0143] Determining basic toolkits corresponding to multiple operating platforms associated with the business logic;
[0144] According to the association relationship between the business logic and the multiple operating platforms, introducing the basic toolkit into the business logic;
[0145] According to the pre-set mapping relationship conversion template, the business logic introduced into the basic toolkit is converted into executable code;
[0146] The executable code is packaged to generate an executable code package.
[0147] According to another reference embodiment of the present invention, determining basic toolkits corresponding to multiple operating platforms associated with the business logic includes:
[0148] Determining whether the operating platform associated with the business logic belongs to a preset operating platform set;
[0149] In the case that the operating platform associated with the business logic does not belong to a preset operating platform set, a platform identifier of the operating platform is obtained, and a basic toolkit of the operating platform is determined according to the platform identifier.
[0150] According to another reference embodiment of the present invention, the service logic encapsulation device 700 further includes:
[0151] A configuration module, configured to render a preset configuration page in response to receiving an add request; the configuration page is used to fill in configuration information;
[0152] The display module is used to render the target linkage scene information included in the configuration information to a preset display page in response to receiving the configuration information; the display page is used to select the linkage scene to be packaged.
[0153] According to another reference embodiment of the present invention, the service logic encapsulation device 700 further includes:
[0154] an uploading module, configured to upload the installation package to the pre-release address in response to receiving the pre-release address;
[0155] A verification module, configured to determine whether the installation package has passed verification according to the pre-release address;
[0156] The online module is used to upload the installation package to the online address in response to the installation package passing the verification and receiving the online address; the online address is used to download the installation package.
[0157] According to yet another reference embodiment of the present invention, the service logic encapsulation device 700 further includes:
[0158] a push module configured to, in response to receiving a push request, determine a push format and a push address for the installation package, convert the installation package according to the push format, and push the converted installation package to the push address;
[0159] The deployment module is configured to, in response to receiving a deployment request, obtain the installation package after the format conversion from the push address, and deploy the installation package after the format conversion to a corresponding target project.
[0160] According to a reference embodiment of the present invention, compressing the executable code package includes:
[0161] In response to determining that the executable code complies with a preset code integration rule and that the executable code matches a preset code template structure, the executable code package is compressed.
[0162] It should be noted that the specific implementation content of the device for business logic encapsulation in the embodiment of the present invention has been described in detail in the above-mentioned method for business logic encapsulation, so the repeated content will not be described again here.
[0163] According to the technical solution of the embodiment of the present invention, the business logic is packaged and compressed based on the linkage scenario information to generate an installation package suitable for multiple operating platforms, which can simplify the development process, improve development efficiency, and enable developers to focus more on the development process of specific business logic; according to the association between business logic and operating platform, a unified packaged basic toolkit is introduced into the business logic, which can give the business logic basic public service capabilities, realize unified calling of the business call layer and differentiated execution of the basic service layer; according to the platform identifier of the operating platform, the corresponding basic toolkit is searched, which can make the business logic applicable to more operating platforms, rather than limited to the pre-set operating platform set; rendering the configuration page and displaying the linkage scenario information can provide developers with a visual configuration method and linkage scenario screening method, further improving development efficiency; providing multiple ways to download the installation package, such as online download address, npm source site download, etc., can make users more convenient to obtain the installation package, and facilitate the sharing and dissemination of the installation package; integration rule detection and template structure detection are performed on the executable code package, which can ensure that the installation package complies with the integration rules and template structure, making the installation package applicable to multiple operating platforms.
[0164] According to a third aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.
[0165] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0166] Figure 8 An exemplary system architecture 800 is shown to which the method for business logic encapsulation or the apparatus for business logic encapsulation according to an embodiment of the present invention may be applied.
[0167] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0168] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as business logic encapsulation applications, installation package downloading applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0169] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0170] Server 805 can be a server that provides various services, such as a background management server (for example only) that provides support for business logic encapsulation requests sent by upstream terminal devices 801, 802, and 803. In response to receiving linkage scenario information, the background management server can determine the business logic corresponding to the linkage scenario information, and the business logic is used to provide linkage services between multiple operating platforms; convert the business logic into an executable code package; compress the executable code package to generate an installation package for the business logic; and feedback the business logic encapsulation situation (for example only) to the terminal device.
[0171] It should be noted that the service logic encapsulation method provided in the embodiment of the present invention is generally performed by the server 805, and accordingly, the service logic encapsulation device is generally set in the server 805. The service logic encapsulation method provided in the embodiment of the present invention can also be performed by the terminal devices 801, 802, and 803, and accordingly, the service logic encapsulation device can be set in the terminal devices 801, 802, and 803.
[0172] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0173] Reference below Figure 9 , which shows a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Figure 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0174] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage unit 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the system 900 are also stored in the RAM 903. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0175] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.
[0176] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the embodiment of the present invention are executed.
[0177] It should be noted that the computer-readable medium shown in the embodiments of the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In embodiments of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In embodiments of the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0178] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer programs according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0179] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, they may be described as: a processor including a determination module, a packaging module, and a compression module. The names of these modules do not, in certain circumstances, constitute limitations on the modules themselves. For example, the determination module may also be described as a "module for determining business logic."
[0180] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: in response to receiving linkage scene information, determining the business logic corresponding to the linkage scene information, the business logic is used to provide linkage services between multiple operating platforms; converting the business logic into an executable code package; compressing the executable code package to generate an installation package for the business logic.
[0181] According to the technical solution of the embodiment of the present invention, the business logic is packaged and compressed based on the linkage scenario information to generate an installation package suitable for multiple operating platforms, which can simplify the development process, improve development efficiency, and enable developers to focus more on the development process of specific business logic; according to the association between business logic and operating platform, a unified packaged basic toolkit is introduced into the business logic, which can give the business logic basic public service capabilities, realize unified calling of the business call layer and differentiated execution of the basic service layer; according to the platform identifier of the operating platform, the corresponding basic toolkit is searched, which can make the business logic applicable to more operating platforms, rather than limited to the pre-set operating platform set; rendering the configuration page and displaying the linkage scenario information can provide developers with a visual configuration method and linkage scenario screening method, further improving development efficiency; providing multiple ways to download the installation package, such as online download address, npm source site download, etc., can make users more convenient to obtain the installation package, and facilitate the sharing and dissemination of the installation package; integration rule detection and template structure detection are performed on the executable code package, which can ensure that the installation package complies with the integration rules and template structure, making the installation package applicable to multiple operating platforms.
[0182] The above specific embodiments do not limit the scope of protection of the embodiments of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the embodiments of the present invention should be included in the scope of protection of the embodiments of the present invention.
Claims
1. A method for business logic encapsulation, characterized in that: include: In response to receiving linkage scenario information, determining a business logic corresponding to the linkage scenario information, wherein the business logic is used to provide linkage services between multiple operation platforms; Convert the business logic into an executable code package; The executable code package is compressed to generate an installation package of the business logic.
2. The method according to claim 1, characterized in that Convert the business logic into an executable code package, including: Determining basic toolkits corresponding to multiple operating platforms associated with the business logic; According to the association relationship between the business logic and the multiple operating platforms, introducing the basic toolkit into the business logic; According to the preset mapping relationship conversion template, the business logic introduced into the basic toolkit is converted into executable code; The executable code is packaged to generate an executable code package.
3. The method according to claim 2, characterized in that Determine the basic toolkits corresponding to multiple operating platforms associated with the business logic, including: Determining whether the operating platform associated with the business logic belongs to a preset operating platform set; In the case that the operating platform associated with the business logic does not belong to a preset operating platform set, a platform identifier of the operating platform is obtained, and a basic toolkit of the operating platform is determined according to the platform identifier.
4. The method according to claim 1, characterized in that The method further comprises: In response to receiving the add request, rendering a preset configuration page; the configuration page is used to fill in configuration information; In response to receiving the configuration information, the target linkage scene information included in the configuration information is rendered to a preset display page; the display page is used to select the linkage scene to be packaged.
5. The method according to claim 1, characterized in that The method further comprises: In response to receiving the pre-release address, uploading the installation package to the pre-release address; Determining whether the installation package has passed verification according to the pre-release address; In response to the installation package passing the verification and receiving the online address, the installation package is uploaded to the online address; the online address is used to download the installation package.
6. The method according to claim 5, characterized in that When the installation package passes the verification, the method further includes: In response to receiving the push request, determining a push format and a push address of the installation package, converting the format of the installation package according to the push format, and pushing the installation package after the format conversion to the push address; In response to receiving the deployment request, the installation package after the format conversion is obtained from the push address, and the installation package after the format conversion is deployed to the corresponding target project.
7. The method according to claim 1, characterized in that Compressing the executable code package includes: In response to determining that the executable code complies with a preset code integration rule and determining that the executable code matches a preset code template structure, the executable code package is compressed.
8. A device for business logic encapsulation, characterized in that: include: A determination module, configured to determine, in response to receiving linkage scenario information, a business logic corresponding to the linkage scenario information, wherein the business logic is configured to provide linkage services between multiple operation platforms; A packaging module, used to convert the business logic into an executable code package; The compression module is used to compress the executable code package to generate an installation package for the business logic.
9. An electronic device, characterized in that: include: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Construction method of business scenario and construction system of business scenario
CN109343846A
Application program development method and device, electronic equipment and storage medium
CN113805882A
Metacode-based low-code development system and method
CN115237380A
Service logic processing method and device, electronic device, storage medium and system
CN115442228A
Multi-platform SDK (Software Development Kit) construction method, device, equipment, system and computer readable medium
CN116185492A