WO2018205557A1 - Page logic control method and apparatus, computer apparatus and readable storage medium - Google Patents

Page logic control method and apparatus, computer apparatus and readable storage medium Download PDF

Info

Publication number
WO2018205557A1
WO2018205557A1 PCT/CN2017/112953 CN2017112953W WO2018205557A1 WO 2018205557 A1 WO2018205557 A1 WO 2018205557A1 CN 2017112953 W CN2017112953 W CN 2017112953W WO 2018205557 A1 WO2018205557 A1 WO 2018205557A1
Authority
WO
WIPO (PCT)
Prior art keywords
layer
data
interface
control
preset
Prior art date
Application number
PCT/CN2017/112953
Other languages
French (fr)
Chinese (zh)
Inventor
张磊
张文明
陈少杰
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2018205557A1 publication Critical patent/WO2018205557A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a page logic control method, apparatus, computer device, and readable storage medium.
  • control layer closely links the view layer to the model layer. This contact is established using a direct reference relationship, which is a strong reference relationship.
  • a strong reference relationship will increase the relationship between the control layer and the view layer and the model layer as the complexity of the business logic increases, and the software cannot continue to be maintained.
  • it is extremely difficult to implement software expansion and maintenance.
  • an object of the present invention is to provide a page logic control method and apparatus, which can effectively reduce the coupling relationship between the view layer and the control layer, and greatly improve the scalability and software of the software. Maintenance.
  • a preferred embodiment of the present invention provides a page logic control method applied to a software development model including a data layer, a control layer, and a view layer.
  • the method includes:
  • the data layer acquires data
  • the control layer parses the preset format data to obtain presentation data corresponding to the preset format data
  • the control layer searches for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and transmits corresponding presentation data through the found interface interface.
  • each interface interface corresponds to a type of presentation logic
  • the view layer performs page rendering on the presentation data according to the found interface interface.
  • the data layer converts the acquired data into the preset format data through an interface protocol between the data layer and the control layer, and then transmits the data to the control layer, including :
  • the preset interface protocol includes a format conversion function
  • the method further includes:
  • the step of creating a preset interface protocol between the data layer and the control layer includes:
  • the preset interface protocol is created in response to a request to create a preset interface protocol between the data layer and the control layer.
  • the preset interface protocol is used to implement communication between the data layer and the control layer.
  • control layer searches for the interface interface for displaying the presentation data from the control layer and the at least one interface interface of the view layer based on the presentation data, including :
  • An interface interface of the view layer corresponding to each rendering logic is obtained according to each rendering logic.
  • the step of the view layer performing page presentation on the presentation data according to the found interface interface includes:
  • the rendered data is page rendered based on the wrapped interface interface.
  • the method further includes: before packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, the method further includes:
  • a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
  • Another preferred embodiment of the present invention further provides a page logic control apparatus, which is applied to a software development model, and the software development model includes a data layer, a control layer, and a view layer.
  • the device includes:
  • An obtaining module configured to acquire data by the data layer
  • a conversion module configured to convert, by the data layer, the acquired data into a preset format data by using an interface protocol between the data layer and the control layer, and then transmitting the data to the control layer;
  • a parsing module configured to parse the preset format data by the control layer, to obtain presentation data corresponding to the preset format data
  • a search module configured by the control layer to search for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and by using the found interface interface Corresponding presentation data is transmitted to the view layer.
  • each interface interface corresponds to a type of presentation logic
  • a rendering module configured by the view layer to perform page rendering on the presentation data according to the found interface interface.
  • the conversion module includes:
  • a protocol acquisition sub-module configured to acquire a preset interface protocol between the data layer and the control layer, where the preset interface protocol includes a format conversion function
  • a conversion submodule configured to convert a format of the acquired data by using a format conversion function in the preset interface protocol
  • the device further includes:
  • Creating a module configured to create a preset interface protocol between the data layer and the control layer
  • the manner of creating a preset interface protocol between the data layer and the control layer includes:
  • the searching module includes:
  • a logic acquisition submodule configured to acquire at least one rendering logic that the rendering data needs to be presented
  • the interface acquisition sub-module is configured to acquire an interface interface of a view layer corresponding to each presentation logic according to each rendering logic.
  • the manner in which the presentation module is configured to display the presentation data by the view layer according to the found interface interface includes:
  • the rendered data is page rendered based on the wrapped interface interface.
  • the creating module is further configured to respond to the request at the control layer according to the request in response to a request to set a wrapper layer between an interface interface of the control layer and the view layer.
  • a wrapper layer is created between the interface interfaces of the view layer.
  • Another preferred embodiment of the present invention further provides a computer device comprising a processor and a non-volatile memory storing a plurality of computer instructions, the computer device performing the above implementation when the computer instructions are executed by the processor
  • the page logic control method described in the example is a preferred embodiment of the present invention.
  • readable storage medium comprising a computer program, the computer program controlling the electronic device where the readable storage medium is located to perform the operations described in the above embodiments Page logic control method.
  • the present invention has the following beneficial effects:
  • the page logic control method, device, computer device and readable storage medium obtained by the embodiment of the present invention obtain data through a data layer; the data layer converts the acquired data into an interface through an interface protocol between the data layer and the control layer.
  • the format data is transmitted to the control layer; the control layer parses the preset format data to obtain presentation data corresponding to the preset format data; and the control layer searches for at least one interface interface of the control layer and the view layer based on the presentation data for searching
  • the interface interface for presenting the data is displayed, and the corresponding presentation data is transmitted to the view layer through the found interface interface; the view layer performs page presentation on the presentation data according to the found interface interface.
  • FIG. 1 is a block diagram of a computer device according to a preferred embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a page logic control method according to a preferred embodiment of the present invention
  • FIG. 3 is another schematic flowchart of a page logic control method according to a preferred embodiment of the present invention.
  • step S220 shown in FIG. 2;
  • FIG. 5 is a schematic flow chart of each sub-step included in step S240 shown in FIG. 2;
  • FIG. 6 is a schematic flow chart of each sub-step included in step S250 shown in FIG. 2;
  • FIG. 7 is a functional block diagram of a page logic control apparatus according to another preferred embodiment of the present invention.
  • FIG. 8 is another functional block diagram of a page logic control apparatus according to another embodiment of the present invention.
  • FIG. 9 is a functional block diagram of each submodule included in the conversion module shown in FIG. 7;
  • FIG. 10 is a functional block diagram of each submodule included in the lookup module shown in FIG. 7.
  • Icon 100-computer device; 110-memory; 120-processor; 130-communication unit; 140-storage controller; 150-display unit; 200-page logic control device; 209-creation module; 210-acquisition module; - conversion module; 221 - protocol acquisition submodule; 222 - conversion submodule; 223 - generation submodule; 230 - parsing module; 240 - lookup module; 241 - logical acquisition submodule; 242 - interface acquisition submodule; 250 - rendering Module.
  • FIG. 1 is a block diagram of a computer device 100 according to a preferred embodiment of the present invention.
  • the computer device 100 may be an electronic device for running a software development model.
  • the computer device 100 may be, but not limited to, a personal computer (PC), a notebook computer, a tablet computer, a personal digital assistant (PDA), and a mobile Internet device (MID). Wait.
  • the operating system of the computer device 100 may be, but not limited to, a Windows system, a Linux system, an OSX system, and the like.
  • the operating system of the computer device 100 may be a Windows system.
  • the computer device 100 can include a memory 110, a processor 120, a communication unit 130, a memory controller 140, and a display unit 150.
  • the memory 110, the processor 120, the communication unit 130, the storage controller 140, and the display unit 150 are electrically connected directly or indirectly to each other to implement data transmission or interaction.
  • the components can be electrically connected to one another via one or more communication buses or signal lines.
  • a page logic control device 200 is stored in the memory 110, and the page logic control device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware, and the processor 120 runs the storage.
  • the software program and the module in the memory 110 such as the page logic control device 200 in the embodiment of the present invention, thereby performing various functional applications and data processing, that is, implementing the page logic control method in the embodiment of the present invention.
  • the memory 110 may include a high speed random access memory, and may also include a non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
  • memory 110 can further include memory remotely located relative to processor 120, which can be connected to computer device 100 over a network. Examples of such networks may include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Access to the memory 110 by the processor 120 and other possible components can be performed under the control of the memory controller 140.
  • the communication unit 130 couples various input/output devices to the processor 120 and the memory 110.
  • the software programs and modules within the memory 110 may also include an operating system, which may include various functions for managing system tasks. Software components and/or drivers (such as memory management, storage device control, power management, etc.) that communicate with various hardware or software components to provide an operating environment for other software components.
  • the processor 120 can be an integrated circuit chip with signal processing capabilities.
  • the processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), and the like. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a general purpose processor can be The microprocessor or the processor 120 can also be any conventional processor or the like.
  • the communication unit 130 can be configured to receive and transmit electromagnetic waves, and realize mutual conversion between electromagnetic waves and electrical signals, thereby communicating with the communication network or the computer device 100.
  • the communication unit 130 can communicate with various networks, such as the Internet, an intranet, a wireless network, or communicate with the computer device 100 over a wireless network.
  • the wireless network described above may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • the above wireless network can use various communication standards, protocols and technologies, including but not limited to global mobile communication systems, enhanced mobile communication technologies, wideband code division multiple access technology, code division multiple access technology, time division multiple access technology, Bluetooth , wireless fidelity technology, VoIP, global microwave access, other protocols for mail, instant messaging and short messages, and any other suitable communication protocols, even those that are not currently being developed.
  • the display unit 150 can be used to provide an interactive interface (such as a user interface) or to display image data.
  • the display unit 150 can be a liquid crystal display or a touch display.
  • a touch display it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense a touch operation generated from one or more positions on the touch display, and the touch operation is performed by the processor 120. Calculation and processing.
  • the computer device 100 may include a software development model, and the software development model may include a data layer, a control layer, and a view layer.
  • the data layer is used for acquiring data logic
  • the control layer is configured to acquire data of the data layer and perform data conversion and data transportation on the acquired data, where the view layer is used according to the The data transmitted by the control layer is displayed in a software view.
  • the software development model may adopt an MVC development model.
  • FIG. 2 is a schematic flowchart diagram of a page logic control method according to a preferred embodiment of the present invention.
  • the page logic control method is applied to the software development model. It should be understood that the method provided by the embodiments of the present invention is not limited to the specific order described in FIG. 2 and the following.
  • the specific process of the method is as follows:
  • step S210 the data layer acquires data.
  • the manner in which the data layer acquires data is not specifically limited.
  • the data layer may acquire data from a certain database, or obtain data from a certain network layer, or Get data in a file, etc. Regardless of the manner in which the data is acquired, all acquired data is stored in the data layer.
  • the method may further include:
  • Step S209 creating a preset interface protocol between the data layer and the control layer.
  • a preset interface protocol for accessing between the data layer and the control layer may be created, where the preset interface protocol may be created by: the computer device Responding to a request to create a preset interface protocol between the data layer and the control layer, creating a preset interface protocol for implementing communication between the data layer and the control layer, the preset interface A protocol conversion function for converting data acquired by the data layer is included in the protocol.
  • the data layer converts the acquired data into a preset format data by using an interface protocol between the data layer and the control layer, and then transmits the data. Give the control layer.
  • the step S220 may include the following sub-steps:
  • Sub-step S221 acquiring a preset interface protocol between the data layer and the control layer.
  • Sub-step S222 converting the format of the acquired data by using a format conversion function in the preset interface protocol.
  • the format conversion function may adopt a convert function to implement conversion of the format of the acquired data.
  • the convert function may convert data acquired by the data layer into data in a JSON format in the preset interface protocol, that is, regardless of what type of data the data layer acquires, acquired.
  • the data is converted into data in JSON format, so that any data acquired by the data layer is a JSON format data for the control layer.
  • a JSON string may be generated, and the generated JSON string is transmitted to the control layer.
  • the data layer and the control layer are coupled by a preset interface protocol.
  • the weak coupling relationship between the data layer and the control layer can be achieved by coupling the relationship between the data layer and the control layer through a fixed preset interface protocol. If you need to replace the data of the data layer, you only need to redefine a set of data interface protocols, and then re-acquire the data and convert it into the corresponding JSON format data. Thus, the data received by the control layer is still in JSON format. Data, so the control layer does not have any impact on the replacement of the data source, thus achieving a weak coupling relationship between the data layer and the control layer, and the data source can be easily extended later. deal with.
  • control layer parses the preset format data, and obtains the The presentation data corresponding to the preset format data.
  • control layer may parse the acquired data in the JSON format by using an existing JSON parsing tool, so as to obtain the rendering data corresponding to the data in the JSON format.
  • Step S240 the control layer searches for an interface interface for displaying the presentation data from at least one interface interface of the control layer and the view layer based on the presentation data, and displays corresponding presentation data through the found interface interface. Transfer to the view layer.
  • the step S240 may include the following sub-steps:
  • Sub-step S241 acquiring at least one rendering logic that the presentation data needs to be presented.
  • Sub-step S242 acquiring an interface interface of the view layer corresponding to each rendering logic according to each rendering logic.
  • each of the interface interfaces corresponds to a type of presentation logic.
  • the same category of rendering logic can be rendered through the same interface interface, while different rendering logic requires different interface interfaces to implement the rendering of the respective view functions.
  • the interface interface is designed by using an interface function, and the interface function performs design on the interface interface according to the interface that the developed software needs to present.
  • the developed software requires three interfaces: A, B, and C, then the interface is The function abstracts the interface interfaces of the three interfaces A, B, and C, so that the control layer can directly control the rendering logic of the view layer through each interface interface. That is, after the control layer obtains the presentation logic of the presentation data for presentation, the interface interface corresponding to the presentation logic can be obtained, so that the view layer can be controlled to display the presentation through the corresponding interface interface.
  • the data is presented.
  • the presentation data reaching the view layer is the final data that needs to be presented. At this time, the view layer is only responsible for rendering the presentation data according to the corresponding presentation logic, without any processing on the presentation data.
  • Step S250 the view layer performs page presentation on the presentation data according to the found interface interface.
  • the step S250 may include the following sub-steps:
  • Sub-step S251 the interface interface is packaged by a packaging layer between the control layer and each interface of the view layer.
  • the interface interface after the packaging forms a weak reference layer, so that the computer device running the software development model recovers the leaked memory when there is a memory leak in the view layer.
  • Sub-step S252 performing page rendering on the presentation data based on the packaged interface interface.
  • a layer of packaging layer may be disposed before each interface of the control layer and the view layer.
  • the packaging layer may be packaged by a reference queue (WeakReference).
  • the packaging layer can then package the interface interface to form a weak reference layer, which can form a weak reference relationship between the view layer and the control layer. If weak If there is a memory leak in the object referenced by the reference layer (eg, the view layer), then the computer device 100 will recycle the leaked memory. Specifically, the garbage collection period in the JAVA virtual machine running on the computer device 100 can be recovered, so that the memory leak caused by the view layer can be effectively avoided.
  • the method may further include:
  • a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
  • another preferred embodiment of the present invention further provides a page logic control apparatus 200.
  • the apparatus is stored in a memory 110 of the computer device 100, and the processor 120 performs the corresponding operation of the apparatus.
  • the device is applied to a software development model, and the software development model includes a data layer, a control layer, and a view layer.
  • the device can include:
  • the obtaining module 210 is configured to acquire data by the data layer.
  • the conversion module 220 is configured to convert, by the data layer, the acquired data into the preset format data by using an interface protocol between the data layer and the control layer, and then transmit the data to the control layer.
  • the parsing module 230 is configured to parse the preset format data by the control layer to obtain presentation data corresponding to the preset format data.
  • the searching module 240 is configured to, by the control layer, searching for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and by using the found interface interface The corresponding presentation data is transmitted to the view layer.
  • each interface interface corresponds to a type of presentation logic
  • the presentation module 250 is configured to perform page presentation on the presentation data according to the found interface interface.
  • the apparatus may further include:
  • a creating module 209 configured to create a preset interface protocol between the data layer and the control layer
  • the manner of creating a preset interface protocol between the data layer and the control layer includes:
  • the conversion module 220 may include:
  • the protocol acquisition sub-module 221 is configured to acquire a preset interface protocol between the data layer and the control layer.
  • the preset interface protocol includes a format conversion function.
  • the conversion sub-module 222 is configured to convert the format of the acquired data by using a format conversion function in the preset interface protocol.
  • the generating sub-module 223 is configured to generate a string of a preset format after the format conversion of the acquired data is successful.
  • the searching module 240 may include:
  • the logic acquisition sub-module 241 is configured to acquire at least one rendering logic that the presentation data needs to be presented.
  • the interface obtaining sub-module 242 is configured to acquire an interface interface of a view layer corresponding to each rendering logic according to each rendering logic.
  • the manner in which the presentation module 250 performs page presentation on the presentation data according to the found interface interface by using the view layer may include:
  • the rendered data is page rendered based on the wrapped interface interface.
  • the creating module 209 is further configured to respond to the request for setting a wrapper layer between the control layer and an interface interface of the view layer, according to the request A wrapper layer is created between the control layer and the interface interface of the view layer.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
  • the functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computing device (which may be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the above design of the embodiment of the present application can effectively reduce the coupling relationship between the view layer and the control layer, and greatly improve the scalability and maintainability of the software. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A page logic control method and apparatus (200), a computer apparatus and a readable storage medium, wherein the page logic control method is applied to a software development model, and the software development model comprises a data layer, a control layer and a view layer. The method comprises: a data layer acquiring data (S210); the data layer converting the acquired data into data of a pre-set format through an interface protocol between the data layer and a control layer, and then transmitting same to the control layer (S220); the control layer parsing the data of the pre-set format to obtain presentation data corresponding to the data of the pre-set format (S230); the control layer, based on the presentation data, searching for, from at least one interface port of the control layer and the view layer, an interface port for displaying the presentation data, and transmitting the corresponding presentation data to the view layer through the found interface port (S240); and the view layer, according to the found interface port, performing page presentation on the presentation data (S250). The page logic control method and apparatus (200), the computer apparatus and the readable storage medium can effectively reduce the coupling relationship between the view layer and the control layer, greatly improving the scalability and maintainability of the software.

Description

页面逻辑控制方法、装置、计算机设备及可读存储介质Page logic control method, device, computer device and readable storage medium
本申请要求于2017年05月09日提交中国专利局的申请号为CN201710322684.0名称为“页面逻辑控制方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims the priority of the Chinese Patent Application No. PCT Application No. PCT Application No.
技术领域Technical field
本发明涉及计算机技术领域,具体而言,涉及一种页面逻辑控制方法、装置、计算机设备及可读存储介质。The present invention relates to the field of computer technologies, and in particular, to a page logic control method, apparatus, computer device, and readable storage medium.
背景技术Background technique
目前的软件开发模型中,控制层会将视图层和模型层进行紧密的联系,这种联系方式使用直接引用关系来建立,也就是强引用关系。这种强引用关系的存在会随着业务逻辑的复杂度的增加,会使得控制层与视图层和模型层之间的关系错综复杂,从而导致软件无法继续维系。此外,在这种强耦合关系条件下,实现软件的扩展和维护变得异常困难。In the current software development model, the control layer closely links the view layer to the model layer. This contact is established using a direct reference relationship, which is a strong reference relationship. The existence of such a strong reference relationship will increase the relationship between the control layer and the view layer and the model layer as the complexity of the business logic increases, and the software cannot continue to be maintained. In addition, under such a strong coupling relationship, it is extremely difficult to implement software expansion and maintenance.
发明内容Summary of the invention
为了克服现有技术中的上述不足,本发明的目的在于提供一种页面逻辑控制方法及装置,能够有效降低视图层和控制层之间的耦合关系,极大地提高了软件的可扩展性和可维护性。In order to overcome the above-mentioned deficiencies in the prior art, an object of the present invention is to provide a page logic control method and apparatus, which can effectively reduce the coupling relationship between the view layer and the control layer, and greatly improve the scalability and software of the software. Maintenance.
为了实现上述目的,本发明实施例采用的技术方案如下:In order to achieve the above object, the technical solution adopted by the embodiment of the present invention is as follows:
本发明一较佳实施例提供一种页面逻辑控制方法,应用于软件开发模型,所述软件开发模型包括数据层、控制层以及视图层。所述方法包括:A preferred embodiment of the present invention provides a page logic control method applied to a software development model including a data layer, a control layer, and a view layer. The method includes:
所述数据层获取数据;The data layer acquires data;
所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层;Transmitting, by the data layer, the acquired data to the preset layer by using an interface protocol between the data layer and the control layer, and transmitting the data to the control layer;
所述控制层对所述预设格式数据进行解析,得到与所述预设格式数据对应的呈现数据;The control layer parses the preset format data to obtain presentation data corresponding to the preset format data;
所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层。其中,每一界面接口对应一类呈现逻辑;The control layer searches for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and transmits corresponding presentation data through the found interface interface. To the view layer. Wherein each interface interface corresponds to a type of presentation logic;
所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。The view layer performs page rendering on the presentation data according to the found interface interface.
在本发明一较佳实施例中,所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层的步骤,包括:In a preferred embodiment of the present invention, the data layer converts the acquired data into the preset format data through an interface protocol between the data layer and the control layer, and then transmits the data to the control layer, including :
获取所述数据层和所述控制层之间的预设接口协议。其中,所述预设接口协议中包括有格式转换函数; Obtaining a preset interface protocol between the data layer and the control layer. The preset interface protocol includes a format conversion function;
采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换;Converting the format of the acquired data by using a format conversion function in the preset interface protocol;
在所述获取的数据的格式转换成功后,生成一预设格式的字符串。After the format conversion of the acquired data is successful, a string of a preset format is generated.
在本发明一较佳实施例中,所述方法还包括:In a preferred embodiment of the present invention, the method further includes:
创建所述数据层和所述控制层之间的预设接口协议;Creating a preset interface protocol between the data layer and the control layer;
所述创建所述数据层和所述控制层之间的预设接口协议的步骤包括:The step of creating a preset interface protocol between the data layer and the control layer includes:
响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建所述预设接口协议。其中,所述预设接口协议用于实现所述数据层和所述控制层之间的通信。The preset interface protocol is created in response to a request to create a preset interface protocol between the data layer and the control layer. The preset interface protocol is used to implement communication between the data layer and the control layer.
在本发明一较佳实施例中,所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口的步骤,包括:In a preferred embodiment of the present invention, the control layer searches for the interface interface for displaying the presentation data from the control layer and the at least one interface interface of the view layer based on the presentation data, including :
获取所述呈现数据需要呈现的至少一个呈现逻辑;Obtaining at least one rendering logic that the rendering data needs to be presented;
根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。An interface interface of the view layer corresponding to each rendering logic is obtained according to each rendering logic.
在本发明较佳实施例中,所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现的步骤,包括:In a preferred embodiment of the present invention, the step of the view layer performing page presentation on the presentation data according to the found interface interface includes:
通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装,其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收;Packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, wherein the packaged interface interface forms a weak reference layer to enable a computer device running the software development model Leaking the leaked memory when there is a memory leak in the view layer;
基于包装后的界面接口对所述呈现数据进行页面呈现。The rendered data is page rendered based on the wrapped interface interface.
在本发明较佳实施例中,在通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装之前,所述方法还包括:In a preferred embodiment of the present invention, the method further includes: before packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, the method further includes:
响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。In response to a request to set a wrapper layer between the control layer and an interface interface of the view layer, a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
本发明另一较佳实施例还提供一种页面逻辑控制装置,应用于软件开发模型,所述软件开发模型包括数据层、控制层以及视图层。所述装置包括:Another preferred embodiment of the present invention further provides a page logic control apparatus, which is applied to a software development model, and the software development model includes a data layer, a control layer, and a view layer. The device includes:
获取模块,用于所述数据层获取数据;An obtaining module, configured to acquire data by the data layer;
转换模块,用于所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层;a conversion module, configured to convert, by the data layer, the acquired data into a preset format data by using an interface protocol between the data layer and the control layer, and then transmitting the data to the control layer;
解析模块,用于所述控制层对所述预设格式数据进行解析,得到与所述预设格式数据对应的呈现数据;a parsing module, configured to parse the preset format data by the control layer, to obtain presentation data corresponding to the preset format data;
查找模块,用于所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层。其中,每一界面接口对应一类呈现逻辑;a search module, configured by the control layer to search for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and by using the found interface interface Corresponding presentation data is transmitted to the view layer. Wherein each interface interface corresponds to a type of presentation logic;
呈现模块,用于所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。 And a rendering module, configured by the view layer to perform page rendering on the presentation data according to the found interface interface.
在本发明一较佳实施例中,所述转换模块包括:In a preferred embodiment of the present invention, the conversion module includes:
协议获取子模块,用于获取所述数据层和所述控制层之间的预设接口协议,其中,所述预设接口协议中包括有格式转换函数;a protocol acquisition sub-module, configured to acquire a preset interface protocol between the data layer and the control layer, where the preset interface protocol includes a format conversion function;
转换子模块,用于采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换;a conversion submodule, configured to convert a format of the acquired data by using a format conversion function in the preset interface protocol;
生成子模块,用于在所述获取的数据的格式转换成功后,生成一预设格式的字符串。And generating a submodule, configured to generate a string of a preset format after the format conversion of the acquired data is successful.
在本发明一较佳实施例中,所述装置还包括:In a preferred embodiment of the present invention, the device further includes:
创建模块,用于创建所述数据层和所述控制层之间的预设接口协议;Creating a module, configured to create a preset interface protocol between the data layer and the control layer;
所述创建所述数据层和所述控制层之间的预设接口协议的方式包括:The manner of creating a preset interface protocol between the data layer and the control layer includes:
响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建所述预设接口协议,其中,所述预设接口协议用于实现所述数据层和所述控制层之间的通信。Creating the preset interface protocol in response to a request to create a preset interface protocol between the data layer and the control layer, wherein the preset interface protocol is used to implement the data layer and the control layer Communication between.
在本发明一较佳实施例中,所述查找模块包括:In a preferred embodiment of the present invention, the searching module includes:
逻辑获取子模块,用于获取所述呈现数据需要呈现的至少一个呈现逻辑;a logic acquisition submodule, configured to acquire at least one rendering logic that the rendering data needs to be presented;
接口获取子模块,用于根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。The interface acquisition sub-module is configured to acquire an interface interface of a view layer corresponding to each presentation logic according to each rendering logic.
在本发明一较佳实施例中,所述呈现模块用于所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现的方式包括:In a preferred embodiment of the present invention, the manner in which the presentation module is configured to display the presentation data by the view layer according to the found interface interface includes:
通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装,其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收;Packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, wherein the packaged interface interface forms a weak reference layer to enable a computer device running the software development model Leaking the leaked memory when there is a memory leak in the view layer;
基于包装后的界面接口对所述呈现数据进行页面呈现。The rendered data is page rendered based on the wrapped interface interface.
在本发明一较佳实施例中,所述创建模块还用于响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。In a preferred embodiment of the present invention, the creating module is further configured to respond to the request at the control layer according to the request in response to a request to set a wrapper layer between an interface interface of the control layer and the view layer. A wrapper layer is created between the interface interfaces of the view layer.
本发明另一较佳实施例还提供一种计算机设备,包括处理器及存储有若干计算机指令的非易失性存储器,所述计算机指令被所述处理器执行时,所述计算机设备执行上面实施例中所述的页面逻辑控制方法。Another preferred embodiment of the present invention further provides a computer device comprising a processor and a non-volatile memory storing a plurality of computer instructions, the computer device performing the above implementation when the computer instructions are executed by the processor The page logic control method described in the example.
本发明其他较佳实施例还提供一种可读存储介质,所述可读存储介质包括计算机程序,所述计算机程序运行时控制所述可读存储介质所在电子设备执行上面实施例中所述的页面逻辑控制方法。Other preferred embodiments of the present invention further provide a readable storage medium, the readable storage medium comprising a computer program, the computer program controlling the electronic device where the readable storage medium is located to perform the operations described in the above embodiments Page logic control method.
相对于现有技术而言,本发明具有以下有益效果:Compared with the prior art, the present invention has the following beneficial effects:
本发明实施例提供的页面逻辑控制方法、装置、计算机设备及可读存储介质,该方法通过数据层获取数据;数据层将获取的数据通过数据层与控制层之间的接口协议转换为预 设格式数据后传送给控制层;控制层对预设格式数据进行解析,得到与预设格式数据对应的呈现数据;控制层基于呈现数据从控制层与视图层的至少一个界面接口中查找用于显示呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至视图层;视图层根据查找到的界面接口对呈现数据进行页面呈现。上述设计能够有效降低视图层和控制层之间的耦合关系,极大地提高了软件的可扩展性和可维护性。The page logic control method, device, computer device and readable storage medium provided by the embodiment of the present invention obtain data through a data layer; the data layer converts the acquired data into an interface through an interface protocol between the data layer and the control layer. The format data is transmitted to the control layer; the control layer parses the preset format data to obtain presentation data corresponding to the preset format data; and the control layer searches for at least one interface interface of the control layer and the view layer based on the presentation data for searching The interface interface for presenting the data is displayed, and the corresponding presentation data is transmitted to the view layer through the found interface interface; the view layer performs page presentation on the presentation data according to the found interface interface. The above design can effectively reduce the coupling relationship between the view layer and the control layer, and greatly improve the scalability and maintainability of the software.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly described below. It should be understood that the following drawings show only certain embodiments of the present invention, and therefore It should be seen as a limitation on the scope, and those skilled in the art can obtain other related drawings according to these drawings without any creative work.
图1是本发明一较佳实施例提供的计算机设备的方框示意图;1 is a block diagram of a computer device according to a preferred embodiment of the present invention;
图2为本发明一较佳实施例提供的页面逻辑控制方法的一种流程示意图;2 is a schematic flowchart of a page logic control method according to a preferred embodiment of the present invention;
图3为本发明较佳实施例提供的页面逻辑控制方法的另一种流程示意图;3 is another schematic flowchart of a page logic control method according to a preferred embodiment of the present invention;
图4为图2中所示的步骤S220包括的各个子步骤的一种流程示意图;4 is a schematic flow chart of each sub-step included in step S220 shown in FIG. 2;
图5为图2中所示的步骤S240包括的各个子步骤的一种流程示意图;FIG. 5 is a schematic flow chart of each sub-step included in step S240 shown in FIG. 2;
图6为图2中所示的步骤S250包括的各个子步骤的一种流程示意图;FIG. 6 is a schematic flow chart of each sub-step included in step S250 shown in FIG. 2;
图7为本发明另一较佳实施例提供的页面逻辑控制装置的一种功能模块图;FIG. 7 is a functional block diagram of a page logic control apparatus according to another preferred embodiment of the present invention; FIG.
图8为本发明另一较佳实施例提供的页面逻辑控制装置的另一种功能模块图;FIG. 8 is another functional block diagram of a page logic control apparatus according to another embodiment of the present invention; FIG.
图9为图7中所示的转换模块包括的各个子模块的一种功能模块图;9 is a functional block diagram of each submodule included in the conversion module shown in FIG. 7;
图10为图7中所示的查找模块包括的各个子模块的一种功能模块图。FIG. 10 is a functional block diagram of each submodule included in the lookup module shown in FIG. 7.
图标:100-计算机设备;110-存储器;120-处理器;130-通信单元;140-存储控制器;150-显示单元;200-页面逻辑控制装置;209-创建模块;210-获取模块;220-转换模块;221-协议获取子模块;222-转换子模块;223-生成子模块;230-解析模块;240-查找模块;241-逻辑获取子模块;242-接口获取子模块;250-呈现模块。Icon: 100-computer device; 110-memory; 120-processor; 130-communication unit; 140-storage controller; 150-display unit; 200-page logic control device; 209-creation module; 210-acquisition module; - conversion module; 221 - protocol acquisition submodule; 222 - conversion submodule; 223 - generation submodule; 230 - parsing module; 240 - lookup module; 241 - logical acquisition submodule; 242 - interface acquisition submodule; 250 - rendering Module.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. The components of the embodiments of the invention, which are generally described and illustrated in the figures herein, may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention in the claims All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个 附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that similar reference numerals and letters indicate similar items in the following figures, so once an item is in one The definitions in the drawings are not required to be further defined and explained in the subsequent figures.
下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some embodiments of the present invention are described in detail below with reference to the accompanying drawings. The features of the embodiments and examples described below can be combined with each other without conflict.
请参阅图1,图1是本发明一较佳实施例提供的计算机设备100的方框示意图。本发明实施例中,所述计算机设备100可以为用于运行有软件开发模型的电子设备。例如,所述计算机设备100可以是,但不限于,个人电脑(Personal Computer,PC)、笔记本电脑、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、移动上网设备(Mobile Internet Device,MID)等。所述计算机设备100的操作系统可以是,但不限于,Windows系统、Linux系统、OSX系统等。优选地,在本实施例中,所述计算机设备100的操作系统可以为Windows系统。Please refer to FIG. 1. FIG. 1 is a block diagram of a computer device 100 according to a preferred embodiment of the present invention. In the embodiment of the present invention, the computer device 100 may be an electronic device for running a software development model. For example, the computer device 100 may be, but not limited to, a personal computer (PC), a notebook computer, a tablet computer, a personal digital assistant (PDA), and a mobile Internet device (MID). Wait. The operating system of the computer device 100 may be, but not limited to, a Windows system, a Linux system, an OSX system, and the like. Preferably, in this embodiment, the operating system of the computer device 100 may be a Windows system.
如图1所示,所述计算机设备100可以包括存储器110、处理器120、通信单元130、存储控制器140以及显示单元150。所述存储器110、处理器120、通信单元130、存储控制器140以及显示单元150相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。存储器110中存储有页面逻辑控制装置200,所述页面逻辑控制装置200包括至少一个可以软件或固件(Firmware)的形式存储于所述存储器110中的软件功能模块,所述处理器120通过运行存储在存储器110内的软件程序以及模块,如本发明实施例中的页面逻辑控制装置200,从而执行各种功能应用以及数据处理,即实现本发明实施例中的页面逻辑控制方法。As shown in FIG. 1, the computer device 100 can include a memory 110, a processor 120, a communication unit 130, a memory controller 140, and a display unit 150. The memory 110, the processor 120, the communication unit 130, the storage controller 140, and the display unit 150 are electrically connected directly or indirectly to each other to implement data transmission or interaction. For example, the components can be electrically connected to one another via one or more communication buses or signal lines. A page logic control device 200 is stored in the memory 110, and the page logic control device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware, and the processor 120 runs the storage. The software program and the module in the memory 110, such as the page logic control device 200 in the embodiment of the present invention, thereby performing various functional applications and data processing, that is, implementing the page logic control method in the embodiment of the present invention.
其中,所述存储器110可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器110可进一步包括相对于处理器120远程设置的存储器,这些远程存储器可以通过网络连接至计算机设备100。上述网络的实例可以包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。所述处理器120以及其他可能的组件对存储器110的访问可在所述存储控制器140的控制下进行。可选地,所述通信单元130将各种输入/输入装置耦合至处理器120以及存储器110,上述存储器110内的软件程序以及模块还可包括操作系统,其可包括各种用于管理系统任务(例如内存管理、存储设备控制、电源管理等)的软件组件和/或驱动,并可与各种硬件或软件组件相互通讯,从而提供其他软件组件的运行环境。The memory 110 may include a high speed random access memory, and may also include a non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, memory 110 can further include memory remotely located relative to processor 120, which can be connected to computer device 100 over a network. Examples of such networks may include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Access to the memory 110 by the processor 120 and other possible components can be performed under the control of the memory controller 140. Optionally, the communication unit 130 couples various input/output devices to the processor 120 and the memory 110. The software programs and modules within the memory 110 may also include an operating system, which may include various functions for managing system tasks. Software components and/or drivers (such as memory management, storage device control, power management, etc.) that communicate with various hardware or software components to provide an operating environment for other software components.
所述处理器120可以是一种集成电路芯片,具有信号的处理能力。上述的处理器120可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等。还可以是数字信号处理器(DSP))、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是 微处理器或者该处理器120也可以是任何常规的处理器等。The processor 120 can be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), and the like. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or carried out. A general purpose processor can be The microprocessor or the processor 120 can also be any conventional processor or the like.
所述通信单元130可以用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者所述计算机设备100进行通讯。所述通信单元130可与各种网络,如互联网、企业内部网、无线网络进行通讯或者通过无线网络与所述计算机设备100进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。上述的无线网络可以使用各种通信标准、协议及技术,包括但并不限于全球移动通信系统、增强型移动通信技术、宽带码分多址技术,码分多址技术、时分多址技术、蓝牙、无线保真技术、网络电话、全球微波互联接入、其他用于邮件、即时通讯及短消息的协议,以及任何其他合适的通讯协议,甚至可包括那些当前仍未被开发出来的协议。The communication unit 130 can be configured to receive and transmit electromagnetic waves, and realize mutual conversion between electromagnetic waves and electrical signals, thereby communicating with the communication network or the computer device 100. The communication unit 130 can communicate with various networks, such as the Internet, an intranet, a wireless network, or communicate with the computer device 100 over a wireless network. The wireless network described above may include a cellular telephone network, a wireless local area network, or a metropolitan area network. The above wireless network can use various communication standards, protocols and technologies, including but not limited to global mobile communication systems, enhanced mobile communication technologies, wideband code division multiple access technology, code division multiple access technology, time division multiple access technology, Bluetooth , wireless fidelity technology, VoIP, global microwave access, other protocols for mail, instant messaging and short messages, and any other suitable communication protocols, even those that are not currently being developed.
所述显示单元150可以用于提供一个交互界面(例如用户操作界面)或用于显示图像数据。本实施例中,所述显示单元150可以是液晶显示器或触控显示器。若为触控显示器,其可为支持单点和多点触控操作的电容式触控屏或电阻式触控屏等。支持单点和多点触控操作是指触控显示器能感应到来自该触控显示器上一个或多个位置处产生的触控操作,并将该感应到的触控操作交由处理器120进行计算和处理。The display unit 150 can be used to provide an interactive interface (such as a user interface) or to display image data. In this embodiment, the display unit 150 can be a liquid crystal display or a touch display. For a touch display, it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense a touch operation generated from one or more positions on the touch display, and the touch operation is performed by the processor 120. Calculation and processing.
本实施例中,所述计算机设备100可以包括一软件开发模型,所述软件开发模型可以包括数据层、控制层以及视图层。其中,所述数据层用于进行数据逻辑的获取,所述控制层用于对所述数据层的数据进行获取并将获取的数据进行数据转换和数据运输,所述视图层用于根据所述控制层传送的数据进行软件视图的展示。In this embodiment, the computer device 100 may include a software development model, and the software development model may include a data layer, a control layer, and a view layer. The data layer is used for acquiring data logic, and the control layer is configured to acquire data of the data layer and perform data conversion and data transportation on the acquired data, where the view layer is used according to the The data transmitted by the control layer is displayed in a software view.
下面以上述软件开发模型作为示例对本实施例的技术方案进行详细说明,可选地,所述软件开发模型可以采用MVC开发模型。The technical solution of the embodiment is described in detail below by using the software development model as an example. Alternatively, the software development model may adopt an MVC development model.
请参阅图2,图2为本发明一较佳实施例提供的页面逻辑控制方法的流程示意图,所述页面逻辑控制方法应用于上述软件开发模型。应当理解的是,本发明实施例提供的方法不以图2及以下所述的具体顺序为限制。所述方法的具体流程如下:Please refer to FIG. 2. FIG. 2 is a schematic flowchart diagram of a page logic control method according to a preferred embodiment of the present invention. The page logic control method is applied to the software development model. It should be understood that the method provided by the embodiments of the present invention is not limited to the specific order described in FIG. 2 and the following. The specific process of the method is as follows:
步骤S210,数据层获取数据。In step S210, the data layer acquires data.
本实施例中,不对所述数据层获取数据的方式进行具体的限制,例如,所述数据层可以从某一数据库中获取数据,或者,从某一网络层中获取数据,又或者,从某一文件中获取数据等。无论所述数据的获取采用的是哪一种方式,所有获取的数据都会被存放在所述数据层中。In this embodiment, the manner in which the data layer acquires data is not specifically limited. For example, the data layer may acquire data from a certain database, or obtain data from a certain network layer, or Get data in a file, etc. Regardless of the manner in which the data is acquired, all acquired data is stored in the data layer.
在传统的MVC开发模型中所述数据层和所述控制层之间是直接耦合关系,也就是“强引用关系”。简单地说,如果一个对象具有所述“强引用关系”,就可以理解为该对象是必不可少的,那么该对象也就不会被所述计算机设备100回收,正是因为这层“强引用关系”,如果所述数据层获取的数据源发生改变,那么所述控制层则无法获取到所述数据层传送的 改变后的数据源,从而导致所述软件开发模型的扩展性和维护性很低。为了解决上述问题,请参阅图3,所述方法还可以包括:In the traditional MVC development model, the data layer and the control layer are directly coupled, that is, a "strong reference relationship." Simply put, if an object has the "strong reference relationship", it can be understood that the object is indispensable, then the object will not be recovered by the computer device 100, precisely because this layer is "strong" a reference relationship, if the data source acquired by the data layer changes, the control layer cannot obtain the data layer to transmit The changed data source results in a low scalability and maintainability of the software development model. In order to solve the above problem, referring to FIG. 3, the method may further include:
步骤S209,创建所述数据层和所述控制层之间的预设接口协议。Step S209, creating a preset interface protocol between the data layer and the control layer.
具体地,在本实施例中,可以创建一套用于所述数据层和所述控制层之间的访问的预设接口协议,其中创建所述预设接口协议的方式可以是:所述计算机设备100响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建用于实现所述数据层和所述控制层之间的通信的预设接口协议,所述预设接口协议中包括有用于对所述数据层获取的数据进行转换的格式转换函数。Specifically, in this embodiment, a preset interface protocol for accessing between the data layer and the control layer may be created, where the preset interface protocol may be created by: the computer device Responding to a request to create a preset interface protocol between the data layer and the control layer, creating a preset interface protocol for implementing communication between the data layer and the control layer, the preset interface A protocol conversion function for converting data acquired by the data layer is included in the protocol.
请再次参阅图2,在创建好所述预设接口协议之后,参见步骤S220,所述数据层将获取的数据通过所述数据层与控制层之间的接口协议转换为预设格式数据后传送给所述控制层。Referring to FIG. 2 again, after the preset interface protocol is created, referring to step S220, the data layer converts the acquired data into a preset format data by using an interface protocol between the data layer and the control layer, and then transmits the data. Give the control layer.
具体地,作为一种实施方式,请参阅图4,本实施例中,所述步骤S220可以包括以下子步骤:Specifically, as an implementation manner, referring to FIG. 4, in this embodiment, the step S220 may include the following sub-steps:
子步骤S221,获取所述数据层和所述控制层之间的预设接口协议。Sub-step S221, acquiring a preset interface protocol between the data layer and the control layer.
子步骤S222,采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换。Sub-step S222, converting the format of the acquired data by using a format conversion function in the preset interface protocol.
本实施例中,所述格式转换函数可以采用convert函数来实现所述获取的数据的格式的转换。具体地,所述convert函数可以将所述数据层获取的数据在所述预设接口协议中转换成JSON格式的数据,也就是说,无论所述数据层获取的是什么类型的数据,获取的数据都会被转换成JSON格式的数据,如此,所述数据层获取的任何数据对于所述控制层来说,都是一个JSON格式的数据。In this embodiment, the format conversion function may adopt a convert function to implement conversion of the format of the acquired data. Specifically, the convert function may convert data acquired by the data layer into data in a JSON format in the preset interface protocol, that is, regardless of what type of data the data layer acquires, acquired. The data is converted into data in JSON format, so that any data acquired by the data layer is a JSON format data for the control layer.
子步骤S223,在所述获取的数据的格式转换成功后,生成一预设格式的字符串。Sub-step S223, after the format conversion of the acquired data is successful, generating a character string of a preset format.
本实施例中,在所述获取的数据的格式转换成功后,可以生成一JSON字符串,并将生成的该JSON字符串传送给所述控制层。In this embodiment, after the format conversion of the acquired data is successful, a JSON string may be generated, and the generated JSON string is transmitted to the control layer.
通过上述设计,所述数据层和所述控制层之间通过预设接口协议进行耦合。通过固定的预设接口协议来耦合数据层和控制层之间的关系,可以实现所述数据层和所述控制层之间的弱耦合关系。后续如果需要更换数据层的数据,只需要重新定义一套数据接口协议,然后再重新对数据进行获取并转换成对应的JSON格式的数据,如此,所述控制层接收到的数据依旧是JSON格式的数据,因此对于控制层来说,数据源的更换并没有任何影响,这样就实现了所述数据层和所述控制层之间的弱耦合关系,后期就可以很方便地对数据源进行拓展处理。Through the above design, the data layer and the control layer are coupled by a preset interface protocol. The weak coupling relationship between the data layer and the control layer can be achieved by coupling the relationship between the data layer and the control layer through a fixed preset interface protocol. If you need to replace the data of the data layer, you only need to redefine a set of data interface protocols, and then re-acquire the data and convert it into the corresponding JSON format data. Thus, the data received by the control layer is still in JSON format. Data, so the control layer does not have any impact on the replacement of the data source, thus achieving a weak coupling relationship between the data layer and the control layer, and the data source can be easily extended later. deal with.
请再次参阅图2,步骤S230,所述控制层对所述预设格式数据进行解析,得到与所述 预设格式数据对应的呈现数据。Referring to FIG. 2 again, in step S230, the control layer parses the preset format data, and obtains the The presentation data corresponding to the preset format data.
本实施例中,所述控制层可以通过现有的JSON解析工具对获取到的JSON格式的数据进行解析,从而获取到所述JSON格式的数据对应的呈现数据。In this embodiment, the control layer may parse the acquired data in the JSON format by using an existing JSON parsing tool, so as to obtain the rendering data corresponding to the data in the JSON format.
步骤S240,所述控制层基于所述呈现数据从所述控制层与视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层。Step S240, the control layer searches for an interface interface for displaying the presentation data from at least one interface interface of the control layer and the view layer based on the presentation data, and displays corresponding presentation data through the found interface interface. Transfer to the view layer.
作为一种实施方式,请参阅图5,所述步骤S240可以包括以下子步骤:As an implementation manner, referring to FIG. 5, the step S240 may include the following sub-steps:
子步骤S241,获取所述呈现数据需要呈现的至少一个呈现逻辑。Sub-step S241, acquiring at least one rendering logic that the presentation data needs to be presented.
子步骤S242,根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。Sub-step S242, acquiring an interface interface of the view layer corresponding to each rendering logic according to each rendering logic.
由于软件视图的变化形式是多种多样的,对于不同的视图层的展现逻辑也是多种多样的,在本实施例中,每一个所述界面接口对应一类呈现逻辑。简单地说,相同类别的呈现逻辑可以通过相同的界面接口来进行呈现,而不同的呈现逻辑则需要不同的界面接口来实现各自的视图功能的呈现。Since the variations of the software view are various, the presentation logic for different view layers is also diverse. In this embodiment, each of the interface interfaces corresponds to a type of presentation logic. Briefly, the same category of rendering logic can be rendered through the same interface interface, while different rendering logic requires different interface interfaces to implement the rendering of the respective view functions.
所述界面接口通过接口函数进行设计,所述接口函数根据开发的软件需要呈现的界面来进行对所述界面接口进行设计,例如开发的软件需要A、B、C三个界面,那么所述接口函数则将A、B、C三个界面的界面接口进行抽象,这样所述控制层可以直接通过每个界面接口来控制所述视图层的呈现逻辑。也就是说,所述控制层在获取到所述呈现数据进行呈现的呈现逻辑后,就可以获取到对应该呈现逻辑的界面接口,从而可以控制所述视图层通过对应的界面接口将所述呈现数据进行呈现。其中,到达所述视图层的呈现数据就是需要呈现的最终数据,此时所述视图层只负责根据对应的呈现逻辑将呈现数据进行呈现,而不需要对呈现数据进行任何处理。The interface interface is designed by using an interface function, and the interface function performs design on the interface interface according to the interface that the developed software needs to present. For example, the developed software requires three interfaces: A, B, and C, then the interface is The function abstracts the interface interfaces of the three interfaces A, B, and C, so that the control layer can directly control the rendering logic of the view layer through each interface interface. That is, after the control layer obtains the presentation logic of the presentation data for presentation, the interface interface corresponding to the presentation logic can be obtained, so that the view layer can be controlled to display the presentation through the corresponding interface interface. The data is presented. The presentation data reaching the view layer is the final data that needs to be presented. At this time, the view layer is only responsible for rendering the presentation data according to the corresponding presentation logic, without any processing on the presentation data.
步骤S250,所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。Step S250, the view layer performs page presentation on the presentation data according to the found interface interface.
作为一种实施方式,请参阅图6,所述步骤S250可以包括以下子步骤:As an implementation manner, referring to FIG. 6, the step S250 may include the following sub-steps:
子步骤S251,通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装。其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收。Sub-step S251, the interface interface is packaged by a packaging layer between the control layer and each interface of the view layer. The interface interface after the packaging forms a weak reference layer, so that the computer device running the software development model recovers the leaked memory when there is a memory leak in the view layer.
子步骤S252,基于包装后的界面接口对所述呈现数据进行页面呈现。Sub-step S252, performing page rendering on the presentation data based on the packaged interface interface.
具体地,由于所述视图层占用内存较大,需要对所述视图层的内存进行严格管理,否则容易出现内存泄露的问题。本实施例中,可以在所述控制层和所述视图层的每个界面接口之前设置一层包装层,作为一种实施方式,所述包装层可以通过引用队列(WeakReference)进行包装。然后所述包装层能够对所述界面接口进行包装,从而形成弱引用层,所述弱引用层可以使得所述视图层和所述控制层之间形成一弱引用关系。如果弱 引用层所引用的对象(例如,视图层)存在内存泄露,那么所述计算机设备100就会将泄露的内存进行回收。具体地,可以通过运行于所述计算机设备100上的JAVA虚拟机中的垃圾回收期进行回收,这样就可以有效避免所述视图层产生的内存泄露的问题。Specifically, since the view layer occupies a large memory, the memory of the view layer needs to be strictly managed, otherwise the memory leakage problem is likely to occur. In this embodiment, a layer of packaging layer may be disposed before each interface of the control layer and the view layer. As an implementation manner, the packaging layer may be packaged by a reference queue (WeakReference). The packaging layer can then package the interface interface to form a weak reference layer, which can form a weak reference relationship between the view layer and the control layer. If weak If there is a memory leak in the object referenced by the reference layer (eg, the view layer), then the computer device 100 will recycle the leaked memory. Specifically, the garbage collection period in the JAVA virtual machine running on the computer device 100 can be recovered, so that the memory leak caused by the view layer can be effectively avoided.
通过上述设计,不仅有效地降低了视图层和控制层之间的强耦合关系,同时也能够有效地避免所述视图层中内存泄漏产生的风险。Through the above design, not only the strong coupling relationship between the view layer and the control layer is effectively reduced, but also the risk of memory leakage in the view layer can be effectively avoided.
在本实施例中,在子步骤S251之前,所述方法还可以包括:In this embodiment, before the sub-step S251, the method may further include:
响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。In response to a request to set a wrapper layer between the control layer and an interface interface of the view layer, a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
请参阅图7,本发明另一较佳实施例还提供一种页面逻辑控制装置200,所述装置存储于所述计算机设备100的存储器110中,由所述处理器120执行所述装置对应的各功能模块的运行。其中,所述装置应用于软件开发模型,所述软件开发模型包括数据层、控制层以及视图层。所述装置可以包括:Referring to FIG. 7, another preferred embodiment of the present invention further provides a page logic control apparatus 200. The apparatus is stored in a memory 110 of the computer device 100, and the processor 120 performs the corresponding operation of the apparatus. The operation of each functional module. Wherein, the device is applied to a software development model, and the software development model includes a data layer, a control layer, and a view layer. The device can include:
获取模块210,用于所述数据层获取数据。The obtaining module 210 is configured to acquire data by the data layer.
转换模块220,用于所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层。The conversion module 220 is configured to convert, by the data layer, the acquired data into the preset format data by using an interface protocol between the data layer and the control layer, and then transmit the data to the control layer.
解析模块230,用于所述控制层对所述预设格式数据进行解析,得到与所述预设格式数据对应的呈现数据。The parsing module 230 is configured to parse the preset format data by the control layer to obtain presentation data corresponding to the preset format data.
查找模块240,用于所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层。其中,每一界面接口对应一类呈现逻辑;The searching module 240 is configured to, by the control layer, searching for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and by using the found interface interface The corresponding presentation data is transmitted to the view layer. Wherein each interface interface corresponds to a type of presentation logic;
呈现模块250,用于所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。The presentation module 250 is configured to perform page presentation on the presentation data according to the found interface interface.
可选地,请参阅图8,所述装置还可以包括:Optionally, referring to FIG. 8, the apparatus may further include:
创建模块209,用于创建所述数据层和所述控制层之间的预设接口协议;a creating module 209, configured to create a preset interface protocol between the data layer and the control layer;
所述创建所述数据层和所述控制层之间的预设接口协议的方式包括:The manner of creating a preset interface protocol between the data layer and the control layer includes:
响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建所述预设接口协议,其中,所述预设接口协议用于实现所述数据层和所述控制层之间的通信。Creating the preset interface protocol in response to a request to create a preset interface protocol between the data layer and the control layer, wherein the preset interface protocol is used to implement the data layer and the control layer Communication between.
可选地,请参阅图9,所述转换模块220可以包括:Optionally, referring to FIG. 9, the conversion module 220 may include:
协议获取子模块221,用于获取所述数据层和所述控制层之间的预设接口协议。其中,所述预设接口协议中包括有格式转换函数。The protocol acquisition sub-module 221 is configured to acquire a preset interface protocol between the data layer and the control layer. The preset interface protocol includes a format conversion function.
转换子模块222,用于采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换。The conversion sub-module 222 is configured to convert the format of the acquired data by using a format conversion function in the preset interface protocol.
生成子模块223,用于在所述获取的数据的格式转换成功后,生成一预设格式的字符串。 The generating sub-module 223 is configured to generate a string of a preset format after the format conversion of the acquired data is successful.
可选地,请参阅图10,所述查找模块240可以包括:Optionally, referring to FIG. 10, the searching module 240 may include:
逻辑获取子模块241,用于获取所述呈现数据需要呈现的至少一个呈现逻辑。The logic acquisition sub-module 241 is configured to acquire at least one rendering logic that the presentation data needs to be presented.
接口获取子模块242,用于根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。The interface obtaining sub-module 242 is configured to acquire an interface interface of a view layer corresponding to each rendering logic according to each rendering logic.
可选地,所述呈现模块250通过所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现的方式可以包括:Optionally, the manner in which the presentation module 250 performs page presentation on the presentation data according to the found interface interface by using the view layer may include:
通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装,其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收;Packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, wherein the packaged interface interface forms a weak reference layer to enable a computer device running the software development model Leaking the leaked memory when there is a memory leak in the view layer;
基于包装后的界面接口对所述呈现数据进行页面呈现。The rendered data is page rendered based on the wrapped interface interface.
可选地,在本实施例中,所述创建模块209还可以用于响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。Optionally, in this embodiment, the creating module 209 is further configured to respond to the request for setting a wrapper layer between the control layer and an interface interface of the view layer, according to the request A wrapper layer is created between the control layer and the interface interface of the view layer.
本实施例中的各功能模块的具体操作方法可参照上述方法实施例中相应步骤的详细描述,在此不再重复赘述。For the specific operation method of each function module in this embodiment, reference may be made to the detailed description of the corresponding steps in the foregoing method embodiments, and details are not repeated herein.
在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置和方法实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本发明的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The above described apparatus and method embodiments are merely illustrative, for example, the flowchart and block diagrams in the figures illustrate the architecture of possible implementations of systems, methods, and computer program products according to various embodiments of the invention, Features and operations. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
另外,在本发明各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算设备(可以是个人计算机,电子设备,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。 The functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computing device (which may be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
需要说明的是,在本文中,术语"包括"、"包含"或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句"包括一个……"限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It is to be understood that the term "comprising", "comprising", or any other variants thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, item, or device. An element defined by the phrase "comprising a ..." does not exclude the presence of additional elements in the process, method, item, or device that comprises the element.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。It is apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and the present invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the invention is defined by the appended claims instead All changes in the meaning and scope of equivalent elements are included in the present invention. Any reference signs in the claims should not be construed as limiting the claim.
工业实用性Industrial applicability
本申请实施例的上述设计能够有效降低视图层和控制层之间的耦合关系,极大地提高了软件的可扩展性和可维护性。。 The above design of the embodiment of the present application can effectively reduce the coupling relationship between the view layer and the control layer, and greatly improve the scalability and maintainability of the software. .

Claims (16)

  1. 一种页面逻辑控制方法,应用于软件开发模型,所述软件开发模型包括数据层、控制层以及视图层,其特征在于,所述方法包括:A page logic control method is applied to a software development model, where the software development model includes a data layer, a control layer, and a view layer, wherein the method includes:
    所述数据层获取数据;The data layer acquires data;
    所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层;Transmitting, by the data layer, the acquired data to the preset layer by using an interface protocol between the data layer and the control layer, and transmitting the data to the control layer;
    所述控制层对所述预设格式数据进行解析,得到与所述预设格式数据对应的呈现数据;The control layer parses the preset format data to obtain presentation data corresponding to the preset format data;
    所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层,其中,每一界面接口对应一类呈现逻辑;The control layer searches for an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and transmits corresponding presentation data through the found interface interface. To the view layer, wherein each interface interface corresponds to a type of presentation logic;
    所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。The view layer performs page rendering on the presentation data according to the found interface interface.
  2. 根据权利要求1所述的页面逻辑控制方法,其特征在于,所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层的步骤,包括:The page logic control method according to claim 1, wherein the data layer converts the acquired data into a preset format data through an interface protocol between the data layer and the control layer, and then transmits the data to the The steps of the control layer include:
    获取所述数据层和所述控制层之间的预设接口协议,其中,所述预设接口协议中包括有格式转换函数;Obtaining a preset interface protocol between the data layer and the control layer, where the preset interface protocol includes a format conversion function;
    采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换;Converting the format of the acquired data by using a format conversion function in the preset interface protocol;
    在所述获取的数据的格式转换成功后,生成一预设格式的字符串。After the format conversion of the acquired data is successful, a string of a preset format is generated.
  3. 根据权利要求1所述的页面逻辑控制方法,其特征在于,在获取所述数据层和所述控制层之间的预设接口协议之前,所述方法还包括:The page logic control method according to claim 1, wherein before the obtaining a preset interface protocol between the data layer and the control layer, the method further comprises:
    创建所述数据层和所述控制层之间的预设接口协议;Creating a preset interface protocol between the data layer and the control layer;
    所述创建所述数据层和所述控制层之间的预设接口协议的步骤包括:The step of creating a preset interface protocol between the data layer and the control layer includes:
    响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建所述预设接口协议,其中,所述预设接口协议用于实现所述数据层和所述控制层之间的通信。Creating the preset interface protocol in response to a request to create a preset interface protocol between the data layer and the control layer, wherein the preset interface protocol is used to implement the data layer and the control layer Communication between.
  4. 根据权利要求1所述的页面逻辑控制方法,其特征在于,所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口的步骤,包括:The page logic control method according to claim 1, wherein the control layer searches for at least one interface interface of the control layer and the view layer for displaying the presentation data based on the presentation data. The steps of the interface interface include:
    获取所述呈现数据需要呈现的至少一个呈现逻辑;Obtaining at least one rendering logic that the rendering data needs to be presented;
    根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。An interface interface of the view layer corresponding to each rendering logic is obtained according to each rendering logic.
  5. 根据权利要求1所述的页面逻辑控制方法,其特征在于,所述视图层根据查找到 的界面接口对所述呈现数据进行页面呈现的步骤,包括:The page logic control method according to claim 1, wherein the view layer is found according to The interface interface performs the step of page rendering the presentation data, including:
    通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装,其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收;Packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, wherein the packaged interface interface forms a weak reference layer to enable a computer device running the software development model Leaking the leaked memory when there is a memory leak in the view layer;
    基于包装后的界面接口对所述呈现数据进行页面呈现。The rendered data is page rendered based on the wrapped interface interface.
  6. 根据权利要求5所述的页面逻辑控制方法,其特征在于,在通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装之前,所述方法还包括:The page logic control method according to claim 5, wherein the method further comprises: before packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, :
    响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。In response to a request to set a wrapper layer between the control layer and an interface interface of the view layer, a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
  7. 根据权利要求1所述的页面逻辑控制方法,其特征在于,所述数据层获取数据的方式包括以下至少一种:The page logic control method according to claim 1, wherein the manner in which the data layer acquires data comprises at least one of the following:
    从数据库中获取数据;Get data from the database;
    从网络层中获取数据;或Get data from the network layer; or
    从文件中获取数据。Get data from a file.
  8. 一种页面逻辑控制装置,应用于软件开发模型,所述软件开发模型包括数据层、控制层以及视图层,其特征在于,所述装置包括:A page logic control device is applied to a software development model, the software development model comprising a data layer, a control layer and a view layer, wherein the device comprises:
    获取模块,配置成通过所述数据层获取数据;An obtaining module configured to acquire data through the data layer;
    转换模块,配置成通过所述数据层将获取的数据通过所述数据层与所述控制层之间的接口协议转换为预设格式数据后传送给所述控制层;The conversion module is configured to convert the acquired data to the preset format data through an interface protocol between the data layer and the control layer, and then transmit the data to the control layer;
    解析模块,配置成通过所述控制层对所述预设格式数据进行解析,得到与所述预设格式数据对应的呈现数据;The parsing module is configured to parse the preset format data by using the control layer to obtain presentation data corresponding to the preset format data;
    查找模块,配置成通过所述控制层基于所述呈现数据从所述控制层与所述视图层的至少一个界面接口中查找用于显示所述呈现数据的界面接口,并通过查找到的界面接口将对应的呈现数据传送至所述视图层,其中,每一界面接口对应一类呈现逻辑;a search module configured to search, by the control layer, an interface interface for displaying the presentation data from the control layer and at least one interface interface of the view layer based on the presentation data, and by using the found interface interface Transmitting corresponding presentation data to the view layer, wherein each interface interface corresponds to a type of presentation logic;
    呈现模块,配置成通过所述视图层根据查找到的界面接口对所述呈现数据进行页面呈现。And a presentation module configured to perform page presentation on the presentation data according to the found interface interface by using the view layer.
  9. 根据权利要求8所述的页面逻辑控制装置,其特征在于,所述转换模块包括:The page logic control device according to claim 8, wherein the conversion module comprises:
    协议获取子模块,配置成获取所述数据层和所述控制层之间的预设接口协议,其中,所述预设接口协议中包括有格式转换函数;The protocol acquisition sub-module is configured to acquire a preset interface protocol between the data layer and the control layer, where the preset interface protocol includes a format conversion function;
    转换子模块,配置成采用所述预设接口协议中的格式转换函数对所述获取的数据的格式进行转换;The conversion submodule is configured to convert the format of the acquired data by using a format conversion function in the preset interface protocol;
    生成子模块,配置成在所述获取的数据的格式转换成功后,生成一预设格式的字 符串。Generating a submodule, configured to generate a word in a preset format after the format conversion of the acquired data is successful String.
  10. 根据权利要求8所述的页面逻辑控制装置,其特征在于,所述装置还包括:The page logic control device according to claim 8, wherein the device further comprises:
    创建模块,配置成创建所述数据层和所述控制层之间的预设接口协议;Creating a module, configured to create a preset interface protocol between the data layer and the control layer;
    所述创建模块被进一步配置成:The creation module is further configured to:
    响应创建所述数据层和所述控制层之间的预设接口协议的请求,创建所述预设接口协议,其中,所述预设接口协议用于实现所述数据层和所述控制层之间的通信。Creating the preset interface protocol in response to a request to create a preset interface protocol between the data layer and the control layer, wherein the preset interface protocol is used to implement the data layer and the control layer Communication between.
  11. 根据权利要求8所述的页面逻辑控制装置,其特征在于,所述查找模块包括:The page logic control device according to claim 8, wherein the searching module comprises:
    逻辑获取子模块,配置成获取所述呈现数据需要呈现的至少一个呈现逻辑;a logic acquisition submodule configured to acquire at least one rendering logic that the rendering data needs to be presented;
    接口获取子模块,配置成根据每个呈现逻辑获取每个呈现逻辑对应的视图层的界面接口。The interface acquires a sub-module configured to acquire an interface interface of a view layer corresponding to each presentation logic according to each rendering logic.
  12. 根据权利要求8所述的页面逻辑控制装置,其特征在于,所述呈现模块被进一步配置成:The page logic control apparatus according to claim 8, wherein the presentation module is further configured to:
    通过所述控制层与所述视图层的每个接口之间的包装层对所述界面接口进行包装,其中包装后的所述界面接口形成弱引用层,使运行所述软件开发模型的计算机设备在当所述视图层存在内存泄露时,将泄露的内存进行回收;Packaging the interface interface by a packaging layer between the control layer and each interface of the view layer, wherein the packaged interface interface forms a weak reference layer to enable a computer device running the software development model Leaking the leaked memory when there is a memory leak in the view layer;
    基于包装后的界面接口对所述呈现数据进行页面呈现。The rendered data is page rendered based on the wrapped interface interface.
  13. 根据权利要求12所述的页面逻辑控制装置,其特征在于,所述创建模块还被进一步配置成:The page logic control apparatus according to claim 12, wherein the creation module is further configured to:
    响应在所述控制层与所述视图层的界面接口之间设置包装层的请求,根据所述请求在所述所述控制层与所述视图层的界面接口之间创建一包装层。In response to a request to set a wrapper layer between the control layer and an interface interface of the view layer, a wrapper layer is created between the control layer and an interface interface of the view layer in accordance with the request.
  14. 根据权利要求8所述的页面逻辑控制装置,其特征在于,所述数据层获取数据的方式包括以下至少一种:The page logic control apparatus according to claim 8, wherein the manner in which the data layer acquires data comprises at least one of the following:
    从数据库中获取数据;Get data from the database;
    从网络层中获取数据;或Get data from the network layer; or
    从文件中获取数据。Get data from a file.
  15. 一种计算机设备,包括处理器及存储有若干计算机指令的非易失性存储器,其特征在于,所述计算机指令被所述处理器执行时,所述计算机设备执行权利要求1-7中任意一项所述的页面逻辑控制方法。A computer device comprising a processor and a non-volatile memory storing a plurality of computer instructions, wherein the computer device performs any one of claims 1-7 when the computer instructions are executed by the processor The page logic control method described in the item.
  16. 一种可读存储介质,所述可读存储介质包括计算机程序,其特征在于:A readable storage medium, the readable storage medium comprising a computer program, characterized by:
    所述计算机程序运行时控制所述可读存储介质所在电子设备执行权利要求1-7中任意一项所述的页面逻辑控制方法。 The computer program controlling the electronic device in which the readable storage medium is located to execute the page logic control method according to any one of claims 1-7.
PCT/CN2017/112953 2017-05-09 2017-11-24 Page logic control method and apparatus, computer apparatus and readable storage medium WO2018205557A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710322684.0A CN107145357B (en) 2017-05-09 2017-05-09 Page logic control method and device
CN201710322684.0 2017-05-09

Publications (1)

Publication Number Publication Date
WO2018205557A1 true WO2018205557A1 (en) 2018-11-15

Family

ID=59778652

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112953 WO2018205557A1 (en) 2017-05-09 2017-11-24 Page logic control method and apparatus, computer apparatus and readable storage medium

Country Status (2)

Country Link
CN (1) CN107145357B (en)
WO (1) WO2018205557A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145357B (en) * 2017-05-09 2019-04-05 武汉斗鱼网络科技有限公司 Page logic control method and device
CN110096279A (en) * 2019-05-08 2019-08-06 湖南快乐阳光互动娱乐传媒有限公司 A kind of user interface design system and method
CN112364281A (en) * 2020-10-30 2021-02-12 深圳点猫科技有限公司 Browser-based webpage editing visualization implementation method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114999A1 (en) * 2008-10-31 2010-05-06 International Business Machines Corporation Method and System to Space-Efficiently Track Memory Access of Object-Oriented Language in Presence of Garbage Collection
CN102253854A (en) * 2011-07-26 2011-11-23 华为技术有限公司 Transaction processing method and Java virtual machine
CN102681759A (en) * 2010-12-17 2012-09-19 微软公司 Staggered animation scheduling
CN104702696A (en) * 2015-03-23 2015-06-10 北京合生共济投资咨询有限责任公司 Cross-platform instant data interaction method, device and system
CN107145357A (en) * 2017-05-09 2017-09-08 武汉斗鱼网络科技有限公司 page logic control method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102364459B (en) * 2011-06-28 2015-10-07 广州市动景计算机科技有限公司 Based on Webpage Flash animation display method and the device of mobile terminal
CN102722372B (en) * 2012-05-25 2015-04-22 上海学智科技有限公司 Method and system for automatically generating codes through classification and configuration
US20140143763A1 (en) * 2012-10-29 2014-05-22 Harsh Bhargava Method and System to develop operating system agnostic software applications for mobile devices using a virtual machine
CN104519410A (en) * 2014-11-25 2015-04-15 四川长虹电器股份有限公司 Method and system for dynamically displaying intelligent terminal user interface
CN104731589A (en) * 2015-03-12 2015-06-24 用友网络科技股份有限公司 Automatic generation method and device of user interface (UI)

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114999A1 (en) * 2008-10-31 2010-05-06 International Business Machines Corporation Method and System to Space-Efficiently Track Memory Access of Object-Oriented Language in Presence of Garbage Collection
CN102681759A (en) * 2010-12-17 2012-09-19 微软公司 Staggered animation scheduling
CN102253854A (en) * 2011-07-26 2011-11-23 华为技术有限公司 Transaction processing method and Java virtual machine
CN104702696A (en) * 2015-03-23 2015-06-10 北京合生共济投资咨询有限责任公司 Cross-platform instant data interaction method, device and system
CN107145357A (en) * 2017-05-09 2017-09-08 武汉斗鱼网络科技有限公司 page logic control method and device

Also Published As

Publication number Publication date
CN107145357B (en) 2019-04-05
CN107145357A (en) 2017-09-08

Similar Documents

Publication Publication Date Title
US20170235435A1 (en) Electronic device and method of application data display therefor
EP2866420B1 (en) Method and device for content synchronization
US8775844B1 (en) Dynamic information adaptation for a computing device having multiple power modes
TWI604368B (en) Data processing method and device
WO2018205557A1 (en) Page logic control method and apparatus, computer apparatus and readable storage medium
KR20150047451A (en) Method, apparatus and terminal device for displaying messages
CN103544059B (en) The realization method and system of pending buffer effect during a kind of application switching
US10796087B2 (en) Method and apparatus for obtaining web content
WO2018196588A1 (en) Information sharing method, apparatus and system
WO2022252882A1 (en) Anti-hijacking method and apparatus for browser webpage, and electronic device and storage medium
US20210266280A1 (en) Audio message processing method and apparatus
WO2015003636A1 (en) Method and device for interception of page elements
CN106156097B (en) Method and device for processing browser input records
US20180253155A1 (en) Private access to human interface devices
WO2017186177A1 (en) Resource numerical value transfer request generating method, device and system, and storage medium
CN113613064A (en) Video processing method, device, storage medium and terminal
CN110430022A (en) Data transmission method and device
GB2507552A (en) Improving local context search results
US11228537B2 (en) Resource processing method and system, storage medium and electronic device
KR20220091441A (en) Data synchronization method and device, electronic device, storage media, and computer program
CN110020338B (en) Browser and webpage opening method and device
CN113656198A (en) Copying and pasting method and device from client to cloud mobile phone
WO2017211260A1 (en) Data access method and related device
WO2019196831A1 (en) Copy-paste method and mobile terminal
WO2019228283A1 (en) Split screen display method and apparatus used for terminal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17909343

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17909343

Country of ref document: EP

Kind code of ref document: A1