Search

CN-115934123-B - Client logic updating method and device, electronic equipment and storage medium

CN115934123BCN 115934123 BCN115934123 BCN 115934123BCN-115934123-B

Abstract

The embodiment of the disclosure provides a client logic updating method, a client logic updating device, electronic equipment and a storage medium. The method can include the steps of responding to the fact that client logic of an application program is to be updated, obtaining a program code file of a plug-in program corresponding to the client logic to be updated, wherein a shared interface between the application program and the plug-in program is defined based on Kotlin language, loading the plug-in program to the application program according to the obtained program code file, and executing the plug-in program to achieve the client logic corresponding to the plug-in program.

Inventors

  • DAI FENG

Assignees

  • 杭州网易再顾科技有限公司

Dates

Publication Date
20260505
Application Date
20221128

Claims (14)

  1. 1. A method of client logic updating, the method comprising: Responding to the determination that the client logic of the application program is to be updated, and acquiring a program code file of a plug-in program corresponding to the client logic to be updated, wherein a shared interface between the application program and the plug-in program is defined based on Kotlin language; The method comprises the steps of obtaining a source code file of a plug-in program written based on Kotlin languages, loading the plug-in program to an application program according to the obtained program code file, wherein the obtained program code file comprises a byte code file of the plug-in program corresponding to client logic to be updated, and the byte code file of the plug-in program comprises a QuickJS byte code file of the plug-in program obtained by compiling the source code file of the plug-in program written based on Kotlin languages; Executing the plug-in program to realize client logic corresponding to the plug-in program, wherein the plug-in program comprises executing an entry function of the plug-in program to acquire a first class bridging class instance corresponding to the shared interface registered on a JS side and calling the first class bridging class instance to enable the JS side to respond to the first class bridging class instance to be called, executing a function defined in the first class bridging class instance and returning a calling result to a native side, the first class bridging class instance comprises responding to an interface instance corresponding to the shared interface registered on the JS side and a bridging class instance corresponding to the bridging class of the shared interface registered on the JS side, and the bridging class is generated by inheriting the shared interface in response to defining the shared interface based on Kotlin language.
  2. 2. The method of claim 1, prior to retrieving a program code file of a plug-in corresponding to client logic to be updated in response to determining that client logic of an application is to be updated, the method further comprising: the method comprises the steps of acquiring a program list from a server side of an application program, wherein the program list comprises module information of at least one functional module contained in a plug-in program and module information of other functional modules on which the at least one functional module depends; Determining whether the module information included in the acquired program list is consistent with the module information included in the program list acquired last time; and if the module information included in the acquired program list is inconsistent with the module information included in the program list acquired last time, determining that the client logic of the application program is to be updated.
  3. 3. The method of claim 2, the obtaining a program code file of a plug-in corresponding to client logic to be updated, comprising: And downloading program code files corresponding to at least one functional module contained in the plug-in program according to the module information contained in the acquired program list, and downloading program code files corresponding to other functional modules on which the at least one functional module depends.
  4. 4. A method according to claim 3, the module information comprising a hash value of a program code file corresponding to a functional module; The method further comprises the steps of: in response to completion of the downloading of the program code file, calculating a hash value of the downloaded program code file; determining whether the obtained hash value in the program list is consistent with the calculated hash value; and if the obtained hash value in the program list is consistent with the calculated hash value, carrying out integrity check on the downloaded program code file.
  5. 5. The method of claim 1, the loading the plug-in into the application program according to the acquired program code file, comprising: And loading the plug-in program to the application program based on QuickJS engine according to the acquired program code file.
  6. 6. The method of claim 1, the method further comprising: In response to registering an interface instance corresponding to the shared interface on a native side, registering a bridging class instance corresponding to a bridging class of the shared interface on the native side, and determining the bridging class instance registered on the native side as a second class bridging class instance corresponding to the shared interface; And executing the function defined in the second class bridging class instance in response to the second class bridging class instance being called.
  7. 7. A client logic updating apparatus, the apparatus comprising: The system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a program code file of a plug-in program corresponding to client logic to be updated in response to determining that the client logic of an application program is to be updated, and a sharing interface between the application program and the plug-in program is defined based on Kotlin languages; The loading module is used for loading the plug-in program to the application program according to the acquired program code file, wherein the acquired program code file comprises a byte code file of the plug-in program corresponding to client logic to be updated, and the byte code file of the plug-in program comprises a QuickJS byte code file of the plug-in program obtained by compiling a source code file of the plug-in program written based on Kotlin language; The execution module is used for executing the plug-in program to realize client logic corresponding to the plug-in program, and comprises an entry function of the plug-in program, a bridging class instance and a bridging class generation module, wherein the entry function of the plug-in program is executed to acquire a first class bridging class instance corresponding to the shared interface and registered on the JS side, the first class bridging class instance is called to enable the JS side to respond to the first class bridging class instance to be called, a function defined in the first class bridging class instance is executed, and a calling result is returned to the original side, the first class bridging class instance comprises a bridging class instance corresponding to the bridging class of the shared interface and registered on the JS side in response to the interface instance corresponding to the shared interface, and the bridging class is generated by inheriting the shared interface in response to defining the shared interface based on Kotlin language.
  8. 8. The apparatus of claim 7, the apparatus further comprising: The system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a program list from a server side of an application program, and the program list comprises module information of at least one functional module contained in a plug-in program and module information of other functional modules on which the at least one functional module depends; And the determining module is used for determining whether the module information included in the acquired program list is consistent with the module information included in the program list acquired last time, and if the module information included in the acquired program list is inconsistent with the module information included in the program list acquired last time, determining that the client logic of the application program is to be updated.
  9. 9. The apparatus of claim 8, the first acquisition module being specifically configured to: And downloading program code files corresponding to at least one functional module contained in the plug-in program according to the module information contained in the acquired program list, and downloading program code files corresponding to other functional modules on which the at least one functional module depends.
  10. 10. The apparatus of claim 9, the module information comprising a hash value of a program code file corresponding to a functional module; The apparatus further comprises: A calculating module, configured to calculate a hash value of the downloaded program code file in response to completion of the downloading of the program code file; The verification module is used for determining whether the hash value in the acquired program list is consistent with the calculated hash value; and if the obtained hash value in the program list is consistent with the calculated hash value, carrying out integrity check on the downloaded program code file.
  11. 11. The apparatus of claim 7, the loading module being specifically configured to: And loading the plug-in program to the application program based on QuickJS engine according to the acquired program code file.
  12. 12. The apparatus of claim 7, the apparatus further comprising: The generation module is used for responding to the interface instance corresponding to the shared interface registered at the original side, registering the bridging class instance corresponding to the bridging class of the shared interface at the original side, and determining the bridging class instance registered at the original side as a second class bridging class instance corresponding to the shared interface; The executing module is further configured to execute the function defined in the second class bridging class instance in response to the second class bridging class instance being called.
  13. 13. An electronic device, comprising: A processor; A memory for storing the processor-executable instructions; Wherein the processor is configured to perform the method of any of the preceding claims 1-6.
  14. 14. A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the method of any of the preceding claims 1-6.

Description

Client logic updating method and device, electronic equipment and storage medium Technical Field Embodiments of the present disclosure relate to the field of application technologies, and in particular, embodiments of the present disclosure relate to a method, an apparatus, an electronic device, and a storage medium for updating client logic. Background This section is intended to provide a background or context to the embodiments of the disclosure recited in the claims. The description herein is not admitted to be prior art by inclusion in this section. Native development (NATIVE APP development) refers to development of an application program for a specific platform, and can be performed by using a development framework, a development language and a development class library provided by the platform. In the scenario of client logic updates for published native development applications, it is often necessary to reissue new versions of the application so that a user can update the client logic of the application by downloading and installing new version clients through the application marketplace or old version clients of the installed application. Therefore, due to factors such as the up-stream of the application market and the updating behavior of the user, the client logic of the native development application program is difficult to update in time. Disclosure of Invention In a first aspect of the embodiments of the present disclosure, there is provided a client logic updating method, the method comprising: Responding to the determination that the client logic of the application program is to be updated, and acquiring a program code file of a plug-in program corresponding to the client logic to be updated, wherein a shared interface between the application program and the plug-in program is defined based on Kotlin language; Loading the plug-in program to the application program according to the acquired program code file; and executing the plug-in program to realize client logic corresponding to the plug-in program. In a second aspect of the embodiments of the present disclosure, there is provided a client logic updating apparatus, the apparatus comprising: The system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a program code file of a plug-in program corresponding to client logic to be updated in response to determining that the client logic of an application program is to be updated, and a sharing interface between the application program and the plug-in program is defined based on Kotlin languages; the loading module is used for loading the plug-in program to the application program according to the acquired program code file; And the execution module is used for executing the plug-in program to realize client logic corresponding to the plug-in program. In a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including: A processor; A memory for storing the processor-executable instructions; wherein the processor is configured to perform the client logic update method. In a fourth aspect of the disclosed embodiments, a computer-readable storage medium is provided, on which a computer program is stored, which program, when executed by a processor, implements the client logic update method. The above embodiments of the present disclosure have at least the following beneficial effects: on the one hand, part of client logic needing to be updated can be dynamically loaded to the application program of the original development in the form of a plug-in program, and the plug-in program which is dynamically issued can be executed based on the JS engine embedded in the client, so that the client logic can be timely updated for the issued application program of the original development without the need of the client to reissue, and the execution high performance of the client logic after the update can be ensured. On the other hand, because the shared interface between the application program of the original development and the plug-in program of the dynamic issuing is defined based on Kotlin language, and can be shared by JVM, JS, native three platforms, in the process of programming the program code of the plug-in program, a developer does not need to uniformly agree on the definition and the use mode of each interface on the original side and the JS side respectively through a document, and does not need to consider too much bridging details or write corresponding conversion codes, so that in the scene of updating the client logic for the issued original development application program, the updating timeliness and the developing efficiency of the client logic can be ensured at the same time. Drawings The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present disclosure will become readily apparent from t