A method, apparatus and storage medium for generating dynamic page data
By using a unified interface solution to generate XML templates and JSON structured data, the problems of high development costs and low reusability for different pages are solved, achieving efficient page data acquisition and rendering, and improving development efficiency and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies require custom development of different backend interfaces and configuration of different data formats when generating different pages, resulting in high development costs, low reusability, high system complexity, and difficulty in maintenance.
By generating XML templates and JSON structured data, a unified interface is used to obtain and render data from different pages, reducing the amount of repetitive code development and backend configuration work, and adapting the data requirements of different pages using a unified interface.
It improved page development efficiency, reduced the workload of front-end and back-end interface integration, ensured the stability and maintainability of functions, and reduced development costs.
Smart Images

Figure CN115291868B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer information system technology, and in particular to a method, apparatus and storage medium for generating dynamic page data. Background Technology
[0002] On a company's mobile and PC websites, website operators need to generate different display pages based on operational needs. Each page has a different structure and data acquisition method, such as a homepage, a special page, and a product introduction page.
[0003] Current methods for generating pages involve writing code on the front end to call backend APIs to retrieve data, and then using the front end framework to call browser-level methods to render the page. With a large number of pages generated daily, this approach requires developers to customize different backend APIs for each page, and these APIs need to be configured or generate data in different formats in the management backend. This results in a huge workload for developers, low code reusability, high development costs, increased system complexity, and reduced maintainability. Summary of the Invention
[0004] This invention provides a method, apparatus, and storage medium for generating dynamic page data, enabling unified development of different pages and improving development efficiency.
[0005] To address the aforementioned technical problems, this invention provides a method for generating dynamic page data, comprising generating a first XML template based on a plurality of first elements of the first user interface draft and corresponding second elements of a definition file when a first user interface draft is received; wherein the definition file is generated based on the basic elements of a conventional display page.
[0006] Based on the first XML template, obtain the first element information and the first instance data of the display page, obtain the first configuration information of the display page, and save the first element information, the first instance data, and the first configuration information to the database; wherein, the first configuration information includes the page name, page code, creation time, and validity.
[0007] When the page code sent by the front-end calling the data query interface is received, the second element information, second sample data and second configuration information of the required page are retrieved from the database according to the page code; according to the second configuration information, second sample data and second element information, an interface response format data is generated, and the interface response format data is sent to the front-end through a unified interface so that the front-end can obtain and develop the rendering of the interface response format data.
[0008] As a preferred solution, a set of XML data format definition files is generated based on the basic elements of the page, such as text and images. Based on the definition files, sample data required for any display page can be generated according to the display data requirements of the display page. Compared with the existing technology that requires the development of different formats of sample data for different pages, this invention does not require repeated code development to develop sample data, reducing the amount of code writing and backend configuration work for backend developers in developing new display pages, and improving the development efficiency of display pages.
[0009] This invention unifies the parameters and return format of the interface for obtaining display page data based on XML templates. It generates an interface response format based on the page's configuration and element information. Different pages generate different interface response formats. These different interface response formats are sent to the front end through the same interface. By using the same interface, data from different pages can be obtained. Front-end developers can then render pages with different styles based on this interface.
[0010] After using a unified interface, backend developers only need to maintain this unified interface during subsequent online operation and maintenance. When updating functions and fixing problems, a single modification can be made to adapt to all pages, which greatly ensures the stable operation of the function after the interface is launched. When developing new display pages, there is no need to redevelop the backend code, and frontend developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of frontend and backend interface integration and improves the development efficiency of display pages.
[0011] As a preferred embodiment, the step of generating a first XML template based on several first elements of the first user interface draft and the corresponding second elements of the definition file specifically involves:
[0012] Based on several first elements of the first user interface draft and the corresponding second elements of the definition file, a first page abstract model corresponding to the display page is abstracted and divided, and a first XML data structure is mapped based on the first page abstract model; the first XML data structure is used as the first XML template of the display page; wherein, the first page abstract model includes several element templates, and each element template includes several elements with the same name and attributes.
[0013] As a preferred embodiment, the present invention can obtain an XML template by abstracting and mapping the elements of the user interface draft. The XML template then generates sample data for the page. Different user interface drafts only need to generate different XML templates, eliminating the need to repeatedly develop code to develop sample data. This greatly reduces the amount of code that backend developers need to write to create new display pages and the workload of backend configuration during the development phase.
[0014] As a preferred embodiment, the definition file is generated based on the basic elements of a typical display page, specifically:
[0015] Based on the basic elements of a typical display page, a definition file is generated; wherein, the basic elements include page, template, image link, text link, large text, product, article, and coupon; each of the basic elements includes corresponding element-related attributes, including name attribute, keyword attribute, quantity attribute, and type attribute.
[0016] As a preferred solution, this invention can generate XML templates in any general XML tree structure data format based on the basic elements of the page, such as text and images, for various types of display pages. Different pages will correspond to different XML templates. This method of generating XML templates can adapt to the display data requirements of any display page, reducing the amount of code written by backend developers and the workload of backend configuration during the development phase, thereby improving the development efficiency of display pages.
[0017] As a preferred embodiment, obtaining the first element information and the first instance data of the display page based on the first XML template specifically involves:
[0018] Parse each node of the first XML template and obtain the element information of each node as the first element information of the displayed page; wherein, each node contains one element;
[0019] Based on the number and type of all nodes, a random algorithm is used to obtain the first instance data.
[0020] As a preferred solution, this invention generates an XML template based on the definition file. It can generate sample data required for any display page according to the display data requirements of the display page. Compared with the existing technology that requires the development of sample data in different formats for different pages, this invention does not require repeated code development to develop sample data, which reduces the amount of code written by backend developers and the workload of backend configuration in developing new display pages, and improves the development efficiency of display pages.
[0021] As a preferred embodiment, the step of generating an interface response format data based on the second configuration information, the second sample data, and the second element information specifically involves:
[0022] The second configuration information is converted into configuration data in JSON structure; the second sample data is parsed and converted into tree structure data in JSON structure; based on the second sample data, the second element information is converted into element information data in JSON structure; the configuration data, the tree structure data, and the element information structure data are combined into an interface response format data.
[0023] As a preferred solution, by converting the sample data and element information of the required page into JSON structured data, and combining all the JSON structured data into a single interface response format, different interface response formats generated by different pages can be transmitted through the same interface. This allows for adaptation to element information of any display page, enabling the retrieval of data from different pages using the same interface. Front-end developers can then render different styles of pages based on this interface. When developing a new display page, there is no need to redevelop the back-end code, and front-end developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of front-end and back-end interface integration and improves the development efficiency of display pages.
[0024] As a preferred embodiment, the step of parsing and converting the second sample data into a tree-structured data in JSON format; and converting the second element information into element information data in JSON format based on the second sample data, specifically includes:
[0025] Use the keywords in the nodes of the second sample data as the key value of each node in the tree structure data; set the name, child nodes, and repeating templates at the same level for each node in the tree structure data; wherein, the keyword is the complete path of the corresponding node;
[0026] The keyword of the first node of the second sample data is used as the key value of the first element information data; the basic information of the first node of the second sample data constitutes the first attribute of the value of the first element information data; the specific information of the first node of the second sample data constitutes the second attribute of the value of the first element information data; wherein, the basic information includes location name, display quantity, and parent node, and the specific information includes name, link, and image;
[0027] Based on each node of the second sample data, generate several corresponding element information data.
[0028] As a preferred embodiment, this invention converts the sample data and element information of the display page into JSON structured data, and then assembles it into an interface response format data, which is sent to the front end through the same interface. This allows the front end to obtain the data required to generate the page. Different interface response format data generated by different pages can all be transmitted through the same interface. The front end can obtain data from all different pages through the same interface. Different page development does not require redeveloping backend code, and frontend developers do not need to familiarize themselves with the interface format of new pages. This reduces the workload of front-end and back-end interface integration and improves the development efficiency of the display page.
[0029] Accordingly, the present invention also provides an apparatus for generating dynamic page data, comprising: a page development module, a database module, and an interface module;
[0030] The page development module is used to generate a first XML template based on several first elements of the first user interface draft and the corresponding second elements of the definition file when the first user interface draft is received; the definition file is generated based on the basic elements of a regular display page; and the first element information and first instance data of the display page are obtained based on the first XML template to obtain the first configuration information of the display page.
[0031] The database module is used to save the first element information, the first sample data, and the first configuration information to the database; wherein, the first configuration information includes page name, page code, creation time, and validity.
[0032] The interface module is used to, when receiving a page code sent by the front-end calling the data query interface, query the database according to the page code and obtain the required second element information, second sample data and second configuration information of the page; generate an interface response format data according to the second configuration information, second sample data and second element information, and send the interface response format data to the front-end through a unified interface so that the front-end can obtain and develop the rendering of the interface response format data.
[0033] As a preferred solution, in the page development module, a set of XML data format definition files is generated based on the basic components of the page, such as text and images. Based on the definition files, sample data required for any display page can be generated according to the display data requirements of the display page. Compared with the existing technology that requires the development of different formats of sample data for different pages, this invention does not require repeated code development to develop sample data, reducing the amount of code written by backend developers and the workload of backend configuration in developing new display pages, and improving the development efficiency of display pages.
[0034] In the API module, the parameters and return format of the API for retrieving display page data based on XML templates are standardized. An API response format is generated based on the page's configuration and element information. Different API response formats are generated for different pages. These different API response formats are sent to the front end through the same API. By using the same API, data from different pages can be retrieved. Front-end developers can then render pages with different styles based on this API.
[0035] After using a unified interface, backend developers only need to maintain this unified interface during subsequent online operation and maintenance. When updating functions and fixing problems, a single modification can be made to adapt to all pages, which greatly ensures the stable operation of the function after the interface is launched. When developing new display pages, there is no need to redevelop the backend code, and frontend developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of frontend and backend interface integration and improves the development efficiency of display pages.
[0036] As a preferred embodiment, the step of generating an interface response format data based on the second configuration information, the second sample data, and the second element information specifically involves:
[0037] The second configuration information is converted into configuration data in JSON structure; the second sample data is parsed and converted into tree structure data in JSON structure; based on the second sample data, the second element information is converted into element information data in JSON structure; the configuration data, the tree structure data, and the element information structure data are combined into an interface response format data.
[0038] As a preferred solution, by converting the sample data and element information of the required page into JSON structured data, and combining all the JSON structured data into a single interface response format, different interface response formats generated by different pages can be transmitted through the same interface. This allows for adaptation to element information of any display page, enabling the retrieval of data from different pages using the same interface. Front-end developers can then render different styles of pages based on this interface. When developing a new display page, there is no need to redevelop the back-end code, and front-end developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of front-end and back-end interface integration and improves the development efficiency of display pages.
[0039] As a preferred embodiment, the step of parsing and converting the second sample data into a tree-structured data in JSON format; and converting the second element information into element information data in JSON format based on the second sample data, specifically includes:
[0040] Use the keywords in the nodes of the second sample data as the key value of each node in the tree structure data; set the name, child nodes, and repeating templates at the same level for each node in the tree structure data; wherein, the keyword is the complete path of the corresponding node;
[0041] The keyword of the first node of the second sample data is used as the key value of the first element information data; the basic information of the first node of the second sample data constitutes the first attribute of the value of the first element information data; the specific information of the first node of the second sample data constitutes the second attribute of the value of the first element information data; wherein, the basic information includes location name, display quantity, and parent node, and the specific information includes name, link, and image;
[0042] Based on each node of the second sample data, generate several corresponding element information data.
[0043] As a preferred embodiment, this invention converts the sample data and element information of the display page into JSON structured data, and then assembles it into an interface response format data, which is sent to the front end through the same interface. This allows the front end to obtain the data required to generate the page. Different interface response format data generated by different pages can all be transmitted through the same interface. The front end can obtain data from all different pages through the same interface. Different page development does not require redeveloping backend code, and frontend developers do not need to familiarize themselves with the interface format of new pages. This reduces the workload of front-end and back-end interface integration and improves the development efficiency of the display page.
[0044] Accordingly, the present invention also provides a computer-readable storage medium comprising a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform a method for generating dynamic page data as described in the present invention. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating an embodiment of the method for generating dynamic page data provided by the present invention;
[0046] Figure 2 This is a flowchart illustrating one embodiment of the method for generating dynamic page data provided by the present invention, which generates an XML data structure.
[0047] Figure 3 This is a schematic diagram of an embodiment of the apparatus for generating dynamic page data provided by the present invention. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] Example 1
[0050] Please refer to Figure 1 The present invention provides a method for generating dynamic page data, comprising steps S101-S103:
[0051] Step S101: When the first user interface draft is received, a first XML template is generated based on several first elements of the first user interface draft and the corresponding second elements of the definition file.
[0052] In this embodiment, the definition file is generated based on the basic elements of a regular display page.
[0053] In this embodiment, a definition file is generated based on the basic elements of a conventional display page; wherein, the basic elements include pages, templates, image links, text links, large text, products, articles, and coupons; each of the basic elements includes corresponding element-related attributes, which include name attributes, keyword attributes, quantity attributes, and type attributes.
[0054] In this embodiment, based on several first elements of the first user interface draft and the corresponding second elements of the definition file, a first page abstract model corresponding to the display page is abstracted and divided, and a first XML data structure is mapped based on the first page abstract model; the first XML data structure is used as the first XML template of the display page; wherein, the first page abstract model includes several element templates, and each element template includes several elements with the same name attribute.
[0055] In this embodiment, reference Figure 2 The elements in the first user interface design include text links A-01, text links A-02, images B-01 and B-02, product C-01 and product C-02, and large text D-01. Based on the elements in the first user interface design, the basic elements of text links, images, products, and large text are obtained in the definition file and combined to form a tree-like XML data structure.
[0056] Based on the elements and tree-like XML data structure of the first user interface draft, an abstract first page model corresponding to the display page is derived, and a first XML data structure is mapped based on the first page abstract model; the first XML data structure is used as the first XML template of the display page.
[0057] The first page abstract model includes four element templates: template A, template B, template C, and template A. Template A includes text link A-01 and text link A-02; template B includes image B-01 and image B-02; template C includes product C-01 and product C-02; and template D includes large text D-01.
[0058] Step S102: Based on the first XML template, obtain the first element information and the first sample data of the display page, obtain the first configuration information of the display page, and save the first element information, the first sample data and the first configuration information to the database.
[0059] In this embodiment, the first configuration information includes page name, page code, creation time, and validity.
[0060] In this embodiment, obtaining the first element information and the first instance data of the display page based on the first XML template specifically includes:
[0061] Parse each node of the first XML template and obtain the element information of each node as the first element information of the displayed page; wherein, each node contains one element;
[0062] Based on the number and type of all nodes, a random algorithm is used to obtain the first instance data.
[0063] Step S103: When the page code sent by the front-end calling the data query interface is received, the second element information, second sample data and second configuration information of the required page are retrieved from the database according to the page code; according to the second configuration information, second sample data and second element information, an interface response format data is generated, and the interface response format data is sent to the front-end through a unified interface so that the front-end can obtain and develop the rendering of the interface response format data.
[0064] In this embodiment, the front-end calls the data query interface and sends the page code to the back-end. The page code is / api / o2o / getPage.do?pageCode=BrandIndex
[0065] In this embodiment, generating an interface response format data based on the second configuration information, the second sample data, and the second element information specifically involves:
[0066] The second configuration information is converted into JSON-structured configuration data and named pageInfo;
[0067] The second sample data is parsed and converted into a tree structure data in JSON format, named treeMap: the keyword in the node of the second sample data is used as the key value of each node in the tree structure data; the name, children, and subList of the same level are set for each node in the tree structure data; wherein, the keyword is the complete path of the corresponding node;
[0068] The JSON structure of treeMap is as follows:
[0069]
[0070]
[0071]
[0072] Based on the second sample data, the second element information is converted into element information data in a JSON structure and named spaceMap: the keyword of the first node of the second sample data is used as the key value of the first element information data; the basic information of the first node of the second sample data constitutes the first attribute of the value of the first element information data; the specific information of the first node of the second sample data constitutes the second attribute of the value of the first element information data.
[0073] The basic information includes location name, display quantity, and parent node; the specific information includes name, link, image, product price and original price, article title and subtitle, and coupon discount information. Based on each node of the second sample data, several corresponding element information data are generated.
[0074] The specific structure of spaceMap is as follows:
[0075]
[0076]
[0077] The configuration data pageInfo, the tree structure data treeMap, and the element information structure data spaceMap are combined into an interface response format data:
[0078] The unified interface response format data is as follows:
[0079]
[0080] Implementing this embodiment has the following beneficial effects:
[0081] The method for generating dynamic page data in this invention generates a set of XML data format definition files based on the basic components of a page, such as text and images. Based on the definition files, sample data required for any display page can be generated according to the display data requirements of that display page. Compared with the existing technology that requires the development of different formats of sample data for different pages, this invention does not require repeated code development to develop sample data, reducing the amount of code written by backend developers and the workload of backend configuration in developing new display pages, and improving the development efficiency of display pages.
[0082] This invention unifies the parameters and return format of the interface for obtaining display page data based on XML templates. It generates an interface response format based on the page's configuration and element information. Different pages generate different interface response formats. These different interface response formats are sent to the front end through the same interface. By using the same interface, data from different pages can be obtained. Front-end developers can then render pages with different styles based on this interface.
[0083] After using a unified interface, backend developers only need to maintain this unified interface during subsequent online operation and maintenance. When updating functions and fixing problems, a single modification can be made to adapt to all pages, which greatly ensures the stable operation of the function after the interface is launched. When developing new display pages, there is no need to redevelop the backend code, and frontend developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of frontend and backend interface integration and improves the development efficiency of display pages.
[0084] Example 2
[0085] Please refer to Figure 3 An apparatus for generating dynamic page data provided in an embodiment of the present invention includes: a page development module 201, a database module 202, and an interface module 203;
[0086] The page development module 201 is used to generate a first XML template based on several first elements of the first user interface draft and the corresponding second elements of the definition file when the first user interface draft is received; the definition file is generated based on the basic elements of a regular display page; and based on the first XML template, the first element information and the first instance data of the display page are obtained, and the first configuration information of the display page is obtained.
[0087] The database module 202 is used to save the first element information, the first sample data, and the first configuration information to the database; wherein, the first configuration information includes page name, page code, creation time, and validity.
[0088] The interface module 203 is used to, when receiving the page code sent by the front-end calling the data query interface, query the database according to the page code and obtain the required second element information, second sample data and second configuration information of the page; generate an interface response format data according to the second configuration information, second sample data and second element information, and send the interface response format data to the front-end through a unified interface so that the front-end can obtain and develop rendering of the interface response format data.
[0089] In this embodiment, generating the first XML template based on several first elements of the first user interface draft and the corresponding second elements of the definition file specifically involves:
[0090] Based on several first elements of the first user interface draft and the corresponding second elements of the definition file, a first page abstract model corresponding to the display page is abstracted and divided, and a first XML data structure is mapped based on the first page abstract model; the first XML data structure is used as the first XML template of the display page; wherein, the first page abstract model includes several element templates, and each element template includes several elements with the same name and attributes.
[0091] In this embodiment, the definition file is generated based on the basic elements of a regular display page, specifically:
[0092] Based on the basic elements of a typical display page, a definition file is generated; wherein, the basic elements include page, template, image link, text link, large text, product, article, and coupon; each of the basic elements includes corresponding element-related attributes, including name attribute, keyword attribute, quantity attribute, and type attribute.
[0093] In this embodiment, obtaining the first element information and the first instance data of the display page based on the first XML template specifically includes:
[0094] Parse each node of the first XML template and obtain the element information of each node as the first element information of the displayed page; wherein, each node contains one element;
[0095] Based on the number and type of all nodes, a random algorithm is used to obtain the first instance data.
[0096] In this embodiment, generating an interface response format data based on the second configuration information, the second sample data, and the second element information specifically involves:
[0097] The second configuration information is converted into configuration data in JSON structure; the second sample data is parsed and converted into tree structure data in JSON structure; based on the second sample data, the second element information is converted into element information data in JSON structure; the configuration data, the tree structure data, and the element information structure data are combined into an interface response format data.
[0098] In this embodiment, the step of parsing and converting the second sample data into a tree-structured data in JSON format, and converting the second element information into element information data in JSON format based on the second sample data, specifically involves:
[0099] Use the keywords in the nodes of the second sample data as the key value of each node in the tree structure data; set the name, child nodes, and repeating templates at the same level for each node in the tree structure data; wherein, the keyword is the complete path of the corresponding node;
[0100] The keyword of the first node of the second sample data is used as the key value of the first element information data; the basic information of the first node of the second sample data constitutes the first attribute of the value of the first element information data; the specific information of the first node of the second sample data constitutes the second attribute of the value of the first element information data; wherein, the basic information includes location name, display quantity, and parent node, and the specific information includes name, link, and image;
[0101] Based on each node of the second sample data, generate several corresponding element information data.
[0102] The apparatus for generating dynamic page data described above can implement the method for generating dynamic page data in the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be described in detail here. The remaining content of this embodiment can be referred to the content of the above method embodiments, and will not be repeated in this embodiment.
[0103] Implementing this embodiment has the following beneficial effects:
[0104] The device for generating dynamic page data provided by this invention generates a set of XML data format definition files in the page development module based on the basic components of the page, such as text and images. Based on the definition files, sample data required for any display page can be generated according to the display data requirements of the display page. Compared with the existing technology that requires the development of different formats of sample data for different pages, this invention does not require repeated code development to develop sample data, reducing the amount of code writing and backend configuration work for backend developers in developing new display pages, and improving the development efficiency of display pages.
[0105] In the API module, the parameters and return format of the API for retrieving display page data based on XML templates are standardized. An API response format is generated based on the page's configuration and element information. Different API response formats are generated for different pages. These different API response formats are sent to the front end through the same API. By using the same API, data from different pages can be retrieved. Front-end developers can then render pages with different styles based on this API.
[0106] After using a unified interface, backend developers only need to maintain this unified interface during subsequent online operation and maintenance. When updating functions and fixing problems, a single modification can be made to adapt to all pages, which greatly ensures the stable operation of the function after the interface is launched. When developing new display pages, there is no need to redevelop the backend code, and frontend developers do not need to familiarize themselves with the interface format of the new page. This reduces the workload of frontend and backend interface integration and improves the development efficiency of display pages.
[0107] Example 3
[0108] Accordingly, embodiments of the present invention also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method for generating dynamic page data as described in any of the above embodiments.
[0109] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.
[0110] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0111] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0112] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0113] Wherein, if the modules / units integrated in the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0114] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method of generating dynamic page data, characterized by, The application comprises the following steps: When receiving a first user interface draft, a first xml template is generated according to a plurality of first elements of the first user interface draft and corresponding second elements of a definition file; The definition file is generated according to basic elements of a regular display page; According to the first xml template, first element information and first sample data of a display page are obtained, first configuration information of the display page is obtained, and the first element information, the first sample data and the first configuration information are saved into a database; wherein the first configuration information comprises a page name, a page code, a creation time and validity; When receiving a page code sent by a front-end calling data query interface, second element information, second sample data and second configuration information of a required page are queried and obtained in the database according to the page code; according to the second configuration information, the second sample data and the second element information, an interface response format data is generated, and the interface response format data is sent to the front end through a unified interface, so that the front end obtains and develops the interface response format data for rendering; The generation of the interface response format data according to the second configuration information, the second sample data and the second element information is specifically: The second configuration information is converted into configuration data in a json structure; the second sample data is parsed and converted into tree structure data in a json structure; the second element information is converted into element information data in a json structure according to the second sample data; the configuration data, the tree structure data and the element information data are combined to form an interface response format data; The parsing and conversion of the second sample data into tree structure data in a json structure and the conversion of the second element information into element information data in a json structure according to the second sample data are specifically: The key in the node of the second sample data is taken as the key value of each node of the tree structure data; the name, child node and same-level repeated template of each node of the tree structure data are set; wherein the key is the complete path of the corresponding node; The key of the first node of the second sample data is taken as the key value of the first element information data; the basic information of the first node of the second sample data is taken to form the first attribute of the value of the first element information data; the specific information of the first node of the second sample data is taken to form the second attribute of the value of the first element information data; wherein the basic information comprises a position name, a display quantity and a parent node, and the specific information comprises a name, a link and a picture; According to each node of the second sample data, a plurality of corresponding element information data are generated.
2. The method for generating dynamic page data of claim 1, wherein, The generation of the first xml template according to the plurality of first elements of the first user interface draft and the corresponding second elements of the definition file is specifically: According to the plurality of first elements of the first user interface draft and the corresponding second elements of the definition file, a first page abstract model corresponding to the display page is abstractly divided, and a first xml data structure is mapped according to the first page abstract model; The first xml data structure is used as a first xml template of the display page; wherein the first page abstract model comprises a plurality of element templates, and each element template comprises a plurality of elements with the same name attribute.
3. The method for generating dynamic page data of claim 2, wherein, The definition file is generated according to basic elements of a conventional display page, and specifically comprises: The definition file is generated according to basic elements of a conventional display page, and specifically comprises:
4. The method for generating dynamic page data of claim 1, wherein, The definition file is generated according to basic elements of a conventional display page, and specifically comprises: The first xml template is parsed to obtain first element information and first sample data of the display page, and specifically comprises: Each node of the first xml template is parsed to obtain element information of each node as the first element information of the display page; wherein each node contains an element; 5. An apparatus for generating dynamic page data, the apparatus comprising: The first sample data is obtained by using a random algorithm according to the number and type of all nodes. Comprise: The page development module, the database module and the interface module; The page development module is used to generate a first xml template according to a plurality of first elements of a first user interface draft and corresponding second elements of a definition file when the first user interface draft is received; the definition file is generated according to basic elements of a conventional display page; first element information, first sample data and first configuration information of a display page are obtained according to the first xml template; The database module is used to save the first element information, the first sample data and the first configuration information into a database; wherein the first configuration information comprises a page name, a page code, a creation time and validity; The interface module is used to query and obtain second element information, second sample data and second configuration information of a required page in the database according to a page code when the page code is received by a data query interface of a front end; an interface response format data is generated according to the second configuration information, the second sample data and the second element information, and the interface response format data is sent to the front end through a unified interface, so that the front end obtains and develops to render the interface response format data; The interface module generates an interface response format data according to the second configuration information, the second sample data and the second element information, and specifically comprises: The second configuration information is converted into configuration data in a json structure; the second sample data is parsed and converted into tree structure data in a json structure; the second element information is converted into element information data in a json structure according to the second sample data; the configuration data, the tree structure data and the element information data are combined to form an interface response format data; The interface module parses and converts the second sample data into tree structure data in a json structure; the second element information is converted into element information data in a json structure according to the second sample data, and specifically comprises: The key in the node of the second sample data is taken as the key value of each node of the tree structure data; the name, the child node and the template of the same level of each node of the tree structure data are set; wherein the key is the complete path of the corresponding node; The key of the first node of the second sample data is taken as the key value of the first element information data; the basic information of the first node of the second sample data is taken to constitute the first attribute of the value of the first element information data; the specific information of the first node of the second sample data is taken to constitute the second attribute of the value of the first element information data; wherein the basic information includes the position name, the display number and the parent node, and the specific information includes the name, the link and the picture; According to each node of the second sample data, a plurality of corresponding element information data are generated.
6. A computer readable storage medium characterized by, The computer readable storage medium comprises a stored computer program; wherein the computer program controls the device where the computer readable storage medium is located to execute the method for generating dynamic page data according to any one of claims 1 to 4 when running.
Citation Information
Patent Citations
User interface design and code separation method for supporting real-time data dynamic binding
CN110795071A
Service interface primitive definition method and system
CN111913739A
User interface configuration method and device, electronic equipment and readable storage medium
CN112433727A
Method for quickly realizing chart based on cell function
CN113988033A