CN110968325B - Applet conversion method and device - Google Patents

Applet conversion method and device Download PDF

Info

Publication number
CN110968325B
CN110968325B CN201911028915.2A CN201911028915A CN110968325B CN 110968325 B CN110968325 B CN 110968325B CN 201911028915 A CN201911028915 A CN 201911028915A CN 110968325 B CN110968325 B CN 110968325B
Authority
CN
China
Prior art keywords
functional component
code files
component
applet
target
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
CN201911028915.2A
Other languages
Chinese (zh)
Other versions
CN110968325A (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.)
Jiangsu Suning Cloud Computing Co ltd
SuningCom Co ltd
Original Assignee
Suning Cloud Computing 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 Suning Cloud Computing Co Ltd filed Critical Suning Cloud Computing Co Ltd
Priority to CN201911028915.2A priority Critical patent/CN110968325B/en
Publication of CN110968325A publication Critical patent/CN110968325A/en
Application granted granted Critical
Publication of CN110968325B publication Critical patent/CN110968325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source

Landscapes

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

Abstract

The invention discloses an applet conversion method and device, belonging to the technical field of computer software, wherein the method is used for converting a WeChat applet into a target applet and comprises the following steps: converting a plurality of code files of the WeChat applet into a plurality of initial code files supported by a target platform according to the acquired conversion instruction, and determining a plurality of functional components corresponding to the plurality of initial code files; identifying component categories of each functional component, wherein the component categories comprise a general functional component, a functional component to be degraded and a functional component to be replaced; converting the plurality of initial code files according to a conversion rule corresponding to the component category of each functional component to obtain a plurality of target code files of the target applet; a plurality of object code files are output to generate an object applet. The embodiment of the invention can quickly convert and distribute the WeChat small program serving as a standard software project to other small program platforms, can reduce the development cost and realize the maximum multiplexing of the WeChat small program.

Description

Applet conversion method and device
Technical Field
The invention relates to the technical field of computer software, in particular to a small program conversion method and device.
Background
The applet can be used without downloading and installing, the dream that the application is 'reachable by a touch hand' is realized, the user can open the application by scanning or searching once, the concept of 'walking after use' is also embodied, and the user does not need to care about whether to install too many applications.
WeChat applets were generated earlier and many companies have developed WeChat applets to assist in the operational promotion of company products or services. At present, small program platforms are released at a great dispute in the internet such as BAT, byte jitter, and payers, and if an enterprise wants to operate and popularize on different platforms, the enterprise needs to repeatedly develop small programs for the different platforms. In order to realize the reuse of the existing WeChat small program, a unified development framework can be used for development, and then conversion and distribution are carried out on the small program to other small program platforms. The unified development framework is essentially a standardized software engineering project, and in the standard framework, a development tool can be converted to other specific engineering projects. Such as conversion to an APP project, an applet project or a WEB project, this process is called "forward conversion". Conversely, converting a specific engineering project into a standardized software engineering project is called "reverse conversion".
However, when the wechat applet is converted and distributed to other applet platforms by using the forward conversion, although the effect of one set of codes and multi-terminal multiplexing can be achieved, the wechat applet needs to be re-developed at least once under the same framework, and thus the development cost is high.
Disclosure of Invention
In order to solve the technical problems mentioned in the background art, the invention provides an applet conversion method and device, which can be used for rapidly converting and distributing a wechat applet to other applet platforms as a standard software project, reducing development cost and realizing maximum multiplexing of the wechat applet.
The embodiment of the invention provides the following specific technical scheme:
in a first aspect, an applet converting method for converting a wechat applet into a target applet of a target platform is provided, the method comprising:
converting the plurality of code files of the WeChat applet into a plurality of initial code files supported by the target platform according to the acquired conversion instruction;
determining a plurality of functional components corresponding to the plurality of initial code files, and identifying the component category of each functional component, wherein the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced;
converting the plurality of initial code files according to a conversion rule corresponding to the component type of each functional component to obtain a plurality of target code files of the target applet;
outputting the plurality of object code files to generate the target applet.
Further, the converting, according to the obtained conversion instruction, the plurality of code files of the wechat applet into a plurality of initial code files supported by the target platform includes:
according to the item directory of the wechat applet carried by the conversion instruction, acquiring a plurality of code files of the wechat applet, wherein the code files comprise a WXML file, a JS file, a WXSS file and a JSON file;
analyzing the code files into syntax trees of tree structures respectively;
and traversing the nodes on each syntax tree, and outputting each processed syntax tree as a plurality of initial code files supported by the target platform.
Further, the syntax tree is a DOM tree.
Further, the identifying the component category of each of the functional components includes:
and determining the component category corresponding to the functional component identification of each functional component according to the mapping relation between the functional component identification and the component category which are created in advance.
Further, the converting the plurality of initial code files according to the conversion rule corresponding to the component type of each functional component to obtain a plurality of object code files of the object applet includes:
if the component type of the functional component is a general functional component, reserving codes corresponding to the functional component in the plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in the plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with a pre-acquired target code corresponding to the functional component.
In a second aspect, there is provided an applet converting apparatus for converting a wechat applet into a target applet of a target platform, the apparatus comprising:
the first conversion module is used for converting the plurality of code files of the WeChat small program into a plurality of initial code files supported by the target platform according to the acquired conversion instruction;
the determining module is used for determining a plurality of functional components corresponding to the plurality of initial code files;
the identification module is used for identifying the component category of each functional component, and the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced;
a second conversion module, configured to convert the multiple initial code files according to a conversion rule corresponding to a component category of each functional component, to obtain multiple target code files of the target applet;
an output module to output the plurality of object code files to generate the object applet.
Further, the first conversion module is specifically configured to:
according to the item directory of the wechat applet carried by the conversion instruction, acquiring a plurality of code files of the wechat applet, wherein the code files comprise a WXML file, a JS file, a WXSS file and a JSON file;
analyzing the code files into syntax trees of tree structures respectively;
and traversing the nodes on each syntax tree, and outputting each processed syntax tree as a plurality of initial code files supported by the target platform.
Further, the syntax tree is a DOM tree.
Further, the identification module is specifically configured to:
and determining the component category corresponding to the functional component identifier of each functional component according to the mapping relation between the functional component identifier and the component category which are created in advance.
Further, the second conversion module is specifically configured to:
if the component type of the functional component is a general functional component, reserving codes corresponding to the functional component in the plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in the plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with a target code corresponding to the pre-acquired functional component.
In a third aspect, an electronic device is provided, including:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the applet transforming method as described in the first aspect above.
In a fourth aspect, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the applet converting method as described in the first aspect above.
The embodiment of the invention provides an applet converting method and device, which are used for converting a WeChat applet into a target applet of a target platform, firstly converting a plurality of code files of the WeChat applet into a plurality of initial code files supported by the target platform, and determining a plurality of functional components corresponding to the plurality of initial code files; then identifying the component category of each functional component, wherein the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced; and finally, converting the plurality of initial code files according to a conversion rule corresponding to the component category of each functional component to obtain a plurality of target code files of the target small program, and outputting the plurality of target code files to generate the target small program, so that the small WeChat program can be quickly converted and distributed to other small program platforms as a standard software project, the development cost can be reduced, the maximum multiplexing of the small WeChat program is realized, and the normal development of the small WeChat program project is not influenced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart illustrating an applet conversion method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an applet converting apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides an applet converting method, which is used for converting a WeChat applet into a target applet of a target platform. The server may be an independent server or a server cluster composed of a plurality of servers. The method can be used for converting and distributing the WeChat small program to other small program platforms as a standard software project, not only can reduce the development cost and realize the maximum multiplexing of the WeChat small program, but also can not influence the normal development of the WeChat small program project. The target platform in the embodiment of the present invention may be a hundred-degree applet platform, a byte-jumping applet platform, or another applet platform.
Example one
An embodiment of the present invention provides an applet converting method, configured to convert a WeChat applet into a target applet of a target platform, and referring to fig. 1, the method includes the following steps:
and S1, converting a plurality of code files of the WeChat applet into a plurality of initial code files supported by a target platform according to the acquired conversion instruction.
The conversion instruction is used for indicating the conversion of the wechat applet into the target applet of the target platform, and the conversion instruction carries the project name and the directory path of the wechat applet, the project name and the release directory path of the target applet.
In practical application, an interface of the applet converter can be provided for a user, so that the user can input the item name and the directory path of the applet and the item name and the release directory path of the target applet on the interface of the applet converter, and generate a conversion instruction after the user clicks a conversion key on the interface to start conversion processing. The applet converter can be started in a command line mode by using npm, and the configuration of the applet converter is stored in a js file form and is output in a module form.
The plurality of code files of the WeChat applet comprise a WXML file, a JS file, a WXSS file and a JSON file.
Specifically, the WXML file is a WXML template file using WXML as suffix, and WXML (WeiXin Markup Language) is a set of tag languages designed by a framework, and a structure of a page can be constructed by combining a basic component and an event system. The JS file is a JS script logic file taking JS as suffix, and can monitor and process the life cycle function of the WeChat applet and declare a global variable in the JS file. The WXSS file is a WXSS Style file with WXSS as a suffix, the WXSS (WeiXin Style Sheets) is a set of Style languages and is used for describing the component styles of the WXML, and the WXSS is used for determining how the components of the WXML should be displayed. The JSON file is a JSON configuration file taking JSON as a suffix, which pages of the applet are composed can be configured in the JSON file, the window background color of the applet is configured, the style of the navigation bar is configured, the default title is configured, and the like.
Specifically, the implementation process of step S1 may include:
and S11, acquiring a plurality of code files of the WeChat applet, including a WXML file, a JS file, a WXSS file and a JSON file, according to the item directory of the WeChat applet carried by the conversion instruction.
Specifically, a NodeJS + FS + PATH library is used for carrying out full scanning on the project directory, extracting the WXML file, the JS file, the WXSS file and the JSON file for carrying out page grouping, and reading text contents in each code file.
And S12, respectively analyzing the code files into a syntax tree with a tree structure, performing traversal processing on nodes on the syntax tree, and outputting the processed syntax tree as a plurality of initial code files supported by a target platform.
Wherein, the syntax tree is a DOM syntax tree.
Specifically, the plurality of code files are respectively analyzed into DOM (document object model) syntax trees, nodes on each DOM syntax tree are traversed, each node is converted according to a syntax conversion library between the WeChat applet platform and the target platform, and the converted DOM syntax trees are output as a plurality of initial code files supported by the target platform.
Exemplarily, taking a hundredth applet as an example, in the development environment of the hundredth applet, the engineering files are divided into four types of SWAN, CSS, JS and JSON, where SWAN is similar to the WXML file of the wechat applet and is also an XML syntax. However, grammars such as logic judgment and circulation of the SWAN file of the Baidu applet on the XML are different from writing methods and using methods of the WXML file of the WeChat applet on the XML. And therefore this difference needs to be corrected. When the WXML file is modified, firstly, the WXML file is analyzed into a DOM tree, then, leaf nodes on the DOM tree are traversed, checked and modified according to an XML grammar conversion rule between the WXML file and the SWAN file, and then, the DOM tree is output as the SWAN file. After the WXSS file is analyzed into a DOM tree, leaf nodes on the DOM tree are subjected to traversal check and modification according to CSS syntax conversion rules between the WXSS file and the CSS file, then the DOM tree is output to be the CSS file, and a JS file and a JSON file of the WeChat applet are obtained by adopting a similar syntax conversion mode based on the JS file and the JSON file of the WeChat applet.
In this embodiment, the structure can be ensured to be complete by using the DOM tree for syntax transformation, and the output content is highly readable. And the whole project of the WeChat applet is organized into a project tree according to the dependency relationship, and then view correction and model correction are performed according to the characteristics of the conversion target platform, so that the WeChat applet can be suitable for converting to different applet platforms.
And S2, determining a plurality of functional components corresponding to the plurality of initial code files, and identifying the component types of the functional components, wherein the component types comprise a general functional component, a functional component to be degraded and a functional component to be replaced.
Specifically, the determining the implementation process of the plurality of functional components corresponding to the plurality of initial code files may include:
and reading codes in each initial code file, and determining a plurality of corresponding functional components.
Specifically, the implementation process of identifying the component category of each functional component in step S2 may include:
and determining the component category corresponding to the functional component identification of each functional component according to the mapping relation between the functional component identification and the component category which are created in advance.
The functional components of the wechat applet and the functional components supported by the target platform can be compared in advance, and the mapping relation between the functional component identification and the component type of the wechat applet is established according to the comparison result.
The general functional component means that a certain functional component of the WeChat applet can be directly used as a functional component of the hundred applet. For example, both the wechat applet and the hundredth applet have "commodity details" in the shopping function, and the functional component corresponding to the "commodity details" is a general functional component.
The functional component to be degraded refers to a function that the function of a certain functional component of the wechat applet exceeds the function supported by the MVVM framework, that is, when the functional component supported by the target platform is only matched with the functional part of the functional component of the wechat applet, the functional component is the functional component to be degraded. For example, the hundredth applet does not have the WXS function of the WeChat applet, but has a similar filter function, and the functional component corresponding to the WXS is the functional component to be degraded.
The functional component to be replaced is a functional component which is developed by customizing a certain functional component of the WeChat applet aiming at a special service scene, and when the functions of the functional component supported by the target platform and the functional component of the WeChat applet are not matched completely, the functional component is the functional component to be replaced. For example, a user login scene has a large platform difference between a WeChat applet and a Baidu applet, a functional component corresponding to the user login scene is a functional component to be replaced, and for example, functional components corresponding to service scenes such as payment, point burying, risk control and the like are also functional components to be replaced.
And S3, converting the plurality of initial code files according to the conversion rule corresponding to the component type of each functional component to obtain a plurality of target code files of the target small program.
Specifically, the implementation process of step S3 may include:
if the component type of the functional component is the general functional component, reserving codes corresponding to the functional component in a plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in a plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with the target code corresponding to the pre-acquired functional component.
When the codes corresponding to the general-purpose functional components are reserved, the corresponding codes can be directly used as codes in the code file of the target small program.
When the code corresponding to the functional component to be degraded is subjected to degradation processing, the view and the data can be directly bound, that is, the degradation processing is performed according to the lowest level of degradation conversion. For example, in a hundredth applet, which does not have the WXS function owned by the WeChat applet, but has a similar filter function, firstly, the WXS can be parsed and converted (CMD = > ES 6-MODELE), then the tag in xml is changed to < WXS > as < filter >, and the original configuration is invoked to realize demotion. For another example, SWAN files in the Baidu applet do not support coexistence of two instructions for/if in the same tag, and such instruction nodes are searched and split into two instruction nodes during the demotion processing, so as to implement demotion.
In the above example process, the WXS function in the wechat applet is demoted, and the WXS data snoop is converted into the component data snoop, so that the component data snoop conforms to the MVVM general rule, and the conversion product can be used in any MVVM framework.
When the code corresponding to the functional component to be replaced is replaced, the code corresponding to the functional component to be replaced can be replaced by a target code corresponding to a pre-acquired functional component in a plurality of initial code files, wherein the target code is stored in a preset code library after being independently developed. For example, in a user login scenario, a large platform difference exists between a hundred-degree applet and a WeChat applet, so that login processes of the hundred-degree applet and the WeChat applet are very different, the object code in the hundred-degree applet is separately developed and stored in a preset code library, the object code is called in a conversion process, codes corresponding to functional components to be replaced in the WeChat applet are directly covered, and in addition, similar processing is required for services such as payment, point burying, risk control and the like.
And S4, outputting a plurality of object code files to generate the object small program.
Specifically, the target applet is generated by outputting the plurality of target code files to a release directory path of the target applet. Wherein, a plurality of object code files of the object small program have the same path and file name, so as to facilitate the developer to reduce configuration items.
Exemplarily, the SWAN file, the CSS file, the JS file, and the JSON file obtained by the conversion are exported to a distribution directory path of the hundred-degree applet to generate the hundred-degree applet.
The applet converting method provided by the embodiment of the invention is used for converting a WeChat applet into a target applet of a target platform, firstly converting a plurality of code files of the WeChat applet into a plurality of initial code files supported by the target platform, and determining a plurality of functional components corresponding to the plurality of initial code files; then identifying the component category of each functional component, wherein the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced; and finally, converting the plurality of initial code files according to a conversion rule corresponding to the component category of each functional component to obtain a plurality of target code files of the target small program, and outputting the plurality of target code files to generate the target small program, so that the micro-messaging small program can be quickly converted and distributed to other small program platforms as a standard software project, development cost can be reduced, the maximum multiplexing of the micro-messaging small program is realized, and meanwhile, the normal development of the micro-messaging small program project is not influenced.
Example two
An embodiment of the present invention provides an applet converting apparatus, configured to convert a WeChat applet into a target applet of a target platform, and referring to fig. 2, the apparatus includes the following:
the first conversion module 21 is configured to convert, according to the obtained conversion instruction, the multiple code files of the WeChat applet into multiple initial code files supported by the target platform;
a determining module 22, configured to determine a plurality of functional components corresponding to the plurality of initial code files;
the identification module 23 is used for identifying the component category of each functional component, wherein the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced;
the second conversion module 24 is configured to convert the multiple initial code files according to a conversion rule corresponding to the component type of each functional component to obtain multiple target code files of the target applet;
and an output module 25, configured to output a plurality of object code files to generate an object applet.
Further, the first conversion module 21 is specifically configured to:
according to the item directory of the WeChat applet, acquiring a plurality of code files of the WeChat applet, wherein the code files comprise a WXML file, a JS file, a WXSS file and a JSON file;
respectively analyzing the plurality of code files into a syntax tree of a tree structure;
and traversing the nodes on each syntax tree, and outputting each processed syntax tree as a plurality of initial code files supported by the target platform.
Further, the syntax tree is a DOM tree.
Further, the identification module 23 is specifically configured to:
and determining the component category corresponding to the functional component identification of each functional component according to the mapping relation between the functional component identification and the component category which are created in advance.
Further, the second conversion module 24 is specifically configured to:
if the component type of the functional component is a universal functional component, reserving codes corresponding to the functional component in a plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in a plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with the target code corresponding to the pre-acquired functional component.
The applet converting apparatus provided in this embodiment of the present invention is similar to the applet converting method provided in the embodiment of the present invention, and is capable of executing the applet converting method provided in the embodiment of the present invention. For details of the applet conversion method provided in the embodiments of the present invention, details thereof are not described herein.
In addition, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the applet transforming method as described in the first aspect above.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the applet converting method according to the first aspect.
All the above-mentioned optional technical solutions can be combined arbitrarily to form the optional embodiments of the present invention, and are not described herein again.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true spirit and scope of the embodiments of the present invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (8)

1. An applet conversion method for converting a wechat applet to a target applet of a target platform, the method comprising:
converting the plurality of code files of the WeChat small program into a plurality of initial code files supported by the target platform according to the acquired conversion instruction;
determining a plurality of functional components corresponding to the plurality of initial code files, and identifying the component category of each functional component, wherein the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced;
converting the plurality of initial code files according to a conversion rule corresponding to the component type of each functional component to obtain a plurality of target code files of the target applet;
outputting the plurality of object code files to generate the target applet;
wherein the converting the plurality of initial code files according to the conversion rule corresponding to the component type of each functional component to obtain a plurality of object code files of the object applet comprises:
if the component type of the functional component is a general functional component, reserving codes corresponding to the functional component in the plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in the plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with a pre-acquired target code corresponding to the functional component.
2. The method of claim 1, wherein the converting the plurality of code files of the WeChat applet into a plurality of initial code files supported by the target platform according to the obtained conversion instruction comprises:
according to the item directory of the wechat applet carried by the conversion instruction, acquiring a plurality of code files of the wechat applet, wherein the code files comprise a WXML file, a JS file, a WXSS file and a JSON file;
analyzing the code files into syntax trees of tree structures respectively;
and traversing the nodes on each syntax tree, and outputting each processed syntax tree as a plurality of initial code files supported by the target platform.
3. The method of claim 2, wherein the syntax tree is a DOM tree.
4. The method of claim 1, wherein the identifying the component category of each of the functional components comprises:
and determining the component category corresponding to the functional component identification of each functional component according to the mapping relation between the functional component identification and the component category which are created in advance.
5. An applet converting apparatus for converting a wechat applet to a target applet of a target platform, the apparatus comprising:
the first conversion module is used for converting the plurality of code files of the WeChat small program into a plurality of initial code files supported by the target platform according to the acquired conversion instruction;
the determining module is used for determining a plurality of functional components corresponding to the plurality of initial code files;
the identification module is used for identifying the component category of each functional component, and the component category comprises a general functional component, a functional component to be degraded and a functional component to be replaced;
a second conversion module, configured to convert the multiple initial code files according to a conversion rule corresponding to a component category of each functional component, to obtain multiple target code files of the target applet;
an output module for outputting the plurality of object code files to generate the object applet;
wherein the second conversion module is specifically configured to:
if the component type of the functional component is a general functional component, reserving codes corresponding to the functional component in the plurality of initial code files;
if the component type of the functional component is the functional component to be degraded, performing degradation processing on codes corresponding to the functional component in the plurality of initial code files;
and if the component type of the functional component is the functional component to be replaced, replacing the code corresponding to the functional component in the plurality of initial code files with a pre-acquired target code corresponding to the functional component.
6. The apparatus of claim 5, wherein the first conversion module is specifically configured to:
according to the item directory of the wechat applet carried by the conversion instruction, acquiring a plurality of code files of the wechat applet, wherein the code files comprise a WXML file, a JS file, a WXSS file and a JSON file;
analyzing the code files into syntax trees of tree structures respectively;
and traversing the nodes on each syntax tree, and outputting each processed syntax tree as a plurality of initial code files supported by the target platform.
7. The apparatus of claim 6, wherein the syntax tree is a DOM tree.
8. The apparatus of claim 5, wherein the identification module is specifically configured to:
and determining the component category corresponding to the functional component identifier of each functional component according to the mapping relation between the functional component identifier and the component category which are created in advance.
CN201911028915.2A 2019-10-28 2019-10-28 Applet conversion method and device Active CN110968325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911028915.2A CN110968325B (en) 2019-10-28 2019-10-28 Applet conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911028915.2A CN110968325B (en) 2019-10-28 2019-10-28 Applet conversion method and device

Publications (2)

Publication Number Publication Date
CN110968325A CN110968325A (en) 2020-04-07
CN110968325B true CN110968325B (en) 2022-12-13

Family

ID=70029913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911028915.2A Active CN110968325B (en) 2019-10-28 2019-10-28 Applet conversion method and device

Country Status (1)

Country Link
CN (1) CN110968325B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111796829B (en) * 2020-05-19 2024-06-07 北京三快在线科技有限公司 Applet updating method, device, electronic equipment and computer readable storage medium
CN111610978B (en) * 2020-05-19 2023-06-20 建信金融科技有限责任公司 Applet conversion method, device, equipment and storage medium
CN111857709A (en) * 2020-06-12 2020-10-30 北京三快在线科技有限公司 Mapping method and device for React component and Flutter component, electronic equipment and storage medium
CN112527415A (en) * 2020-12-23 2021-03-19 深圳尚米网络技术有限公司 Method, device, equipment and medium for migrating applets across platforms
CN112764757B (en) * 2021-01-18 2024-06-14 深圳前海微众银行股份有限公司 Applet processing method, device, equipment and storage medium
CN112860235B (en) * 2021-02-04 2023-09-05 北京百度网讯科技有限公司 Method, device, equipment and storage medium for processing text
CN112560076B (en) * 2021-02-23 2021-05-18 浙江口碑网络技术有限公司 Program page display method and device, computer equipment and readable storage medium
CN112799670B (en) * 2021-04-14 2021-08-03 盛威时代科技集团有限公司 Method and system for unified multi-terminal logic development
CN113312055B (en) * 2021-05-28 2023-02-24 支付宝(中国)网络技术有限公司 Applet launching method, device and equipment
CN113672224A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Method and device for generating small program page code and computer equipment
CN113805890A (en) * 2021-09-10 2021-12-17 中国银联股份有限公司 Method, device, terminal, system and storage medium for migrating applets across applications
CN113946384B (en) * 2021-10-15 2023-06-13 中电金信软件有限公司 Method and device for running applet and electronic equipment
CN114185551B (en) * 2022-02-17 2022-06-21 浙江口碑网络技术有限公司 Applet compiling method, applet running method and device and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109710260A (en) * 2018-11-16 2019-05-03 青岛特锐德电气股份有限公司 It is a kind of based on multi-platform applet code converting system and conversion method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109710260A (en) * 2018-11-16 2019-05-03 青岛特锐德电气股份有限公司 It is a kind of based on multi-platform applet code converting system and conversion method

Also Published As

Publication number Publication date
CN110968325A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
CN110968325B (en) Applet conversion method and device
CN109508191B (en) Code generation method and system
US9977770B2 (en) Conversion of a presentation to Darwin Information Typing Architecture (DITA)
US20190129734A1 (en) Data collection workflow extension
CN106547527B (en) JavaScript file construction method and device
US20020107684A1 (en) Methods and apparatus for globalising software
EP2521043A1 (en) Method for establishing a relationship between semantic data and the running of a widget
US9053450B2 (en) Automated business process modeling
CN115599386A (en) Code generation method, device, equipment and storage medium
CN116028028A (en) Request function generation method, device, equipment and storage medium
US9244706B2 (en) Command line shell command generation based on schema
CN110069455B (en) File merging method and device
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
Le Zou et al. On synchronizing with web service evolution
CN111273940B (en) Method and device for uploading program file to code warehouse
CA2784172A1 (en) Modular tool for constructing a link to a rights program from article information
US8959246B2 (en) Method and computer program for a mediation processing node to update a message
CN117785274B (en) Method for disassembling version based on gitlab and micro-service architecture
AU2018313995B2 (en) Systems and methods for providing globalization features in a service management application interface
CN109992293A (en) The assemble method and device of android system complement version information
CN112988528B (en) Log processing method, device and container group
CN117667089A (en) Front-end form generation method and device, storage medium and electronic equipment
CN117785156A (en) Single file optimization method and device, electronic equipment and storage medium
Krause et al. Introduction to Node
Freeman et al. Understanding React Projects

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
CP03 Change of name, title or address

Address after: No.1-1 Suning Avenue, Xuzhuang Software Park, Xuanwu District, Nanjing, Jiangsu Province, 210000

Patentee after: Jiangsu Suning cloud computing Co.,Ltd.

Country or region after: China

Address before: No.1-1 Suning Avenue, Xuzhuang Software Park, Xuanwu District, Nanjing, Jiangsu Province, 210000

Patentee before: Suning Cloud Computing Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address
TR01 Transfer of patent right

Effective date of registration: 20240422

Address after: 210000, 1-5 story, Jinshan building, 8 Shanxi Road, Nanjing, Jiangsu.

Patentee after: SUNING.COM Co.,Ltd.

Country or region after: China

Address before: No.1-1 Suning Avenue, Xuzhuang Software Park, Xuanwu District, Nanjing, Jiangsu Province, 210000

Patentee before: Jiangsu Suning cloud computing Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right