CN112650529A - System and method capable of configuring generation of mobile terminal APP code - Google Patents

System and method capable of configuring generation of mobile terminal APP code Download PDF

Info

Publication number
CN112650529A
CN112650529A CN202011637486.1A CN202011637486A CN112650529A CN 112650529 A CN112650529 A CN 112650529A CN 202011637486 A CN202011637486 A CN 202011637486A CN 112650529 A CN112650529 A CN 112650529A
Authority
CN
China
Prior art keywords
key
value
file
configuration
code
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.)
Granted
Application number
CN202011637486.1A
Other languages
Chinese (zh)
Other versions
CN112650529B (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.)
CCI China Co Ltd
Original Assignee
CCI China 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 CCI China Co Ltd filed Critical CCI China Co Ltd
Priority to CN202011637486.1A priority Critical patent/CN112650529B/en
Publication of CN112650529A publication Critical patent/CN112650529A/en
Application granted granted Critical
Publication of CN112650529B publication Critical patent/CN112650529B/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/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Abstract

The application relates to a system and a method for generating mobile terminal APP codes in a configurable mode, wherein the method comprises the following steps: respectively acquiring configuration elements corresponding to the formats of the key value pairs from the interface document and the UI design drawing, wherein the configuration elements are used for describing project information and file layout of the target code structure; finding out corresponding key and value in the configuration elements according to the definition rule and writing the key and the value into the configuration file; circularly reading in the content of each line of the configuration file, and analyzing according to key value to obtain an analysis result; and converting the analysis result into a file directory structure list and a code frame structure, and obtaining a target code structure under the same directory of the configuration file. By the aid of the method, division workload is simplified, multi-terminal APP codes are unified, logic is unified, maintenance and management are facilitated, and working efficiency is improved.

Description

System and method capable of configuring generation of mobile terminal APP code
Technical Field
The present application relates to the field of mobile side code generation technologies, and in particular, to a system and a method for configurable generation of a mobile side APP code.
Background
Currently, the mainstream smart phones in the market are mainly two systems, namely iOS and Android. There are three types of split forms for smart phone split APP: primary separation, H5 separation, and mixed separation.
The first is native language score, iOS is score using object-c and swift languages, and Android is score using Java. The native separation has the advantages of full functions, high running speed, high performance, interface flow and good user experience. The disadvantage is that each end needs to be separated independently, and the labor cost is a little higher.
The second is pure H5 split, pages are split based on web page technology, and the pages are split by using javascript language. The method has the advantages of cross-platform performance and the defects that the capability, the performance and the experience of the device cannot be completely realized.
And the third method is that the mixture is divided, the native sum H5 is used, the webview is used for realizing the page, and the device capability is called by interacting with the webview, so that the defect that the H5 cannot realize the device is overcome. Performance and experience are relatively poor compared to native.
In each of the three forms, there is a matching scenario, and in most cases, the use of native partitions is still an option. The primary separation has the main problems of complex technology and low separation efficiency at present; the division personnel at different ends are different, so that the code structures of a plurality of ends are different, and the later maintenance and management difficulty is increased. Therefore, how to improve the efficiency of the native separation is the main current problem.
There are many repetitive tasks in the whole project split, for example, most codes have their commonalities and similarities, and repeated execution of the same type of task content in the split process consumes many unnecessary costs. Aiming at the problems of low native separation efficiency and different code structures of a plurality of ends, no effective solution is provided at present.
Disclosure of Invention
The embodiment of the application provides a system and a method capable of configuring and generating a mobile terminal APP code, so that the problems of low native separation efficiency and different code structures of a plurality of terminals in the related technology are solved at least, the frame design aiming at different operation platforms can be unified, the mobile terminal APP code is automatically generated, the working efficiency is effectively improved, the separation cost is reduced, and the management and maintenance effects of APP separation can be improved.
In a first aspect, an embodiment of the present application provides a method for generating a mobile terminal APP code in a configurable manner, including: respectively acquiring configuration elements corresponding to the formats of the key value pairs from the interface document and the UI design drawing, wherein the configuration elements are used for describing project information and file layout of the target code structure; finding out corresponding key and value in the configuration elements according to the definition rule and writing the key and the value into the configuration file; circularly reading in the content of each line of the configuration file, and analyzing according to key value to obtain an analysis result; and converting the analysis result into a file directory structure list and a code frame structure, and obtaining a target code structure under the same directory of the configuration file.
In some embodiments, the "obtaining configuration elements corresponding to the format of the key-value pairs from the interface document and the UI plan, respectively" includes: acquiring an interface document and a UI design drawing from the outside; extracting the content of project information, which is used for describing the object code structure, of each interface from the interface document, wherein the content comprises the following steps: request mode, request path, request parameter and parameter type; extracting the content of the file layout used for describing the object code structure of each layer from the UI design drawing, wherein the content comprises the following steps: the layer type, the UI elements and the position information and necessary parameter information of each UI element.
In some embodiments, the "finding the corresponding key and value in the configuration element according to the definition rule" is specifically: dividing the key value pairs into a first-level key value pair, a second-level key value pair and a third-level key value pair according to the key authority; row-wise write key-value pairs: writing the first-level key value pair into any row in the configuration file; writing the second-level key-value pair into a row subsequent to the first-level key-value pair; the third level key-value pair is written to a row subsequent to the second level key-value pair.
In some embodiments, the "dividing key-value pairs into first level key-value pairs, second level key-value pairs, third level key-value pairs according to key-rights" comprises: defining key-value pairs whose keys are character strings "project", "copy", "author", "folder", "in" as first-level key-value pairs; defining key value pairs with keys of character strings of 'api', 'entity' and 'mvc' as second-level key value pairs; and defining key value pairs except the first-level key value pair and the second-level key value pair as third-level key value pairs.
In some embodiments, the "cyclically reading in the content of each line of the configuration file, and parsing by key value to obtain a parsing result" includes: circularly reading the content of each line of the configuration file, and respectively transferring the content into an API module, an entity module, an MVC module and an auxiliary module according to key values of character strings 'API', 'entity', 'MVC' and 'folder' of keys; if the key is the character string 'api', 'entity' or 'mvc', resolving the key value pair to obtain a corresponding value, storing the value in the ccFileInfo object and storing the value in the ccFileList array; and if the key is the character string 'folder', resolving the key value pair to obtain a corresponding value, storing the corresponding value in the ccFolderInfo object and storing the corresponding value in the ccFolderList array.
In some embodiments, the ccFileInfo object includes a file name attribute, a path attribute, a type attribute, and a ccclasslst array, where the ccclasslst array stores the ccclasslnfo object, and the "converting the parsing result into a file directory structure list and a code framework structure, and obtaining the target code structure under the same directory of the configuration file" includes: traversing the ccFolderInfo object in the ccFolderList array to generate a file directory structure list; traversing the ccFileInfo objects in the ccFileList array, and dividing the ccFileInfo objects into corresponding jinjia modules according to different type attributes to generate file structures; and grouping the file structures to obtain the target code structure under the same directory of the configuration file.
In a second aspect, an embodiment of the present application provides a system for configurable generation of a mobile terminal APP code, including: the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for respectively acquiring configuration elements corresponding to the formats of key value pairs from an interface document and a UI design drawing, and the configuration elements are used for describing project information and file layout of a target code structure; the writing unit is used for finding out corresponding key and value writing configuration files in the configuration elements according to the definition rules; the analysis unit is used for circularly reading the content of each line of the configuration file and analyzing the content according to key value to obtain an analysis result; and the code generation unit is used for converting the analysis result into a file directory structure list and a code frame structure and obtaining a target code structure under the same directory of the configuration file.
In some of these embodiments, the parsing unit and the code generating unit are configured in a GenCode system, the GenCode system including: the API module is configured to be responsible for analyzing the API interface class and generating codes; the entity module is configured to be responsible for analyzing the entity class and generating codes; the MVC module is configured to be responsible for the analysis and code generation of the UI interface class; and the auxiliary module is configured to be responsible for analyzing the header information and the directory file information and generating codes.
In a third aspect, an embodiment of the present application provides an electronic apparatus, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the method for configurable generation of mobile terminal APP code according to the first aspect.
In a fourth aspect, the present application provides a storage medium, on which a computer program is stored, where the program, when executed by a processor, implements the method for configurable generation of mobile terminal APP code as described in the first aspect above.
Compared with the related art, the method for generating the mobile terminal APP code in the configurable mode solves the problems that in the related art, the original separation efficiency is low, and the code structures of a plurality of terminals are different. And finding corresponding key and value writing configuration files in the configuration elements according to the split interface and the UI design drawing. And analyzing and converting the configuration items into corresponding structures, writing the jinjia module and the file directory module into corresponding paths to write the code content into the corresponding paths, and forming the final file directory and the final mobile terminal code, including the codes of the iOS terminal and the Android terminal. Through this branch clearly, can unify the frame design to different operation platform, the automatic generation removes end APP code, not only effectively improves work efficiency, reduces the cost of dividing, can also improve the management and the maintenance effect that APP divided.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic diagram of a configurable method for generating a mobile-side APP code according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for configurable generation of mobile-side APP codes according to an embodiment of the present application;
FIG. 3 is an internal flow diagram of a system that may be configured to generate mobile-side APP code;
FIG. 4 is a key definition illustration of keys of a method for configurable generation of mobile-side APP codes;
FIG. 5 is a schematic diagram of a system that may be configured to generate mobile-side APP codes;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be described as a single step in other embodiments.
The embodiment provides a method for generating a mobile terminal APP code in a configurable manner, and the flow of the method is shown in fig. 1, and the method includes the following steps:
step 101, respectively acquiring configuration elements corresponding to the formats of the key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of a target code structure;
step 102, finding out corresponding key and value in configuration elements according to a definition rule and writing the key and the value into a configuration file;
step 103, circularly reading in the content of each line of the configuration file, and analyzing according to key value to obtain an analysis result;
and 104, converting the analysis result into a file directory structure list and a code frame structure, and obtaining a target code structure under the same directory of the configuration file.
In step 101, the configuration elements in the interface and UI design drawing are obtained.
Specifically, extracting the content of the project information, which is used for describing the object code structure, of each interface from the interface document comprises the following steps: request mode, request path, request parameter and parameter type;
extracting the content of the file layout used for describing the object code structure of each layer from the UI design drawing, wherein the content comprises the following steps: the layer type, the UI elements and the position information and necessary parameter information of each UI element.
In an embodiment, Key-Value pairs in the interface document and UI layout store data, and the content of the project information and file layout describing the object code structure is obtained by extracting configuration elements corresponding to the format of the Key-Value.
In step 102, the configuration file adopts an ini format, keys and values are separated by equal numbers (═ s), keys are predefined keywords, and values can be added with a plurality of attributes by semicolons "; "separate different attributes, each row can only define one key value pair. The content of the configuration file can be manually written by a separating person according to a back-end interface document and a design drawing; or can be captured from the derived content in a mature third-party API document specification tool such as swagger and automatically converted into related configuration information; related information can also be captured from a system of storing UI design drawings by a third party, such as blue lake, and can be automatically converted into related configuration information.
In step 103, the system is divided into different modules for analysis according to specific configuration contents. The GenCode system is realized by python scripting language, and the inside of the GenCode system mainly comprises three main modules and an auxiliary module.
As shown in fig. 3, in one embodiment, each line of the configuration file is cyclically read in, and the key values of the strings "API", "entity", "MVC" and "folder" are respectively transferred to the API module, entity module, MVC module and auxiliary module, and in this step, the parsing may be performed by a conventional parsing method, such as string comparison, or according to a regular expression.
In this embodiment, the API module is responsible for parsing the API interface class and generating the code; the Entity module is responsible for analyzing the Entity class and generating codes; the MVC module is responsible for analyzing the UI interface class and generating codes; the auxiliary module is responsible for analyzing and generating folders and general information, and comprises a file directory submodule and a global information generating submodule, wherein header information of each file comprises an author, project information, a header author and the like.
In step 104, the GenCode system divides the storage object into different modules according to the specific type of the storage object content to perform conversion processing, and writes the jinjia module and the file directory sub-module into corresponding paths to form the final file directory and the mobile end code, including the codes of the IOS end and the Android end. Specifically, the type attribute type is used for distinguishing the type of the file content, such as an interface type file, an entity type file or an mvc type file, and the subsequent references are different in modulo.
The technical scheme shown in the above steps 101 to 104 is described in detail with specific examples in conjunction with fig. 2.
In step 201, an interface document and a UI design drawing are obtained from the outside.
In step 202, configuration elements are extracted from the interface document and the UI design drawing, respectively. According to the interface document and the UI design drawing, the separating personnel can fix the project information and the file layout on the whole; in specific details, the content of each interface is extracted from the interface document, and the content comprises a request mode received by the interface, a server request path, a server request parameter and the type of the parameter. The layer structure element composition of each page is extracted from the UI design drawing, and the layer structure element composition comprises the type, the area, the text size and possibly attributes of different types, such as a title, an action response function and the like.
Step 203, generating a configuration file: a blank file is generated under any folder, and the configuration elements extracted in step 202 are stored. And finding out the key-value of the corresponding type according to the rule definition, and writing the key-value into the configuration file. The preset key is divided into three levels of authority, the key value of the first level of authority can be independently configured and can be written in any row of the file, and the key value of the second level can only follow the row behind the corresponding first level key value pair and cannot be independently configured. A third level key value can only follow the corresponding second level key value pair. The following describes specific key and value defining rules, which are shown in fig. 5, where header information and directory file information are used as authority definitions, mvc of UI class, api of interface class, and entity of entity class are used as secondary authority definitions, and elements included in mvc, api, and entity are used as tertiary authority definitions, specifically,
rule 1: project global information such as project name, copyright ownership, and author name is set. The keywords key are "project", "copy", "author" strings, respectively, which are primary rights definitions.
Rule 2: the project file directory layout is represented by a character string with the keyword key being 'folder', and the following values are paths to be created. The operation following under the folder of the value path is represented by a character string whose key is "in". "folder" and "in" are also primary rights definitions.
Rule 3: the service interface docking rule takes key as a character string 'api' as an entry for processing, and the key word of the 'api' is the definition of secondary authority. The value corresponding to the key "api" will be the final generated file name and at the same time the class name of the finally generated code level. One class may need to contain a plurality of function-related interfaces, each interface is implemented by a function in the corresponding class, and each function is determined by starting with a prefix of a character string "api-". The key included in each function content is defined as: the method comprises the steps of adding an annotation character string 'comment', a service request path character string 'url', a request mode character string 'method', a parameter data character string 'param' function name character string 'func' uploaded in a body form, returning data to an analysis object processing character string 'model' and the like, wherein keys for defining information of functions are all third-level rights.
Rule 4: the different data structures returned by each interface have corresponding processing of the entity class after analysis, the character string 'entity' is taken as a key to start judgment processing, the 'entity' is taken as a value corresponding to the key and is the finally generated entity class file name and the class name of the code level, and the keyword 'entity' is positioned in the second-level authority. Each entity class content contains two class elements, the annotation content of one entity class and the attributes of the entity class. The comment key is defined as the string "comment", the attribute key is defined as the string "prop", and "prop" is the third level authority.
Rule 5: the definition rule of UI layer starts with the key character string name as "mvc" as each UI processing module, and the key word of "mvc" is defined in the second level authority. For a value corresponding to the mvc, generating a folder with the value under the iOS environment, wherein the folder comprises 3 sub-folders which respectively correspond to the m-v-c model design idea, and a corresponding file module is stored under each sub-folder; for the Andorid environment, a folder with the value is generated, two classes, a corresponding activity and a corresponding model class are stored in the folder, and the layout file is placed in the layout folder of the common folder res. The next level key of the mvc is a character string 'sub', and the specific class of the mvc to be edited can be further specified subsequently.
And step 204, importing the system GenCode for processing after the configuration file is completed. Illustratively, a command line window (cmd window of the windows system; terminal program of the mac system) of the desktop system is opened, the GenCode program directory is transferred, and a complete path of python GenCode. The GenCode reads the contents of each row of the configuration file in a circulating way, and analyzes a specific value by setting a key value pair to be value. value according to different keys, will further disassemble, take out different attribute content.
The inside of the GenCode system mainly consists of three main modules and one auxiliary module. The three main modules are an API module, an entity module, an MVC module and an auxiliary module respectively. And (4) transferring to different module processes according to the current key name of the configuration file (the key word is 'API' to be transferred to the API module, the key word is 'Entity' to be transferred to the Entity module, and the key word 'MVC' to be transferred to the MVC module). And the three main modules analyze corresponding values, store the values in the ccFileInfo object and store the values in the ccFileList array for unified management. The ccFileInfo object contains a file name attribute name, a path attribute path, a type attribute type and a ccClassList array. ccClassList is an array of generated classes, each member being a ccClassInfo object. The ccClassInfo object contains a class name attribute name, an attribute list object ccProList and a function list object ccFuncList. The members of the ccpprplist array are ccpoplnfo objects. The ccproplnfo object contains a name attribute name, a type attribute type, an annotation attribute, and an additional dictionary object. The members of the ccFuncList array are ccFuncInfo objects. The ccFuncInfo object contains a function name attribute name, an additional dictionary object. Other global information, like the keywords "project", "copy right", "author", individually store the value content. Folder information, like the keyword "folder," is stored in the ccFolderList array structure.
Step 205, entering a code conversion link. After the content of the configuration file is analyzed, the obtained two storage structures ccFileList array and ccFolderList, array are transmitted into the code generation module. The auxiliary module generates a file directory structure list in advance according to the ccFolderList. And traversing the CCFileList members, sequentially dividing the CCFileList members into different modules according to different type field values, reading corresponding jinjia file module objects, and preliminarily generating a code frame structure. And reading ccClassList in the object of the storage structure ccFileInfo, obtaining the name of the class, a member list ccFuncList of the class and an attribute list ccPropList of the class, and further performing code content conversion.
And step 206, obtaining a final target code structure under the same directory of the configuration file after the conversion is finished.
Through the technical scheme, the method for generating the APP code of the mobile terminal in a configurable mode can generate the configuration item according to the split interface and the UI design drawing, the GenCode system is realized by utilizing the quick split script capability of the python language, the configuration item is converted into a corresponding structure, then a Jinja layout module is called to fix the whole structure, the configuration content is further used for filling the specific content of each attribute, and the code of each terminal is exported. In the first aspect, the configuration file adopts an ini configuration file format and is composed of keys and values, wherein the keys and the values are separated by equal signs, key is equal to value, the key is a predefined keyword, and the value can be added with a plurality of attributes, namely a semicolon; "separate different attributes, each row can only define one key value pair. According to the second aspect, the system is divided into different modules for analysis according to specific configuration contents, and the different modules comprise a file and directory management module, a network interface entity class docking module and an mvc view module, and are finally stored in an object in a unified mode. In the third aspect, after the configuration file is analyzed, the system divides the storage object content into different modules in a unified way according to the specific type of the storage object content to perform conversion processing, and writes the jinjia module and the file directory module into corresponding paths to form the final file directory and the final mobile end code, including the codes of the iOS end and the Android end. By the aid of the method, division workload is simplified, multi-terminal APP codes are unified, logic is unified, maintenance and management are facilitated, and working efficiency is improved.
Based on the same concept, the application provides a system capable of configuring and generating an APP code of a mobile terminal, which comprises:
an obtaining unit 401, configured to obtain configuration elements corresponding to the formats of the key value pairs from the interface document and the UI design drawing, respectively, where the configuration elements are used to describe project information and file layout of the object code structure;
a writing unit 402, configured to find corresponding key and value in the configuration element according to a definition rule, and write the configuration file;
an analyzing unit 403, configured to read content of each line of the configuration file in a circulating manner, and analyze the content according to key value to obtain an analysis result;
and a code generating unit 404, configured to convert the analysis result into a file directory structure list and a code framework structure, and obtain an object code structure in the same directory of the configuration file.
In one embodiment, the parsing unit and the code generating unit are configured in a GenCode system, the GenCode system including:
the API module is configured to be responsible for analyzing the API interface class and generating codes;
the entity module is configured to be responsible for analyzing the entity class and generating codes;
the MVC module is configured to be responsible for the analysis and code generation of the UI interface class;
and the auxiliary module is configured to be responsible for analyzing the header information and the directory file information and generating codes.
The present embodiment also provides an electronic device comprising a memory 304 and a processor 302, wherein the memory 304 stores a computer program, and the processor 302 is configured to execute the computer program to perform the steps of any of the above method embodiments.
Specifically, the processor 302 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
Memory 304 may include, among other things, mass storage 304 for data or instructions. By way of example, and not limitation, memory 304 may include a hard disk drive (hard disk drive, HDD for short), a floppy disk drive, a solid state drive (SSD for short), flash memory, an optical disk, a magneto-optical disk, tape, or a Universal Serial Bus (USB) drive or a set of two or more of these. Memory 304 may include removable or non-removable (or fixed) media, as will be appropriate. The memory 304 may be internal or external to the data processing apparatus, as will be appropriate. In a particular embodiment, the memory 304 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, memory 304 includes Read-only memory (ROM) and Random Access Memory (RAM). Where appropriate, the ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or FLASH memory (FLASH), or a combination of two or more of these. In a suitable case, the RAM may be a static random-access memory (SRAM) or a dynamic random-access memory (DRAM), where the DRAM may be a fast page mode dynamic random-access memory 304 (FPMDRAM), an extended data output dynamic random-access memory (EDODRAM), a synchronous dynamic random-access memory (SDRAM), and the like.
Memory 304 may be used to store or cache various data files for processing and/or communication purposes, as well as possibly computer program instructions for execution by processor 302.
The processor 302 reads and executes the computer program instructions stored in the memory 304 to implement the method for transmitting data in one-way communication between any of the servers in the above-described embodiments.
Optionally, the electronic apparatus may further include a transmission device 306, wherein the transmission device 306 is connected to the processor 302.
The transmitting device 306 may be used to receive or distribute data via a network. Specific examples of the network described above may include wired or wireless networks provided by communication providers of the electronic devices. In one example, the transmission device includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmitting device 306 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Alternatively, in this embodiment, the processor 302 may be configured to execute the following steps by a computer program:
s101, configuration elements corresponding to the formats of the key value pairs are respectively acquired from the interface document and the UI design drawing, wherein the configuration elements are used for describing project information and file layout of the object code structure.
S102, finding out corresponding key and value in the configuration elements according to the definition rule and writing the key and the value into the configuration file.
And S103, circularly reading the content of each line of the configuration file, and analyzing according to key value to obtain an analysis result.
And S104, converting the analysis result into a file directory structure list and a code frame structure, and obtaining a target code structure under the same directory of the configuration file.
It should be noted that, for specific examples in this embodiment, reference may be made to examples described in the foregoing embodiments and optional implementations, and details of this embodiment are not described herein again.
In addition, in view of the method for generating a mobile terminal APP code in the foregoing embodiment, an embodiment of the present application may provide a storage medium to implement. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements any configurable method for generating mobile-side APP code in the above embodiments.
It will be appreciated by those skilled in the art that various features of the above embodiments may be grouped in any manner, and that for the sake of brevity, all possible groupings of individual features of the above embodiments may not be described in detail, but rather are to be construed as being within the scope of the claims so long as such groupings are not inconsistent. The above examples are merely illustrative of several embodiments of the present application, and the description is more specific and detailed, but not to be construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A configurable method for generating mobile terminal APP codes is characterized in that,
respectively acquiring configuration elements corresponding to the formats of the key value pairs from the interface document and the UI design drawing, wherein the configuration elements are used for describing project information and file layout of the target code structure;
finding out corresponding key and value in the configuration elements according to a definition rule and writing the key and the value into a configuration file;
circularly reading in the content of each row of the configuration file, and analyzing according to key value to obtain an analysis result;
and converting the analysis result into a file directory structure list and a code frame structure, and obtaining the target code structure under the same directory of the configuration file.
2. The method of claim 1, wherein the step of obtaining configuration elements corresponding to the formats of key-value pairs from the interface document and the UI design drawing respectively comprises:
acquiring an interface document and a UI design drawing from the outside;
extracting from the interface document the content of project information for each interface describing object code structure, including: request mode, request path, request parameter and parameter type;
extracting the content of the file layout used for describing the object code structure of each layer from the UI design drawing, wherein the content comprises the following steps: the layer type, the UI elements and the position information and necessary parameter information of each UI element.
3. The method of claim 1, wherein "finding corresponding key and value write configuration files in the configuration elements according to a definition rule" is specifically:
dividing the key value pairs into a first-level key value pair, a second-level key value pair and a third-level key value pair according to key authority;
and writing the key-value pair into a row:
writing the first-level key-value pair into any row in the configuration file;
writing the second level key-value pair to a row subsequent to the first level key-value pair;
writing the third level key-value pair to a row subsequent to the second level key-value pair.
4. The method of claim 2, wherein the step of classifying the key-value pairs into a first-level key-value pair, a second-level key-value pair and a third-level key-value pair according to key authority comprises:
defining key-value pairs whose keys are character strings "project", "copy", "author", "folder", "in" as first-level key-value pairs;
defining key value pairs with keys of character strings of 'api', 'entity' and 'mvc' as second-level key value pairs;
and defining key value pairs except the first-level key value pair and the second-level key value pair as third-level key value pairs.
5. The method of claim 4, wherein "cyclically reading in contents of each row of the configuration file and obtaining an analysis result by analyzing the contents with key value" includes:
circularly reading the content of each line of the configuration file, and respectively transferring the content into an API module, an entity module, an MVC module and an auxiliary module according to key values of character strings 'API', 'entity', 'MVC' and 'folder' of keys;
if the key is a character string of 'api', 'entity' or 'mvc', resolving the key value pair to obtain a corresponding value, storing the value in a ccFileInfo object and storing the value in a ccFileList array;
and if the key is the character string 'folder', analyzing the key value pair to obtain a corresponding value, storing the corresponding value in the ccFolderInfo object and storing the corresponding value in the ccFolderList array.
6. The method as claimed in claim 5, wherein the ccFileInfo object includes a file name attribute, a path attribute, a type attribute, and a ccClassList array, the ccClassInfo object is stored in the ccClassList array,
"converting the analysis result into a file directory structure list and a code framework structure, and obtaining the target code structure under the same directory of the configuration file" includes:
traversing the ccFolderInfo object in the ccFolderList array to generate a file directory structure list;
traversing the ccFileInfo objects in the ccFileList array, and dividing the ccFileInfo objects into corresponding jinjia modules according to different type attributes to generate file structures;
and grouping the file structures to obtain the target code structure under the same directory of the configuration file.
7. A system for configurable generation of mobile-side APP codes, comprising:
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for respectively acquiring configuration elements corresponding to the formats of key value pairs from an interface document and a UI design drawing, and the configuration elements are used for describing project information and file layout of an object code structure;
the writing unit is used for finding out corresponding key and value writing configuration files in the configuration elements according to the definition rules;
the analysis unit is used for circularly reading the content of each line of the configuration file and analyzing the content according to key value to obtain an analysis result;
and the code generation unit is used for converting the analysis result into a file directory structure list and a code frame structure and obtaining the target code structure under the same directory of the configuration file.
8. The system for configurable generation of mobile-end APP codes according to claim 7, wherein the parsing unit and the code generation unit are configured in a GenCode system, the GenCode system comprising:
the API module is configured to be responsible for analyzing the API interface class and generating codes;
the entity module is configured to be responsible for analyzing the entity class and generating codes;
the MVC module is configured to be responsible for the analysis and code generation of the UI interface class;
and the auxiliary module is configured to be responsible for analyzing the header information and the directory file information and generating codes.
9. An electronic apparatus comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the method of configurable generation of mobile-side APP code according to any one of claims 1 to 6.
10. A storage medium having stored thereon a computer program, wherein the computer program is configured to execute the method of configurable generation of mobile-side APP code according to any of claims 1 to 6 when running.
CN202011637486.1A 2020-12-31 2020-12-31 System and method for configurable generation of mobile terminal APP codes Active CN112650529B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011637486.1A CN112650529B (en) 2020-12-31 2020-12-31 System and method for configurable generation of mobile terminal APP codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011637486.1A CN112650529B (en) 2020-12-31 2020-12-31 System and method for configurable generation of mobile terminal APP codes

Publications (2)

Publication Number Publication Date
CN112650529A true CN112650529A (en) 2021-04-13
CN112650529B CN112650529B (en) 2023-06-06

Family

ID=75366881

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011637486.1A Active CN112650529B (en) 2020-12-31 2020-12-31 System and method for configurable generation of mobile terminal APP codes

Country Status (1)

Country Link
CN (1) CN112650529B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799670A (en) * 2021-04-14 2021-05-14 盛威时代科技集团有限公司 Method and system for unified multi-terminal logic development
CN114866451A (en) * 2022-04-29 2022-08-05 深圳依时货拉拉科技有限公司 iOS end route communication improvement method, device, storage medium and equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9424003B1 (en) * 2014-10-24 2016-08-23 Emc Corporation Schema-less system output object parser and code generator
CN108469952A (en) * 2018-03-16 2018-08-31 祖龙(天津)科技有限公司 A kind of code generating method and kit of management game configuration
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
US10169035B1 (en) * 2017-09-06 2019-01-01 International Business Machines Corporation Customized static source code analysis
CN109885298A (en) * 2019-02-20 2019-06-14 百度在线网络技术(北京)有限公司 A kind of UI component generation method, device and terminal device
CN112114807A (en) * 2020-09-28 2020-12-22 腾讯科技(深圳)有限公司 Interface display method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9424003B1 (en) * 2014-10-24 2016-08-23 Emc Corporation Schema-less system output object parser and code generator
US10169035B1 (en) * 2017-09-06 2019-01-01 International Business Machines Corporation Customized static source code analysis
CN108469952A (en) * 2018-03-16 2018-08-31 祖龙(天津)科技有限公司 A kind of code generating method and kit of management game configuration
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
CN109885298A (en) * 2019-02-20 2019-06-14 百度在线网络技术(北京)有限公司 A kind of UI component generation method, device and terminal device
CN112114807A (en) * 2020-09-28 2020-12-22 腾讯科技(深圳)有限公司 Interface display method, device, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799670A (en) * 2021-04-14 2021-05-14 盛威时代科技集团有限公司 Method and system for unified multi-terminal logic development
CN112799670B (en) * 2021-04-14 2021-08-03 盛威时代科技集团有限公司 Method and system for unified multi-terminal logic development
CN114866451A (en) * 2022-04-29 2022-08-05 深圳依时货拉拉科技有限公司 iOS end route communication improvement method, device, storage medium and equipment
CN114866451B (en) * 2022-04-29 2023-10-03 深圳依时货拉拉科技有限公司 iOS end route communication improvement method, device, storage medium and equipment

Also Published As

Publication number Publication date
CN112650529B (en) 2023-06-06

Similar Documents

Publication Publication Date Title
CN109582909B (en) Webpage automatic generation method and device, electronic equipment and storage medium
US10303689B2 (en) Answering natural language table queries through semantic table representation
US10073876B2 (en) Bloom filter index for device discovery
CN109582647B (en) Unstructured evidence file oriented analysis method and system
Chaqfeh et al. Jscleaner: De-cluttering mobile webpages through javascript cleanup
CN112650529B (en) System and method for configurable generation of mobile terminal APP codes
CN114328276B (en) Test case generation method and device, and test case display method and device
CN110727417B (en) Data processing method and device
CN112434811A (en) Knowledge graph construction method and device, computing equipment and storage medium
CN105589959A (en) Form processing method and form processing system
CN110705226A (en) Spreadsheet creating method and device and computer equipment
CN111831384A (en) Language switching method and device, equipment and storage medium
RU2637472C2 (en) Method, device and terminal for data search
CN113094355A (en) Model instantiation method, device, equipment and medium based on domestic communication protocol
JP6723976B2 (en) Test execution device and program
CN111090668B (en) Data retrieval method and device, electronic equipment and computer readable storage medium
CN106339381B (en) Information processing method and device
CN107643892B (en) Interface processing method, device, storage medium and processor
CN107977381B (en) Data configuration method, index management method, related device and computing equipment
CN109543122B (en) Content synchronization method, device, storage medium and electronic device
US20150324333A1 (en) Systems and methods for automatically generating hyperlinks
CN111651531A (en) Data import method, device, equipment and computer storage medium
CN108052654A (en) Data extraction method, device, equipment and storage medium
CN110489130A (en) A kind of client-based business datum extracting method and device
US8370397B1 (en) Enhanced data collection techniques

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