Application code processing method, device, electronic device and storage medium

By storing and managing the reused code on the server and generating basic information, the terminal can build applications based on this information, thereby realizing the reuse of code, solving the problem of code in the prior art that cannot be reused and improving application access efficiency.

CN113626027BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110917696.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-11
Publication Date
2025-03-18
Estimated Expiration
2041-08-11

AI Technical Summary

Technical Problem

In the prior art, the code of front-end applications cannot be reused, resulting in low application access efficiency.

Method used

By storing and managing multiplexed codes on the server and generating basic information, the terminal can build applications based on this information, thereby realizing the reuse of codes.

Benefits of technology

It realizes code reuse between different applications, improves application access efficiency, and avoids the need to reuse code repeatedly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113626027B_ABST
    Figure CN113626027B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, electronic device and storage medium for processing application code, and relates to the field of computer technology. A specific implementation of the method includes: in response to an upload request, obtaining a reuse code, a reuse code identifier and a version identifier in the upload request, storing the reuse code to a preset storage address, generating and storing basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier; in response to a query request sent by a first terminal, obtaining the reuse code identifier in the query request, querying the corresponding basic information and sending it to the first terminal, so that the first terminal can build an application based on the received basic information. This implementation can solve the problem of being unable to reuse code, resulting in low application access efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for processing application code. Background Art

[0002] In the rapid development of front-end business, the code size of front-end applications is getting larger and larger, and the logic complexity of business is getting higher and higher. In order to simplify the development process, developers can develop based on existing code, but the code of each application is independent of each other after development. After the application is built, the terminal needs to obtain the corresponding code separately when accessing each application, so code reuse cannot be achieved, resulting in low efficiency of application access. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a method, device, electronic device and storage medium for processing application code, which can solve the problem that code reuse cannot be achieved, resulting in low application access efficiency.

[0004] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for processing application code is provided.

[0005] A method for processing application code in an embodiment of the present invention is applied to a server, including: responding to an upload request, obtaining a reuse code, a reuse code identifier and a version identifier in the upload request, storing the reuse code to a preset storage address, generating and storing basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier; responding to a query request sent by a first terminal, obtaining the reuse code identifier in the query request, querying the corresponding basic information and sending it to the first terminal, so that the first terminal can build an application based on the received basic information.

[0006] In one embodiment, after generating and storing the basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier, the method further includes:

[0007] In response to the update request, obtaining the reuse code identifier, the updated reuse code, and the updated version identifier in the update request;

[0008] The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier.

[0009] In yet another embodiment, after querying the corresponding basic information and sending it to the first terminal, the method further includes:

[0010] In response to an acquisition request sent by the second terminal through a connection, wherein the acquisition request includes the loaded basic information, and the connection is established when the second terminal accesses an application constructed by the first terminal;

[0011] Based on the basic information in the acquisition request, the corresponding multiplexing code is queried, and the queried multiplexing code is sent to the second terminal through the connection.

[0012] In yet another embodiment, after sending the queried multiplexed code to the second terminal through the connection, the method further includes:

[0013] Receiving an update request, and obtaining a reuse code identifier, an updated reuse code, and an updated version identifier in the update request;

[0014] The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier;

[0015] An update prompt message is sent to the second terminal based on the connection, so that the second terminal obtains basic information corresponding to the updated multiplexing code.

[0016] To achieve the above objective, according to another aspect of an embodiment of the present invention, another method for processing application code is provided.

[0017] Another method for processing application code according to an embodiment of the present invention is applied to a first terminal, comprising: obtaining an initial code for constructing an application, identifying an identifier of a reused code in the initial code, wherein the reused code is a code that can be reused by different applications, and the reused code is a part of the initial code; sending a query request including the identifier to a server, and then receiving basic information returned by the server to construct and store the application based on the basic information; receiving an application access request sent by a second terminal, querying the basic information of the reused code identifier corresponding to the application access request, and sending the basic information to the second terminal, so that the second terminal obtains the reused code from the server based on the basic information.

[0018] In one embodiment, the basic information includes a multiplexing code identifier and a storage address corresponding to the multiplexing code identifier;

[0019] Building an application based on the basic information includes:

[0020] For each reuse code identifier, the address information in the initial code is replaced with the storage address in the basic information, and then the application is constructed based on the initial code after the address is replaced, wherein the address information and the storage address both correspond to the reuse code identifier.

[0021] In yet another embodiment, constructing an application based on the basic information includes:

[0022] Add the preset protocol client to the built application;

[0023] After receiving the application access request sent by the second terminal, the method further includes:

[0024] The protocol client is sent to the second terminal, so that the second terminal establishes a connection with the server based on the protocol client.

[0025] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for processing application code is provided.

[0026] A device for processing application code according to an embodiment of the present invention is arranged at a server end, and includes: a storage unit, used to respond to an upload request, obtain a reuse code, a reuse code identifier and a version identifier in the upload request, store the reuse code to a preset storage address, generate and store basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier; a query unit, used to respond to a query request sent by a first terminal, obtain the reuse code identifier in the query request, query the corresponding basic information and send it to the first terminal, so that the first terminal can build an application based on the received basic information.

[0027] In one embodiment, the storage unit is further used for:

[0028] In response to the update request, obtaining the reuse code identifier, the updated reuse code, and the updated version identifier in the update request;

[0029] The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier.

[0030] In yet another embodiment, the query unit is further configured to:

[0031] In response to an acquisition request sent by the second terminal through a connection, wherein the acquisition request includes the loaded basic information, and the connection is established when the second terminal accesses an application constructed by the first terminal;

[0032] Based on the basic information in the acquisition request, the corresponding multiplexing code is queried, and the queried multiplexing code is sent to the second terminal through the connection.

[0033] In another embodiment, the query unit is further used to receive an update request, obtain the multiplexing code identifier, the updated multiplexing code and the updated version identifier in the update request; store the updated multiplexing code to the storage address, and generate and store the basic information corresponding to the updated multiplexing code based on the storage address, the multiplexing code identifier and the updated version identifier;

[0034] The device also includes:

[0035] An update prompt message is sent to the second terminal based on the connection, so that the second terminal obtains basic information corresponding to the updated multiplexing code.

[0036] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for processing application code is provided.

[0037] A device for processing application code according to an embodiment of the present invention is applied to a first terminal, and includes: an acquisition unit, used to acquire an initial code for constructing an application, and identify an identifier of a reused code in the initial code, wherein the reused code is a code that can be reused by different applications, and the reused code is a part of the initial code; a construction unit, used to send a query request including the identifier to a server, and then receive basic information returned by the server, so as to construct and store the application based on the basic information; and a query unit, used to receive an application access request sent by a second terminal, query the basic information of the reused code identifier corresponding to the application access request, and send it to the second terminal, so that the second terminal obtains the reused code from the server based on the basic information.

[0038] In one embodiment, the basic information includes a multiplexing code identifier and a storage address corresponding to the multiplexing code identifier;

[0039] The building block is specifically used for:

[0040] For each reuse code identifier, the address information in the initial code is replaced with the storage address in the basic information, and then the application is constructed based on the initial code after the address is replaced, wherein the address information and the storage address both correspond to the reuse code identifier.

[0041] In yet another embodiment, the construction unit is specifically used to add a preset protocol client to the constructed application;

[0042] The device also includes:

[0043] A sending unit is used to send the protocol client to the second terminal, so that the second terminal can establish a connection with the server based on the protocol client.

[0044] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0045] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the application code processing method provided by the embodiment of the present invention.

[0046] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0047] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the method for processing application code provided by the embodiment of the present invention is implemented.

[0048] An embodiment of the above invention has the following advantages or beneficial effects: In the embodiment of the present invention, the server can store the reused code based on the upload request, and generate and store the basic information of the reused code. When the first terminal builds the application, if the initial code used to build the application includes the identifier of the reused code, it means that the reused code is used, and a query request can be sent to the server. The server can query the corresponding basic information based on the reused code identifier in the query request and send it to the first terminal. The first terminal builds the application based on the basic information and stores it. When the second terminal accesses the constructed application, it can load the basic information of the reused code, and then obtain the reused code from the server to generate the corresponding page. In this way, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. When the second terminal accesses the application, the reused code can be obtained from the server, so that different applications can use the reused code together, that is, code reuse is realized; in addition, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information obtained by the second terminal is the same. At this time, the second terminal only needs to obtain the reused code from the server once, which can be used to generate pages corresponding to different applications. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0049] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0051] Figure 1 is a schematic diagram of a main process of a method for processing application code according to an embodiment of the present invention;

[0052] Figure 2 is a schematic diagram of another main process of a method for processing application code according to an embodiment of the present invention;

[0053] Figure 3 is a schematic diagram of another main flow of a method for processing application code according to an embodiment of the present invention;

[0054] Figure 4 is a schematic diagram of a main process of a method for updating a multiplexed code according to an embodiment of the present invention;

[0055] Figure 5 is a schematic diagram of main units of an application code processing device according to an embodiment of the present invention;

[0056] Figure 6 is another schematic diagram of main units of the application code processing device according to an embodiment of the present invention;

[0057] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0058] Figure 8 It is a schematic diagram of the structure of a computer system suitable for implementing the embodiment of the present invention. DETAILED DESCRIPTION

[0059] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0060] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.

[0061] An embodiment of the present invention provides an application code processing system, which can be used in a scenario where code is reused when a terminal accesses an application.

[0062] Specifically, the processing system may include a server, a terminal for application construction (such as a first terminal) and a terminal for application access (such as a second terminal). In the real-time example of the present invention, the terminal for application construction is the first terminal, and the terminal for application access is the second terminal. The server can be used for storage and management of reused codes; the first terminal can be used for application development, and application construction based on the reused code stored in the server, and then receive access to the constructed application from the second terminal; the second terminal can be used to access each application.

[0063] At present, different applications are usually constructed using different first terminals. Even if the same reused code is used when different applications are developed, their codes will be stored separately after development and are independent of each other. Therefore, the application construction is also independent of each other. When the second terminal accesses the different applications, the codes of each application are not related and need to be obtained separately, so code reuse cannot be achieved, reducing the efficiency of application access. In the embodiment of the present invention, the reused code is stored in the server. If the reused code is used when the application is developed, the first terminal corresponding to the application can construct the application based on the basic information of the application code in the server. In this way, if different applications use the same reused code, the constructed application includes the same basic information.

[0064] The second terminal is a terminal used by the user, and the user can access the applications built by the first terminal through the browser in the second terminal. When the second terminal accesses the application built by the first terminal, it can obtain the basic information of the reused code used to build the application, and then obtain the reused code from the server to generate the page corresponding to the built application. At the same time, the second terminal will cache the reused code after obtaining it. If during the reused code caching period, when the second terminal accesses the application built by other first terminals, it can be determined based on the basic information that the reused code also needs to be used, then the second terminal can directly obtain the reused code from the cache without having to obtain it from the server, so that code reuse can be achieved and the efficiency of application access can be improved.

[0065] The embodiment of the present invention provides a method for processing application code, which can be executed by a server, such as Figure 1 As shown, the method includes:

[0066] S101: In response to an upload request, obtain the reuse code, reuse code identifier and version identifier in the upload request, store the reuse code to a preset storage address, generate and store basic information of the reuse code based on the storage address, reuse code identifier and version identifier.

[0067] The upload request may be sent when uploading the server after the reused code is developed and completed, and may be sent by the first terminal or by other terminals.

[0068] The upload request may include the reuse code, reuse code identifier and version identifier. The reuse code is usually stored in the CDN server, and its storage address can be preset, so after the server obtains the reuse code in the upload request, it can store it in the preset storage address, and then generate and store the basic information of the reuse code based on the storage address, reuse code identifier and version identifier.

[0069] Specifically, a service program for uploading can be pre-set in the terminal for uploading the reused code, and then the reused code, reused code identifier and version identifier are uploaded to the server by calling the service program. The uploaded reused code can be a pre-built umd package.

[0070] It should be noted that Node.js (an open source and cross-platform JavaScript runtime environment) can be run on the server to manage the reused code. The websocket communication protocol can be pre-set, so that messages can be actively pushed to the websocket client and messages sent by the websocket client can be received, that is, communication between the server and the websocket client can be realized.

[0071] S102: In response to the query request sent by the first terminal, obtain the multiplexing code identifier in the query request, query the corresponding basic information and send it to the first terminal, so that the first terminal builds an application based on the received basic information.

[0072] After the first terminal constructs an application based on the received basic information, the second terminal loads the basic information when accessing the application constructed by the first terminal, so as to obtain the reuse code from the server based on the loaded basic information and generate a corresponding page.

[0073] In an embodiment of the present invention, if an application uses a reused code stored in a server during development, it can be constructed based on the basic information of the reused code in the server, so that when the second terminal accesses the application, the reused code can be obtained from the server based on the basic information. Therefore, when the first terminal constructs the application, it can send a query request to the server to obtain the basic information of the reused code used when the application was developed. After the server receives the query request from the first terminal, it can query the corresponding basic information based on the reused code identifier in the query request, and then send it to the first terminal, so that the first terminal can construct the application based on the basic information, and then when the second terminal accesses the application constructed by the first terminal, it can load the basic information used to construct the application from the first terminal, so that the second terminal can obtain the reused code from the server based on the loaded basic information, and then generate a page corresponding to the access application.

[0074] In an embodiment of the present invention, the reuse code stored in the server can also be updated, which can be specifically performed as follows: in response to an update request, obtain the reuse code identifier, the updated reuse code and the updated version identifier in the update request; store the updated reuse code to a storage address, and generate and store the basic information corresponding to the updated reuse code based on the storage address, the reuse code identifier and the updated version identifier.

[0075] After receiving the update request, the server can obtain the reuse code identifier to determine which reuse code to update, and can query the storage address to store the updated reuse code in the queried storage address, and then generate and store the basic information corresponding to the updated reuse code.

[0076] It should be noted that in order to distinguish the reused code before and after the update, the reused code can generate a code name based on the reused code identifier and the version identifier, so that the corresponding reused code can be determined based on the reused code identifier and the version identifier.

[0077] In an embodiment of the present invention, in order to enable the second terminal to communicate with the server after accessing the first terminal, the first terminal can add a preset protocol client, such as a websocket client, when constructing an application, so that the second terminal can obtain the protocol client when accessing the application constructed by the first terminal, and then run the protocol client to establish a communication connection with the server, that is, through this connection, a request for obtaining a reuse code can be sent to the server. After the server receives the acquisition request sent by the second terminal through the connection, basic information can be obtained from the acquisition request, that is, the basic information loaded by the second terminal from the first terminal, and then the corresponding reuse code can be queried based on the basic information in the acquisition request, and the queried reuse code can be sent to the second terminal through the established connection, so that the second terminal can generate the corresponding page.

[0078] The second terminal establishes a connection with the server through the protocol client, so after the reuse code in the server is updated, the server can directly send an update prompt message to the second terminal, so that the second terminal can obtain the basic information corresponding to the updated reuse code in time, thereby updating the application code and generating an updated page. The update prompt message may include the version identifier of the updated reuse code, so that the second terminal can determine whether it needs to be updated based on the version identifier.

[0079] In this way, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. When the second terminal accesses the application, the reused code can be obtained from the server, so that different applications can use the reused code together, that is, code reuse is realized; in addition, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information obtained by the second terminal is the same. At this time, the second terminal only needs to obtain the reused code from the server once, which can be used to generate pages corresponding to different applications. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0080] Combine the following Figure 1In the embodiment shown in FIG. 1 , an embodiment of the present invention provides a method for processing an application code, which can be executed by a first terminal, such as Figure 2 As shown, the method includes:

[0081] S201: Acquire initial code for building an application, and identify an identifier of a reused code in the initial code.

[0082] Among them, the reused code is a code that can be reused by different applications, and the reused code is a part of the initial code. When the first terminal constructs an application, it is necessary to obtain the initial code used to construct the application, that is, the code after the application is developed. Since even if the reused code is used during application development, it is necessary to store it locally first for testing, so the initial code usually includes the storage address of the reused code, that is, the code address in this step, so that the corresponding reused code can be called through the storage address when the initial code is running. The storage address usually includes the identifier of the reused code, so in this step, the identifier of the reused code in the initial code is identified, and which reused codes are included in the initial code can be determined. In order to realize code reuse, the reused code of the server side needs to be used in the constructed application, so when the application is constructed, the storage address of the reused code in the initial code needs to be replaced with the storage address of the server side. After obtaining the initial code in this step, the identifier of the reused code in the initial code can be identified, and then the storage address of the reused code in the initial code can be identified. Specifically, the identifier of the reuse code stored in the server may be obtained in advance, and then the storage addresses included in the code may be screened in sequence, thereby obtaining the reuse code identifier included in the initial code.

[0083] S202: Send a query request including an identifier to the server, and then receive basic information returned by the server to build and store an application based on the basic information.

[0084] After the first terminal inquires about the basic information corresponding to the reuse code identifier from the server, the storage address including the reuse code identifier in the initial code can be replaced with the storage address in the basic information, wherein both the address information and the storage address correspond to the reuse code identifier. In addition, the basic information can be recorded, and the application can be constructed in this way, so that the second terminal can obtain the reuse code based on the basic information and correctly run the application based on the replaced code.

[0085] S203: receiving an application access request sent by the second terminal, querying basic information of a reuse code identifier corresponding to the application access request, and sending the basic information to the second terminal, so that the second terminal obtains the reuse code from the server based on the basic information.

[0086] After the first terminal builds the application, other terminals can access it to use the built application. After the first terminal receives the application access request sent by the second terminal, it can query the corresponding code based on the application access request. Since the code at this time is the initial code replaced in step S202, it can be determined that the code includes a reuse code identifier, and then determine the basic information of the reuse code identifier. After the second terminal obtains the basic information, it can obtain the reuse code from the server to generate the corresponding page.

[0087] In order to enable the second terminal to communicate with the server, when building the application, the first terminal can add a preset protocol client to the built application, and the protocol client can be a websocket client. In this way, when the second terminal accesses the first terminal, the second terminal can send the protocol client to the second terminal, so that the second terminal can establish a connection with the server based on the protocol client.

[0088] In this way, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. When the second terminal accesses the application, the reused code can be obtained from the server, so that different applications can use the reused code together, that is, code reuse is realized; in addition, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information obtained by the second terminal is the same. At this time, the second terminal only needs to obtain the reused code from the server once, which can be used to generate pages corresponding to different applications. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0089] based on Figure 1 and Figure 2 In the illustrated embodiment, the present invention provides an implementation method to illustrate the specific execution process of the method for code reuse in the second terminal after the first terminal constructs an application.

[0090] like Figure 3 As shown, the method includes:

[0091] S301: The second terminal sends an application access request to the first terminal.

[0092] The second terminal can access each application through a browser, and then send a corresponding application access request.

[0093] S302: The first terminal queries basic information corresponding to the multiplexing code identifier corresponding to the application access request.

[0094] Specifically, the first terminal may query the code corresponding to the application access request, and then determine the reuse code identifier in the code to query the basic information corresponding to the reuse code identifier.

[0095] S303: The first terminal sends the queried basic information and the preset protocol client to the second terminal.

[0096] The first terminal may send a code corresponding to the application access request to the second terminal while sending the basic information of the query.

[0097] S304: The second terminal queries whether the multiplexing code corresponding to the basic information is stored in the cache.

[0098] After the browser accesses the application, it usually caches the information obtained during the access for subsequent use. In this step, the cache can be specifically the browser's storage. If the cache stores the reused code corresponding to the basic information, it means that the reused code has been obtained when accessing other applications. In this case, the second terminal does not need to obtain it from the server again, and can run the code obtained from the first terminal and the reused code in the cache to generate the corresponding page for display.

[0099] S305: After determining that the multiplexing code corresponding to the basic information is not stored in the cache, the second terminal runs the protocol client to establish a connection with the server.

[0100] In the embodiment of the present invention, the multiplexing code corresponding to the basic information not stored in the cache is taken as an example for description.

[0101] S306: The second terminal sends an acquisition request including basic information to the server through the connection.

[0102] S307: The server queries and obtains the multiplexing code corresponding to the basic information in the request, and sends it to the second terminal.

[0103] S308: The second terminal runs the code obtained from the first terminal and the reused code obtained from the server, and generates a corresponding page for display.

[0104] It should be noted that the data processing principle in the embodiment of the present invention is the same as Figure 1 and Figure 2 The data processing principle in the illustrated embodiments is the same and will not be described in detail here.

[0105] In this way, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. Therefore, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information that the second terminal can obtain is the same. At this time, it is only necessary to obtain the reused code from the server once, and it can be used to generate pages corresponding to different applications. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0106] based on Figure 1 , Figure 2and Figure 3 The embodiment shown in the figure, the present invention provides an implementation method to illustrate the specific execution process of the method for updating the reused code. Figure 4 As shown, the method includes:

[0107] S401: The server receives an update request, and obtains a reuse code identifier, an updated reuse code, and an updated version identifier in the update request.

[0108] S402: The server stores the updated reuse code to a storage address, generates and stores basic information corresponding to the updated reuse code based on the storage address, the reuse code identifier and the updated version identifier.

[0109] S403: The server sends an update prompt message to the second terminal based on the connection, where the update prompt message includes basic information of the updated multiplexing code.

[0110] S404: The second terminal queries the stored basic information, determines that the updated version identifier is higher than the version identifier in the stored basic information, and then sends an acquisition request to the server, where the acquisition request includes the basic information of the updated reuse code.

[0111] The second terminal may obtain the reuse code identifier and the updated version identifier based on the basic information in the update prompt message, and then query the stored basic information based on the reuse code identifier.

[0112] S405: The server queries the corresponding multiplexing code based on the basic information in the acquisition request, and sends it to the second terminal.

[0113] S406: The second terminal runs the obtained multiplexing code to update and display the corresponding page.

[0114] It should be noted that the data processing principle in the embodiment of the present invention is the same as Figure 1 and Figure 2 The data processing principle in the illustrated embodiments is the same and will not be described in detail here.

[0115] In the embodiment of the present invention, after the reused code is updated, the server can directly notify the second terminal to update the reused code without the first terminal having to re-build the application based on the updated reused code, thereby improving the efficiency of code update.

[0116] In order to solve the problems existing in the prior art, an embodiment of the present invention provides an application code processing device 500, such as Figure 5 As shown, the device 500 includes:

[0117] The storage unit 501 is used to obtain the reuse code, the reuse code identifier and the version identifier in the upload request in response to the upload request, store the reuse code to a preset storage address, and generate and store basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier;

[0118] The query unit 502 is used to respond to the query request sent by the first terminal, obtain the multiplexing code identifier in the query request, query the corresponding basic information and send it to the first terminal, so that the first terminal builds an application based on the received basic information.

[0119] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 The method of the illustrated embodiment is the same and will not be described again here.

[0120] In an implementation of the embodiment of the present invention, the storage unit 501 is further used for:

[0121] In response to the update request, obtaining the reuse code identifier, the updated reuse code, and the updated version identifier in the update request;

[0122] The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier.

[0123] In another implementation of the embodiment of the present invention, the query unit 502 is further configured to:

[0124] In response to an acquisition request sent by a second terminal through a connection, wherein the acquisition request includes basic information loaded, and the connection is established when the second terminal accesses an application constructed by the first terminal;

[0125] Based on the basic information in the acquisition request, the corresponding multiplexing code is queried, and the queried multiplexing code is sent to the second terminal through the connection.

[0126] In another implementation of the embodiment of the present invention, the query unit 502 is further used to receive an update request, obtain the multiplexing code identifier, the updated multiplexing code and the updated version identifier in the update request; store the updated multiplexing code to the storage address, and generate and store the basic information corresponding to the updated multiplexing code based on the storage address, the multiplexing code identifier and the updated version identifier;

[0127] The device 500 further includes:

[0128] An update prompt message is sent to the second terminal based on the connection, so that the second terminal obtains basic information corresponding to the updated multiplexing code.

[0129] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 , 3 , and the method of the embodiment shown in 4 is the same and will not be repeated here.

[0130] In the embodiment of the present invention, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. Therefore, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information that the second terminal can obtain is the same. At this time, it is only necessary to obtain the reused code from the server once to generate pages corresponding to each different application. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0131] In order to solve the problems existing in the prior art, an embodiment of the present invention provides an application code processing device 600, which is arranged in a first terminal, such as Figure 6 As shown, the device 600 includes:

[0132] The acquisition unit 601 is used to acquire the initial code for constructing the application, and identify the identifier of the reused code in the initial code, wherein the reused code is a code that can be reused by different applications, and the reused code is a part of the initial code;

[0133] A construction unit 602 is used to send a query request including the identifier to a server, and then receive basic information returned by the server to construct and store an application based on the basic information;

[0134] The query unit 603 is used to receive an application access request sent by the second terminal, query basic information of the multiplexing code identifier corresponding to the application access request, and send it to the second terminal, so that the second terminal obtains the multiplexing code from the server based on the basic information.

[0135] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 2 The method of the illustrated embodiment is the same and will not be described again here.

[0136] In an implementation of the embodiment of the present invention, the basic information includes a multiplexing code identifier and a storage address corresponding to the multiplexing code identifier; the construction unit 602 is specifically used to:

[0137] For each reuse code identifier, the address information in the initial code is replaced with the storage address in the basic information, and then the application is constructed based on the initial code after the address is replaced, wherein the address information and the storage address both correspond to the reuse code identifier.

[0138] In another implementation of the embodiment of the present invention, the construction unit 602 is specifically used to add a preset protocol client to the constructed application;

[0139] The device 600 further includes:

[0140] A sending unit is used to send the protocol client to the second terminal, so that the second terminal can establish a connection with the server based on the protocol client.

[0141] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 2 , 3 , and the method of the embodiment shown in 4 is the same and will not be repeated here.

[0142] In the embodiment of the present invention, each application developed using the reused code can be constructed by querying the basic information corresponding to the reused code from the server. Therefore, when the second terminal accesses different applications, if the accessed applications all use the same reused code, the basic information that the second terminal can obtain is the same. At this time, it is only necessary to obtain the reused code from the server once to generate pages corresponding to each different application. There is no need to repeatedly obtain the reused code, thereby realizing code reuse and improving the efficiency of application access.

[0143] According to an embodiment of the present invention, the embodiment of the present invention further provides an electronic device and a readable storage medium.

[0144] An electronic device according to an embodiment of the present invention comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the application code processing method provided by the embodiment of the present invention.

[0145] Figure 7 An exemplary system architecture 700 is shown to which the method for processing application code or the apparatus for processing application code according to the embodiment of the present invention can be applied.

[0146] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0147] The user can use the terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various client applications can be installed on the terminal devices 701, 702, 703.

[0148] The terminal devices 701 , 702 , and 703 may be, but are not limited to, smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0149] The server 705 may be a server that provides various services. The server may analyze and process the received query request and other data, and feed back the processing results (such as basic information - just an example) to the terminal device.

[0150] It should be noted that the application code processing method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the application code processing device is generally set in the server 705 .

[0151] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0152] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 suitable for implementing an embodiment of the present invention. Figure 8 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0153] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0154] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0155] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0156] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0157] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a unit, a program segment, or a part of a code, and the above-mentioned unit, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0158] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be arranged in a processor, for example, it may be described as: a processor includes a storage unit and a query unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the storage unit may also be described as a "unit of the function of the storage unit".

[0159] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the application code processing method provided by the present invention.

[0160] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing application code, characterized in that: include: In response to an upload request, obtaining a reuse code, a reuse code identifier and a version identifier in the upload request, storing the reuse code to a preset storage address, and generating and storing basic information of the reuse code based on the storage address, the reuse code identifier and the version identifier; In response to a query request sent by the first terminal, obtaining a multiplexing code identifier in the query request, querying corresponding basic information and sending the basic information to the first terminal, so that the first terminal constructs an application based on the received basic information; Receiving an update request, and obtaining a reuse code identifier, an updated reuse code, and an updated version identifier in the update request; The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier; An update prompt message is sent to the second terminal based on a connection so that the second terminal obtains basic information corresponding to the updated multiplexing code, the connection is established when the second terminal accesses an application built by the first terminal, and the second terminal is a terminal that has obtained the multiplexing code before the update.

2. The method according to claim 1, characterized in that After generating and storing the basic information of the multiplexing code based on the storage address, the multiplexing code identifier and the version identifier, the method further includes: In response to the update request, obtaining the reuse code identifier, the updated reuse code, and the updated version identifier in the update request; The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier.

3. The method according to claim 1, characterized in that After the querying of the corresponding basic information and sending it to the first terminal, the method further includes: Responding to an acquisition request sent by the second terminal through the connection, wherein the acquisition request includes the loaded basic information; Based on the basic information in the acquisition request, the corresponding multiplexing code is queried, and the queried multiplexing code is sent to the second terminal through the connection.

4. A method for processing application code, characterized in that: include: Acquire the initial code for building the application, and identify the identifier of the reused code in the initial code, wherein the reused code is code that can be reused by different applications, and the reused code is a part of the initial code; Sending a query request including the identifier to a server, and then receiving basic information returned by the server, so as to construct and store an application based on the basic information; Receive an application access request sent by a second terminal, query basic information of a reuse code identifier corresponding to the application access request, and send a protocol client and the basic information in the constructed application to the second terminal, so that the second terminal establishes a connection with the server, and obtains the reuse code from the server based on the basic information, and enables the second terminal to obtain the basic information corresponding to the updated reuse code after receiving an update prompt message sent by the server through the connection, the update prompt message is generated after the server stores the updated reuse code to a storage address after receiving the update request, and generates and stores the basic information corresponding to the updated reuse code based on the storage address, the reuse code identifier and the updated version identifier.

5. The method according to claim 4, characterized in that The basic information includes a multiplexing code identifier and a storage address corresponding to the multiplexing code identifier; Building an application based on the basic information includes: For each reuse code identifier, the address information in the initial code is replaced with the storage address in the basic information, and then the application is constructed based on the initial code after the address is replaced, wherein the address information and the storage address both correspond to the reuse code identifier.

6. The method according to claim 4, characterized in that Building an application based on the basic information includes: Add the preset protocol client to the built application.

7. A device for processing application code, characterized in that: include: A storage unit, configured to, in response to an upload request, obtain a reuse code, a reuse code identifier, and a version identifier in the upload request, store the reuse code in a preset storage address, and generate and store basic information of the reuse code based on the storage address, the reuse code identifier, and the version identifier; A query unit, configured to respond to a query request sent by the first terminal, obtain a multiplexing code identifier in the query request, query corresponding basic information and send the basic information to the first terminal, so that the first terminal constructs an application based on the received basic information; The device also includes: Receiving an update request, and obtaining a reuse code identifier, an updated reuse code, and an updated version identifier in the update request; The updated multiplexing code is stored in the storage address, and basic information corresponding to the updated multiplexing code is generated and stored based on the storage address, the multiplexing code identifier and the updated version identifier; An update prompt message is sent to the second terminal based on a connection so that the second terminal obtains basic information corresponding to the updated multiplexing code, the connection is established when the second terminal accesses an application built by the first terminal, and the second terminal is a terminal that has obtained the multiplexing code before the update.

8. A device for processing application code, characterized in that: include: An acquisition unit, used to acquire an initial code for constructing an application, and identify an identifier of a reused code in the initial code, wherein the reused code is a code that can be reused by different applications, and the reused code is a part of the initial code; A construction unit, configured to send a query request including the identifier to a server, and then receive basic information returned by the server, so as to construct and store an application based on the basic information; A query unit is used to receive an application access request sent by a second terminal, query basic information of a reuse code identifier corresponding to the application access request, so as to send a protocol client and the basic information in a constructed application to the second terminal, so that the second terminal establishes a connection with the server, and obtains a reuse code from the server based on the basic information, and enables the second terminal to obtain basic information corresponding to the updated reuse code after receiving an update prompt message sent by the server through the connection, wherein the update prompt message is generated when the server stores the updated reuse code to a storage address after receiving the update request, and generates basic information corresponding to the updated reuse code based on the storage address, the reuse code identifier and the updated version identifier and stores it.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Application engineering construction method and device, equipment and computer readable storage medium

    CN112965746A