Application generation method and device, equipment and storage medium

By obtaining and compiling the code files of desktop applications, generating web-side applications that can be run in the browser, solving the cost and efficiency problems of writing codes of various running versions and achieving efficient application development.

CN119597260APending Publication Date: 2025-03-11SHENZHEN FUTU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411404025.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

When developing applications, you need to write code for multiple running versions separately, resulting in high cost and low efficiency of application development.

Method used

By obtaining the function code files and interface library code files of the desktop version of the target application, compiling and linking, a target code file that can run in the browser, thereby generating the target application on the web page version.

Benefits of technology

There is no need to write code for multiple running versions, which improves application development efficiency and reduces application development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597260A_ABST
    Figure CN119597260A_ABST
Patent Text Reader

Abstract

The invention provides an application generation method and device, equipment and a storage medium. The application generation method comprises the steps of obtaining a function code file and an interface library code file of a target application program of a desktop end version; compiling the function code file to obtain an intermediate code file; compiling the interface library code file to obtain a static library file; linking the intermediate code file and the static library file to obtain a target code file capable of running in the browser; and generating a target application program of the webpage end version according to the target code file. The application development efficiency is improved, and the application development cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to an application generation method, apparatus, device and storage medium. Background Art

[0002] Application programs, referred to as applications for short, can include multiple operating versions depending on the operating environment or operating mode. For example, the versions of the same application generally include: desktop version and web version, that is, the same application generally includes desktop applications and web applications. Desktop applications refer to applications that are directly installed on users' computers and other devices; web applications (or, web applications) are applications that present user interfaces and content through browsers.

[0003] At present, when developing applications, it is often necessary to develop multiple versions of the application, that is, to write the code of each version separately to complete the development of multiple versions. For example, for the same application, developers need to write the application code of the desktop and web versions separately to complete the development of the two versions of the desktop application and the web application. Obviously, this will not only lead to higher application development costs, but also affect application development efficiency. Summary of the invention

[0004] The present application provides an application generation method, apparatus, device and storage medium to improve application development efficiency and reduce application development costs.

[0005] In a first aspect, the present application provides an application generation method, the method comprising: obtaining a function code file and an interface library code file of a desktop version of a target application; compiling the function code file to obtain an intermediate code file; compiling the interface library code file to obtain a static library file; linking the intermediate code file and the static library file to obtain a target code file that can run on a browser; and generating a web version of a target application based on the target code file.

[0006] In the second aspect, the present application provides an application generation device, including: a file acquisition module, used to obtain the function code file and interface library code file of the desktop version of the target application; a first compilation module, used to compile the function code file to obtain an intermediate code file; a second compilation module, used to compile the interface library code file to obtain a static library file; a file linking module, used to link the intermediate code file and the static library file to obtain a target code file that can run on a browser; an application generation module, used to generate a web version of the target application according to the target code file.

[0007] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, and executing the method in the first aspect or its various implementations.

[0008] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program enables a computer to execute the method in the first aspect or its various implementations.

[0009] In a fifth aspect, the present application provides a computer program product, comprising computer program instructions, which enable a computer to execute the method in the first aspect or its various implementations.

[0010] In a sixth aspect, the present application provides a computer program, which enables a computer to execute the method in the first aspect or its various implementations.

[0011] Through the technical solution of the present application, the terminal device can generate a web version of the target application based on the function code files and interface library code files of the desktop version of the target application, thereby eliminating the need to write separate codes for multiple running versions of the same application. Therefore, the application development efficiency can be improved and the application development cost can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] 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.

[0013] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0014] Figure 2 A flowchart of an application generation method provided in an embodiment of the present application;

[0015] Figure 3 A schematic diagram of an application generation method provided in an embodiment of the present application;

[0016] Figure 4 A schematic diagram of another application generation method provided in an embodiment of the present application;

[0017] Figure 5 A schematic diagram of another application generation method provided in an embodiment of the present application;

[0018] Figure 6A schematic diagram of an application generating device 600 provided in an embodiment of the present application;

[0019] Figure 7 A schematic block diagram of an electronic device 700 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] As mentioned above, when developing an application, it is often necessary to separately write codes for various running versions of the application, which not only leads to higher application development costs, but also affects application development efficiency.

[0024] In order to solve the above technical problems, the inventive concept of the present application is to generate a web version of the target application based on the function code file and interface library code file of the desktop version of the target application.

[0025] It should be understood that the technical solution of the present application can be applied to the following scenarios, but is not limited to:

[0026] In one embodiment, the present application can be applied to a display scenario of application development, and specifically can be applied to: a development scenario of developing a web application based on a desktop application.

[0027] In addition, the present application can also be applied to the process of developing a web version of a target application based on a mini-program version of a target application. The corresponding specific content is similar to the content of generating a web version of a target application based on a desktop version of a target application. To avoid repetition, the present application will not go into details.

[0028] In one embodiment, Figure 1 As shown, the application scenario may include a terminal device 110 and a server 120, and the terminal device 110 and the server 120 may be connected via a wired network or a wireless network.

[0029] Exemplarily, a desktop version of the target application and a browser can be installed on the terminal device 110. The terminal device 110 can obtain the code files of the desktop version of the target application (for example, function code files and interface library code files) based on data compliance requirements, or obtain the code files of the desktop version of the target application from other channels; thereafter, the web version of the target application can be generated according to the desktop version of the target application through the technical solution of the present application; thereafter, the web version of the target application can be deployed to the server 120, so that the web version of the target application can be accessed in the browser through a uniform resource locator (URL), that is, the web version of the target application can run in the browser on the terminal device 110.

[0030] The server 120 may be a server, a server cluster consisting of multiple servers, or a cloud platform control center, but is not limited thereto. The terminal device 110 may be a mobile phone, a tablet computer, a laptop computer, or a desktop computer, but is not limited thereto.

[0031] It should be noted that Figure 1 The terminal devices and servers are merely exemplary. Specifically, other numbers or types of terminal devices or servers may also be included.

[0032] After introducing the application scenarios of the embodiments of the present application, the technical solution of the present application will be described in detail below:

[0033] Figure 2 This is a flowchart of an application generation method provided in an embodiment of the present application. The method can be executed by the terminal device 110 in the above application scenario, but is not limited thereto. Figure 2 As shown, the method may include the following steps:

[0034] S210: Obtaining a function code file and an interface library code file of a desktop version of a target application;

[0035] S220: Compile the function code file to obtain an intermediate code file;

[0036] S230: compile the interface library code file to obtain a static library file;

[0037] S240: Linking the intermediate code file and the static library file to obtain a target code file that can be run on the browser;

[0038] S250: Generate a web version of the target application according to the target code file.

[0039] This application will first explain the terms involved in the embodiment in the following content:

[0040] Function code files refer to code files that implement application functions of the target application of the desktop version. The application functions may be functions related to the interaction with the user interface (UI), but are not limited thereto. For example, they may be functions such as displaying charts, drawing lines, and conducting virtual resource transactions. In addition, it should be noted that the function code files include function logic codes and function interface codes, wherein the function logic codes refer to codes that implement the function logic corresponding to different application functions in the target application, and the function interface codes refer to codes that implement the function interface corresponding to different application functions of the target application.

[0041] The desktop terminal may be a desktop terminal running on Windows, Mac, Linux and other systems, but is not limited thereto. The programming language used to develop the above function code file may be C language, C++ language, Rust language, but is not limited thereto.

[0042] It should be noted that the function code file may be a function code file corresponding to all functions of the target application of the desktop version, or may be a function code file corresponding to part of the functions.

[0043] The interface library code file refers to the code file that implements the user interface design and layout of the target application of the desktop version, for example, it can be a code file related to the UI library (i.e., interface library), but not limited to this. Among them, the UI library can be DuiLib, MFC, wxWidget, Qt, but not limited to this.

[0044] The programming language used to develop the above interface library code file may be JavaScript, but is not limited thereto.

[0045] The intermediate code file refers to an intermediate file (eg, a binary file) generated during the compilation of the function code file, and includes the machine code and program structure after the function code file is converted.

[0046] The file type of the intermediate code file may be an OBJ (Wavefront OBJect) file, and the corresponding extension may be .obj, but is not limited thereto.

[0047] A static library file refers to a file obtained by compiling an interface library code file. It contains all necessary interface elements and logic involved in the interface library code file and can be used to generate the user interface of the web version of the target application.

[0048] The file type of the static library file may be a static link library file, and the corresponding extension may be .a, but is not limited thereto.

[0049] The target code file refers to the code file that can be run on the browser by linking the intermediate code file and the static library file. The target code file includes the web page executable code file and the glue layer code file.

[0050] Here, “capable of running in a browser” means that it can be interpreted or executed in a browser environment.

[0051] Linking can ensure the interaction between the intermediate code file and the static library file, and by merging the intermediate code file and the static library file, a code file that can be run in the browser, namely the target code file, is obtained.

[0052] The web-side executable code file refers to the code file that can be directly run in the browser after the function code files and interface library code files of the desktop version of the target application are compiled or converted and linked, and can provide an application interface and functions consistent with the desktop version of the target application. In other words, the application interface (or called functional interface) and application functions corresponding to the web-side version of the target application obtained by loading the web-side executable code file in the browser are consistent with the application interface and application functions corresponding to the desktop version of the target application.

[0053] The glue layer code file can process the web page executable code file to obtain the web page version of the target application. The glue layer code file refers to a file used to connect various web page executable code files so that the various web page executable code files can work together. The glue layer code file can be a file based on the browser's native language (for example, HTML language and JavaScript language). Specifically, the glue layer code can "glue" together different components or layers in the web page executable code file to ensure that different components or layers can run smoothly and stably in the browser.

[0054] Among them, the terminal device can perform the above compilation and linking based on WebAssembly (Wasm) technology, and can specifically use Emscripten SDK (Software Development Kit). Emscripten is a tool chain that compiles C / C++ code into Wasm modules (the file type of the file included in the Wasm module can be a WebAssembly (Wasm) file, and the corresponding extension is .wasm), and Java Script code. Correspondingly, the executable code file on the web page can be the file corresponding to the Wasm module in the target code file, and the glue layer code file is the file corresponding to the JavaScript code in the target code file.

[0055] This application will introduce the various steps involved in the embodiment in the following content:

[0056] In one embodiment, for S210, the terminal device may first determine the target application of the desktop version; then, the terminal device may determine the functional information of each code file included in the target application of the desktop version based on the programming annotations involved in the target application of the desktop version; then, the terminal device may identify the functional code files and interface library code files in the target application of the desktop version based on the above-mentioned functional information; thereafter, the terminal device may locate the functional code files and interface library code files through regular expressions, thereby obtaining the functional code files and interface library code files.

[0057] In addition, since the subsequent steps require the compilation of the interface library code file, for example, the interface library code file needs to be compiled by a compiler, the terminal device can also determine the compilation compatibility information between the compiler and the interface library code file before obtaining the interface library code file, and then determine the interface library code file or compiler that needs to be obtained based on the compilation compatibility information.

[0058] Among them, compilation compatibility information refers to relevant information used to indicate whether the interface library code file supports the compiler's compilation technology (specifically, whether the compiler is supported to compile the corresponding binary file (i.e., static library file)), that is, it refers to relevant information used to indicate whether the compiler can compile the binary file corresponding to the interface library code file.

[0059] For example, the interface library code file is a code file built using a UI library based on the Qt framework, and supports compiler 1 to compile the corresponding static library file. The interface library code file obtained by the terminal device can be a code file related to Qt. At the same time, the compiler used by the terminal device when subsequently compiling the interface library code file can be compiler 1.

[0060] In one embodiment, for S220 and S230, the terminal device may compile the function code file and the interface library code file respectively according to the compiler, and obtain the intermediate code file and the static library file accordingly.

[0061] The compiler may be a compiler that supports Wasm technology, for example, a compiler based on Ems cripten SDK, or a Binaryen toolchain, WasmEdge, etc., but not limited thereto.

[0062] It should be noted that the terminal device can use the same or different modules of the same compiler to compile the function code files and the interface library code files, or use different compilers to compile the function code files and the interface library code files. This application does not impose any restrictions on this.

[0063] In addition, the present application does not limit the execution order of S220 and S230. For example, the terminal device may execute S220 and S230 simultaneously, or execute S220 first and then S230, or execute S230 first and then S220.

[0064] In one embodiment, in combination with the above explanation of the terms, after the terminal device links the intermediate code file and the static library file, the target code file obtained may include: a web page executable code file and a glue layer code file that can run on the browser, that is, the above S240 may include: linking the intermediate code file and the static library file to obtain a web page executable code file and a glue layer code file that can run on the browser.

[0065] The terminal device may perform the linking process based on the linking function provided by the Emscripten SDK; or, the terminal device may perform the linking process based on a preset linker, wherein the linker may be lld (LLVM LinkerDaemon) or GNU ld, but is not limited thereto.

[0066] Specifically, when the terminal device links the intermediate code file and the static library file, it can first parse the symbol identifiers and symbol reference relationships included in the intermediate code file and the static library file, wherein the symbol identifier can be a function name or a variable name, etc., and the symbol reference relationship refers to the reference relationship between each symbol identifier; then, the terminal device can extract the code segments and data segments in the intermediate code file and the static library file according to the symbol identifier and symbol reference information, and merge the code segments and the data segments to obtain a merged file; finally, the terminal device can divide the merged file into a web page executable code file and a glue layer code file in combination with the code functions corresponding to the web page executable code file and the glue layer code file, thereby completing the linking of the intermediate code file and the static library file.

[0067] In the above embodiment, the terminal device can link the intermediate code file and the static library file, not only to achieve full merging and interaction of the intermediate code file and the static library file, and generate a web version of the target application whose application interface and application functions are closer to the desktop version of the target application; it can also obtain modular files that are more convenient to maintain and use, namely the web executable code file and the glue layer code file.

[0068] Accordingly, in one embodiment, the above S250 may include: processing the web page executable code file through the glue layer code file to generate a web page version of the target application.

[0069] Specifically, the above-mentioned processing of the web-side executable code file through the glue layer code file to generate the web-side version of the target application can include: compiling and instantiating the web-side executable code file through the glue layer code file to obtain the instantiated code file; accessing and calling the instantiated code file through the glue layer code file to obtain the calling result; and generating the web-side version of the target application according to the calling result.

[0070] The above-mentioned compilation of the executable code file can be understood as escaping or packaging the executable code file, the purpose of which is to enable the executable code file to run in the current browser.

[0071] The instantiation of the web page executable code file may specifically be to create an instance of the compiled executable code file. Specifically, the terminal device may activate components in the compiled executable code file, perform initialization state settings (e.g., setting initial attribute values, etc.) and run logic configuration (e.g., registering event listeners, configuring routing, etc.) for components or services in the compiled executable code file through the glue layer code file. Accordingly, the instantiated code file refers to a file obtained after instantiating the compiled executable code file.

[0072] By compiling and instantiating the web page executable code files, not only can the compatibility and performance of the web page executable code files be ensured, but also the corresponding components can be activated so that they can respond to user operations and display corresponding content.

[0073] The above-mentioned access and calling of the instantiation code file through the glue layer code file can be understood as a process of converting the instantiation code file into a specific form, and the specific form refers to the form in which the browser displays the application interface and application functions. Specifically, the instantiation code file can be obtained through the glue layer code file first, and then the instantiation code file can be converted into the above-mentioned specific form.

[0074] The above-mentioned generating the target application of the web version according to the calling result may specifically be determining the calling result as the target application of the web version.

[0075] The call result can be understood as the output result after calling the instantiated code file, which may specifically include: the application interface suitable for browser display and the elements corresponding to the application functions that the browser needs to provide, for example, the HTML structure, CSS style, JavaScript logic corresponding to the executable code file on the web page, and the page routing information for controlling the navigation and content display of the application page, etc.

[0076] Combined with the above explanations of each term, it can be understood that the glue layer code file is a file based on the native language of the browser, so it can be executed in the browser more stably and smoothly, and the glue layer code file also has good compatibility, and can run on various types of browsers with consistent running results; based on this, it can be seen that the terminal device can use the glue layer code to control the loading process of the web-side executable code file (specifically including compiling, instantiating, calling and outputting the web-side executable code file) to ensure that the generated web-side version of the target application can achieve better interaction with the browser, so that the effect produced by the generated web-side version of the target application after running is closer to the effect produced by the running of the desktop version of the target application, and ensure that the running effect of the web-side version of the target application on various types of browsers is consistent, thereby improving the stability of the application display effect and the user experience.

[0077] The above embodiment is introduced below through a schematic diagram:

[0078] In one embodiment, Figure 3 As shown, the terminal device can first obtain the Qt source code (i.e., the interface library code file) and the desktop C++ code (i.e., the function code file); then, they can be compiled separately to obtain a static link library file (.a file, i.e., the static library file) and an OBJ file (i.e., the intermediate code file); finally, the terminal device can link the static link library file and the OBJ file to obtain a Wasm file (i.e., the web page executable code file) and JavaScript code (i.e., the glue layer code file); thereafter, the Wasm file can be processed by the JavaScript code to generate a web page version of the target application.

[0079] Through the above embodiments, the interface library code file can be compiled to obtain a static library file, and the function code file including the function interface code can be compiled in combination with the static library file obtained after the compilation to obtain an intermediate code file. After that, the function interface code in the function code file used to display the function interface of different application functions can be compiled into a code file that can be directly used on the browser and presents the corresponding function interface by linking the intermediate code file and the static library file, and the code file can be deployed on the server, so that when the web version of the target application is accessed through the URL in the browser, the corresponding function interface can be directly rendered and displayed by pulling the code file, without the need to do secondary UI development for the function interface of the web version of the target application. In other words, the terminal device can extend the application functions and function interfaces (for example, including but not limited to functions and interfaces related to UI interaction) of the desktop version of the target application to the web version of the target application with lower cost, higher efficiency and more stable performance, so as to achieve the effect of "one set of code, multiple terminals reuse", which can improve development efficiency and code reuse.

[0080] The following is an introduction to the data transmission content involved in the web version of the target application, that is, the process of creating a communication channel and making a network request between the web version of the target application and the target server corresponding to the web version of the target application:

[0081] In one embodiment, the target service side corresponding to the web version of the target application includes an access layer and a business side service, wherein the business side service is used to process the business functions corresponding to the web version of the target application, and the access layer is used to process the data transmission between the web version of the target application and the business side. The present application can first create a web version communication channel; then, the web version communication channel is built on the access layer; thereafter, based on the web version communication channel, data can be transmitted between the web version of the target application and the business side service, that is, the web version of the target application can transmit data to the business side service through the web version of the communication channel.

[0082] Specifically, the data transmission between the target application of the web version and the business-side service includes the following two situations:

[0083] Scenario 1: The business-side service pushes data to the web version of the target application.

[0084] For example, during the intraday period, after the stock price changes, the business-side service can push the stock price data to the target application of the web version through the web communication channel of the access layer. The data protocol used for the push is agreed upon by the target application of the web version and the business-side service. After receiving the stock price data, the target application of the web version unpacks the stock price data according to the protocol format, obtains the UI display data corresponding to the stock price data, and refreshes the UI display according to the corresponding UI display data, that is, updates the application interface.

[0085] Scenario 2: The target application of the web version actively requests data from the business-side service.

[0086] For example, if a user places an order based on the web version of the target application and clicks the "buy button", the web version of the target application can send the message request corresponding to the order operation to the web communication channel of the access layer according to the message protocol agreed upon with the business-side service. The access layer can select the brokerage channel according to the brokerage corresponding to different order operations. Finally, the business service corresponding to the brokerage channel in the business-side service responds to the message request corresponding to the above order operation to complete the order operation.

[0087] Among them, the target server can be the execution subject in the above embodiment: the server, or it can be a module or unit of the server, or it can be other equipment different from the server, and this application does not impose any restrictions on this.

[0088] In addition, the target server corresponding to the target application of the web version can be the same device as the target server corresponding to the target application of the desktop version, and this application does not impose any restrictions on this.

[0089] It is understandable that since the protocols involved in the communication between the desktop version of the target application and its corresponding target server (for example, the transmission of business data or request data) may be different from the protocols involved in the communication between the web version of the target application and its corresponding target server, in order to ensure that the generated web version of the target application and its corresponding target server can perform more stable and efficient data transmission, the server can create a specific communication channel, namely the web communication channel, to realize data transmission between the web version of the target application and the target server.

[0090] In addition, since the web-side communication channel is built on the access layer, it will not affect the original logic of the business-side service, achieve decoupling between different functions, and facilitate system maintenance.

[0091] The following is an introduction to the process of creating a web-side communication channel:

[0092] In one embodiment, the server may first create a web page communication object; then, initialize the internal data structure of the web page communication object to obtain a web page communication endpoint; then, the web page communication endpoint may be bound to the target server according to the communication address of the target server; thereafter, the server may set a connection establishment function, a data transmission function, and a connection closing function; finally, the server may obtain a web page communication channel according to the web page communication endpoint, the connection establishment function, the data transmission function, and the connection closing function.

[0093] The web-side communication object refers to an entity or data structure used for communication between the web-side version of the target application and the target server, which encapsulates the data required for the communication process (including but not limited to: fields for storing connection status, session information, security credentials, etc.). When the web-side version of the target application and the target server communicate, they can send requests, receive responses, manage connections, etc. based on the web-side communication object (specifically based on the web-side communication endpoint determined according to the web-side communication object).

[0094] The above-mentioned initialization processing of the internal data structure of the web page communication object may include: setting the parameters and configuration options necessary for the communication process according to the internal data structure of the web page communication object, for example, setting the protocol, port range and domain name used to communicate with the target server, but not limited to this.

[0095] After initializing the internal data structure of the web page communication object, a web page communication endpoint can be generated based on the initialized web page communication object. The web page communication endpoint refers to a specific point or interface (specifically, an Internet Protocol Address (IP) address and port number) used to identify the accessible address of the target server when communicating between the web page version of the target application and the target server, which allows the web page version of the target application and the target server to send requests and receive responses. Specifically, the server can first extract endpoint-related information from the initialized web page communication object, such as the protocol, port range, and domain name used to communicate with the target server, and then determine a port number based on the endpoint-related information, and determine the port number as the web page communication endpoint.

[0096] The above-mentioned binding of the web page communication endpoint to the target server according to the communication address of the target server includes: registering the web page communication endpoint to the communication address of the target server. Specifically, the communication address of the target server refers to the unique identifier of the target server on the network, including an IP address and a port number, wherein the included IP address is used to locate the physical or virtual location of the target server, and the port number is used to distinguish different services running on the target server. Registering the web page communication endpoint to the communication address of the target server may refer to adding the port number corresponding to the web page communication endpoint to the communication address of the target server to specify the service running on the target server for communication between the web version of the target application and the target server.

[0097] The connection establishment function, specifically connect(), can be used to establish a connection between the web-side communication endpoint of the target server and the web-side version of the target application.

[0098] The data transmission function may be send(), recv(), read(), and write(), which are used to send data, receive data, read data, and write data between the target server and the target application of the web version. When transmitting data, the data transmission function may also perform format conversion on the data to be transmitted.

[0099] The connection closing function, specifically close(), is used to close the web page communication endpoint and release the resources used for communication.

[0100] Specifically, the server can configure the above-mentioned connection establishment function, data transmission function and connection closing function in the target server and the target application of the web version respectively, so that the target server and the target application of the web version can listen and use the connection establishment function, data transmission function and connection closing function to transmit data through the web communication endpoint, thereby realizing the creation of the web communication channel.

[0101] After the web-side communication channel is created, the web-side version of the target application can transmit data to the business-side service through the web-side communication channel. The data transmission process can be as follows:

[0102] Accordingly, the data transmission between the target application of the web version and the business-side service based on the web communication channel may include:

[0103] Step one, use the connection establishment function to connect the web communication endpoint of the target server and the web version of the target application, and set a first callback function, and determine the connection status corresponding to the connection through the first callback function; for example, the web version of the target application can send a connection request to the web communication endpoint based on the connection establishment function; the web communication endpoint can listen to the connection establishment function; and determine to establish the connection; then, the target server can set the first callback function, the first callback function indicates that the connection status is successfully connected, and returns the first callback function to the web version of the target application.

[0104] Step 2: Use the data transmission function to convert the format of the data to be transmitted between the target application of the web version and the target server, and set a second callback function to determine the transmission status corresponding to the transmission through the second callback function. For example, the target application of the web version can send a request to obtain data 1 to the web communication endpoint based on the data transmission function "send()"; the web communication endpoint can monitor the data transmission function "send()"; then, send data 1 to the target application of the web version through the data transmission function "send()"; and set a second callback function, the second callback function indicates that the transmission status is successful, and returns the second callback function to the target application of the web version.

[0105] Step three, in response to the completion of the transmission of the data to be transmitted, use the close function to close the web page communication endpoint.

[0106] In one embodiment, the server can also set a connection timeout; the target application of the web page version periodically sends a connection interruption test request to the target server; in response to the target application of the web page version receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout, the connection is maintained; in response to the target application of the web page version not receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout, the connection is interrupted (specifically, the web page communication endpoint can be closed by the above-mentioned closing function to achieve connection interruption). This ensures that the connection is not interrupted when data transmission is required, and avoids the waste of transmission resources when data transmission is not required.

[0107] Specifically, in one embodiment, the server may send a control message to the target application of the web version, and the control message is used to control the target application of the web version to periodically send a connection interruption test request to the target server, and to control the target application of the web version to maintain or disconnect the connection. Accordingly, after obtaining the control message, the target application of the web version may respond to the control message and perform the operations corresponding to sending the connection interruption test request, maintaining or disconnecting the connection.

[0108] Alternatively, before generating the web version of the target application, the server can determine the code file corresponding to the operations of communicating with the target server through the network communication channel, sending a connection interruption test request, maintaining a connection, and disconnecting a connection; and generate the web version of the target application based on the code file (for example, the code file can be added to the target code file, specifically, it can be added to the web executable code file). Thus, the web version of the target application can perform operations such as communicating with the target server through the network communication channel, sending a connection interruption test request, maintaining a connection, and disconnecting a connection.

[0109] In one embodiment, the server can create a network request thread, and based on the network request thread, transmit the network request between the target application of the web page version and the business side service in the web page communication channel. Specifically, the server can add the code file corresponding to the network request between the target application of the web page version and the business side service transmitted in the web page communication channel based on the network request thread to the target code file, and specifically can add it to the web page executable code file, so that the target application of the web page version can transmit the network request between the business side service based on the network request thread.

[0110] Among them, the network request thread is a thread used to transmit the above-mentioned network request. The network request is a request for data transmission between the target application of the web version and the target server. It can be used to obtain the web page content that needs to be displayed on the application interface of the target application of the web version, such as market data of virtual resources.

[0111] It is understandable that obtaining web page content through a separate thread, namely a network request thread, can improve the efficiency of obtaining web page content and avoid application interface freezes.

[0112] It is understandable that the network request interface of the desktop version of the target application may not be suitable for network requests of the web version of the target application. Therefore, before generating the web version of the target application, the web version of the network request interface can be used to replace the desktop version of the target application's code file to ensure the normal progress of the network request.

[0113] In one embodiment, the above-mentioned generation of a web version of the target application based on the target code file may include: obtaining other desktop code files other than the function code files in the code files of the desktop version of the target application; identifying the desktop network request interface in the other desktop code files; obtaining the web network request interface that supports the web version of the target application to make network requests; replacing the desktop network request interface in the other desktop code files with the web network request interface; and generating a web version of the target application based on the replaced other desktop code files and the target code file.

[0114] Correspondingly, the above-mentioned network request thread-based transmission of the network request between the target application of the web version and the business side service in the web communication channel includes: based on the network request thread, using the web network request interface to transmit the network request in the web communication channel.

[0115] The network request may be a HyperText Transfer Protocol (HTTP), but is not limited thereto.

[0116] The web page network request interface or the desktop network request interface can be understood as an interface for sending, receiving and executing network requests.

[0117] In one embodiment, Figure 4 As shown, the target application of the web version can support basic services and services 1, ..., business n, where n is a positive integer. The basic services can be implemented based on the login module and the network library. The basic services can include login services, transaction services, etc. The target service side corresponding to the target application of the web version includes basic services and business side services. The basic services include an access layer. The access layer includes a web communication channel and a channel based on the Transmission Control Protocol (TCP). The network library can communicate with the web communication channel and the channel based on TCP through a virtual IP address (VI P), thereby realizing data transmission with the business service side, for example, obtaining data related to business 1, ..., business n from the business service side.

[0118] In one embodiment, Figure 5As shown, the server can first obtain the functional code file of the desktop version of the target application: C / C++ source code; then, compile and link the C / C++ source code to obtain the web page executable code file (Wasm module) and glue layer code file (HTML file, including JavaScript "glue" code file); finally, the web page executable code file can be processed by the glue layer code file to generate the web page version of the target application.

[0119] It should be noted that all the above technical solutions can be combined in any way to form optional embodiments of the present application, which will not be described one by one here.

[0120] It should be noted that in the specific implementation of this application, various files such as code files and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission, consent or authorization is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0121] Figure 6 Schematic diagram of an application generation device 600 provided in an embodiment of the present application. Figure 6 As shown, the device 600 includes: a file acquisition module 601, a first compilation module 602, a second compilation module 603, a file link module 604, an application generation module 605, a first creation module 606, a channel building module 607, a first transmission module 608, a second creation module 609, a second transmission module 610, a duration setting module 611, a connection test module 612, and a communication link module 613.

[0122] In one embodiment, the file acquisition module 601 is used to obtain the function code file and interface library code file of the desktop version of the target application; the first compilation module 602 is used to compile the function code file to obtain the intermediate code file; the second compilation module 603 is used to compile the interface library code file to obtain the static library file; the file linking module 604 is used to link the intermediate code file and the static library file to obtain the target code file that can run on the browser; the application generation module 605 is used to generate the web version of the target application according to the target code file.

[0123] In one embodiment, the file linking module 604 is specifically used to: link the intermediate code file and the static library file to obtain a web page executable code file and a glue layer code file that can run on a browser; wherein the application interface and application functions corresponding to the web page version of the target application obtained by loading the web page executable code file in the browser are consistent with the application interface and application functions corresponding to the desktop version of the target application; the glue layer code file is used to process the web page executable code file to obtain the web page version of the target application; correspondingly, the application generation module 605 is specifically used to: process the web page executable code file through the glue layer code file to generate a web page version of the target application.

[0124] In one embodiment, the application generation module 605 is specifically used to: compile and instantiate the web page executable code file through the glue layer code file to obtain the instantiated code file; access and call the instantiated code file through the glue layer code file to obtain the calling result; and generate a web page version of the target application according to the calling result.

[0125] In one embodiment, the target server corresponding to the target application of the web version includes an access layer and a business side service. The business side service is used to process the business functions corresponding to the target application of the web version, and the access layer is used to process the data transmission between the target application of the web version and the business side; the first creation module 606 is used to create a web communication channel; the channel construction module 607 is used to build the web communication channel on the access layer; the first transmission module 608 is used to transmit data between the target application of the web version and the business side service based on the web communication channel.

[0126] In one embodiment, the first creation module 606 is specifically used to: create a web page communication object; initialize the internal data structure of the web page communication object to obtain a web page communication endpoint; bind the web page communication endpoint to the target server according to the communication address of the target server; set a connection establishment function, a data transmission function, and a connection closing function; obtain a web page communication channel according to the web page communication endpoint, the connection establishment function, the data transmission function, and the connection closing function.

[0127] Correspondingly, the first transmission module 608 is specifically used to: use the connection establishment function to connect the web-side communication endpoint of the target server and the web-side version of the target application, and set a first callback function to determine the connection status corresponding to the connection through the first callback function; use the data transmission function to convert the format and transmit the data to be transmitted between the web-side version of the target application and the target server, and set a second callback function to determine the transmission status corresponding to the transmission through the second callback function; in response to the end of the transmission of the data to be transmitted, use the closing function to close the web-side communication endpoint.

[0128] In one embodiment, the second creation module 609 is used to create a network request thread; the second transmission module 610 is used to transmit the network request between the target application of the web version and the business side service in the web communication channel based on the network request thread.

[0129] In one embodiment, the application generation module 605 is specifically used to: obtain other desktop code files except the function code files in the code files of the desktop version of the target application; identify the desktop network request interface in the other desktop code files; obtain the web page network request interface that supports the web page version of the target application to make network requests; use the web page network request interface to replace the desktop network request interface in other desktop code files; and generate a web page version of the target application based on the replaced other desktop code files and the target code files.

[0130] Correspondingly, the second transmission module 610 is specifically used to: based on the network request thread, use the web page network request interface to transmit the network request in the web page communication channel.

[0131] In one embodiment, the duration setting module 611 is used to set the connection timeout duration; the connection test module 612 is used for the target application of the web version to periodically send a connection interruption test request to the target server; the communication connection module 613 is used to: in response to the target application of the web version receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout duration, maintain the connection; in response to the target application of the web version not receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout duration, interrupt the connection.

[0132] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 6 The device 600 shown can execute the above method embodiments, and the above and other operations and / or functions of each module in the device 600 are respectively for implementing the corresponding processes in the above methods, which will not be repeated here for the sake of brevity.

[0133] The above describes the device 600 of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.

[0134] Figure 7 A schematic block diagram of an electronic device 700 provided in an embodiment of the present application.

[0135] like Figure 7 As shown, the electronic device 700 may include:

[0136] The memory 710 and the processor 720, the memory 710 is used to store the computer program and transmit the program code to the processor 720. In other words, the processor 720 can call and run the computer program from the memory 710 to implement the method in the embodiment of the present application.

[0137] For example, the processor 720 may be configured to execute the above method embodiments according to instructions in the computer program.

[0138] In some embodiments of the present application, the processor 720 may include but is not limited to:

[0139] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.

[0140] In some embodiments of the present application, the memory 710 includes but is not limited to:

[0141] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SL DRAM) and direct memory bus random access memory (DR RAM).

[0142] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 710 and executed by the processor 720 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.

[0143] like Figure 7 As shown, the electronic device may also include:

[0144] The transceiver 730 may be connected to the processor 720 or the memory 710 .

[0145] The processor 720 may control the transceiver 730 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 730 may include a transmitter and a receiver. The transceiver 730 may further include an antenna, and the number of antennas may be one or more.

[0146] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.

[0147] The present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.

[0148] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instruction is loaded and executed on a computer, the computer can be made to perform the corresponding flow in each method in the embodiment of the present application in whole or in part, and generate the functions that can be realized by each method in the embodiment of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0149] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0150] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0151] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0152] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An application generation method, characterized in that: include: Obtain the function code files and interface library code files of the target application of the desktop version; Compiling the function code file to obtain an intermediate code file; Compiling the interface library code file to obtain a static library file; Linking the intermediate code file and the static library file to obtain a target code file that can be run on a browser; Generate a web page version of the target application according to the target code file.

2. The method according to claim 1, characterized in that: The linking of the intermediate code file and the static library file to obtain a target code file that can be run on a browser includes: Linking the intermediate code file and the static library file to obtain a web page executable code file and a glue layer code file that can be run on a browser; The application interface and application functions corresponding to the target application of the web version obtained by loading the executable code file of the web version in the browser are consistent with the application interface and application functions corresponding to the target application of the desktop version; The glue layer code file is used to process the web page executable code file to obtain the web page version of the target application; Correspondingly, the step of generating a web page version of the target application according to the target code file includes: The web page executable code file is processed through the glue layer code file to generate the web page version of the target application.

3. The method according to claim 2, characterized in that The step of processing the web page executable code file through the glue layer code file to generate the web page version of the target application program includes: Compile and instantiate the web page executable code file through the glue layer code file to obtain an instantiated code file; Access and call the instantiation code file through the glue layer code file to obtain a calling result; The web version of the target application is generated according to the calling result.

4. The method according to any one of claims 1 to 3, characterized in that: The target server corresponding to the target application of the web version includes an access layer and a business side service, wherein the business side service is used to process the business functions corresponding to the target application of the web version, and the access layer is used to process the data transmission between the target application of the web version and the business side; The method further comprises: Create a web-side communication channel; Building the web page communication channel on the access layer; Based on the web-side communication channel, data is transmitted between the target application of the web-side version and the business-side service.

5. The method according to claim 4, characterized in that The step of creating a web page communication channel includes: Create a web page communication object; Initializing the internal data structure of the web page communication object to obtain a web page communication endpoint; Binding the web page communication endpoint to the target server according to the communication address of the target server; Set up connection establishment function, data transmission function and connection closing function; Obtaining the web page communication channel according to the web page communication endpoint, the connection establishment function, the data transmission function and the connection closing function; Correspondingly, the data transmission between the target application of the web page version and the business side service based on the web page communication channel includes: Using the connection establishment function, connecting the web page communication endpoint of the target server and the web page version of the target application, and setting a first callback function, and determining the connection state corresponding to the connection through the first callback function; Using the data transmission function, format conversion and transmission of the data to be transmitted between the target application of the web version and the target server are performed, and a second callback function is set to determine the transmission status corresponding to the transmission through the second callback function; In response to the completion of the transmission of the data to be transmitted, the web page communication endpoint is closed using a close function.

6. The method according to claim 5, characterized in that Also includes: Create a network request thread; Based on the network request thread, a network request between the target application of the web page version and the business side service is transmitted in the web page communication channel.

7. The method according to claim 6, characterized in that The step of generating a web page version of the target application according to the target code file includes: Obtaining other desktop code files except the function code files from the code files of the target application of the desktop version; Identify the desktop network request interface in the other desktop code files; Obtaining a web page network request interface that supports the target application program of the web page version to make a network request; Use the webpage network request interface to replace the desktop network request interface in the other desktop code file; Generate the web page version of the target application according to the replaced other desktop code files and the target code files; Correspondingly, the network request between the target application of the web page version and the business side service is transmitted in the web page communication channel based on the network request thread, including: Based on the network request thread, the network request is transmitted in the web page communication channel using the web page network request interface.

8. The method according to claim 5, characterized in that Also includes: Set the connection timeout period; The target application of the web version periodically sends a connection interruption test request to the target server; In response to the target application of the web version receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout period, maintaining the connection; In response to the target application of the web version not receiving a response corresponding to the connection interruption test request sent by the target server within the connection timeout period, the connection is interrupted.

9. An application generating device, characterized in that: include: The file acquisition module is used to: acquire the function code file and interface library code file of the target application of the desktop version; A first compiling module is used to compile the function code file to obtain an intermediate code file; The second compiling module is used to compile the interface library code file to obtain a static library file; A file linking module is used to link the intermediate code file and the static library file to obtain a target code file that can be run on a browser; The application generation module is used to generate a web page version of the target application according to the target code file.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.

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