CN113791836A - Subprogram generation method and device, medium and electronic device - Google Patents

Subprogram generation method and device, medium and electronic device Download PDF

Info

Publication number
CN113791836A
CN113791836A CN202110089646.1A CN202110089646A CN113791836A CN 113791836 A CN113791836 A CN 113791836A CN 202110089646 A CN202110089646 A CN 202110089646A CN 113791836 A CN113791836 A CN 113791836A
Authority
CN
China
Prior art keywords
data
component
source code
code file
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.)
Pending
Application number
CN202110089646.1A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110089646.1A priority Critical patent/CN113791836A/en
Publication of CN113791836A publication Critical patent/CN113791836A/en
Pending legal-status Critical Current

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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

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 present disclosure relates to the field of computers, and in particular, to a method and an apparatus for generating a sub-program, a computer-readable storage medium, and an electronic device, where the method includes: acquiring user request data, wherein the user request data comprises a plurality of component data and configuration data; calling component codes corresponding to the component data according to the component data; and obtaining a source code file according to the configuration data and the component codes, and compressing the source code file to generate a target subprogram corresponding to the application platform. Through the technical scheme of the embodiment of the disclosure, the target subprogram corresponding to the application platform can be generated according to the user request data.

Description

Subprogram generation method and device, medium and electronic device
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method and an apparatus for generating a subprogram, a computer-readable storage medium, and an electronic device.
Background
With the development of the internet and intelligent terminal technology, more and more applications appear on the intelligent terminal, and the forms are more and more abundant.
The existing small program is an implementation form of an application function, and the small program is a basic application depending on application program design, and can be opened only by scanning or searching once. For a user, the system can be used without downloading and installing, the use time cost and the storage space of the terminal equipment can be saved, and for developers, the development cost and the popularization cost can be saved by the small program. The small program is used as an internet platform product and has a good development prospect.
With the diversification of services and the continuous development of industries, the demand for the online speed of small programs is further improved. However, in the prior art, customized development is required for different service types, and development work has certain repeatability, low efficiency and complexity.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a method and an apparatus for generating a sub program, a computer-readable storage medium, and an electronic device, which can generate a target sub program corresponding to an application platform according to user request data.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a method for generating a subprogram, the subprogram running in dependence on a target application platform, the method comprising: obtaining user request data, the user request data comprising component data and configuration data for a plurality of candidate components, the candidate components being components capable of operating in dependence on the target application platform;
in an exemplary embodiment of the present disclosure, based on the foregoing scheme, the target subprogram and the compressed integrated packet corresponding to the target subprogram are obtained; uploading the compressed integrated package into at least one of the application platforms.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the uploading includes: manual upload or automatic upload.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, before obtaining user request data, where the user request data includes component data and configuration data, the method further includes: receiving an operation instruction and configuration data of a user; selecting a plurality of target components in a template database according to the operation instructions of the user, wherein the target components comprise component data; and generating user request data according to the plurality of component data and the configuration data.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the compressing the source code file to generate a target subroutine corresponding to a target application platform includes: acquiring the source code file and a preset standard, and judging whether the source code file meets the preset standard or not; and when the source code file meets the preset standard, compressing the source code file to generate a target subprogram corresponding to the target application platform.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the determining whether the source code file meets a preset criterion includes: acquiring the data size of the source code file; comparing the data size of the source code file with the preset threshold value; and when the data size of the source code file is equal to or smaller than a preset threshold value, the source code file conforms to a preset standard.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the calling component code corresponding to the plurality of component data according to the plurality of component data includes: acquiring a plurality of preset storage path information corresponding to the plurality of component data; and calling component codes corresponding to the plurality of component data according to the plurality of preset storage path information.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the obtaining a source code file according to the configuration data and the component code includes: acquiring the page layout data; and configuring the component codes according to the page layout data to obtain a source code file.
According to a second aspect of the present disclosure, there is provided an apparatus for generating a subprogram, the subprogram running in dependence on a target application platform, the apparatus comprising: a data acquisition module for acquiring user request data, the user request data including component data and configuration data of a plurality of candidate components, the candidate components being components capable of operating in dependence on the target application platform; the code calling module is used for calling component codes corresponding to the component data according to the component data; and the program generation module is used for obtaining a source code file according to the configuration data and the component codes and compressing the source code file to generate a target subprogram corresponding to the target application platform.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the method of generating a subroutine as described in the first aspect of the above embodiments.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising:
a processor; and
a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of generating a subroutine as described in the first aspect of the above embodiments.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the method for generating a subroutine according to an embodiment of the present disclosure, after the user request data is acquired, component codes corresponding to a plurality of component data may be called according to the component data of a plurality of candidate components in the user request data, then a source code file is generated according to the component codes and configuration data, and the source code file is compressed to generate a target subroutine. According to the method and the device, the target subprogram can be generated according to the component data and the configuration data input by the user, customized development is not needed for different services, code multiplexing efficiency is improved, user operation is simplified, workload of developers is reduced, and development efficiency and the online speed of the subprogram are improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
FIG. 1 schematically illustrates a schematic diagram of an exemplary system architecture to which a method of generating a sub-program of an embodiment of the present disclosure may be applied;
fig. 2 schematically shows a flowchart of a generation method of a subroutine in an exemplary embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow chart for generating user request data based on user operating instructions and configuration data in an exemplary embodiment of the disclosure;
FIG. 4 schematically illustrates a schematic diagram of a subroutine design visualization interface in an exemplary embodiment of the present disclosure;
fig. 5 schematically illustrates a flowchart of retrieving component code corresponding to a plurality of component data according to preset storage path information in an exemplary embodiment of the present disclosure;
FIG. 6 is a flow diagram that schematically illustrates configuring component code to obtain a source code file according to page layout data, in an exemplary embodiment of the disclosure;
fig. 7 schematically illustrates a flowchart for determining whether a source code file meets a preset criterion in an exemplary embodiment of the present disclosure;
fig. 8 schematically illustrates a flowchart of determining that the data size of the source code file is equal to or smaller than a preset threshold in an exemplary embodiment of the present disclosure;
fig. 9 is a flowchart schematically illustrating acquiring a compressed integrated packet corresponding to a target sub-program and uploading the compressed integrated packet to at least one application platform according to an exemplary embodiment of the present disclosure;
fig. 10 schematically shows a composition diagram of a generation apparatus of a sub program in an exemplary embodiment of the present disclosure;
fig. 11 schematically shows a schematic structural diagram of a computer system of an electronic device suitable for implementing an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in the form of software, or in one or more software-hardened modules, or in different networks and/or processor devices and/or microcontroller devices.
With the development of the internet, the development of the applet is promoted, the applet is an application which can be used without downloading and installing, the user can open the application by scanning or searching once depending on the existing application platform (such as WeChat), the idea of going away after use is realized, the user does not need to install too many applications, and the application can be used anywhere without installing and uninstalling. From the essence of the applet, the applet exists in a form similar to a Web App, provides a direct service without downloading, namely searching, and provides more services for a user by opening more Application Programming Interfaces (APIs) and an Application platform portal. But applets are different from Web apps because the development logic and the development language of the applets are completely different.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the generation method of the subroutine of the embodiment of the present disclosure can be applied.
As shown in fig. 1, the system architecture 1000 may include one or more of terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 is used to provide a medium for communication links between the terminal devices 1001, 1002, 1003 and the server 1005. Network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, the server 1005 may be a server cluster composed of a plurality of servers.
A user may use the terminal devices 1001, 1002, 1003 to interact with a server 1005 via a network 1004 to receive or transmit messages or the like. The terminal devices 1001, 1002, 1003 may be various electronic devices having a display screen, including but not limited to smart phones, tablet computers, portable computers, desktop computers, and the like. In addition, the server 1005 may be a server that provides various services.
In one embodiment, the main body of the sub-program generation method of the present disclosure may be the server 1005, and the server 1005 may acquire the user request data transmitted by the terminal devices 1001, 1002, and 1003, process the user request data according to the sub-program generation method of the present disclosure, and then return the target sub-program corresponding to the application platform obtained after the processing to the terminal devices 1001, 1002, and 1003. Further, the method for generating a sub program of the present disclosure may be executed by the terminal device 1001, 1002, 1003 or the like to realize a process of obtaining a target sub program corresponding to the application platform according to the user request data.
Further, the implementation procedure of the generation method of the sub program of the present disclosure may also be implemented by the terminal devices 1001, 1002, 1003 and the server 1005 together. For example, the terminal devices 1001, 1002, and 1003 may obtain user request data, call component codes corresponding to the plurality of component data according to the plurality of component data, and then transmit the obtained component codes to the server 1005, so that the server 1005 may obtain a source code file according to the configuration data and the component codes, and compress the source code file to generate a target sub program corresponding to the application platform.
The subprogram generation scheme can be applied to various different application programs, and can be used for developing the subprograms meeting the business requirements according to different application programs. For example, for a certain e-commerce application software, a merchant can quickly develop an applet according to the business requirements of the merchant; for another example, for a certain travel application software, the customer service department can rapidly develop small programs according to the business requirements of the customer service department; for another example, for a certain chat communication application software, a user can quickly develop an applet according to the service requirement of the user, and in application, the user can obtain the applet by scanning a two-dimensional code or searching and the like. The application scenario of the generated applet is not particularly limited in this disclosure.
According to the method for generating the subprogram provided in the exemplary embodiment, after the user request data is acquired, component codes corresponding to a plurality of component data may be called according to the plurality of component data in the user request data, then a source code file is generated according to the component codes and the configuration data, and the source code file is compressed to generate the target subprogram. As shown in fig. 2, the subroutine generating method may include the steps of:
s210: obtaining user request data, wherein the user request data comprises component data and configuration data of a plurality of candidate components, and the candidate components are components capable of running depending on a target application platform;
s220: calling component codes corresponding to the plurality of component data according to the plurality of component data;
s230: and obtaining a source code file according to the configuration data and the component codes, and compressing the source code file to generate a target subprogram corresponding to the target application platform.
In the method for generating the subprogram provided by the exemplary embodiment, the target subprogram is generated according to the component data and the configuration data input by the user, and customized development is not required for different services, so that the code multiplexing efficiency is improved, the user operation is simplified, the workload of developers is reduced, and further the development efficiency and the online speed of the subprogram are improved.
Next, steps S210 to S230 of the generation of the subroutine in the present exemplary embodiment will be described in more detail with reference to the drawings and the embodiments.
Step S210, user request data is obtained, wherein the user request data comprises component data and configuration data of a plurality of candidate components, and the candidate components are components capable of running depending on a target application platform;
in an example embodiment of the present disclosure, when a user needs to perform sub-program development, user request data may be input, and the user request data may include component data of a plurality of candidate components and configuration data, the candidate components being components capable of running depending on a target application platform. Specifically, the candidate components may include small modules in the subprogram for completing different functions, when the subprogram is developed, the functions of the subprogram may be divided into a plurality of components, and the plurality of candidate components may be combined according to different business requirements to develop the subprogram.
For example, for an e-commerce subprogram, candidate components such as login, message notification, carousel, coupon, commodity recommendation, intelligent commodity, second-killing class, premium single, countdown and the like can be set in advance; for example, for a video playing sub-program, a component for displaying images, a component for displaying text information, or a component for inputting comments by a user, etc. may be set in advance, and may be updated continuously according to the development of the business environment.
In an example embodiment of the present disclosure, a corresponding component may be found through component data, and the component data may include data having a correspondence relationship with the component. For example, the component data may include a component tag, assuming that the component data is XXTZ, its corresponding component is a message notification component; alternatively, the component data may also include a component index by which the corresponding component may be looked up. The form of the component data is not particularly limited in the present disclosure, as long as the corresponding component can be searched for according to the component data.
In an example embodiment of the present disclosure, the configuration data may include information about the sub-program, for example, the configuration data may be basic built-in data of the applet, the applet name, the user identification, the merchant identification, the type of the applet, etc.; the page layout of the subprogram can be further included, for example, the placement position of the component, the display form of the component, the corresponding icon of the component, the color of the component, and the like; and may also include content such as service data.
In an example embodiment of the present disclosure, a user may input component data and configuration data that meet his business requirements in a certain subprogram generation tool, such as a tool for node-based development. The component data and the configuration data may be input by instructions or by pictures. Specifically, the configuration data and the component data may be acquired and combined to obtain user request data. For example, a plurality of instructions may be input in the subroutine, and the corresponding components may be acquired according to the instructions; as another example, the subroutine generation tool may include component templates that the user may drag directly into the operating interface of the subroutine generation tool to enter component data. The present disclosure does not specifically limit the manner in which component data and configuration data are input.
In an example embodiment of the present disclosure, before obtaining the user request data, a plurality of target components may be selected in the template database according to an operation instruction of the user, and the user request data may be generated according to the component data and the configuration data. Referring to fig. 3, generating user request data according to an operation instruction and configuration data of a user may include the following steps S310 to S330:
step S310, receiving an operation instruction and configuration data of a user;
in an example embodiment of the present disclosure, an operation instruction and configuration data of a user may be acquired. Specifically, a text instruction or a drag operation instruction input by a user may be received, and these user operation instructions may be used to acquire the component. The present disclosure does not specifically limit the form of the operation instruction of the user as long as the component can be acquired by the operation instruction of the user.
Step S320, selecting a plurality of target components in the template database according to the operation instructions of the user, wherein the target components comprise component data;
in an example embodiment of the present disclosure, a template database may be set in advance, and the template database includes a plurality of components that can be applied to the subprogram. For example, for a video playing applet, a component that displays an image, a component that displays text information, or a component that a user inputs a comment may be included, which is not limited in the embodiment of the present invention. For the file management applet, an article management component, a form management component, a product management component, or a payment management component, etc. may be included. The components provided in the template database are not particularly limited in this disclosure.
In an example embodiment of the present disclosure, after the operation instruction of the user is obtained, the target component may be selected in the template database according to the operation instruction of the user. Specifically, the required target component can be searched in the template database according to the operation instruction of the user, and the corresponding target component can also be directly dragged through the dragging operation instruction. The present disclosure does not specifically limit the manner in which the target component is selected in the template database according to the operation instruction of the user.
For example, referring to fig. 4, a sub-programming visualization interface 400 may be provided, where the sub-programming visualization interface 400 includes a component template library 440 and a sub-programming interface 450, the component template library 440 may include a plurality of components 410, and the components 410 may be directly dragged by a dragging operation 420, and the components 410 are dragged to the sub-programming interface 450 to obtain a target component 4110.
Further, the component template library 440 may be partitioned according to component types. For example, for an e-commerce class subroutine, the component template library 440 may be divided into purchase classes including poster components, blind box components, floating layer components, etc.; commodity classes can also be divided, including intelligent commodity components, leaderboard components, AR components, beyond commodity components, and the like. It should be noted that, in the present disclosure, the partition manner of the template database and the specific components in each category are not particularly limited, and may be adjusted according to a specific service scenario.
Step S330, generating user request data according to the plurality of component data and the configuration data.
In an example embodiment of the present disclosure, after the target component and the target data corresponding to the target component are obtained, the component data and the configuration data may be combined to generate user request data. Specifically, formats of the component data and the configuration data may be unified, and the component data and the configuration data having the same format may be combined to generate the user request data. It should be noted that the present disclosure does not specifically limit the manner in which the user request data is generated from the component data and the configuration data.
Through the steps S310 to S330, before the user request data is obtained, a plurality of target components may be selected from the template database according to the operation instruction of the user, and the user request data may be generated according to the component data and the configuration data.
Step S220, calling component codes corresponding to the component data according to the component data;
in an example embodiment of the present disclosure, after the plurality of component data obtained in the above steps are acquired, a component code corresponding to the component book data may be called according to the component data. Specifically, the component data may include data having a correspondence relationship with the component, and a code corresponding to the component may be searched for according to the component data. Component code is a code file written using a language supported by a development tool, and is a definite system of rules that represent information in discrete form by characters, symbols, or signal symbols, which represent different components. The component code may be stored in the terminal device or the server, and after the component data is acquired, the component code corresponding to the component data may be searched and retrieved in the terminal device or the server according to the component tag or the component index in the component data.
In an example embodiment of the present disclosure, a plurality of preset storage path information corresponding to component data may be obtained, and a component code corresponding to the plurality of component data may be called according to the plurality of preset storage path information. Referring to FIG. 5, retrieving component codes corresponding to a plurality of component data according to preset storage path information includes the following steps S510-S520:
step S510, acquiring a plurality of preset storage path information corresponding to a plurality of component data;
in an example embodiment of the present disclosure, after the plurality of component data obtained in the above step are obtained, preset storage path information corresponding to each component data may be obtained. Specifically, the preset storage path information includes a storage path of the component code, and the storage path of the component code may be set in advance, so as to search for the component code based on the storage path.
Step S520, retrieving a component code corresponding to the plurality of component data according to the plurality of preset storage path information.
In an example embodiment of the present disclosure, after the preset storage path information corresponding to the plurality of component data obtained in the above step is acquired, the component code corresponding to the plurality of component data may be called according to the plurality of preset storage path information. In particular, a file and/or folder line of the component code may be looked up in the terminal device or the server.
For example, when the preset storage path information is "t 1-t2-t 3", it indicates that the component code is stored in the folder t3 within the subfolder t2 in the folder t 1; alternatively, the component code may also be represented as a file with a file name t3 within the subfolder t2 stored in the folder t 1. The present disclosure does not specifically limit the form of the preset storage path information, as long as the component code corresponding to the plurality of component data can be called according to the preset storage path information.
Through the above steps S510 to S520, a plurality of preset storage path information corresponding to the component data may be obtained, and the component codes corresponding to the plurality of component data may be called according to the plurality of preset storage path information.
And step S230, obtaining a source code file according to the configuration data and the component codes, and compressing the source code file to generate a target subprogram corresponding to the application platform.
In an example embodiment of the present disclosure, after the component code and the configuration data in the above steps are acquired, the component code and the configuration data may be packaged into a source code file. In particular, configuration data may be placed into component code and integrated with the packed commands. For example, data in the configuration data such as applet name, user identification, merchant identification, type of applet, etc. may be placed in the component code. Furthermore, compiling the integrated file to obtain a readable and writable source code file.
In an example embodiment of the present disclosure, after the source code file obtained in the above step is obtained, the source code file may be compressed to obtain a target sub program corresponding to the application platform. Specifically, different application platforms have different compression rules (e.g., zip, rar, etc.), and the source code file may be compressed according to the different compression rules, where the file obtained by compression is a target subprogram conforming to the application platform. Further, in the compression process, the hierarchical relationship and directory structure of the subprogram can be set.
In an example embodiment of the present disclosure, the configuration data may include page layout data, and after the page layout data is obtained, the component code may be configured according to the page layout data to obtain a source code file. Referring to fig. 6, configuring the component code according to the page layout data to obtain a source code file may include the following steps S610 to S620:
step S610, acquiring page layout data;
in an example embodiment of the present disclosure, the page layout data may include page layout style data of the sub program. For example, the page layout data may include placement positions of various components in the sub-program, colors of different components in the sub-program, fonts of component characters in the sub-program, transition animations of components in the sub-program, and the like. The specific content of the page layout data is not particularly limited in this disclosure.
Step S620, configuring the component codes according to the page layout data to obtain a source code file.
In an example embodiment of the present disclosure, after the page layout data obtained in the above step is obtained, the component code may be configured according to the page layout data to obtain a source code file. Specifically, the page layout data may be combined with the component code, so that the component code includes the page layout data; the component code can also be directly configured according to the page layout data so as to adjust the related content of the component code. The manner in which the page layout data is configured for the component code is not particularly limited in this disclosure.
Through the steps S610 to S620, after the page layout data is obtained, the component code may be configured according to the page layout data to obtain the source code file.
In an example embodiment of the present disclosure, before compressing a source code file to generate a target sub-program corresponding to an application platform, the source code file and a preset standard may be obtained, and whether the source code file meets the preset standard or not may be determined, and when the source code file meets the preset standard, the source code file is compressed to generate the target sub-program corresponding to the target application platform. Referring to fig. 7, the determining whether the source code file meets the predetermined standard includes the following steps S710 to S720:
step S710, acquiring a source code file and a preset standard, and judging whether the source code file meets the preset standard;
in an example embodiment of the present disclosure, the preset standard and the source code file obtained in the above steps may be obtained. Specifically, the preset standard may be stored in the terminal device or the server, and the preset standard is called when it is required to determine whether the source code file meets the preset standard; the preset standard of the external input can be acquired in real time. The preset standard may include whether the format of the source code file meets the standard, whether the integrity meets the standard, whether the content meets the standard, and the like.
In an example embodiment of the present disclosure, after the source code file and the preset standard are obtained, it may be determined whether the source code file meets the preset standard. For example, when the preset standard is whether the content meets the standard, a sensitive information base which cannot be online can be set in advance, the source code file is checked, and when the sensitive information which cannot be online is related in the source code file, the source code file is judged to be not in accordance with the preset standard. For another example, when the preset standard is that whether the format is the specific format, the format of the source code file may be checked, and when the source code file does not conform to the specific format, it is determined that the source code file does not conform to the preset standard.
Step S720, when the source code file meets the preset standard, the source code file is compressed to generate a target subprogram corresponding to the target application platform.
Through the steps S710 to S720, before compressing the source code file to generate the target subprogram corresponding to the application platform, the source code file and the preset standard may be obtained, and whether the source code file meets the preset standard is determined, and when the source code file meets the preset standard, the source code file is compressed to generate the target subprogram corresponding to the target application platform.
In an example embodiment of the present disclosure, the data size of the source code file may be obtained, and the data size of the source code file may be compared with a preset threshold, and when the data size of the source code file is equal to or smaller than the preset threshold, the preset criterion may be met. Referring to fig. 8, determining that the data size of the source code file is equal to or smaller than the preset threshold may include the following steps S810 to S830:
step S810, acquiring the data size of a source code file;
in an example embodiment of the present disclosure, the data size of the source code file may be obtained. Specifically, the data size of the source code file can be obtained by adopting a method of a PackageStats object. Note that, in the present disclosure, a manner of obtaining the data size of the source code file is not particularly limited.
Step S820, comparing the data size of the source code file with a preset threshold value;
in step S830, when the data size of the source code file is equal to or smaller than a preset threshold, the data size meets a preset standard.
In an example embodiment of the present disclosure, the preset threshold may be stored in the terminal device or the server, and after the data size of the source code file in the above step is reached, the preset threshold may be obtained, and the data size of the source code file is compared with the preset threshold, and when the data size of the source code file is equal to or smaller than the preset threshold, the preset criterion is met. For example, the data size of the obtained source code file is 10MB, the preset threshold is 15MB, and at this time, the data size of the source code file is smaller than the preset threshold, that is, the data size of the source code file meets the preset standard. It should be noted that, the size of the preset threshold is not particularly limited in the present disclosure.
Through the steps S810 to S820, the data size of the source code file may be obtained, and the data size of the source code file is compared with the preset threshold, and when the data size of the source code file is equal to or smaller than the preset threshold, the data size of the source code file meets the preset standard.
In an example embodiment of the present disclosure, after the target subprogram obtained in the above step is obtained, the target subprogram and a compressed integrated package corresponding to the target subprogram may be obtained, and the compressed integrated package is uploaded to at least one application platform. Referring to fig. 9, acquiring a compressed integrated packet corresponding to a target subprogram and uploading the compressed integrated packet to at least one application platform includes the following steps S910 to S920:
step S910: acquiring a target subprogram and a compressed integrated packet corresponding to the target subprogram;
step S920: the compressed integrated package is uploaded into at least one application platform.
In an example embodiment of the present disclosure, after the target subprogram obtained in the above step is obtained, a compressed integrated package corresponding to the target subprogram may be obtained, and when an internal directory and a file structure of the compressed integrated package conform to an application platform to be uploaded, the compressed integrated package may be uploaded to one or more application platforms.
Further, automatic uploading and manual uploading can be set, the generation condition of the target subprogram can be set to be monitored continuously, when the target subprogram is detected to be generated, the compressed integrated package of the target subprogram is obtained, and automatic uploading or manual uploading is carried out.
In an example embodiment of the present disclosure, after the user request data is acquired, component codes corresponding to a plurality of component data may be called according to the plurality of component data in the user request data, and then a source code file is generated according to the component codes and the configuration data, and the source code file is compressed to generate the target subprogram. According to the method and the device, the target subprogram can be generated according to the component data and the configuration data input by the user, customized development is not needed for different services, code multiplexing efficiency is improved, user operation is simplified, workload of developers is reduced, and development efficiency and the online speed of the subprogram are improved.
It is noted that the above-mentioned figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
In addition, in the exemplary embodiment of the disclosure, a generating device of the subprogram is also provided. Referring to fig. 10, a subroutine generation apparatus 1000 includes: a data acquisition module 1010, a code calling module 1020 and a program generation module 1030.
The data acquisition module is used for acquiring user request data, wherein the user request data comprises component data and configuration data of a plurality of candidate components, and the candidate components are components capable of running depending on a target application platform; the code calling module is used for calling component codes corresponding to the component data according to the component data; and the program generation module is used for obtaining a source code file according to the configuration data and the component codes and compressing the source code file to generate a target subprogram corresponding to the target application platform.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, a target subprogram and a compressed integrated packet corresponding to the target subprogram are obtained; the compressed integrated package is uploaded into at least one application platform.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the uploading includes: manual upload or automatic upload.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, before obtaining the user request data, the user request data including the component data and the configuration data, the method further includes: receiving an operation instruction and configuration data of a user; selecting a plurality of target components in a template database according to an operation instruction of a user, wherein the target components comprise component data; user request data is generated based on the plurality of component data and the configuration data.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, compressing the source code file to generate a target subroutine corresponding to the target application platform includes: acquiring a source code file and a preset standard, and judging whether the source code file meets the preset standard or not; and when the source code file meets the preset standard, compressing the source code file to generate a target subprogram corresponding to the target application platform.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, determining whether the source code file meets a preset standard includes: acquiring the data size of a source code file; comparing the data size of the source code file with a preset threshold value; and when the data size of the source code file is equal to or smaller than a preset threshold value, the data size meets a preset standard.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, retrieving component code corresponding to a plurality of component data according to the plurality of component data includes: acquiring a plurality of preset storage path information corresponding to a plurality of component data; and calling component codes corresponding to the plurality of component data according to the plurality of preset storage path information.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the obtaining a source code file according to the configuration data and the component code, where the configuration data includes page layout data, includes: acquiring page layout data; and configuring the component codes according to the page layout data to obtain a source code file.
For details which are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the methods for generating the subprograms described above for the details which are not disclosed in the embodiments of the apparatus of the present disclosure.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the generation method of the foregoing sub program is also provided.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1100 according to such an embodiment of the disclosure is described below with reference to fig. 11. The electronic device 1100 shown in fig. 11 is only an example and should not bring any limitations to the function and scope of use of the embodiments of the present disclosure.
As shown in fig. 11, electronic device 1100 is embodied in the form of a general purpose computing device. The components of the electronic device 1100 may include, but are not limited to: the at least one processing unit 1110, the at least one memory unit 1120, a bus 1130 connecting different system components (including the memory unit 1120 and the processing unit 1110), and a display unit 1140.
Where the memory unit stores program code, the program code may be executed by the processing unit 1110 to cause the processing unit 1110 to perform the steps according to various exemplary embodiments of the present disclosure as described in the above-mentioned "exemplary methods" section of this specification. For example, the processing unit 1110 may perform step S210 as shown in fig. 2: obtaining user request data, wherein the user request data comprises component data and configuration data of a plurality of candidate components, and the candidate components are components capable of running depending on a target application platform; step S220: calling component codes corresponding to the plurality of component data according to the plurality of component data; step S230: and obtaining a source code file according to the configuration data and the component codes, and compressing the source code file to generate a target subprogram corresponding to the target application platform.
As another example, the electronic device may implement the various steps shown in FIG. 2.
The storage unit 1120 may include readable media in the form of volatile storage units, such as a random access memory unit (RAM)1121 and/or a cache memory unit 1122, and may further include a read-only memory unit (ROM) 1123.
The storage unit 1120 may also include a program/utility 1124 having a set (at least one) of program modules 1125, such program modules 1125 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1130 may be representative of one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 1100 may also communicate with one or more external devices 1170 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1100, and/or any devices (e.g., router, modem, etc.) that enable the electronic device 1100 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 1150. Also, the electronic device 1100 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 1160. As shown, the network adapter 1160 communicates with the other modules of the electronic device 1100 over the bus 1130. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method of generating a subprogram, wherein the subprogram runs in dependence on a target application platform, the method comprising:
obtaining user request data, the user request data comprising component data and configuration data for a plurality of candidate components, the candidate components being components capable of operating in dependence on the target application platform;
calling component codes corresponding to the component data according to the component data;
and obtaining a source code file according to the configuration data and the component codes, and compressing the source code file to generate a target subprogram corresponding to the target application platform.
2. The method of claim 1, further comprising:
acquiring the target subprogram and a compressed integrated packet corresponding to the target subprogram;
uploading the compressed integrated package into at least one of the application platforms.
3. The method of claim 1, wherein prior to obtaining user request data, the user request data including component data and configuration data, the method further comprises:
receiving an operation instruction and configuration data of a user;
selecting a plurality of target components in a template database according to the operation instructions of the user, wherein the target components comprise component data;
and generating user request data according to the plurality of component data and the configuration data.
4. The method of claim 1, wherein compressing the source code file to generate a target subprogram corresponding to a target application platform comprises:
acquiring the source code file and a preset standard, and judging whether the source code file meets the preset standard or not;
and when the source code file meets the preset standard, compressing the source code file to generate a target subprogram corresponding to the target application platform.
5. The method of claim 4, wherein the determining whether the source code file meets a predetermined criterion comprises:
acquiring the data size of the source code file;
comparing the data size of the source code file with the preset threshold value;
and when the data size of the source code file is equal to or smaller than a preset threshold value, the source code file conforms to a preset standard.
6. The method of claim 1, wherein said calling a component code corresponding to the plurality of component data from the plurality of component data comprises:
acquiring a plurality of preset storage path information corresponding to the plurality of component data;
and calling component codes corresponding to the plurality of component data according to the plurality of preset storage path information.
7. The method of claim 1, wherein the configuration data comprises page layout data, and wherein obtaining a source code file from the configuration data and component code comprises:
acquiring the page layout data;
and configuring the component codes according to the page layout data to obtain a source code file.
8. An apparatus for generating a subprogram, wherein the subprogram runs in dependence on a target application platform, the apparatus comprising:
a data acquisition module for acquiring user request data, the user request data including component data and configuration data of a plurality of candidate components, the candidate components being components capable of operating in dependence on the target application platform;
the code calling module is used for calling component codes corresponding to the component data according to the component data;
and the program generation module is used for obtaining a source code file according to the configuration data and the component codes and compressing the source code file to generate a target subprogram corresponding to the target application platform.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a processor; and
memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7.
CN202110089646.1A 2021-01-22 2021-01-22 Subprogram generation method and device, medium and electronic device Pending CN113791836A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110089646.1A CN113791836A (en) 2021-01-22 2021-01-22 Subprogram generation method and device, medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110089646.1A CN113791836A (en) 2021-01-22 2021-01-22 Subprogram generation method and device, medium and electronic device

Publications (1)

Publication Number Publication Date
CN113791836A true CN113791836A (en) 2021-12-14

Family

ID=78876839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110089646.1A Pending CN113791836A (en) 2021-01-22 2021-01-22 Subprogram generation method and device, medium and electronic device

Country Status (1)

Country Link
CN (1) CN113791836A (en)

Similar Documents

Publication Publication Date Title
CN109062563B (en) Method and device for generating page
CN111045653B (en) System generation method and device, computer readable medium and electronic equipment
CN110058854B (en) Method, terminal device and computer-readable medium for generating application
CN109582317B (en) Method and apparatus for debugging hosted applications
CN113505082B (en) Application program testing method and device
CN114036439A (en) Website building method, device, medium and electronic equipment
CN113407882A (en) Component generation method and device, computer-readable storage medium and electronic equipment
CN110688145B (en) Android MVP code automatic generation method and device, medium and electronic equipment
CN113495730A (en) Resource package generation and analysis method and device
CN112835568A (en) Project construction method and device
CN112395027A (en) Widget interface generation method and device, storage medium and electronic equipment
CN113419711A (en) Page guiding method and device, electronic equipment and storage medium
EP3819760A1 (en) Methods and apparatus for generating a platform-agnostic mobile application configuration data structure with a dynamic quiz
EP3627313A1 (en) Method and system for operating a software application on a processor of a mobile device
CN110717134A (en) Product description issuing method and device, storage medium and electronic equipment
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN113553123B (en) Data processing method, device, electronic equipment and storage medium
CN113791836A (en) Subprogram generation method and device, medium and electronic device
CN115344786A (en) Cloud resource recommendation system, method, equipment and storage medium
CN113656041A (en) Data processing method, device, equipment and storage medium
CN113220297A (en) Webpage style dynamic generation method and device, storage medium and electronic equipment
CN109857838B (en) Method and apparatus for generating information
CN113312900A (en) Data verification method and device
CN113360232A (en) Task processing method and device, electronic equipment and storage medium
CN112965699B (en) Front-end page generation method, device, computer system and readable 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