CN113946384B - Method and device for running applet and electronic equipment - Google Patents

Method and device for running applet and electronic equipment Download PDF

Info

Publication number
CN113946384B
CN113946384B CN202111203229.1A CN202111203229A CN113946384B CN 113946384 B CN113946384 B CN 113946384B CN 202111203229 A CN202111203229 A CN 202111203229A CN 113946384 B CN113946384 B CN 113946384B
Authority
CN
China
Prior art keywords
applet
function
target
platform
environment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111203229.1A
Other languages
Chinese (zh)
Other versions
CN113946384A (en
Inventor
彭昊晨
曹馨竹
苏景博
陈英军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Jinxin Software Co Ltd
Original Assignee
Zhongdian Jinxin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongdian Jinxin Software Co Ltd filed Critical Zhongdian Jinxin Software Co Ltd
Priority to CN202111203229.1A priority Critical patent/CN113946384B/en
Publication of CN113946384A publication Critical patent/CN113946384A/en
Application granted granted Critical
Publication of CN113946384B publication Critical patent/CN113946384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an operation method and device of an applet and electronic equipment, wherein the method comprises the following steps: when the applet detects that a user initiates through the applet, a call instruction for calling a first function of a platform where the applet is located, detecting whether a current running environment of the platform is matched with a running environment required by the applet; when the environments are not matched, calling an interactive code corresponding to the first function, and uniquely identifying the identification information of the first function and parameters required by running the first function, and converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interactive code; when the platform searches the target function corresponding to the target identification information, the target parameter is matched through the target function, so that the purpose of executing the first function through the platform is achieved. Therefore, the reuse of the applet on different platforms is realized without developing the applet again, and the suitability of the applet and the platform is improved.

Description

Method and device for running applet and electronic equipment
Technical Field
The present invention relates to the field of computer software technologies, and in particular, to a method and an apparatus for operating an applet, and an electronic device.
Background
With the rapid development of internet technology, applets have received wide attention from various industries as a convenient tool for use without downloading and installing, and it is known that applets need to be run through a platform, for example, weChat applets need to be run in a WeChat platform, and Payment treasures programs need to be run on a Payment treasures platform.
However, in the prior art, the applet can only run on a specific platform, the native applet can only run on a platform compatible with the running environment of the native applet, and the native applet can be understood as an applet developed by the native platform and only run on the native platform of the development applet, for example, the WeChat applet developed on WeChat can only run on WeChat, the Payment device applet developed on Payment device can only run on Payment device, but the WeChat applet cannot run on Payment device, nor on the platform developed based on H5.
In the prior art, if the applet is to be reused on different platforms, the applet needs to be developed again to achieve the purpose of running the native applet on a non-native platform, for example, when the WeChat applet is to be reused on other platforms following the fifth generation hypertext markup language (H5) protocol or APP such as payment treasures, the applet suitable for the H5 platform or payment treasures needs to be developed, which is time-consuming, laborious and inefficient.
Disclosure of Invention
In view of the above, the embodiment of the invention discloses a method and a device for running a small program and electronic equipment, and solves the problem that the small program cannot be reused on different platforms in the prior art.
The embodiment of the invention discloses an operation method of an applet, which comprises the following steps:
when the applet detects that a user initiates through the applet and invokes a call instruction of a first function of a platform where the applet is located, detecting whether a current running environment of the platform is matched with a running environment required by the applet;
when the environments are not matched, calling an interaction code corresponding to the first function, identification information for uniquely identifying the first function and parameters required for running the first function;
converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction codes;
and when the platform searches the target function corresponding to the target identification information, performing matching operation on the target parameter through the target function.
Optionally, the detecting whether the current running environment of the platform matches the running environment required by the applet includes:
acquiring a platform environment identifier of the current running environment and an applet environment identifier of the running environment required by the applet;
when the platform environment identifier is consistent with the applet environment identifier, determining that the environments are matched;
and when the platform environment identifier is inconsistent with the applet environment identifier, otherwise, determining that the environments are not matched.
Optionally, when the environments do not match, invoking the interaction code corresponding to the first function, including:
if the current running environment conforms to the H5 protocol, converting the applet into a target applet conforming to the H5 protocol;
generating the adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and codes for realizing functional interaction between each function in the target applet and the platform;
and determining the interaction code corresponding to the first function from the adaptation information.
Optionally, when the environments do not match, invoking the interaction code corresponding to the first function, including:
and if the current running environment of the platform conforms to the H5 protocol, converting the code corresponding to the first function into the code conforming to the H5 protocol as the interaction code.
Optionally, the converting, by the interaction code, the identification information and the parameter into target identification information and target parameter corresponding to the platform includes:
converting the identification information into the target identification information conforming to the H5 protocol;
the parameters are converted into the target parameters following the H5 protocol.
Optionally, the matching the target parameter by the target function includes:
selecting a target SDK corresponding to the target function from a preset SDK set;
operating the target SDK through the target parameters; the target SDK stores logic code for executing a first function.
The embodiment of the invention discloses an operation device of an applet, which comprises:
the detection unit is used for detecting whether the current running environment of the platform is matched with the running environment required by the applet or not when the applet detects that a call instruction of a first function of the platform where the applet is located is initiated by a user through the applet;
the calling unit is used for calling the interaction code corresponding to the first function, the identification information for uniquely identifying the first function and the parameters required for running the first function when the environments are not matched;
the conversion unit is used for converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction code;
and the matching unit is used for performing matching operation on the target parameters through the target function when the platform searches the target function corresponding to the target identification information.
Optionally, the detection unit includes:
the acquisition subunit is used for acquiring the platform environment identifier of the current running environment and the applet environment identifier of the running environment required by the applet;
a first determining subunit, configured to determine that an environment matches when the platform environment identifier is consistent with the applet environment identifier;
and the second determining subunit is used for determining that the environment is not matched when the platform environment identifier is inconsistent with the applet environment identifier.
Optionally, the calling unit includes:
the first conversion subunit is used for converting the applet into a target applet conforming to the H5 protocol if the current running environment conforms to the H5 protocol;
the generation subunit is used for generating the adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and the codes of the interaction between each function in the target applet and the platform implementation function;
and determining the interaction code corresponding to the first function from the adaptation information.
The embodiment of the invention discloses an electronic device, which comprises:
a memory and a processor;
the memory is used for storing a program, and the processor is used for executing the operation method of the small program when executing the program.
The embodiment of the invention discloses an operation method and device of an applet and electronic equipment, wherein the method comprises the following steps: when the applet added on the platform runs, if the applet detects that a user initiates through the applet, a call instruction for calling a first function of the platform where the applet is located, whether the current running environment of the platform is matched with the running environment required by the applet is detected; when the environments are not matched, calling an interactive code corresponding to the first function, and uniquely identifying the identification information of the first function and parameters required by running the first function, and converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interactive code; when the platform searches the target function corresponding to the target identification information, the target parameter is matched through the target function, so that the purpose of executing the first function through the platform is achieved. Therefore, under the condition that the development of the applet is not needed again, the reuse of the applet on different platforms is realized, the purpose of cross-platform application of the applet is realized, and the suitability of the applet and the platform is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of an operation method of an applet according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an apparatus for running an applet according to an embodiment of the present invention;
fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1:
referring to fig. 1, a flow chart of a method for running an applet according to an embodiment of the invention is shown, where in this embodiment, the method includes:
s101: when the applet detects that a user initiates through the applet and invokes a call instruction of a first function of a platform where the applet is located, detecting whether a current running environment of the platform is matched with a running environment required by the applet;
in this embodiment, the execution of the applet depends on the platform, and the applet needs to be executed after the applet is added to the platform.
In this embodiment, the different platforms are different for the running environments of the applet, where the running environments include, for example: the operating environment of the native applet, such as WeChat, payment Bao, etc., the operating environment of H5. The running environment of the native applet is suitable for running the native applet, for example, the WeChat applet is the native applet of the WeChat platform, and the Payment device applet is the native applet of the Payment device.
In this embodiment, the first function of the platform refers to a function that needs to be executed by the platform, for example, an applet may need to call the function of the platform in the running process, for example, if face recognition is required, a camera of the terminal needs to be called, and then the camera needs to be called by the platform.
The matching condition of the running environment required by the applet and the running environment of the platform is as follows:
the running environment of the applet is a running environment supporting the native applet, for example, the running environment matched with the WeChat applet is a WeChat platform, and the platform matched with the running environment required by the Payment applet is a Payment platform.
The condition that the running environment required by the applet is not matched with the running environment of the platform comprises the following two conditions:
case one: the operating environment of the platform is H5, and the operating environment of the H5 does not support the operation of the applet;
and a second case: platforms that are incompatible with native applets, such as WeChat applets, and Payment platform, then Payment platform is incompatible with WeChat applets.
In this embodiment, whether the current running environment of the platform matches with the running environment required by the applet or not may be detected, by multiple modes, optionally, by the environment identifier of the platform and the environment identifier of the applet, or not, specifically including:
acquiring a platform environment identifier of the current running environment and an applet environment identifier of the running environment required by the applet;
when the platform environment identifier is consistent with the applet environment identifier, determining that the environments are matched;
and when the platform environment identifier is inconsistent with the applet environment identifier, determining that the environment identifier is not matched.
In this embodiment, in the generating process, the applet will set the identifier of the required running environment, where the identifier is the environment identifier of the applet, and in the generating process, the platform will also set the identifier of the running environment, which is denoted as the environment identifier of the applet.
S102: when the environments are not matched, calling an interaction code corresponding to the first function, identification information for uniquely identifying the first function and parameters required for running the first function;
in this embodiment, in the process of generating the applet, in order to adapt to the operating environment of the platform, interaction with the platform may be implemented by calling the interaction code corresponding to the first function, the identification information of the first function, and the parameters required for operating the first function, and instruct the platform to execute the purpose of calling the first function.
The method for acquiring the interaction code corresponding to the first function comprises the following steps:
in the first embodiment, in the process of applet generation, interactive codes which are adapted to the platform and correspond to the first function are generated in advance.
The interaction code is used for realizing interaction between the applet and the platform, and under an implementation mode, under the condition that the running environment required by the applet is not matched with the running environment of the platform, the identification information of the first function and the parameters required by the first function can be converted into target identification information and target parameters which can be identified by the platform through the interaction code.
Or, in the process of generating the applet, the adaptation information suitable for the platform is generated in advance, and the interaction code corresponding to the first function can be obtained from the adaptation information.
Embodiment II,
If the current running environment conforms to the H5 protocol, converting the applet into a target applet conforming to the H5 protocol;
generating the adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and codes for realizing functional interaction between each function in the target applet and the platform;
and determining the interaction code corresponding to the first function from the adaptation information.
In this embodiment, if the current running environment complies with the H5 protocol, in order to implement adaptation of the applet and the platform, the applet needs to be converted into a target applet compliant with the H5 protocol, and in order to implement interaction between the applet and the platform, adaptation information is generated, where the adaptation information at least includes an interaction code for interaction between the applet and the platform.
Besides, the adaptation information further includes: the method comprises the steps of uniquely identifying identification information of a first function and parameters required by running the first function, wherein the first function is any function of a platform which needs to be called when an applet executes.
S103: converting the identification information and the parameters into target identification information and target parameters corresponding to a platform through the interaction codes;
in this embodiment, the applet and the platform belong to two independent application programs, which are independently developed, and the protocols that they follow may also be different, so that in order to implement interaction between the two, the identification information of the first function and the parameters required for running the first function may be converted into the target function and the target parameters that the platform can identify.
In one embodiment, if the current running environment of the platform complies with the H5 protocol, S103 includes:
converting the identification information into the target identification information conforming to the H5 protocol;
the parameters are converted into the target parameters following the H5 protocol.
In this embodiment, the identification information is used to uniquely identify the first function, for example, a name of the first function, if the first function is an address book, the identification information may be an address book, and the platform may identify the function of applet calling through the target identification information corresponding to the identification information; the parameters of the first function are parameters required for executing the first function, for example, if the function of the address book needs to be called, the parameters may be "name: zhang Sanj can be performed by the parameter to retrieve the address book and obtain the information of Zhang Sanj from the address book.
In addition, the interaction code can also transmit the converted target identification information and the target parameters to the platform.
Illustrating: the process of communicating identification information and parameters to the platform may include: identification information and parameters are transferred to a native call in jsBridge through a shagma (protocol header agreed with a client), and a postmessage (prompt) method is called and transferred to an application program.
S104: when the platform searches a target function corresponding to the target identification information, matching the target parameter through the target function;
in this embodiment, the target function is a function corresponding to the target identifier on the platform, specifically, the target function refers to a specific operation of the first function corresponding to the target identifier information, the target parameter is a parameter required for running the target function, and the target function is used for performing a matching operation on the target parameter, so as to achieve the purpose of executing and calling the first function.
In this embodiment, the target function refers to a specific operation of the first function corresponding to the target identification information, for example, when calling the address book, a person name in the address book may be called, and then the target function indicates that the person name is called from the address book.
In this embodiment, the target parameter refers to a parameter required for calling the target function, for example, when information in the address book is called, a specific person name needs to be known, for example, the target parameter is "Zhang san", and when the target parameter is executed, address book information of Zhang san needs to be obtained from the address book.
In one embodiment, the platforms may not be able to support execution of the target function, and in order for any one of the platforms to be able to execute the first function of the applet call, a set of SDKs (software development kits, software Development Kit)) may be pre-generated, wherein the set of SDKs includes different SDKs, each of which stores logic code that executes a different target function. Based on this, further comprising: and selecting a target SDK corresponding to the target function from a preset SDK set, and operating the target SDK through the target parameter, thereby realizing the purpose of executing the target function.
Further, when the applet calls the first function of the platform, some information needs to be returned, for example, if calling the phone number of the third phone in the address book, the phone number of the third phone needs to be returned to the applet, and in order to achieve the purpose, a return parameter needs to be called, and after the platform executes S104, the execution result of the target function is returned to the applet.
In this embodiment, when the operating environment required by the applet is not matched with the operating environment of the platform, the backhaul parameters are converted into target backhaul parameters corresponding to the platform.
In one embodiment, if the operating environment of the platform complies with the H5 protocol, the backhaul parameters may be converted to target backhaul parameters that comply with the H5 protocol.
From the above description, the information that the applet transmits to the platform includes: target identification information, target parameters and target return parameters.
In addition, when the running environment required by the applet is not matched with the running environment of the platform where the applet is located and the running environment of the platform is the running environment of the native applet, when the second function of the calling platform is detected, the interface logic code adapted to the second function is called, and the interface logic code is adapted to an API interface of the platform, so that the purpose of calling the second function of the platform is achieved.
In this embodiment, when the applet added on the platform runs, if the applet detects a call instruction initiated by a user through the applet to call a first function of the platform where the applet is located, it is detected whether the current running environment of the platform is matched with the running environment required by the applet; when the environments are not matched, calling an interactive code corresponding to the first function, and uniquely identifying the identification information of the first function and parameters required by running the first function, and converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interactive code; when the platform searches the target function corresponding to the target identification information, the target parameter is matched through the target function, so that the purpose of executing the first function through the platform is achieved. Therefore, under the condition that the development of the applet is not needed again, the reuse of the applet on different platforms is realized, the purpose of cross-platform application of the applet is realized, and the suitability of the applet and the platform is improved.
Example 2:
referring to fig. 2, a schematic structural diagram of an apparatus for running an applet according to an embodiment of the present invention is shown, where in this embodiment, the apparatus includes:
the detection unit is used for detecting whether the current running environment of the platform is matched with the running environment required by the applet or not when the applet detects that a call instruction of a first function of the platform where the applet is located is initiated by a user through the applet;
the calling unit is used for calling the interaction code corresponding to the first function, the identification information for uniquely identifying the first function and the parameters required for running the first function when the environments are not matched;
the conversion unit is used for converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction code;
and the matching unit is used for performing matching operation on the target parameters through the target function when the platform searches the target function corresponding to the target identification information.
Optionally, the detection unit includes:
the acquisition subunit is used for acquiring the platform environment identifier of the current running environment and the applet environment identifier of the running environment required by the applet;
a first determining subunit, configured to determine that an environment matches when the platform environment identifier is consistent with the applet environment identifier;
and the second determining subunit is used for determining that the environment is not matched when the platform environment identifier is inconsistent with the applet environment identifier.
Optionally, the calling unit includes:
the first conversion subunit is used for converting the applet into a target applet conforming to the H5 protocol if the current running environment conforms to the H5 protocol;
the generation subunit is used for generating the adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and the codes of the interaction between each function in the target applet and the platform implementation function;
and determining the interaction code corresponding to the first function from the adaptation information.
Optionally, the calling unit includes:
and the second conversion subunit is used for converting codes corresponding to the first function into codes conforming to the H5 protocol to serve as the interaction codes if the current running environment of the platform conforms to the H5 protocol.
Optionally, the conversion unit includes:
a third conversion subunit, configured to convert the identification information into the target identification information that conforms to the H5 protocol;
a fourth conversion subunit, configured to convert the parameter into the target parameter that complies with the H5 protocol.
Optionally, the matching unit includes:
a selecting subunit, configured to select a target SDK corresponding to the target function from a preset SDK set;
an operation subunit, configured to operate the target SDK according to the target parameter; the target SDK stores logic code for executing a first function.
Through the device of the embodiment, when the applet added on the platform runs, if the applet detects that a user initiates through the applet, and invokes a call instruction of a first function of the platform where the applet is located, whether the current running environment of the platform is matched with the running environment required by the applet is detected; when the environments are not matched, calling an interactive code corresponding to the first function, and uniquely identifying the identification information of the first function and parameters required by running the first function, and converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interactive code; when the platform searches the target function corresponding to the target identification information, the target parameter is matched through the target function, so that the purpose of executing the first function through the platform is achieved. Therefore, under the condition that the development of the applet is not needed again, the reuse of the applet on different platforms is realized, the purpose of cross-platform application of the applet is realized, and the suitability of the applet and the platform is improved.
Example 3
Referring to fig. 3, a schematic structural diagram of an electronic device according to an embodiment of the present invention is shown, where in this embodiment, the electronic device includes:
a memory 301 and a processor 302;
the memory 301 is configured to store a program, and the processor 302 is configured to execute, when executing the program, a method of executing the following applet:
when the applet detects that a user initiates through the applet and invokes a call instruction of a first function of a platform where the applet is located, detecting whether a current running environment of the platform is matched with a running environment required by the applet;
when the environments are not matched, calling an interaction code corresponding to the first function, identification information for uniquely identifying the first function and parameters required for running the first function;
converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction codes;
and when the platform searches the target function corresponding to the target identification information, performing matching operation on the target parameter through the target function.
Optionally, the detecting whether the current running environment of the platform matches the running environment required by the applet includes:
acquiring a platform environment identifier of the current running environment and an applet environment identifier of the running environment required by the applet;
when the platform environment identifier is consistent with the applet environment identifier, determining that the environments are matched;
and when the platform environment identifier is inconsistent with the applet environment identifier, otherwise, determining that the environments are not matched.
Optionally, when the environments do not match, invoking the interaction code corresponding to the first function, including:
if the current running environment conforms to the H5 protocol, converting the applet into a target applet conforming to the H5 protocol;
generating the adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and codes for realizing functional interaction between each function in the target applet and the platform;
and determining the interaction code corresponding to the first function from the adaptation information.
Optionally, when the environments do not match, invoking the interaction code corresponding to the first function, including:
and if the current running environment of the platform conforms to the H5 protocol, converting the code corresponding to the first function into the code conforming to the H5 protocol as the interaction code.
Optionally, the converting, by the interaction code, the identification information and the parameter into target identification information and target parameter corresponding to the platform includes:
converting the identification information into the target identification information conforming to the H5 protocol;
the parameters are converted into the target parameters following the H5 protocol.
Optionally, the matching the target parameter by the target function includes:
selecting a target SDK corresponding to the target function from a preset SDK set;
operating the target SDK through the target parameters; the target SDK stores logic code for executing a first function.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of operating an applet, comprising:
when the applet detects that a user initiates through the applet and invokes a call instruction of a first function of a platform where the applet is located, detecting whether a current running environment of the platform is matched with a running environment required by the applet;
when the environments are not matched, calling an interaction code corresponding to the first function, identification information for uniquely identifying the first function and parameters required for running the first function; the interaction code is used for realizing interaction between the applet and the platform;
converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction codes;
and when the platform searches the target function corresponding to the target identification information, performing matching operation on the target parameter through the target function.
2. The method of claim 1, wherein the detecting whether the current operating environment of the platform matches the operating environment required by the applet comprises:
acquiring a platform environment identifier of the current running environment and an applet environment identifier of the running environment required by the applet;
when the platform environment identifier is consistent with the applet environment identifier, determining that the environments are matched;
and when the platform environment identifier is inconsistent with the applet environment identifier, otherwise, determining that the environments are not matched.
3. The method of claim 1, wherein invoking the interaction code corresponding to the first function when the environments do not match comprises:
if the current running environment conforms to the H5 protocol, converting the applet into a target applet conforming to the H5 protocol;
generating adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and codes for realizing functional interaction between each function in the target applet and the platform;
and determining the interaction code corresponding to the first function from the adaptation information.
4. The method of claim 1, wherein invoking the interaction code corresponding to the first function when the environments do not match comprises:
and if the current running environment of the platform conforms to the H5 protocol, converting the code corresponding to the first function into the code conforming to the H5 protocol as the interaction code.
5. The method of claim 4, wherein said converting said identification information and said parameters into target identification information and target parameters corresponding to said platform by said interaction code comprises:
converting the identification information into the target identification information conforming to the H5 protocol;
the parameters are converted into the target parameters following the H5 protocol.
6. The method of claim 1, wherein said matching the target parameters by the target function comprises:
selecting a target SDK corresponding to the target function from a preset SDK set;
operating the target SDK through the target parameters; the target SDK stores logic code for executing a first function.
7. An applet operating apparatus, comprising:
the detection unit is used for detecting whether the current running environment of the platform is matched with the running environment required by the applet or not when the applet detects that a call instruction of a first function of the platform where the applet is located is initiated by a user through the applet;
the calling unit is used for calling the interaction code corresponding to the first function, the identification information for uniquely identifying the first function and the parameters required for running the first function when the environments are not matched; the interaction code is used for realizing interaction between the applet and the platform;
the conversion unit is used for converting the identification information and the parameters into target identification information and target parameters corresponding to the platform through the interaction code;
and the matching unit is used for performing matching operation on the target parameters through the target function when the platform searches the target function corresponding to the target identification information.
8. The apparatus of claim 7, wherein the detection unit comprises:
the acquisition subunit is used for acquiring the platform environment identifier of the current running environment and the applet environment identifier of the running environment required by the applet;
a first determining subunit, configured to determine that an environment matches when the platform environment identifier is consistent with the applet environment identifier;
and the second determining subunit is used for determining that the environment is not matched when the platform environment identifier is inconsistent with the applet environment identifier.
9. The apparatus of claim 7, wherein the calling unit comprises:
the first conversion subunit is used for converting the applet into a target applet conforming to the H5 protocol if the current running environment conforms to the H5 protocol;
the generation subunit is used for generating adaptation information based on the corresponding relation between each function in the applet and each function in the target applet and codes for realizing functional interaction between each function in the target applet and the platform;
and determining the interaction code corresponding to the first function from the adaptation information.
10. An electronic device, comprising:
a memory and a processor;
the memory is adapted to store a program, the processor being adapted to perform the method of operating the applet according to any one of the claims 1-6 when the program is executed.
CN202111203229.1A 2021-10-15 2021-10-15 Method and device for running applet and electronic equipment Active CN113946384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111203229.1A CN113946384B (en) 2021-10-15 2021-10-15 Method and device for running applet and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111203229.1A CN113946384B (en) 2021-10-15 2021-10-15 Method and device for running applet and electronic equipment

Publications (2)

Publication Number Publication Date
CN113946384A CN113946384A (en) 2022-01-18
CN113946384B true CN113946384B (en) 2023-06-13

Family

ID=79330672

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111203229.1A Active CN113946384B (en) 2021-10-15 2021-10-15 Method and device for running applet and electronic equipment

Country Status (1)

Country Link
CN (1) CN113946384B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185551B (en) * 2022-02-17 2022-06-21 浙江口碑网络技术有限公司 Applet compiling method, applet running method and device and storage medium
CN115296949A (en) * 2022-06-28 2022-11-04 青岛海尔科技有限公司 Remote control method, device and system for intelligent household electrical appliance
CN115687827B (en) * 2022-11-15 2023-08-25 中电金信软件有限公司 Method, device, equipment and medium for communicating native page and H5 page path

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9823909B1 (en) * 2014-05-02 2017-11-21 Amazon Technologies, Inc. Program code conversion for cross-platform compatibility
CN110968325A (en) * 2019-10-28 2020-04-07 苏宁云计算有限公司 Applet conversion method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111694569A (en) * 2019-03-15 2020-09-22 北京奇虎科技有限公司 Method and device for constructing small program public component library and computing equipment
CN110764791B (en) * 2019-10-25 2023-10-27 网易(杭州)网络有限公司 Channel adaptation method and device for applet and electronic equipment
CN111124576B (en) * 2019-12-23 2022-08-09 焦点科技股份有限公司 Multi-platform applet and H5 page adaptation method and system
CN111222062B (en) * 2020-01-09 2021-06-01 百度在线网络技术(北京)有限公司 Applet running method and device, electronic equipment and storage medium
CN113110825B (en) * 2020-03-06 2022-06-03 北京五八信息技术有限公司 Method and device for converting interfaces of small programs

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9823909B1 (en) * 2014-05-02 2017-11-21 Amazon Technologies, Inc. Program code conversion for cross-platform compatibility
CN110968325A (en) * 2019-10-28 2020-04-07 苏宁云计算有限公司 Applet conversion method and device

Also Published As

Publication number Publication date
CN113946384A (en) 2022-01-18

Similar Documents

Publication Publication Date Title
CN113946384B (en) Method and device for running applet and electronic equipment
CN101119517B (en) Method of automatic downloading software from network server
US8848893B2 (en) Method and apparatus for callback processing in telecommunication capability opening
WO2016177341A1 (en) Interface calling method and device, and terminal
CN111752641A (en) Method, device, equipment and storage medium for starting service between micro-service containers
CN110888418B (en) Vehicle diagnosis method, device, equipment and readable storage medium
WO2015000398A1 (en) Systems and methods for testing terminal applications
CN108196878A (en) Method and device for generating application program installation package, electronic equipment and storage medium
CN108376544B (en) Information processing method, device, equipment and computer readable storage medium
CN106055375B (en) Application program installation method and device
CN110727524A (en) Method and device for realizing remote procedure call
CN108845810B (en) Method and device for dynamically updating application, electronic equipment and storage medium
CN110928548A (en) Data processing method and equipment
CN106843857B (en) Method and device for realizing SDK (software development kit) conversion of code base based on SRP (sequence-related protocol)
CN114844814A (en) Pressure testing method and device
CN111596970B (en) Method, device, equipment and storage medium for dynamic library delay loading
CN113691618A (en) Message notification method, device, message center and storage medium
CN112965732A (en) Resource package obtaining method, intelligent wearable device and storage medium
CN113900677A (en) Deployment method, device and equipment of program running environment and computer storage medium
CN112073462A (en) Positioning method and device
CN111078215A (en) Software product application method and device, storage medium and electronic equipment
CN111782282B (en) Start program loading method and device, electronic equipment and storage medium
US10726109B2 (en) Method and system for identifying whether an application is genuine by means of digital watermarks
CN111444100A (en) Test method, test device, test apparatus and storage medium
CN111857678B (en) Code generation method, device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant