Front-end value acquisition method, device, computer-readable storage medium and terminal

Through the method of front-end recursive processing of multi-level data, the problems of code duplication and excessive server load in multi-level data acquisition in the existing technology are solved, and more efficient data acquisition and resource utilization are achieved.

CN109377385BInactive Publication Date: 2024-09-13CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201811020701.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-09-03
Publication Date
2024-09-13
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the existing technology processes multi-level data, the code is highly repetitive, the server background load is too large, and the smart terminal hardware resources cannot be effectively utilized, resulting in a waste of resources.

Method used

Through the front-end value acquisition method, it responds to the operation instructions to request data from the server, receives and recursively processes the source data to obtain the target level value. If the target level does not exist, feedback reminder parameters and sends error messages to the server, simplifying the adaptation work of the server background.

Benefits of technology

It reduces the logic complexity and load of the server backend, releases server resources, and improves the data acquisition efficiency of the front-end and the resource utilization of smart terminals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109377385B
    Figure CN109377385B
Patent Text Reader

Abstract

The present invention relates to the field of data processing, and specifically to a front-end value-taking method, device, computer-readable storage medium and terminal, the method comprising: in response to an operation instruction of a front-end, requesting the server back-end for the data required by the front-end corresponding to the operation instruction; receiving source data returned by the server back-end, the source data comprising multiple level names and corresponding level values; determining the target level name of the data required by the front-end according to the operation instruction, searching the target level name from the source data using recursive processing, obtaining the level value corresponding to the target level name from the source data; applying the level value corresponding to the target level name to the operation of the front-end. The present invention can utilize the hardware configuration of the front-end to efficiently take values ​​from source data with multiple levels, thereby obtaining the data required by the front-end and relieving the pressure of the server back-end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a front-end value acquisition method, device, computer-readable storage medium and terminal. Background Art

[0002] With the continuous development of Internet technology and smart terminal hardware, the tasks that smart terminal hardware devices can complete are increasing and their complexity is also increasing. In some usage scenarios, it is necessary to obtain specified data from a large amount of data, such as the value of multi-level data. The current value-taking methods are mostly executed by the server background, and the multi-level data are valued through logical operations. This method has high code repetitiveness, and if a certain level does not exist during execution, the code will directly report an error and cannot continue to execute. At the same time, the server background needs to adapt to the data required by different front ends, resulting in a large amount of code redundancy and excessive load on the server background. The server background needs to have a higher hardware configuration, and at the same time, it is impossible to use the increasingly powerful hardware configuration of smart terminals, resulting in a waste of terminal resources. Summary of the invention

[0003] In order to overcome the above technical problems, especially the problem that the existing technology cannot efficiently extract values ​​from multi-level data, the following technical solutions are proposed:

[0004] In a first aspect, the present invention provides a front-end value acquisition method, comprising:

[0005] In response to the operation instruction of the front end, request the server back end for the data required by the front end corresponding to the operation instruction;

[0006] Receive source data returned by the server backend, wherein the source data includes multiple level names and corresponding level values;

[0007] Determine the target level name of the data required by the front end according to the operation instruction, use recursive processing to find the target level name from the source data, and obtain the level value corresponding to the target level name from the source data;

[0008] The level value corresponding to the target level name is applied to the operation of the front end.

[0009] Further, after searching the target level name from the source data using recursive processing, the method further includes:

[0010] If the target level name cannot be found in the source data, a preset reminder parameter is fed back to the front end, so that the front end outputs corresponding prompt information after receiving the reminder parameter.

[0011] Furthermore, after feeding back a preset reminder parameter to the front end if the target level name cannot be found in the source data, the method further includes:

[0012] When the front end receives the reminder parameter, it sends an error message to the server back end, so that the server back end processes the data required by the front end and feeds it back to the front end.

[0013] Further, after receiving the reminder parameter, the current end sends an error message to the server backend, so that the server backend processes the data required by the front end and feeds it back to the front end, including:

[0014] When the front end receives the reminder parameter, it sends an error message carrying the operation instruction and the target level name to the server back end; the server back end searches whether the target level name is included in the source data; if the target level name cannot be found, the default level value of the operation instruction is fed back to the front end; if the target level name is found, the level value corresponding to the target level name is obtained, and the level value of the target level name is fed back to the front end.

[0015] Optionally, the source data includes an array, an object, or a combination of an array and an object; and determining the target level name corresponding to the data required by the front end according to the operation instruction includes:

[0016] If the source data includes an array, the array subscript of the data required by the front end is determined according to the operation instruction, and the target level name is determined according to the array subscript.

[0017] Further, after applying the level value corresponding to the target level name to the operation of the front end, the method further includes:

[0018] Determine whether the front end has an exception, and if so, send an error message of data application exception to the server back end.

[0019] In a second aspect, the present invention provides a front-end value acquisition device, comprising:

[0020] Response module: used to respond to the operation instruction of the front end and request the data required by the front end corresponding to the operation instruction from the server backend;

[0021] Receiving module: used to receive source data returned by the server background, wherein the source data includes multiple level names and corresponding level values;

[0022] A value acquisition module: used to determine the target level name of the data required by the front end according to the operation instruction, use recursive processing to find the target level name from the source data, and obtain the level value corresponding to the target level name from the source data;

[0023] Application module: used to apply the level value corresponding to the target level name to the operation of the front end.

[0024] Furthermore, the value obtaining module further includes executing:

[0025] If the target level name cannot be found in the source data, a preset reminder parameter is fed back to the front end, so that the front end outputs corresponding prompt information after receiving the reminder parameter.

[0026] In a third aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned front-end value acquisition method is implemented.

[0027] In a fourth aspect, the present invention also provides a terminal, comprising one or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned front-end value acquisition method.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] The present invention provides a method for obtaining values ​​of source data with complex hierarchies at the front end, by requesting source data from a server background in response to an operation instruction of the front end, then receiving the source data returned by the server background and containing multiple hierarchical names and corresponding hierarchical values, and then determining the target hierarchical name corresponding to the data required by the front end according to the code logic for obtaining hierarchical values ​​from the source data defined at the front end according to the operation instruction, and then using recursive processing to obtain the hierarchical value corresponding to the target hierarchical name in the source data, the server background does not need to adapt to the format of the source data required by different front ends, after the server background returns the basic source data to the front end, the front end selects the hierarchical value corresponding to the required target hierarchical name by itself, and the server background does not need to perform excessive adaptation work on the data required by the front end, thereby simplifying the logic of the server background returning the data required by the front end, making the server background easy to develop and maintain, and relieving the pressure of the server background.

[0030] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0032] Figure 1 A schematic diagram of a flow chart of an embodiment of a front-end value acquisition method of the present invention;

[0033] Figure 2 This is a flow chart of another embodiment of the front-end value acquisition method of the present invention;

[0034] Figure 3 A schematic diagram of an embodiment of a front-end value acquisition device of the present invention;

[0035] Figure 4 It is a schematic diagram of the structure of an embodiment of a terminal of the present invention. DETAILED DESCRIPTION

[0036] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0037] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, but does not exclude the presence or addition of one or more other features, integers, steps, operations.

[0038] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.

[0039] Those skilled in the art should understand that the concepts of "application", "application program", "computer program" and similar expressions referred to in the present invention are the same concepts known to those skilled in the art, and refer to computer software suitable for electronic operation that is organically constructed by a series of computer instructions and related data resources. Unless otherwise specified, such naming itself is not limited by the type and level of programming language, nor by the operating system or platform on which it runs. Of course, such concepts are not limited by any form of terminal.

[0040] The embodiment of the present invention provides a front-end value acquisition method, such as Figure 1 As shown, the method comprises the following steps:

[0041] S10: In response to the operation instruction of the front end, request the server back end for the data required by the front end corresponding to the operation instruction.

[0042] In this embodiment, the front end can be an application front end or an HTML web page front end. The front end cooperates with the server back end to display or apply the data fed back by the server back end on the front end. This embodiment is preferably explained using the application front end as an example. After the front end performs a specific operation, the corresponding operation instruction is triggered, and then the data required by the front end corresponding to the operation instruction is requested from the server back end. The operation instruction instructions include update operation instructions, display operation instructions, query operation instructions, etc. For example, in the Ping An Financial Manager application, when the user enters the details page of a certain insurance product, the detailed information of the insurance product needs to be displayed on the front end for the user to browse. At this time, the application responds to the query operation instruction of the front end and requests the data required by the front end, that is, the detailed data of the insurance product, from the server back end.

[0043] S20: receiving source data returned by the server backend, wherein the source data includes multiple level names and corresponding level values.

[0044] In this embodiment, in order to reduce the computing pressure of the server backend and reduce the logical complexity of the server backend, the server backend does not simplify the source data requested by the front end under non-specified circumstances, and directly returns the unified source data corresponding to the specific functional module of the front end to the front end. At this time, the source data hierarchy returned by the server backend is relatively complex. The source data includes multiple data levels, each data level has a corresponding level name, and each data level has a corresponding level value. For example, a source data (object) is x={a:{b:[{c:1},{d:2}]}}, which includes four data levels a, b, c, and d. a, b, c, and d are also the level names of the data levels, and also include the level values ​​corresponding to each data level. The four levels included in the source data are all data levels that may be used by the front end. For example, the front end is a display page for insurance products, which includes multiple insurance products such as S1, S2, and S3. The server backend places the data required for each insurance product in different levels of the same source data. When the data of a certain insurance product is needed, the data required for the insurance product is obtained from the received source data. The specific process is explained below.

[0045] S30: determining the target level name of the data required by the front end according to the operation instruction, searching the target level name from the source data using recursive processing, and obtaining the level value corresponding to the target level name from the source data.

[0046] After receiving the source data returned by the server backend, the front end determines the target level name of the required data according to the operation instruction, that is, determines the level name corresponding to the required data in the source data. For example, the operation instruction of the front end is to query and display the detailed information of insurance product S1, and the target level name corresponding to the data required by the operation instruction is a; the operation instruction of the front end is to query and display the detailed information of insurance product S2, and the target level name corresponding to the data required by the operation instruction is b; then the front end uses recursive processing to obtain the level value corresponding to the target level name from the source data according to the target level name. For example, the received source data (object) is x= {a:{b:[{c:1},{d:2}]}}, the front end determines that the target level name of the required data is d according to the operation instruction, that is, the front end only needs to obtain the level value of the data level name d. At this time, recursive processing is used. After determining the source data x and the target level name d, in a loop function, the level name is searched, such as safeProp(x,'a','b',0,'d') to find the level value corresponding to the level name d in the source data x. The loop function performs recursive processing until the last level name passed in is the target level name. At this time, the level value corresponding to the level name is found in the source data, and then the level value can be obtained.

[0047] S40: Apply the level value corresponding to the target level name to the operation of the front end.

[0048] After obtaining the level value corresponding to the target level name from the source data, the level value of the target level name is applied to the operation of the front end. For example, the level value of the target level name a corresponding to the data required for the insurance product S1 is obtained in the source data, and then the level value of the target level name is applied to the front end to display the detailed information of the insurance product S1 on the front end.

[0049] The front-end value-taking method of this embodiment is developed based on the JavaScript language and is implemented on the front-end of a computer program. When a user performs an operation on the front-end and needs to obtain new data or update the front-end page, the source data is requested from the server back-end and processed on the front-end. The front-end defines the logic for obtaining the required hierarchical values ​​using JavaScript, and there is no need to perform excessive adaptation work on the data required by the front-end on the server back-end, thereby simplifying the logic of the server back-end returning the data required by the front-end, making the server back-end easy to develop and maintain, and relieving the pressure on the server back-end.

[0050] The present embodiment provides a method for obtaining values ​​of source data with complex hierarchies at the front end, by requesting source data from the server back end in response to the operation instruction of the front end, and then receiving the source data returned by the server back end containing multiple hierarchical names and corresponding hierarchical values, and then determining the target hierarchical name corresponding to the data required by the front end according to the operation instruction through the code logic defined at the front end, and then using recursive processing to obtain the hierarchical value corresponding to the target hierarchical name in the source data, the server back end does not need to adapt to the format of the source data required by different front ends. After the server back end returns the basic source data to the front end, the front end selects the hierarchical value corresponding to the required target hierarchical name by itself, and the server back end does not need to perform excessive adaptation work on the data required by the front end, thereby simplifying the logic of the server back end returning the data required by the front end, making the server back end easy to develop and maintain, and relieving the pressure on the server back end.

[0051] An embodiment of the present invention, as Figure 2 As shown, after searching the target level name from the source data using recursive processing, the method further includes:

[0052] S31: If the target level name cannot be found in the source data, a preset reminder parameter is fed back to the front end, so that the front end outputs corresponding prompt information after receiving the reminder parameter.

[0053] In this embodiment, since errors will inevitably occur in computer programs, causing the program to be unable to complete the specified operation normally, considering this situation, when the target level name required by the front end cannot be found in the source data, the preset reminder parameter is fed back to the front end, for example, the preset reminder parameter undefined is fed back to the front end. After the front end receives the reminder parameter undefined, it triggers the subsequent reminder logic and outputs the corresponding prompt information, such as outputting the prompt information "Please refresh again" after triggering the reminder logic, reminding the user to refresh the page again to re-acquire the source data. Further, in this embodiment, different reminder parameters are fed back to the front end according to different error types, and then different prompt information is displayed on the front end according to the different reminder parameters. In this embodiment, in the case of relatively complex source data levels, even if a certain level in the middle does not exist, or the name of the target level passed in is incorrect, the program code will not report an error, but return the preset reminder parameter to the front end for this situation. After the front end receives the reminder parameter, it solves the error problem.

[0054] In an embodiment of the present invention, after feeding back a preset reminder parameter to the front end if the target level name cannot be found in the source data, the method further includes:

[0055] When the front end receives the reminder parameter, it sends an error message to the server back end, so that the server back end processes the data required by the front end and feeds it back to the front end.

[0056] In this embodiment, after the front end receives the preset reminder parameters, it knows that an error has occurred in this operation, and reports the error information to the server backend. After receiving the error report, the server backend processes the data required by the front end in the server backend, and no longer returns the source data with complex hierarchies to the front end. Instead, it directly feeds back the data required by the front end. When the front end receives the processed data fed back by the server backend, it can directly apply it to the front end operation without the need to process the level value according to the target level name, thereby avoiding the front end being unable to obtain the required level value and causing a poor experience for users.

[0057] In one embodiment of the present invention, after receiving the reminder parameter, the current end sends an error message to the server backend so that the server backend processes the data required by the front end and feeds it back to the front end, including:

[0058] When the front end receives the reminder parameter, it sends an error message carrying the operation instruction and the target level name to the server back end; the server back end searches whether the target level name is included in the source data; if the target level name cannot be found, the default level value of the operation instruction is fed back to the front end; if the target level name is found, the level value corresponding to the target level name is obtained, and the level value of the target level name is fed back to the front end.

[0059] In this embodiment, after the front end receives the preset reminder parameters, it sends an error message carrying the current erroneous operation instruction and the target level name to the server backend. After the server backend receives the error message, it can directly search from the source data whether it contains the target level name and the corresponding level value. If the target level name cannot be found, the default level value of the operation instruction is fed back to the front end instead of the information that the level value cannot be found. If the target level name can be found, the level value corresponding to the target level name is obtained, and then the level value is fed back to the front end.

[0060] Furthermore, the server backend may adjust the rules for generating source data according to the error message, so that the front end can determine the target level name and the corresponding level value according to the operation instruction.

[0061] In one embodiment of the present invention, the source data includes an array, an object, or a combination of an array and an object; and determining the target level name corresponding to the data required by the front end according to the operation instruction includes:

[0062] If the source data includes an array, the array subscript of the data required by the front end is determined according to the operation instruction, and the target level name is determined according to the array subscript.

[0063] In this embodiment, the data set can be represented by an array or an object. For example, the source data can be represented by an array a=[1,2,3,4], or by an object a={0:1,1:2,2:3,3:4}. The source data can be better represented by an array representation to represent the order of the data set, while the object representation is a collection of unordered data. In this embodiment, if the source data includes an array, the array subscript of the data required by the front end, such as a[1], is determined according to the operation instruction, and then the target level name is determined according to the array subscript, and then the corresponding level value is obtained through the target level name.

[0064] An embodiment of the present invention, after applying the level value corresponding to the target level name to the operation of the front end, includes:

[0065] Determine whether an exception occurs in the front end, and if so, send an error message of data application exception to the server backend.

[0066] After the front end obtains the required data, that is, applies the level value corresponding to the target level name to the operation of the front end, the front end may still not be able to use the level value. For example, the level value has been incorrectly configured in the server backend. When it is transmitted to the front end, the front end uses the incorrectly configured level value and still cannot complete the front end operation normally. At this time, it is determined whether the front end sends an exception. If so, an error message of data application exception is sent to the server backend. Different from the error message of not finding the target level name mentioned above, the error message of this embodiment is an error message of data application exception. Through this error message, the cause of the rough data exception can be found from the source, so that the front end can work more stably.

[0067] like Figure 3 As shown, in another embodiment, the present invention provides a front-end value acquisition device, comprising:

[0068] Response module 10: used to respond to the operation instruction of the front end and request the data required by the front end corresponding to the operation instruction from the server backend;

[0069] Receiving module 20: used to receive source data returned by the server backend, wherein the source data includes multiple level names and corresponding level values;

[0070] The value obtaining module 30 is used to determine the target level name of the data required by the front end according to the operation instruction, use recursive processing to find the target level name from the source data, and obtain the level value corresponding to the target level name from the source data;

[0071] Application module 40: used for applying the level value corresponding to the target level name to the operation of the front end.

[0072] In one embodiment of the present invention, the value obtaining module 30 further includes executing:

[0073] If the target level name cannot be found in the source data, a preset reminder parameter is fed back to the front end, so that the front end outputs corresponding prompt information after receiving the reminder parameter.

[0074] In an embodiment of the present invention, after feeding back a preset reminder parameter to the front end if the target level name cannot be found in the source data, the method further includes:

[0075] When the front end receives the reminder parameter, it sends an error message to the server back end, so that the server back end processes the data required by the front end and feeds it back to the front end.

[0076] In one embodiment of the present invention, after receiving the reminder parameter, the current end sends an error message to the server backend so that the server backend processes the data required by the front end and feeds it back to the front end, including:

[0077] When the front end receives the reminder parameter, it sends an error message carrying the operation instruction and the target level name to the server back end; the server back end searches whether the target level name is included in the source data; if the target level name cannot be found, the default level value of the operation instruction is fed back to the front end; if the target level name is found, the level value corresponding to the target level name is obtained, and the level value of the target level name is fed back to the front end.

[0078] In one embodiment of the present invention, the source data includes an array, an object, or a combination of an array and an object; the value obtaining module 30 determines the target level name corresponding to the data required by the front end according to the operation instruction, including:

[0079] If the source data includes an array, the array subscript of the data required by the front end is determined according to the operation instruction, and the target level name is determined according to the array subscript.

[0080] In another embodiment, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the front-end value acquisition method described in the above embodiment is implemented. Wherein, the computer-readable storage medium includes but is not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (EraSable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the storage device includes any medium that can store or transmit information in a readable form by a device (for example, a computer, a mobile phone), which can be a read-only memory, a disk or an optical disk, etc.

[0081] A computer-readable storage medium provided by an embodiment of the present invention can be implemented to respond to an operation instruction of the front end, request the server background for the data required by the front end corresponding to the operation instruction; receive source data returned by the server background, the source data including multiple level names and corresponding level values; determine the target level name of the data required by the front end according to the operation instruction, use recursive processing to search the target level name from the source data, and obtain the level value corresponding to the target level name from the source data; and apply the level value corresponding to the target level name to the operation of the front end. By providing a method for obtaining the value of source data with complex hierarchies on the front end, the source data is requested from the server back end in response to the operation instruction of the front end, and then the source data containing multiple hierarchical names and corresponding hierarchical values ​​returned by the server back end is received, and then the target hierarchical name corresponding to the data required by the front end is determined according to the operation instruction through the code logic for obtaining the hierarchical value from the source data defined on the front end, and then the hierarchical value corresponding to the target hierarchical name in the source data is obtained by recursive processing. The server back end does not need to adapt to the format of the source data required by different front ends. After the server back end returns the basic source data to the front end, the front end selects the hierarchical value corresponding to the required target hierarchical name by itself. The server back end does not need to perform excessive adaptation work on the data required by the front end, thereby simplifying the logic of the server back end returning the data required by the front end, making the server back end easy to develop and maintain, and relieving the pressure on the server back end.

[0082] The computer-readable storage medium provided in the embodiment of the present invention can implement the embodiment of the above-mentioned front-end value acquisition method. For specific function implementation, please refer to the description in the method embodiment, which will not be repeated here.

[0083] In addition, in another embodiment, the present invention also provides a terminal, such as Figure 4 As shown, the terminal includes a processor 403, a memory 405, an input unit 407, a display unit 409 and other devices. Those skilled in the art can understand that Figure 4 The structural devices shown do not constitute a limitation on all terminals, and may include more or fewer components than shown, or combine certain components. The memory 405 can be used to store the computer program 401 and various functional modules, and the processor 403 runs the computer program 401 stored in the memory 405, thereby executing various functional applications and data processing of the device. The memory 405 can be an internal memory or an external memory, or include both internal and external memories. The internal memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, or a random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a U disk, a magnetic tape, etc. The memory disclosed in the present invention includes but is not limited to these types of memories. The memory 405 disclosed in the present invention is only used as an example and not as a limitation.

[0084] The input unit 407 is used to receive input signals and user input. The input unit 407 may include a touch panel and other input devices. The touch panel can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel), and drive the corresponding connection device according to a pre-set program; other input devices may include but are not limited to one or more of a physical keyboard, function keys (such as playback control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc. The display unit 409 can be used to display information input by the user or information provided to the user and various menus of the computer device. The display unit 409 can be in the form of a liquid crystal display, an organic light emitting diode, etc. The processor 403 is the control center of the computer device, which uses various interfaces and lines to connect various parts of the entire computer, and executes various functions and processes data by running or executing software programs and / or modules stored in the memory 403, and calling data stored in the memory.

[0085] In one embodiment, the terminal includes one or more processors 403, one or more memories 405, and one or more computer programs 401, wherein the one or more computer programs 401 are stored in the memory 405 and are configured to be executed by the one or more processors 403, and the one or more computer programs 401 are configured to execute the front-end value acquisition method described in the above embodiment. Figure 4The one or more processors 403 shown in FIG. 4 are capable of executing, implementing Figure 3 The functions of the response module 10, the receiving module 20, the value obtaining module 30 and the application module 40 are shown in FIG.

[0086] A terminal provided by an embodiment of the present invention can respond to an operation instruction of the front end and request the server background for the data required by the front end corresponding to the operation instruction; receive source data returned by the server background, the source data including multiple level names and corresponding level values; determine the target level name of the data required by the front end according to the operation instruction, use recursive processing to search the target level name from the source data, and obtain the level value corresponding to the target level name from the source data; and apply the level value corresponding to the target level name to the operation of the front end. By providing a method for obtaining the value of source data with complex hierarchies on the front end, the source data is requested from the server back end in response to the operation instruction of the front end, and then the source data containing multiple hierarchical names and corresponding hierarchical values ​​returned by the server back end is received, and then the target hierarchical name corresponding to the data required by the front end is determined according to the operation instruction through the code logic for obtaining the hierarchical value from the source data defined on the front end, and then the hierarchical value corresponding to the target hierarchical name in the source data is obtained by recursive processing. The server back end does not need to adapt to the format of the source data required by different front ends. After the server back end returns the basic source data to the front end, the front end selects the hierarchical value corresponding to the required target hierarchical name by itself. The server back end does not need to perform excessive adaptation work on the data required by the front end, thereby simplifying the logic of the server back end returning the data required by the front end, making the server back end easy to develop and maintain, and relieving the pressure on the server back end.

[0087] The terminal provided in the embodiment of the present invention can implement the embodiment of the front-end value acquisition method provided above. For specific function implementation, please refer to the description in the method embodiment, which will not be repeated here.

[0088] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A front-end value acquisition method, characterized in that: include: In response to the operation instruction of the front end, request the server back end for the data required by the front end corresponding to the operation instruction; Receive source data returned by the server backend, wherein the source data includes multiple level names and corresponding level values; the source data includes an array, an object, or a combination of an array and an object; If the source data includes an array, determine the array subscript of the data required by the front end according to the operation instruction, determine the target level name according to the array subscript, use recursive processing to find the target level name from the source data, and obtain the level value corresponding to the target level name from the source data; If the target level name cannot be found in the source data, a preset reminder parameter is fed back to the front end, so that the front end outputs corresponding prompt information after receiving the reminder parameter; When the front end receives the reminder parameter, it sends an error message carrying the operation instruction and the target level name to the server back end; The server backend searches the source data to see whether it contains the target level name; if the target level name cannot be found, the default level value of the operation instruction is fed back to the front end; if the target level name is found, the level value corresponding to the target level name is obtained, and the level value of the target level name is fed back to the front end; The level value corresponding to the target level name is applied to the operation of the front end.

2. The method according to claim 1, characterized in that After the level value corresponding to the target level name is applied to the operation of the front end, the method further comprises: Determine whether an exception occurs in the front end, and if so, send an error message of data application exception to the server backend.

3. A front-end value acquisition device, characterized in that: include: Response module: used to respond to the operation instruction of the front end and request the data required by the front end corresponding to the operation instruction from the server backend; Receiving module: used to receive source data returned by the server background, wherein the source data includes multiple level names and corresponding level values; the source data includes arrays, objects or a combination of arrays and objects; A value acquisition module: used for determining the array subscript of the data required by the front end according to the operation instruction if the source data includes an array, determining the target level name according to the array subscript, searching the target level name from the source data using recursive processing, and obtaining the level value corresponding to the target level name from the source data; The value obtaining module is further used to feed back a preset reminder parameter to the front end if the target level name cannot be found in the source data, so that the front end outputs corresponding prompt information after receiving the reminder parameter; The value-taking module is also used for sending an error message carrying an operation instruction and a target level name to a server backend after the front end receives the reminder parameter; the server backend searches the source data to see whether the target level name is included; if the target level name cannot be found, the default level value of the operation instruction is fed back to the front end; if the target level name is found, the level value corresponding to the target level name is obtained, and the level value of the target level name is fed back to the front end; Application module: used to apply the level value corresponding to the target level name to the operation of the front end.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the front-end value acquisition method described in any one of claims 1 to 2.

5. A terminal, characterized in that: include: one or more processors; Memory; One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more computer programs are configured to execute the front-end value acquisition method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Information display method and device, and user terminal

    CN106603684A

  • Hierarchical user interface query automation

    US20050246326A1