A method and apparatus for service logic encapsulation
By identifying business logic and converting it into an executable code package in scenarios involving multiple operating platforms, the problem of repetitive development by developers in multi-platform collaborative business scenarios is solved, thereby simplifying the development process and improving efficiency.
Patent Information
- Application Number
- CN202311308060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2043-10-10
AI Technical Summary
Developers need to perform a lot of repetitive development that is unrelated to specific business logic in business scenarios involving multiple operating platforms, resulting in a cumbersome and inefficient development process.
By responding to contextual information, the business logic is determined and converted into an executable code package. A basic toolkit is introduced, and the package is transformed and packaged according to the mapping relationship to generate an installation package. Visual configuration is provided through configuration and display pages, and online download and deployment are supported.
It simplifies the development process, improves development efficiency, allows developers to focus more on developing specific business logic, supports multi-platform applicability, and provides flexible package management and sharing methods.
Smart Images

Figure CN119806611B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software development, and in particular to a business logic encapsulation method and device. BACKGROUND
[0002] There are often linkage business scenarios between multiple running platforms, for example, clicking a commodity link in an application and then jumping to a small program to complete a commodity ordering operation. Developers need to adaptively develop each running platform involved in the linkage business scenario, and the development for the linkage business scenario is customized, and the development process of different linkage business scenarios is relatively independent, and a business framework needs to be repeatedly built, and a complete development process is performed, which involves a large number of development processes irrelevant to specific business logic.
[0003] In the process of implementing the present application, the inventors have found that the prior art at least has the following problems:
[0004] Developers need to participate in a large number of development processes irrelevant to specific business logic, resulting in a cumbersome development process and low development efficiency for the linkage business scenario. SUMMARY
[0005] Therefore, the embodiments of the present application provide a business logic encapsulation method and device, which can simplify the development process and improve the development efficiency.
[0006] To achieve the above object, according to a first aspect of the embodiments of the present application, a business logic encapsulation method is provided, comprising:
[0007] In response to receiving linkage scenario information, determining business logic corresponding to the linkage scenario information, the business logic being used to provide linkage services between multiple running platforms;
[0008] Converting the business logic into an executable code package;
[0009] Compressing the executable code package to generate an installation package of the business logic.
[0010] Optionally, converting the business logic into an executable code package comprises:
[0011] Determining a plurality of running platforms corresponding to a basic tool package associated with the business logic;
[0012] According to an association relationship between the business logic and the plurality of running platforms, introducing the basic tool package into the business logic;
[0013] According to a pre-set mapping relationship conversion template, converting the business logic into which the basic tool package is introduced into an executable code;
[0014] The executable code is packaged to generate an executable code package.
[0015] Optionally, the method further comprises:
[0016] determining whether the running platform associated with the business logic belongs to a preset running platform set;
[0017] In a case where the running platform associated with the business logic does not belong to the preset running platform set, obtaining a platform identifier of the running platform, and determining a basic tool package of the running platform according to the platform identifier.
[0018] Optionally, the method further comprises:
[0019] in response to receiving the adding request, rendering a preset configuration page; the configuration page is used for filling configuration information;
[0020] in response to receiving the configuration information, rendering target linkage scenario information included in the configuration information to a preset display page; the display page is used for selecting a linkage scenario to be packaged.
[0021] Optionally, the method further comprises:
[0022] in response to receiving a 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 a case where the installation package passes verification and an online address is received, uploading the installation package to the online address; the online address is used for downloading the installation package.
[0025] Optionally, in a case where the installation package passes verification, the method further comprises:
[0026] in response to receiving a pushing request, determining a pushing format and a pushing address of the installation package, performing format conversion on the installation package according to the pushing format, and pushing the installation package after format conversion to the pushing address;
[0027] in response to receiving a deployment request, obtaining the installation package after format conversion from the pushing address, and deploying the installation package after format conversion to a corresponding target project.
[0028] Optionally, the executable code package is compressed, comprising:
[0029] In response to determining that the executable code meets preset code integration rules and judging that the executable code matches a preset code template structure, the executable code package is compressed.
[0030] According to a second aspect of the embodiments of the present application, a device for service logic packaging is provided, comprising:
[0031] A determining module is configured to determine service logic corresponding to linkage scene information in response to receiving the linkage scene information, the service logic being used to provide linkage services between multiple running platforms;
[0032] A packaging module is configured to convert the service logic into an executable code package;
[0033] A compression module is configured to compress the executable code package to generate an installation package of the service logic.
[0034] Optionally, converting the service logic into an executable code package comprises:
[0035] Determining a plurality of basic tool packages corresponding to running platforms associated with the service logic;
[0036] According to an association relationship between the service logic and the multiple running platforms, introducing the basic tool packages into the service logic;
[0037] Converting the service logic into which the basic tool packages are introduced into executable code according to a preset mapping relationship conversion template;
[0038] Packing the executable code to generate an executable code package.
[0039] Optionally, determining a plurality of basic tool packages corresponding to running platforms associated with the service logic comprises:
[0040] Judging whether a running platform associated with the service logic belongs to a preset running platform set;
[0041] In a case where the running platform associated with the service logic does not belong to the preset running platform set, obtaining a platform identifier of the running platform and determining a basic tool package of the running platform according to the platform identifier.
[0042] Optionally, the device further comprises:
[0043] A configuration module is configured to render a preset configuration page in response to receiving an addition request, the configuration page being used to fill in configuration information;
[0044] The display module is configured to, in response to receiving the configuration information, render target linkage scenario information included in the configuration information to a preset display page; and the display page is configured to select a linkage scenario that needs to be packaged.
[0045] Optionally, the apparatus further comprises:
[0046] The uploading module is configured to, in response to receiving a pre-release address, upload the installation package to the pre-release address.
[0047] The verification module is configured to determine whether the installation package passes verification according to the pre-release address.
[0048] The online module is configured to, in response to the installation package passing verification and receiving an online address, upload the installation package to the online address; and the online address is configured to download the installation package.
[0049] Optionally, the apparatus further comprises:
[0050] The pushing module is configured to, in response to receiving a pushing request, determine a pushing format and a pushing address of the installation package, perform format conversion on the installation package according to the pushing format, and push the format-converted installation package to the pushing address.
[0051] The deployment module is configured to, in response to receiving a deployment request, acquire the format-converted installation package from the pushing address, and deploy the format-converted installation package to a corresponding target project.
[0052] Optionally, the executable code package is compressed, including:
[0053] In response to determining that the executable code meets preset code integration rules and judging that the executable code matches a preset code template structure, the executable code package is compressed.
[0054] According to a third aspect of the embodiments of the present application, an electronic device is provided, including:
[0055] one or more processors;
[0056] a storage device configured to store 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 of the above embodiments.
[0058] According to a fourth aspect of the embodiments of the present application, a computer readable medium is provided, which stores a computer program, and the program is executed by a processor to implement the method described in any of the above embodiments.
[0059] One embodiment in the above application has the following advantages or beneficial effects: the service logic is packaged and compressed based on the linkage scenario information, an installation package suitable for multiple running platforms is generated, the development process can be simplified, the development efficiency is improved, and the developer can focus more on the development process of specific service logic; according to the association between the service logic and the running platform, a unified packaged basic tool package is introduced in the service logic, the service logic can be given basic public service capabilities, unified calling of the service calling layer is realized, and differentiated execution of the basic service layer is realized; according to the platform identifier of the running platform, the corresponding basic tool package is found, the service logic can be applied to more running platforms, and is not limited to a set of pre-set running platforms; the rendering configuration page and the display of the linkage scenario information can provide a visual configuration method and a linkage scenario screening method for the developer, and further improve the development efficiency; the online download address, npm source station download and other ways of downloading the installation package can make it more convenient for the user to obtain the installation package, and facilitate the sharing and dissemination of the installation package; the executable code package is subjected to integrated rule detection and template structure detection, the installation package can be ensured to conform to the integrated rule and the template structure, and the installation package can be applied to multiple running platforms.
[0060] The further effects of the above-mentioned non-conventional optional mode will be described in the following combined with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0061] The accompanying drawings are used to better understand the present application, and do not constitute undue limitations on the present application. Among them:
[0062] Figure 1 is a schematic diagram of the main process of the service logic packaging method according to an embodiment of the present application;
[0063] Figure 2 is a schematic diagram of the overall process of service logic packaging according to a reference embodiment of the present application;
[0064] Figure 3 is a schematic diagram of a configuration page according to a reference embodiment of the present application;
[0065] Figure 4 is a schematic diagram of a display page according to a reference embodiment of the present application;
[0066] Figure 5 is a schematic diagram of the main process of the service logic packaging method according to a reference embodiment of the present application;
[0067] Figure 6 is a schematic diagram of the main process of the service logic packaging method according to another reference embodiment of the present application;
[0068] Figure 7is a schematic diagram of main modules of an apparatus of service logic encapsulation according to an embodiment of the present application;
[0069] Figure 8 is an exemplary system architecture diagram in which embodiments of the present application can be applied;
[0070] Figure 9 is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0071] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, which should be considered in a descriptive sense only. Thus, it will be apparent to one of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted from the following description.
[0072] It should be noted that in the technical solutions of the present application, the collection, use, storage, sharing and transfer of user personal information involved in the processing comply with relevant laws and regulations, and the user needs to be informed and the user's consent or authorization needs to be obtained, and when applicable, the user personal information is subjected to de-identification and / or anonymization and / or encryption technical processing.
[0073] There are often linkage business scenarios between multiple running platforms, for example, clicking on a commodity link in an application program and then jumping to a small program to complete a commodity ordering operation. Developers need to adaptively develop each running platform involved in the linkage business scenario, and the development for the linkage business scenario is customized, and the development process of different linkage business scenarios is relatively independent, and it is necessary to repeatedly build a business framework and perform a complete development process, which involves a large number of development processes irrelevant to specific business logic.
[0074] Developers need to participate in a large number of development processes irrelevant to specific business logic, resulting in a cumbersome development process and low development efficiency for the linkage business scenario.
[0075] Therefore, according to a first aspect of an embodiment of the present application, a service logic encapsulation method is provided.
[0076] Figure 1 is a schematic diagram of the main flow of the service logic encapsulation method according to an embodiment of the present application. As shown in Figure 1 The service logic encapsulation method according to an embodiment of the present application mainly includes the following steps S101 to S103.
[0077] Step S101, in response to receiving the linkage scene information, determining the business logic corresponding to the linkage scene information, the business logic being used to provide linkage service between multiple running platforms.
[0078] The linkage scene is formed by connecting the same business scene or the business scenes before and after the connection in the small program, H5 page, application program (i.e. app) and other running platforms. The same business scene includes that the goods and order can be viewed in the small program, H5 page or application program, and the business scenes before and after the connection include that the goods link is clicked from the application program of product A1, and the goods details are viewed in the small program of product A2. The linkage scene information is the scene information of the business linkage between multiple running platforms, and the linkage scene information includes the scene information of the goods details page from the application program to the small program, the scene information from the small program to the H5 page, the scene information of sharing the goods link of the small program to the application program, and the scene information of adding the goods to the shopping cart in the H5 page.
[0079] After receiving the linkage scene information, the business logic associated with the linkage scene information is found. The business logic associated with the linkage scene information is pre-configured by the developer, and the linkage scene 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 found according to the scene title or scene code of the linkage scene information. The business logic associated with the linkage scene information is the business logic suitable for multiple running platforms, and is used to process the linkage business request between multiple running platforms. Specifically, the business logic associated with the linkage scene information has multiple segments, each segment of the business logic is suitable for one running platform, and each segment of the business logic is used to process the linkage business request on one running platform.
[0080] Figure 2 is the schematic diagram of the overall flow of the business logic encapsulation according to one reference embodiment of the present application. As shown in Figure 2 the execution body of the embodiment of the present application includes multiple modules such as the multi-end conversion module, the multi-end configuration module, the multi-running platform matching module, the native end business module, the packaging module, the compression module and the online download module. The developer registers the multi-end conversion module, and inputs the linkage scene information, the running platform and the business logic in the multi-end configuration filling module. The configuration information filled by the developer is stored. After receiving the linkage scene information, the execution body of the embodiment of the present application matches in the H5 scene matching module, the small program scene matching module and the App native scene matching module, and finds the business logic corresponding to the linkage scene.
[0081] Exemplarily, the received linkage scene information has a scene title of "jump to commodity details", a scene description of "jump to commodity details page by each running platform", and a scene code of "#001". According to the above scene title, the corresponding business logic is searched, and the running platforms to which the business logic is applicable include a small program of product A1, an application of product A1, a small program of product A2, an embedded webview end of product A2, and a browser end, and the like.
[0082] According to the linkage scene information, the business logic applicable to the same linkage scene and multiple running platforms can be quickly determined, so as to facilitate the packaging efficiency and accuracy of the business logic.
[0083] In step S102, the business logic is converted into an executable code package.
[0084] After determining the business logic corresponding to the linkage scene information, the business logic is compiled, specifically, the business logic is subjected to lexical analysis, syntax analysis, semantic analysis, and the like. Then, the compiled business logic is packaged, and the compiled business logic is packaged into an executable code package that can be executed by multiple running platforms.
[0085] According to an embodiment of the present application, when the business logic is converted into an executable code package, the underlying common service is called first to determine the multiple running platforms associated with the business logic, that is, the running platforms to which the business logic is applicable. After determining the running platforms, the basic tool package corresponding to the multiple running platforms associated with the business logic is determined, that is, the SDK (Software Development Kit, software development kit). The basic tool package is a bottom business logic library specific to each running platform. For example, the small program of product B1 and the application of product B2 each have a corresponding basic tool package. When the small program of product B1 processes a page jump request, the corresponding business method in the basic tool package needs to be called, and in the case of lacking the basic tool package, the jump request cannot be processed. According to the association between the business logic and the multiple running platforms, the basic tool package of each running platform is determined, and the basic tool package corresponding to each running platform is introduced into the business logic.
[0086] According to the preset mapping relationship conversion template, the business logic introduced with the basic toolkit is converted into executable code. The mapping relationship conversion template includes the way in which multiple running platforms handle business requests and execute business logic in each linkage scenario. For example, for the business request "jump from the commodity list page to the commodity detail page", different running platforms have different handling methods. The mapping relationship conversion template is used to determine how each running platform executes the business logic. According to the mapping relationship conversion target, the business logic is converted into executable code, i.e., executable code. After obtaining the executable code, the executable code is packaged to generate an executable code package.
[0087] As shown in Figure 2 The business logic is transmitted to the packaging module. The packaging module includes a conversion packaging engine, a multi-terminal SDK introduction service, a mapping relationship analysis tool, a basic common underlying service, a mapping relationship conversion template, and the like. The basic common underlying service determines which running platforms the business logic is applicable to. Then, the multi-terminal SDK introduction service determines the basic toolkits corresponding to the multiple running platforms, introduces the basic toolkits into the business logic, and then converts the business logic introduced with the basic toolkits into executable code by using the mapping relationship analysis tool and the mapping relationship conversion template. Finally, the conversion packaging engine packages the executable code to obtain an executable code package.
[0088] The basic common underlying service is refined and encapsulated for consistency of various application scenarios and various running platforms, has underlying general functions, such as, for example, burying points, jumping, sharing, and the like. Meanwhile, the basic common underlying service also includes business triggering methods of different running platforms, such as, for example, jumping to a commodity detail page, adding a shopping cart, and the like, and finally can realize unified calling of a business calling layer and differential business processing of the basic common underlying service.
[0089] After the underlying common service calling, the basic toolkit introduction, the mapping relationship conversion, the executable code packaging, and the like, an executable code package applicable to multiple running platforms is obtained, and the executable code package has the ability of the basic toolkit, simplifies the business logic encapsulation process, reduces the development cost of developers, and enables the developers to focus more on the development of business logic of specific business scenarios.
[0090] According to another embodiment of the present application, a running platform set is preconfigured, the running platform set is a collection of running platforms, i.e. the execution subject of the embodiment of the present application 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 the unique running platform can be determined according to the name or platform identifier of the running platform. When the basic tool package corresponding to the plurality of running platforms associated with the business logic is determined, it is judged whether each running platform associated with the business logic belongs to the preconfigured running platform set, i.e. whether the running platform set includes each running platform associated with the business logic; in the case that the running platform associated with the business logic does not belong to the preconfigured running platform set, it is indicated 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 according to the name of the running platform. The basic tool package of the running platform is determined according to the platform identifier, for example, the basic tool package of the running platform is obtained from the corresponding mirror resource station according to the platform identifier.
[0091] The platform identifier has the function of identifying the running platform, specifically, in the actual execution process of the business logic, the running platform is identified according to the platform identifier first, and then the corresponding basic tool package, business logic and the like are called to process the corresponding request.
[0092] Exemplarily, the preconfigured running platform set includes: the applet, application program, applet, application program, H5 page and browser end of product C1 and the like, and the running platform associated with the business logic includes: the applet of product C3, since the running platform does not belong to the preconfigured running platform set, the platform identifier is determined according to the name of the running platform, and then the corresponding basic tool package is found according to the platform identifier.
[0093] In the case that the running platform does not belong to the running platform set, the platform identifier is used to identify the running platform, the running platform suitable for the execution subject of the embodiment of the present application can be dynamically expanded, the developer can actively supplement the running platform not supported by the execution subject of the embodiment of the present application by default, the flexibility of the business logic encapsulation and the use experience of the developer are improved.
[0094] Step S103, the executable code package is compressed to generate the installation package of the business logic.
[0095] After obtaining the executable code package, the executable code package is compressed to obtain the installation package of the business logic. Exemplarily, the executable code package is compressed by using a pre-set code compression tool, for example, JavaScript code is compressed by using a code compression tool UglifyJS, CSS code is compressed by using a code compression tool cssnano, HTML code is compressed by using a code compression plug-in HtmlWebpackPlugin, and the like. Exemplarily, the executable code package is online compressed by using a code online compression tool, a code online compression interface is called, and the installation package of the business logic returned by the code online compression interface is received.
[0096] Exemplarily, as shown in Figure 2 , the executable code package is transmitted to a compression module, and the compression module includes a compression integration detection rule service, a compression configuration structure template, a compression engine, a platform uploading service, a platform publishing service, and the like. The executable code package is detected by the compression integration detection rule service and the compression configuration structure template, and after the detection, the executable code package is compressed by the compression engine to obtain the installation package of the business logic.
[0097] The executable code package is compressed to quickly obtain the installation package of the business logic, complete the encapsulation process of the business logic, and improve the encapsulation efficiency of the business logic.
[0098] According to a reference embodiment of the present application, the method further includes: in response to receiving the adding request, rendering a pre-set configuration page, the configuration page being a page for filling configuration information, specifically, the configuration information being configuration information for encapsulating the business logic, and the configuration information on the configuration page including: linkage scene information, running platform information, and the business logic, and the like. The running platform information includes: default displayed running platform information and running platform information customized by the developer. The configuration page is rendered to enable the developer to fill the above-mentioned configuration information on the configuration page.
[0099] Figure 3 is a schematic diagram of a configuration page according to a reference embodiment of the present application. Exemplarily, the developer sends an adding request to an execution subject of an embodiment of the present application to request adding configuration information, and the execution subject of the embodiment of the present application renders out the configuration page as shown in Figure 3The configuration page includes scene title, scene description, and other linkage scene information, running platform information of product 1 applet side, product 2 applet side, and other running platforms, which are checked by the developer. The checked running platform is associated with the corresponding linkage scene information. After each running platform, the developer can fill in the corresponding business logic, for example, jump logic, sharing logic, and add-to-cart logic. The right side of the configuration page includes the running platform information (running platform name and platform identifier) and the corresponding business logic customized by the developer. In the case that the running platform that the developer needs to add is not in the running platform listed on the left side, the developer can fill in the custom running platform information on the right side. After the developer fills in the configuration information of the configuration page, the "OK" button in the lower right corner of the configuration page is clicked, and the linkage scene information, running platform information, business logic, and other configuration information on the configuration page are sent to the execution subject of the embodiment of the application.
[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 scene that needs to be packaged. For example, the target linkage scene information is displayed in the form of a table on the display page. The developer can select the linkage scene that needs to be packaged on the display page, and package the configuration information corresponding to the linkage scene together, so that the packaging result is applicable to the linkage scenes corresponding to multiple configuration information.
[0101] Figure 4 is a schematic diagram of a display page according to a reference embodiment of the application. As shown in Figure 4 each record in the table is a linkage scene information, including scene title, scene description, standard running environment, custom running environment, and the like. Clicking the "Edit" button in the operation bar can edit the corresponding linkage scene information and the business logic associated with the linkage scene information. Clicking the "Delete" button in the operation bar can delete the linkage scene information so that it is not displayed on the display page. Clicking the check box in front of the linkage scene information and clicking the "Compile and Package" button above the display page can compile and package the business logic associated with the checked linkage scene information, and then obtain an executable code package. One or more linkage scene information can be checked each time. Clicking the "Add Scene" button in the upper left corner of the display page can pop up a configuration page as shown in Figure 3 for the developer to configure the linkage scene information and the business logic.
[0102] According to another embodiment of the present application, the method further comprises: uploading the installation package of the business logic to the pre-release address in response to receiving the pre-release address. The installation package has a status, and the status of the installation package uploaded to the pre-release address is changed from "compressed" to "pre-release". The execution subject of the embodiment of the present application judges whether the installation package is verified according to the pre-release address, for example, the execution subject of the embodiment of the present application downloads the installation package from the pre-release address, judges whether the installation package can be installed normally, and judges that the installation package is verified in the case that the installation package is downloaded and can be installed normally. The developer or tester can also judge whether the installation package is verified according to the pre-release address, for example, the 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 subject of the embodiment of the present application, and the verification result includes pass and fail. In the case that the installation package is verified, the installation package is uploaded to the online address in response to receiving the online address, and the online address is a public network address and can be accessed by all users, that is, the installation package can be downloaded by all people through the online address, while the pre-release address has access limitation and only allows a small number of people such as developers and testers to access it.
[0103] For example, Table 1 is a basic information list of the installation package, as shown in Table 1, the basic information of the installation package includes: subject (i.e. main purpose of the installation package), packaging time, running platform, download mode, status, etc. Before the installation package is uploaded to the pre-release address, the developer and the tester can only download the installation package from the basic information list, and after the installation package is uploaded to the pre-release address, the developer and the tester can click "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, and then the installation package can be uploaded to the upload address and the status of the installation package is changed 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, and the two are different.
[0104] Table 1
[0105]
[0106]
[0107] For another example, as Figure 2As shown, after obtaining the installation package, the platform of the compression module publishes the installation package through the internal server according to the pre-release address, allowing the developer and the tester to access, and after the installation package is verified, the platform of the compression module publishes the installation package through the external server according to the online address, allowing all users to access. The user can obtain the installation package through the online download module.
[0108] Through the pre-release address and the online address, the access and download of the installation package can be effectively controlled, the installation package can be verified, the access permission of the specific developer or user can be developed, the installation package in different states can be classified and managed, and the management efficiency of the installation package is improved.
[0109] According to another embodiment of the present application, in the case where the installation package passes the verification, the method further comprises: analyzing the received push request to determine the push format and the push address required by the user. The push request is a request for actively pushing the installation package to the user, and the user can also set the acquisition mode of the installation package to "push" before generating the installation package. The execution subject of the embodiment of the present application directly pushes the installation package to the user according to the acquisition mode set by the user after determining that the installation package passes the verification.
[0110] The push format is the format of the installation package expected to be received by the user, the installation package is converted in the format, and the converted installation package conforms to the push format. For example, the push format is "npm (node package manger) package" format, and npm is a code package management tool. The code package managed by npm is npm package. In the case where the installation package does not conform to the "npm package" format, the installation package is converted into npm package. The push address is the address where the user expects to receive the installation package. For example, the push address is the npm source station of the user (i.e., the personal private npm established by the user). After determining that the installation package conforms to the push format, the npm package is pushed to the npm source station of the user, and the user can download the npm package from the npm source station of the user. Exemplarily, as shown in Table 1, after the npm package is pushed to the npm source station of the user, the download address of the npm package is displayed in the basic information list of the installation package, the "npm address" in the basic information list is clicked to obtain the npm address of the installation package, and the installation package can be downloaded through the npm address. Exemplarily, the npm source station is also divided into private source station and public source station. The private source station is used to store the npm package in the "pre-release" state, and the public source station is used to store the npm package in the "online" state (i.e., passing the verification).
[0111] Exemplarily, as Figure 2As shown, the platform of the compression module publishes the service, and 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 and the npm package of the npm public source station are different, 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 subject of the embodiment of the application parses the received deployment request, determines a target installation package and a target project corresponding to the deployment request, determines a pushing address of the target installation package, obtains the target installation package from the pushing address, and deploys the obtained target installation package in the target project. For example, the target installation package is installed in the target project, the target installation package is introduced in various business scenarios of the target project, and a method included in the target installation package is called.
[0113] According to the pushing format and the pushing address, the installation package is pushed to the user, more flexible storage mode, sharing mode and downloading mode of the installation package can be provided, the user can more conveniently obtain the installation package, sharing and propagation of the installation package are facilitated, and various installation package obtaining requirements of the user are met.
[0114] According to another referable embodiment of the application, before the executable code package is compressed, the executable code is subjected to integration rule detection, integration rules of different running platforms are different, and the integration rules include file name detection, directory structure detection, file size detection, target word detection, packaging mode checking, and source detection of the executable code package. After the executable code package passes all the integration rule detection, it is determined that the executable code conforms to the pre-set code integration rule.
[0115] Before the executable code package is compressed, the executable code is subjected to code template structure detection, whether the code structure of the executable code matches the code template structure is judged, for example, whether there is a class package introduction, whether the positions of methods and attributes meet the requirements, whether the method calling and parameter reference meet the requirements, and the like. After the executable code passes all the code template structure detection, it is determined that the executable code matches the pre-set code template structure.
[0116] Exemplarily, the file name of the executable code package has 10 letters, and the file size is 128KB. The executable code is subjected to integration rule detection, and it is obtained that the file name length of the executable code package meets the requirements, the size does not exceed the specified threshold, no target word is detected, and the packaging mode is qualified. Therefore, it is determined that the executable code package conforms to the code integration rule. In the case that the executable code conforms to the pre-set code integration rule and it is determined that the executable code matches the pre-set code template structure, the executable code is compressed.
[0117] The integrated rule detection and code template structure detection of the executable code package can ensure that the installation package meets the integrated rule and template structure, and make the installation package applicable to multiple running platforms.
[0118] Figure 5 is a schematic diagram of the main flow of a method of service logic encapsulation according to an embodiment of the present application. As shown in Figure 5 the method of service logic encapsulation can include:
[0119] Step S501, in response to receiving the linkage scenario information, determining the service logic corresponding to the linkage scenario information, the service logic being used to provide linkage services between multiple running platforms;
[0120] Step S502, determining the basic tool package corresponding to the multiple running platforms associated with the service logic;
[0121] Step S503, according to the association relationship between the service logic and the multiple running platforms, introducing the basic tool package into the service logic;
[0122] Step S504, converting the template according to the pre-set mapping relationship, and converting the service logic with the introduced basic tool package into executable code;
[0123] Step S505, packaging the executable code to generate an executable code package;
[0124] Step S506, compressing the executable code package to generate an installation package of the service logic.
[0125] The specific implementation content of the method of service logic encapsulation according to an embodiment of the present application has been described in detail in the method of service logic encapsulation described above, and therefore the repeated content will not be described here.
[0126] Figure 6 is a schematic diagram of the main flow of a method of service logic encapsulation according to another embodiment of the present application. As shown in Figure 6 the method of service logic encapsulation can include:
[0127] Step S601, in response to receiving an addition request, rendering a pre-set configuration page;
[0128] Step S602, in response to receiving configuration information, rendering target linkage scenario information included in the configuration information to a pre-set display page;
[0129] Step S603, in response to receiving linkage scenario information, determining the service logic corresponding to the linkage scenario information, the service logic being used to provide linkage services between multiple running platforms;
[0130] Step S604, converting the business logic into an executable code package;
[0131] Step S605, judging whether the executable code package meets the code integration rule, if yes, jumping to step S606, otherwise, jumping to step S601;
[0132] Step S606, compressing the executable code package to generate an installation package of the business logic;
[0133] Step S607, uploading the installation package to the received pre-release address;
[0134] Step S608, judging whether the installation package passes the verification, if yes, jumping to step S609, otherwise, jumping to step S601;
[0135] Step S609, uploading the installation package to the online address in response to receiving the online address.
[0136] The specific implementation of the method for encapsulating the business logic according to another embodiment of the present application has been described in detail in the method for encapsulating the business logic described above, and thus the repeated content will not be described here.
[0137] According to a second aspect of the embodiments of the present application, a device for encapsulating business logic is provided.
[0138] Figure 7 is a schematic diagram of main modules of the device for encapsulating business logic according to the embodiments of the present application, as shown in Figure 7 the device for encapsulating business logic 700 mainly includes:
[0139] The determining module 701 is configured to determine the business logic corresponding to the linkage scenario information in response to receiving the linkage scenario information, and the business logic is used to provide linkage service between multiple running platforms.
[0140] The packaging module 702 is configured to convert the business logic into an executable code package.
[0141] The compressing module 703 is configured to compress the executable code package to generate an installation package of the business logic.
[0142] According to one embodiment of the present application, converting the business logic into an executable code package includes:
[0143] determining a basic tool package corresponding to multiple running platforms associated with the business logic;
[0144] introducing the basic tool package into the business logic according to the association relationship between the business logic and the multiple running platforms.
[0145] According to the preset mapping relationship conversion template, the business logic introduced by the basic toolkit is converted into executable code;
[0146] The executable code is packaged to generate an executable code package.
[0147] According to another embodiment of the present application, the basic toolkit corresponding to the running platform associated with the business logic is determined, comprising:
[0148] It is judged whether the running platform associated with the business logic belongs to a preset running platform set;
[0149] In the case that the running platform associated with the business logic does not belong to the preset running platform set, the platform identifier of the running platform is obtained, and the basic toolkit of the running platform is determined according to the platform identifier.
[0150] According to another embodiment of the present application, the business logic packaging device 700 further comprises:
[0151] The configuration module is configured to render a preset configuration page in response to receiving an addition request; the configuration page is used to fill in configuration information;
[0152] The display module is configured to render 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 a linkage scene that needs to be packaged.
[0153] According to another embodiment of the present application, the business logic packaging device 700 further comprises:
[0154] The upload module is configured to upload the installation package to a pre-release address in response to receiving the pre-release address;
[0155] The verification module is configured to determine whether the installation package passes verification according to the pre-release address;
[0156] The online module is configured to upload the installation package to an online address in response to the installation package passing verification and receiving the online address; the online address is used to download the installation package.
[0157] According to another embodiment of the present application, the business logic packaging device 700 further comprises:
[0158] The push module is configured to determine a push format and a push address of the installation package in response to receiving a push request, to perform format conversion on the installation package according to the push format, and to push the format-converted installation package to the push address.
[0159] a deployment module, configured to acquire the format-converted installation package from the push address in response to receiving the deployment request, and deploy the format-converted installation package into a corresponding target project.
[0160] According to an embodiment of the present application, the executable code package is compressed, including:
[0161] The executable code package is compressed in response to determining that the executable code meets preset code integration rules and determining that the executable code matches a preset code template structure.
[0162] It should be noted that the specific implementation of the device for encapsulating the business logic is described in detail in the method for encapsulating the business logic above, and thus the repeated content is not described herein.
[0163] According to the technical solution of the embodiment of the present application, the business logic is packed and compressed based on linkage scenario information, and an installation package suitable for multiple running platforms is generated, which can simplify the development process, improve the development efficiency, and enable the developer to focus more on the development process of the specific business logic; according to the association between the business logic and the running platform, a unified encapsulated basic tool package is introduced into the business logic, which can give the business logic basic public service capabilities, implement unified calling of the business calling layer, and differential execution of the basic service layer; according to the platform identifier of the running platform, the corresponding basic tool package is searched, which can make the business logic applicable to more running platforms, and not limited to a preset running platform set; the rendering configuration page and the display of the linkage scenario information can provide a visual configuration method and a linkage scenario screening method for the developer, and further improve the development efficiency; providing multiple ways of downloading and installing the package, such as an online download address and an npm source station download, can enable the user to more conveniently obtain the installation package, and facilitate the sharing and dissemination of the installation package; the executable code package is subjected to integration rule detection and template structure detection, which can ensure that the installation package meets the integration rules and the template structure, and make the installation package applicable to multiple running platforms.
[0164] According to a third aspect of the embodiment of the present application, an electronic device is provided, including: one or more processors; a storage device configured to store 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 provided by the first aspect of the embodiment of the present application.
[0165] According to a fourth aspect of the embodiment of the present application, a computer readable medium is provided, which stores a computer program, when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present application is implemented.
[0166] Figure 8 An exemplary system architecture 800 of the method of business logic packaging or the apparatus of business logic packaging to which embodiments of the present application can be applied is shown.
[0167] As shown in Figure 8 , the system architecture 800 can include terminal devices 801, 802, 803, a network 804 and a server 805. The network 804 is a medium to provide communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 can include various connection types, such as wired, wireless communication links or fiber optic cables, etc.
[0168] A user can use the terminal devices 801, 802, 803 to interact with the server 805 through the network 804 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 801, 802, 803, such as business logic packaging class applications, installation package downloading class applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (only as examples).
[0169] The terminal devices 801, 802, 803 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers and desktop computers, etc.
[0170] The server 805 can be a server providing various services, such as a background management server supporting requests for business logic packaging sent by upstream terminal devices 801, 802, 803 (only as an example). The background management server can determine a business logic corresponding to linkage scene information in response to receiving the linkage scene information, the business logic being used to provide linkage services between multiple running platforms; convert the business logic into an executable code package; compress the executable code package to generate an installation package of the business logic; and feed back the business logic packaging situation (only as an example) to the terminal device.
[0171] It should be noted that the method of business logic packaging provided by embodiments of the present application is generally executed by the server 805, and accordingly, the apparatus of business logic packaging is generally provided in the server 805. The method of business logic packaging provided by embodiments of the present application can also be executed by the terminal devices 801, 802, 803, and accordingly, the apparatus of business logic packaging can be provided in the terminal devices 801, 802, 803.
[0172] It should be understood that Figure 8 the number of terminal devices, networks and servers in is only illustrative. Any number of terminal devices, networks and servers can be provided according to implementation needs.
[0173] Reference will now be made to Figure 9 which shows a structural diagram of a computer system 900 suitable for use in implementing the terminal device of an embodiment of the present application. Figure 9 The terminal device shown is merely an example and should not impose any limitation on the functions and the range of use of an embodiment of the present application.
[0174] As shown in Figure 9 , the computer system 900 includes a central processing unit (CPU) 901 which can perform various appropriate actions and processes in accordance with a program stored in a read only memory (ROM) 902 or a program loaded from a storage section 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other through 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, etc.; an output section 907 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. 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 necessary. A removable media 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 910 as necessary, so that a computer program read therefrom is installed into the storage section 908 as necessary.
[0176] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program in accordance with an embodiment of the present application. For example, an embodiment of the present application includes a computer program which includes a computer program carried on a computer readable medium, the computer program containing program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network by the communication section 909, and / or installed from the removable media 911. When the computer program is executed by the central processing unit (CPU) 901, the above-described functions defined in the system of an embodiment of the present application are performed.
[0177] It should be noted that the computer-readable medium in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 of the above. In the embodiments of the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the embodiments of the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a carrier wave in a carrier wave part, in which computer-readable program codes are carried. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, transmit, propagate or transport a program for use by or in conjunction with an instruction execution system, device or apparatus. The program codes contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0178] The flowcharts and block diagrams in the drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment, or a portion of codes which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks noted in succession can in fact be executed substantially concurrently or in the reverse order, depending on the functionality involved. It should also be noted that each block in the flowcharts or block diagrams and combinations of blocks in the flowcharts or block diagrams can be implemented by special-purpose hardware-based systems which perform the specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0179] The modules described in the embodiments of the present application can be implemented in the form of software or in the form of hardware. The modules described can also be arranged in a processor, for example, a processor can be described as including a determining module, a packaging module, and a compressing module, wherein the names of the modules do not constitute a limitation on the modules themselves in some cases, for example, the determining module can also be described as a "module that determines service logic".
[0180] As another aspect, the embodiments of the present application also provide a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, and when the one or more programs are executed by the device, the device implements the following method: in response to receiving linkage scenario information, determining service logic corresponding to the linkage scenario information, the service logic being used to provide linkage services between multiple running platforms; converting the service logic into an executable code package; and compressing the executable code package to generate an installation package of the service logic.
[0181] According to the technical scheme of the embodiments of the present application, the service logic is packaged and compressed based on the linkage scenario information to generate an installation package suitable for multiple running platforms, which can simplify the development process, improve the development efficiency, and enable the developer to focus more on the development process of the specific service logic; according to the association between the service logic and the running platform, a uniformly packaged basic tool package is introduced into the service logic, which can endow the service logic with basic common service capabilities, implement uniform calling of the business calling layer and differentiated execution of the basic service layer; according to the platform identifier of the running platform, the corresponding basic tool package is found, which can make the service logic applicable to more running platforms, rather than being limited to a pre-set running platform set; rendering a configuration page and displaying the linkage scenario information can provide the developer with a visual configuration method and linkage scenario screening method, further improving the development efficiency; providing multiple ways of downloading and installing the package, such as online download address and npm source station download, can enable the user to more conveniently obtain the installation package, facilitating the sharing and dissemination of the installation package; performing integrated rule detection and template structure detection on the executable code package can ensure that the installation package conforms to the integrated rule and the template structure, making the installation package applicable to multiple running platforms.
[0182] The specific embodiments described above do not constitute a limitation on the protection scope of the embodiments of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principles of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.
Claims
1. A method for encapsulating business logic, characterized in that, include: In response to receiving linkage scenario information, the business logic corresponding to the linkage scenario information is determined, and the business logic is used to provide linkage services between multiple operating platforms; Convert the business logic into an executable code package; The executable code package is compressed to generate an installation package for the business logic; Converting the business logic into an executable code package includes: determining the basic toolkits corresponding to multiple running platforms associated with the business logic; introducing the basic toolkits into the business logic based on the association between the business logic and the multiple running platforms; converting the business logic with the basic toolkits introduced into executable code according to a pre-set mapping relationship conversion template, wherein the mapping relationship conversion template includes the methods by which multiple running platforms handle business requests and execute business logic in each linkage scenario; and packaging the executable code to generate an executable code package.
2. The method according to claim 1, characterized in that, Identify the basic toolkits corresponding to multiple runtime platforms associated with the business logic, including: Determine whether the operating platform associated with the business logic belongs to a pre-set set of operating platforms; If the operating platform associated with the business logic does not belong to the pre-set set of operating platforms, obtain the platform identifier of the operating platform, and determine the basic toolkit of the operating platform based on the platform identifier.
3. The method according to claim 1, characterized in that, The method further includes: In response to receiving an add request, a pre-set configuration page is rendered; the configuration page is used to fill in configuration information. In response to receiving 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 scene to be packaged.
4. The method according to claim 1, characterized in that, The method further includes: Upon receiving the pre-release address, the installation package is uploaded to the pre-release address; Determine whether the installation package passes verification based on the pre-release address; In response to the installation package passing 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.
5. The method according to claim 4, characterized in that, If the installation package passes verification, the method further includes: In response to receiving a push request, the push format and push address of the installation package are determined, the installation package is converted according to the push format, and the converted installation package is pushed to the push address; In response to receiving a deployment request, the system retrieves the converted installation package from the push address and deploys the converted installation package to the corresponding target project.
6. The method according to claim 1, characterized in that, Compression of the executable code package includes: In response to determining that the executable code conforms to the preset code integration rules and that the executable code matches the preset code template structure, the executable code package is compressed.
7. A device for encapsulating business logic, characterized in that, include: The determination module is used to determine the business logic corresponding to the received linkage scenario information in response to receiving the linkage scenario information. The business logic is used to provide linkage services between multiple running platforms. The packaging module is used to convert the business logic into an executable code package; A compression module is used to compress the executable code package to generate an installation package for the business logic; Converting the business logic into an executable code package includes: determining the basic toolkits corresponding to multiple running platforms associated with the business logic; introducing the basic toolkits into the business logic based on the association between the business logic and the multiple running platforms; converting the business logic with the basic toolkits introduced into executable code according to a pre-set mapping relationship conversion template, wherein the mapping relationship conversion template includes the methods by which multiple running platforms handle business requests and execute business logic in each linkage scenario; and packaging the executable code to generate an executable code package.
8. An electronic device, characterized in that, include: One or more processors; Storage device, used to store 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 as described in any one of claims 1-6.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Construction method of business scenario and construction system of business scenario
CN109343846A
Service logic processing method and device, electronic device, storage medium and system
CN115442228A