Method, device, equipment and storage medium for generating business code package

By deduplication processing and precisely cutting unreferenced structure code, the resource waste problem in the generation of business code packages in the prior art is solved, and efficient code package generation is achieved.

CN111752564BActive Publication Date: 2024-12-20TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010549192.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-16
Publication Date
2024-12-20
Estimated Expiration
2040-06-16

AI Technical Summary

Technical Problem

In the prior art, when generating business code packages, there is a waste of resources caused by inaccurate code cutting, and the deleted code may be reacquired, resulting in waste of system resources.

Method used

By determining the structure directly referenced by the target page code and its structure class to which it belongs, combined with the pre-stored reference relationship, after deduplication processing, the code that has not been directly or indirectly referenced is generated to avoid duplicate cropping.

Benefits of technology

It reduces the waste of system resources, ensures that each structural class is only trimmed once, and improves the efficiency of code package generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111752564B_ABST
    Figure CN111752564B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for generating a business code package, and belongs to the field of computer technology. The method comprises: determining at least one structure directly referenced in the target page code; based on the structure class to which at least one structure belongs, and the reference relationship between different structure classes stored in advance, determining each structure class that needs to be referenced when executing the target page code, and obtaining a first structure class set; performing deduplication processing on the first structure class set, and obtaining a second structure class set; for each structure class in the second structure class set, cutting the code of the structure that is not directly referenced or indirectly referenced by the target page code in the code of the structure class, and obtaining the code of the structure to be used corresponding to the structure class; based on the code of the structure to be used corresponding to each structure class in the second structure class set, generating a business code package corresponding to the target page code. The present application can reduce the waste of system resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for generating a business code package. Background Art

[0002] Each application will contain a business code package corresponding to each page. The business code package may contain the code of at least one structure in the target transmission protocol, so that after receiving the page code, the terminal can compile it according to the page code and the code of the structure it references to obtain the page display data, and then display the page according to the page display data. The generation of the business code package can be as follows:

[0003] Determine all structures that need to be referenced by executing the target page code, then obtain the code of each structure class in the target transmission protocol, and cut the code of the structure class to which each referenced structure belongs, and generate the business code package of the target page with the obtained code.

[0004] In the process of implementing this application, the inventor found that the prior art has at least the following problems:

[0005] If the referenced structure is a1, c1, b1, c2, the code of structure class a in the target transmission protocol is first trimmed, that is, all the code in structure class a except the code of structure a1 is trimmed, and then the code of structure class c in the target transmission protocol is trimmed, that is, all the code in structure class c except the code of structure c1 is trimmed, and then the code of structure class b in the target transmission protocol is trimmed, that is, all the code in structure class b except the code of structure b1 is trimmed, and then the code of structure c2 is obtained from the target transmission protocol. In this way, the process of obtaining the deleted code is generated, which wastes system resources. Summary of the invention

[0006] The embodiment of the present application provides a method, device, equipment and storage medium for generating a service code package, which can solve the problem of wasting system resources. The technical solution is as follows:

[0007] In one aspect, a method for generating a service code package is provided, the method comprising:

[0008] Identify at least one structure directly referenced in the target page code;

[0009] Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine each structure class that needs to be referenced when executing the target page code, and obtain a first structure class set;

[0010] Deduplication processing is performed on the first structure class set to obtain a second structure class set;

[0011] For each structure class in the second structure class set, the code of the structure that is not directly or indirectly referenced by the target page code is trimmed in the code of the structure class to obtain the code of the structure to be used corresponding to the structure class;

[0012] Based on the code of the structure to be used corresponding to each structure class in the second structure class set, a business code package corresponding to the target page code is generated.

[0013] Optionally, the determining, based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, each structure class that needs to be referenced for executing the target page code to obtain a first structure class set includes:

[0014] Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code and the reference order of the structure classes;

[0015] The structural classes are arranged based on the reference order to obtain a plurality of structural classes arranged in sequence, which constitute a first structural class set.

[0016] Optionally, performing deduplication processing on the first structure class set to obtain a second structure class set includes:

[0017] For the structural classes that appear multiple times in the first structural class set, among the structural classes that appear multiple times, the structural class that appears last in the reference order is retained, and structural classes other than the structural class that appears last are removed.

[0018] Optionally, for each structure class in the second structure class set, the code of the structure that is not directly referenced or indirectly referenced by the target page code is trimmed in the code of the structure class to obtain the code of the structure to be used corresponding to the structure class, including:

[0019] Based on the code of the at least one structure, determining each structure that needs to be referenced to execute the target page code and the reference order of each structure;

[0020] The first structure of each structure in the reference order is set as a reference structure, and a structure class in the arrangement order of each structure class in the second structure class set is set as a reference structure class;

[0021] Determine whether the structure class to which the reference structure belongs is the reference structure class;

[0022] If the structure class to which the reference structure belongs is not the reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0023] If the structure class to which the reference structure belongs is the reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of the structures other than the reference structure in the code of the reference structure class are clipped to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0024] If the structural class to which the reference structure belongs is the reference structural class, and a structure to be used corresponding to the reference structural class is recorded, the codes of other structures in the code of the reference structural class except the reference structure and the structure to be used corresponding to the reference structural class are trimmed to obtain the code of the structure to be used corresponding to the reference structural class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structural class of the reference structure class in the arrangement order is set as the reference structural class, and the process proceeds to determine whether the structural class to which the reference structure belongs is the reference structural class.

[0025] Optionally, after generating the business code package corresponding to the target page code, the process further includes:

[0026] The business code package is added to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when receiving the target page code, the terminal loads the page based on the business code corresponding to the target page code and the target page code.

[0027] On the other hand, a device for generating a service code package is provided, the device comprising:

[0028] A determination module, used for determining at least one structure directly referenced in the target page code;

[0029] The determination module is further used to determine the structure classes that need to be referenced when executing the target page code based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, so as to obtain a first structure class set;

[0030] A deduplication module, used for performing deduplication processing on the first structure class set to obtain a second structure class set;

[0031] A clipping module is used for clipping the code of the structure that is not directly or indirectly referenced by the target page code in the code of each structure class in the second structure class set, so as to obtain the code of the structure to be used corresponding to the structure class;

[0032] A generation module is used to generate a business code package corresponding to the target page code based on the code of the structure to be used corresponding to each structure class in the second structure class set.

[0033] Optionally, the determining module is used to:

[0034] Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code and the reference order of the structure classes;

[0035] The structural classes are arranged based on the reference order to obtain a plurality of structural classes arranged in sequence, which constitute a first structural class set.

[0036] Optionally, the deduplication module is used to:

[0037] For the structural classes that appear multiple times in the first structural class set, among the structural classes that appear multiple times, the structural class that appears last in the reference order is retained, and structural classes other than the structural class that appears last are removed.

[0038] Optionally, the cutting module is used to:

[0039] Based on the code of the at least one structure, determining each structure that needs to be referenced to execute the target page code and the reference order of each structure;

[0040] The first structure of each structure in the reference order is set as a reference structure, and a structure class in the arrangement order of each structure class in the second structure class set is set as a reference structure class;

[0041] Determine whether the structure class to which the reference structure belongs is the reference structure class;

[0042] If the structure class to which the reference structure belongs is not the reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0043] If the structure class to which the reference structure belongs is the reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of the structures other than the reference structure in the code of the reference structure class are clipped to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0044] If the structural class to which the reference structure belongs is the reference structural class, and a structure to be used corresponding to the reference structural class is recorded, the codes of other structures in the code of the reference structural class except the reference structure and the structure to be used corresponding to the reference structural class are trimmed to obtain the code of the structure to be used corresponding to the reference structural class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structural class of the reference structure class in the arrangement order is set as the reference structural class, and the process proceeds to determine whether the structural class to which the reference structure belongs is the reference structural class.

[0045] Optionally, the device further includes an adding module, wherein the adding module is used to:

[0046] The business code package is added to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when receiving the target page code, the terminal loads the page based on the business code corresponding to the target page code and the target page code.

[0047] On the other hand, a computer device is provided, the computer device comprising a processor and a memory, the memory storing instructions, the processor executing the instructions so that the computer device implements the method for generating a service code package.

[0048] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and a computer device executes the instructions so that the computer device implements the method for generating a service code package.

[0049] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0050] The present application obtains the structures directly referenced and indirectly referenced by the target page code, determines the structural class to which each structure belongs, and then obtains the first structural class set. The first structural class is deduplicated to obtain the second structural class set, and then, based on the second structural class set, the code of each structural class corresponding to the second structural class set in the target transmission protocol is obtained, and the code of the structure directly referenced and indirectly referenced in the code of each structural class is cut out, and a business code package is generated. This avoids the situation where only one cutting process is performed for each structural class when generating the business code package of the target page, and there is no process of obtaining the deleted code, thereby reducing the waste of system resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0052] Figure 1 It is a schematic diagram of the implementation environment provided by the embodiment of the present application;

[0053] Figure 2 This is a flow chart of a method for generating a service code package provided by an embodiment of the present application;

[0054] Figure 3 is a schematic diagram of a method for generating a service code package provided in an embodiment of the present application;

[0055] Figure 4 It is a schematic diagram of the structure of a device for generating a service code package provided in an embodiment of the present application;

[0056] Figure 5 It is a schematic diagram of the server structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0058] An embodiment of the present application provides a method for generating a business code package, which can be implemented by a server. The server can be a background server of an application. The server can be a single server or a server group. If it is a single server, the management server can be responsible for all processing in the following scheme that needs to be performed by the management server. If it is a server group, different servers in the server group can be responsible for different processing in the following scheme. The specific processing distribution can be arbitrarily set by technical personnel according to actual needs, and will not be repeated here.

[0059] Figure 1 Schematic diagram of the implementation environment of an embodiment of the present application. When a user is using an application, the user triggers a control for jumping to a page, and the terminal sends a request to jump to the page to the server. The server receives the request to jump to the page, and obtains corresponding page data according to the request to jump to the page, and then sends the obtained page data to the terminal. The terminal receives the page data sent by the server, and pre-processes the page data according to the business code package, that is, obtains the identifier of the structure referenced in the page data, and obtains the corresponding structure code from the business code package according to the identifier, and adds it to the page data, thereby obtaining a complete code to be compiled. Furthermore, the terminal can compile the above-mentioned code to be compiled, generate and display the corresponding page.

[0060] Figure 2 This is a flow chart of a method for generating a service code package provided by an embodiment of the present application. Figure 2 , the process includes:

[0061] Step 201: Determine at least one structure directly referenced in the target page code.

[0062] In implementation, the page codes of each page stored in the server are obtained, and one of them is selected as the target page code. The code of the target page is detected, and the identifier of at least one structure directly referenced in the target page code is obtained. The identifier of the structure can be the name of the structure. For example, the statement after include in the code of the target page is checked. The statement is used to reference the structure, and then the statement / path / to / a.jce / a1 after include can be obtained, and the name a1 of the referenced structure is obtained.

[0063] Then, the server may determine at least one structure directly referenced in the target page code according to the acquired name of the structure.

[0064] It should be noted here that this solution can select only part of the page codes stored in the server as the target page codes for subsequent processing, or can select all the page codes stored in the server as the target page codes for subsequent processing. This is not limited here. The technicians can choose to select part of the page codes as the target page codes or to select all the page codes stored in the server as the target pages according to actual needs.

[0065] Step 202: Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code to obtain a first structure class set.

[0066] In implementation, after obtaining the name of at least one structure directly referenced by the target page code, the structural class to which the at least one structure belongs can be determined based on the name of the at least one structure. For example, the structural class to which the structure a1 belongs can be obtained based on the above / path / to / a.jce / a1 statement, which is the a structural class. Then, the reference relationship between different structural classes pre-stored in the server is obtained. For example, in the reference relationship between different structural classes pre-stored, the a structural class references the b structural class and the c structural class, and the b structural class references the c structural class. Furthermore, the structural classes that need to be referenced by executing the target page code and the arrangement order of the structural classes can be determined. For example, the structural classes that need to be referenced by the above target page code are the a structural class, the b structural class, and the c structural class, and the arrangement order of the structural classes is the a structural class, the c structural class, the b structural class, and the c structural class.

[0067] Then, the server can arrange the identifiers of each structural class based on the above arrangement order to obtain a first structural class set. The identifiers of each structural class can be the names of each structural class. For example, after the structural classes are arranged in the arrangement order, the first structural class set obtained is a, c, b, c.

[0068] Step 203: perform deduplication processing on the first structure class set to obtain a second structure class set.

[0069] In implementation, after obtaining the first structural class set, the server can retain the name of the structural class that appears last in the arrangement order among the names of the structural classes that appear multiple times in the first structural class set, remove the names of the structural classes except the name of the structural class that appears last, and obtain the second structural class set.

[0070] For example, if the name of the structure class c appears repeatedly in the first structure class set a, c, b, c, then the last c is retained and the first c is removed to obtain the second structure class set a, b, c.

[0071] Step 204: For each structure class in the second structure class set, the code of the structure that is not directly or indirectly referenced by the target page code is trimmed in the code of the structure class to obtain the code of the structure to be used corresponding to the structure class.

[0072] In implementation, after obtaining the second structure class set, the server may obtain the structure class code corresponding to the name of each structure class in the second structure class set in the target transmission protocol, wherein the structure class code includes the structure body code.

[0073] After the above processing is completed, first, the server can determine the structures that need to be referenced when executing the target page code and the reference order of the structures based on the code of at least one structure.

[0074] In implementation, the server can obtain the structure directly referenced by the target page code, and then obtain the code of the structure, and detect the code of the directly referenced structure to obtain other structures referenced in the code of the directly referenced structure, that is, the indirectly referenced structure, and the reference order of the directly referenced structure and the indirectly referenced structure.

[0075] For example, if the target page code directly references the a1 structure, the code of the a1 structure is obtained, and it is detected that the code of the a1 structure references the c1 structure and the b1 structure in sequence, and the b1 structure references the c2 structure.

[0076] Secondly, the server may set the first structure of each structure in the reference order as the reference structure, and set a structure class in the arrangement order of each structure class in the second structure class set as the reference structure class;

[0077] In implementation, after the above processing, the server can obtain the reference order of each structure and the second structure class set, which also includes the arrangement order. Furthermore, the server can set the first structure of each structure in the reference order as the reference structure, and set a structure class in the arrangement order of each structure class in the second structure class set as the reference structure class.

[0078] For example, Figure 3 As shown, the reference order of each structure is a1, c1, b1, c2, and the second structure class set is arranged in the order of a, b, c. The server can set the a1 structure as the reference structure and the a structure class as the reference structure class.

[0079] It should be noted here that in this embodiment, all reference structures are structures currently being processed, and all reference structure classes are structure classes currently being processed, which will not be described one by one hereinafter.

[0080] Secondly, the server can determine whether the structure class to which the reference structure belongs is a reference structure class.

[0081] In implementation, the server may detect whether the code of the reference structure class contains the code of the reference structure, and the server may also obtain whether the name of the structure contained in the reference structure class contains the name of the reference structure.

[0082] For example, Figure 3 As shown, when the server performs detection based on the reference structure class (structure class a) and the reference structure (structure a1), the server can detect whether the code of the reference structure class (structure class a) contains the code of the reference structure (structure a1), and the server can also obtain whether the names (a1, a2) of the structures (structure a1, structure a2) contained in the reference structure class (structure class a) contain the name (a1) of the reference structure (structure a1).

[0083] Then, the server can perform the following different processing according to different results:

[0084] If the structure class to which the reference structure belongs is not a reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process proceeds to determine whether the structure class to which the reference structure belongs is a reference structure class.

[0085] For example, Figure 3 As shown, when the server performs detection based on the reference structure class (b structure class) and the reference structure (c1 structure), the server will obtain the result that the structure class to which the reference structure (c1 structure) belongs is not the reference structure class (b structure class). Then the server records the reference structure (c1 structure) as the structure to be used corresponding to the reference structure class (c structure class), and sets the next structure (b1 structure) of the reference structure in the reference order as the reference structure. Then, the server switches to the process of determining that the structure class to which the reference structure belongs is the reference structure class.

[0086] If the structure class to which the reference structure belongs is a reference structure class, it can be handled in the following situations:

[0087] First, if the structure class to which the reference structure belongs is a reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of other structures except the reference structure in the code of the reference structure class are trimmed to obtain the code of the structure to be used corresponding to the reference structure class.

[0088] For example, Figure 3As shown, when the server performs detection based on the reference structure class (b structure class) and the reference structure (b1 structure), the server will obtain the result that the structure class to which the reference structure (b1 structure) belongs is the reference structure class (b structure class). Then, it is detected whether there is a structure to be used corresponding to the reference structure class. If not, the code of other structures (b2 structure, b3 structure) except the reference structure (b1 structure) in the code of the reference structure class (b structure class) is cut to obtain the code of the structure to be used (b1 structure) corresponding to the reference structure class.

[0089] Then, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process proceeds to determine whether the structure class to which the reference structure belongs is the reference structure class.

[0090] For example, the next structure (c2 structure) in the reference order of the reference structure is set as the reference structure. Then, the process proceeds to determine whether the structure class to which the reference structure (c2 structure) belongs is the reference structure class (c structure class).

[0091] The second method is that if the structure class to which the reference structure belongs is a reference structure class and a structure to be used corresponding to the reference structure class is recorded, the codes of other structures in the code of the reference structure class except the reference structure and the structure to be used corresponding to the reference structure class are trimmed to obtain the code of the structure to be used corresponding to the reference structure class.

[0092] For example, Figure 3 As shown, when the server performs detection based on the reference structure class (c structure class) and the reference structure (c2 structure), the server will obtain the result that the structure class to which the reference structure (c2 structure) belongs is the reference structure class (c structure class). Then, it is detected whether there is a structure to be used corresponding to the reference structure class. If so, the code of other structures in the code of the reference structure class except the reference structure (c2 structure) and the structure to be used corresponding to the reference structure class (c1 structure) is cut to obtain the code of the structure to be used corresponding to the reference structure class (c1 structure, c2 structure).

[0093] Then, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process proceeds to determine whether the structure class to which the reference structure belongs is the reference structure class.

[0094] It should be noted that if there is no next structure in the reference order, the process of step 205 is performed, for example, Figure 3 As shown, if there is no next structure in the reference order for the c2 structure, the process of step 205 is performed.

[0095] Step 205: Generate a business code package corresponding to the target page code based on the code of the structure to be used corresponding to each structure class in the second structure class set.

[0096] Optionally, after obtaining the generated business code package corresponding to the target page code, the server can add the business code package to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when it receives the target page code, it loads the page based on the business code corresponding to the target page code and the target page code.

[0097] The business code may be the code of a structure directly referenced by the target page code or the code of a structure indirectly referenced by the target page code. The target page code is the code of the corresponding target page sent by the server.

[0098] Optionally, after obtaining the generated business code package corresponding to the target page code, the server can also obtain the business code packages corresponding to all pages stored in the server through the above steps, and then the server can add the business code packages corresponding to all pages to the installation package of the application, so that after the terminal downloads and uses the installation package to install the application, when receiving any page code, it can load the page based on the business code corresponding to any page code and the page code.

[0099] The business code may be the code of a structure directly referenced by any page code or the code of a structure indirectly referenced by any page code, and the any page code is the code corresponding to any page sent by the server.

[0100] The present application obtains the structures directly referenced and indirectly referenced by the target page code, determines the structural class to which each structure belongs, and then obtains the first structural class set. The first structural class is deduplicated to obtain the second structural class set, and then, based on the second structural class set, the code of each structural class corresponding to the second structural class set in the target transmission protocol is obtained, and the code of the structure directly referenced and indirectly referenced in the code of each structural class is cut out, and a business code package is generated. This avoids the situation where only one cutting process is performed for each structural class when generating the business code package of the target page, and there is no process of obtaining the deleted code, thereby reducing the waste of system resources.

[0101] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0102] Figure 4Schematic diagram of a device structure for generating a service code package provided in an embodiment of the present application. Figure 3 , the device may be the above-mentioned server, and the device includes:

[0103] A determination module 410, configured to determine at least one structure directly referenced in the target page code;

[0104] The determination module 410 is further configured to determine, based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, the structure classes that need to be referenced when executing the target page code, and obtain a first structure class set;

[0105] A deduplication module 420, configured to perform deduplication processing on the first structure class set to obtain a second structure class set;

[0106] A cutting module 430 is used for cutting the code of the structure that is not directly or indirectly referenced by the target page code in the code of each structure class in the second structure class set, so as to obtain the code of the structure to be used corresponding to the structure class;

[0107] The generating module 440 is used to generate a business code package corresponding to the target page code based on the code of the structure to be used corresponding to each structure class in the second structure class set.

[0108] Optionally, the determining module 410 is used to:

[0109] Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code and the reference order of the structure classes;

[0110] The structural classes are arranged based on the reference order to obtain a plurality of structural classes arranged in sequence, which constitute a first structural class set.

[0111] Optionally, the deduplication module 420 is used to:

[0112] For the structural classes that appear multiple times in the first structural class set, among the structural classes that appear multiple times, the structural class that appears last in the reference order is retained, and structural classes other than the structural class that appears last are removed.

[0113] Optionally, the cutting module 430 is used to:

[0114] Based on the code of the at least one structure, determining each structure that needs to be referenced to execute the target page code and the reference order of each structure;

[0115] The first structure of each structure in the reference order is set as a reference structure, and a structure class in the arrangement order of each structure class in the second structure class set is set as a reference structure class;

[0116] Determine whether the structure class to which the reference structure belongs is the reference structure class;

[0117] If the structure class to which the reference structure belongs is not the reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0118] If the structure class to which the reference structure belongs is the reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of the structures other than the reference structure in the code of the reference structure class are clipped to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed;

[0119] If the structural class to which the reference structure belongs is the reference structural class, and a structure to be used corresponding to the reference structural class is recorded, the codes of other structures in the code of the reference structural class except the reference structure and the structure to be used corresponding to the reference structural class are trimmed to obtain the code of the structure to be used corresponding to the reference structural class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structural class of the reference structure class in the arrangement order is set as the reference structural class, and the process proceeds to determine whether the structural class to which the reference structure belongs is the reference structural class.

[0120] Optionally, the device further includes an adding module, wherein the adding module is used to:

[0121] The business code package is added to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when receiving the target page code, the terminal loads the page based on the business code corresponding to the target page code and the target page code.

[0122] The present application obtains the structures directly referenced and indirectly referenced by the target page code, determines the structural class to which each structure belongs, and then obtains the first structural class set. The first structural class is deduplicated to obtain the second structural class set, and then, based on the second structural class set, the code of each structural class corresponding to the second structural class set in the target transmission protocol is obtained, and the code of the structure directly referenced and indirectly referenced in the code of each structural class is cut out, and a business code package is generated. This avoids the situation where only one cutting process is performed for each structural class when generating the business code package of the target page, and there is no process of obtaining the deleted code, thereby reducing the waste of system resources.

[0123] It should be noted that: the device for generating a business code package provided in the above embodiment only uses the division of the above functional modules as an example when generating a business code package. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for generating a business code package provided in the above embodiment and the method embodiment for generating a business code package belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0124] Figure 5 It is a structural diagram of a server provided in an embodiment of the present application. The server may be the above-mentioned server. The server 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 and one or more memories 502, wherein the memory 502 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 501 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.

[0125] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, and the instructions can be executed by a processor in a terminal to complete the method of generating a service code package in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0126] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0127] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for generating a service code package, characterized in that: The method comprises: Identify at least one structure directly referenced in the target page code; Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine each structure class that needs to be referenced when executing the target page code, and obtain a first structure class set; Deduplication processing is performed on the first structure class set to obtain a second structure class set; Based on the code of the at least one structure, determining each structure that needs to be referenced to execute the target page code and the reference order of each structure; The first structure of each structure in the reference order is set as a reference structure, and a structure class in the arrangement order of each structure class in the second structure class set is set as a reference structure class; Determine whether the structure class to which the reference structure belongs is the reference structure class; If the structure class to which the reference structure belongs is not the reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed; If the structure class to which the reference structure belongs is the reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of the structures other than the reference structure in the code of the reference structure class are clipped to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed; If the structure class to which the reference structure belongs is the reference structure class, and a structure to be used corresponding to the reference structure class is recorded, the codes of other structures in the code of the reference structure class except the reference structure and the structure to be used corresponding to the reference structure class are trimmed to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed; Based on the code of the structure to be used corresponding to each structure class in the second structure class set, a business code package corresponding to the target page code is generated.

2. The method according to claim 1, characterized in that The step of determining the structure classes that need to be referenced for executing the target page code based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, and obtaining a first structure class set, includes: Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code and the reference order of the structure classes; The structural classes are arranged based on the reference order to obtain a plurality of structural classes arranged in sequence, which constitute a first structural class set.

3. The method according to claim 2, characterized in that The step of performing deduplication processing on the first structure class set to obtain a second structure class set includes: For the structural classes that appear multiple times in the first structural class set, among the structural classes that appear multiple times, the structural class that appears last in the reference order is retained, and structural classes other than the structural class that appears last are removed.

4. The method according to claim 1, characterized in that: After generating the business code package corresponding to the target page code, the method further includes: The business code package is added to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when receiving the target page code, the terminal loads the page based on the business code corresponding to the target page code and the target page code.

5. A device for generating a service code package, characterized in that: The device comprises: A determination module, used for determining at least one structure directly referenced in the target page code; The determination module is further used to determine the structure classes that need to be referenced when executing the target page code based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, so as to obtain a first structure class set; A deduplication module, used for performing deduplication processing on the first structure class set to obtain a second structure class set; A clipping module is used for clipping the code of the structure that is not directly or indirectly referenced by the target page code in the code of each structure class in the second structure class set, so as to obtain the code of the structure to be used corresponding to the structure class; A generating module, configured to generate a business code package corresponding to the target page code based on the code of the structure to be used corresponding to each structure class in the second structure class set; The cutting module is used for: Based on the code of the at least one structure, determining each structure that needs to be referenced to execute the target page code and the reference order of each structure; The first structure of each structure in the reference order is set as a reference structure, and a structure class in the arrangement order of each structure class in the second structure class set is set as a reference structure class; Determine whether the structure class to which the reference structure belongs is the reference structure class; If the structure class to which the reference structure belongs is not the reference structure class, the reference structure is recorded as a to-be-used structure corresponding to the structure class to which the reference structure belongs, the next structure of the reference structure in the reference order is set as the reference structure, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed; If the structure class to which the reference structure belongs is the reference structure class, and the structure to be used corresponding to the reference structure class is not recorded, the codes of the structures other than the reference structure in the code of the reference structure class are clipped to obtain the code of the structure to be used corresponding to the reference structure class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structure class of the reference structure class in the arrangement order is set as the reference structure class, and the process of determining whether the structure class to which the reference structure belongs is the reference structure class is executed; If the structural class to which the reference structure belongs is the reference structural class, and a structure to be used corresponding to the reference structural class is recorded, the codes of other structures in the code of the reference structural class except the reference structure and the structure to be used corresponding to the reference structural class are trimmed to obtain the code of the structure to be used corresponding to the reference structural class, the next structure of the reference structure in the reference order is set as the reference structure, and the next structural class of the reference structure class in the arrangement order is set as the reference structural class, and the process proceeds to determine whether the structural class to which the reference structure belongs is the reference structural class.

6. The device according to claim 5, characterized in that The determining module is used to: Based on the structure class to which the at least one structure belongs and the pre-stored reference relationship between different structure classes, determine the structure classes that need to be referenced when executing the target page code and the reference order of the structure classes; The structural classes are arranged based on the reference order to obtain a plurality of structural classes arranged in sequence, which constitute a first structural class set.

7. The device according to claim 6, characterized in that The deduplication module is used to: For the structural classes that appear multiple times in the first structural class set, among the structural classes that appear multiple times, the structural class that appears last in the reference order is retained, and structural classes other than the structural class that appears last are removed.

8. The device according to claim 5, characterized in that The device further comprises an adding module, wherein the adding module is used to: The business code package is added to the installation package of the application to which the target page code belongs, so that after the terminal downloads and uses the installation package to install the application, when receiving the target page code, the terminal loads the page based on the business code corresponding to the target page code and the target page code.

9. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the method for generating a business code package as described in any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for generating a business code package as described in any one of claims 1 to 4.