CN111459484B - Method for simulating back-end data during separate development of front end and back end of webpage - Google Patents

Method for simulating back-end data during separate development of front end and back end of webpage Download PDF

Info

Publication number
CN111459484B
CN111459484B CN202010238508.0A CN202010238508A CN111459484B CN 111459484 B CN111459484 B CN 111459484B CN 202010238508 A CN202010238508 A CN 202010238508A CN 111459484 B CN111459484 B CN 111459484B
Authority
CN
China
Prior art keywords
simulation
data structure
type
data
webpage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010238508.0A
Other languages
Chinese (zh)
Other versions
CN111459484A (en
Inventor
李剑欣
郑晋
张旭明
王豪迈
胥昕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xingchen Tianhe Technology Co ltd
Original Assignee
Beijing Xingchen Tianhe Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xingchen Tianhe Technology Co ltd filed Critical Beijing Xingchen Tianhe Technology Co ltd
Priority to CN202010238508.0A priority Critical patent/CN111459484B/en
Publication of CN111459484A publication Critical patent/CN111459484A/en
Application granted granted Critical
Publication of CN111459484B publication Critical patent/CN111459484B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/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/70Software maintenance or management
    • G06F8/71Version control; Configuration management

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)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method for simulating backend data during the front-end and back-end separation development of a webpage. Wherein, the method comprises the following steps: acquiring a configuration file of a webpage back end, wherein the webpage back end and the webpage front end are respectively developed; receiving a simulation request for requesting simulation data sent by a webpage front end; determining the type of a data structure of the requested simulation data according to the simulation request and the configuration file; simulation data is generated according to the type of the data structure. The invention solves the technical problem that the data simulation method in the related technology is inflexible to use because the corresponding simulation field and the related configuration are required to be added aiming at the application scene.

Description

Method for simulating back-end data during separate development of front and back ends of webpage
Technical Field
The invention relates to the field of webpage development, in particular to a method for simulating back-end data during webpage front-end and back-end separation development.
Background
Currently, web page development generally adopts a front-end and back-end separation mode to perform parallel development, at this time, a front end and back-end personnel agree on a corresponding API interface, and the front end and the back end perform development work according to agreed interface documents. The logic and presentation of the front-end page needs to rely on the interface returned by the back-end, so that the simulation data of the back-end is needed to support the development of the page logic.
The common analog data method is that the front end generally adds a mock field and corresponding configuration when sending a request, and the back end identifies the mock field and the configuration when responding to return the needed analog data, so that the back end analog data is not flexible to use.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a back-end data simulation method during the front-end and back-end separation development of a webpage, which at least solves the technical problem that the data simulation method in the related technology is inflexible to use because corresponding simulation fields and related configuration need to be added for application scenes.
According to an aspect of the embodiments of the present invention, there is provided a method for simulating backend data during front-end and back-end separation development of a web page, including: acquiring a configuration file of a webpage back end, wherein the webpage back end and the webpage front end are respectively developed; receiving a simulation request for requesting simulation data sent by a webpage front end; determining the type of a data structure of the requested simulation data according to the simulation request and the configuration file; and generating the simulation data according to the type of the data structure.
Optionally, determining the type of the data structure of the requested simulation data according to the simulation request and the configuration file includes: acquiring a corresponding data structure of the simulation data from the configuration file according to the path and the request type of the simulation request, wherein the configuration file comprises the data structures of the simulation data of a plurality of scenes; determining a type of the data structure from the data structure, wherein the type of the data structure comprises at least one of: base type, object type, array type.
Optionally, before receiving a simulation request for requesting simulation data sent by a front end of a web page, the method includes: setting a scene; acquiring simulation parameters corresponding to the scene according to the configuration file; and taking the value of the simulation parameter as a default value, wherein the configuration file comprises simulation parameters corresponding to a plurality of scenes.
Optionally, the type of the data structure is the basic type, and generating the simulation data according to the return type includes: searching whether the simulation parameter has a default value in a data structure of the basic type, wherein the data structure of the basic type comprises a plurality of simulation parameters; updating the initial values of the simulation parameters to default values to update the data structure if the simulation parameters in the data structure have the default values; and generating simulation data according to the updated data structure of the basic type.
Optionally, the type of the data structure is the object type, and generating simulation data according to the return type includes: traversing all identifiers of simulation parameters in the data structure of the object type, wherein the data structure of the object type comprises a plurality of identifiers; determining the value of the identifier corresponding to the default value according to the default value of the simulation parameter; updating the data structure of the object type according to the identified values corresponding to all the default values; and generating the simulation data according to the updated data structure of the object type.
Optionally, the type of the data structure is the array type, and generating the simulation data according to the return type includes: setting simulation parameters of the data structure of the array type as preset values, wherein the default parameters of the data structure of the array type are the array length of the data structure of the array type; determining whether simulation parameters of the data structure have the default values; under the condition that the simulation parameters of the data structure have default values, updating the preset values of the simulation parameters of the data structure to the default values so as to update the data structure; and generating the simulation data according to the updated data structure of the array type.
Optionally, after generating the simulation data according to the return type, the method includes: and returning the simulation data to the front end of the webpage.
According to another aspect of the embodiments of the present invention, there is also provided a backend data simulation apparatus when a front end and a back end of a web page are separately developed, including: the system comprises an acquisition module, a configuration module and a display module, wherein the acquisition module is used for acquiring a configuration file of a webpage back end, and the webpage back end and the webpage front end are respectively developed; the receiving module is used for receiving a simulation request which is sent by the front end of the webpage and used for requesting simulation data; a determining module, configured to determine a type of a data structure of the requested simulation data according to the simulation request and the configuration file; and the generation module is used for generating the simulation data according to the type of the data structure.
According to another aspect of the embodiments of the present invention, a storage medium is further provided, where the storage medium includes a stored program, and when the program runs, a device where the storage medium is located is controlled to execute any one of the foregoing backend data simulation methods when web page front-end and back-end separation development is performed.
According to another aspect of the embodiments of the present invention, there is also provided a processor, where the processor is configured to run a program, where the program executes the method for simulating backend data during separate development of a front end and a back end of a web page in any one of the above descriptions.
In the embodiment of the invention, a configuration file of a webpage back end is obtained, wherein the webpage back end and the webpage front end are respectively developed; receiving a simulation request for requesting simulation data sent by a webpage front end; determining the type of a data structure of the requested simulation data according to the simulation request and the configuration file; the method for generating the simulation data according to the type of the data structure achieves the purpose of acquiring the simulation data by generating the simulation data according to the configuration file and the simulation request at the rear end, thereby achieving the technical effect of improving the flexibility of acquiring the simulation data, and further solving the technical problem that the data simulation method in the related technology is inflexible to use due to the fact that corresponding simulation fields and related configuration need to be added for application scenes.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention and do not constitute a limitation of the invention. In the drawings:
FIG. 1 is a flowchart of a method for backend data simulation during separate development of a front end and a back end of a web page according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a backend simulation data configuration method according to an embodiment of the present invention;
FIG. 3 is a flow diagram of a backend simulation data acquisition method according to an embodiment of the present invention;
fig. 4 is a flowchart of a backend data simulation apparatus when the front end and the back end of the web page are separately developed according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided a method embodiment of a backend data simulation method when a web page is developed front-end and back-end separately, it is noted that the steps illustrated in the flowchart of the accompanying figures may be executed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be executed in an order different than here.
Fig. 1 is a flowchart of a method for simulating backend data during separate development of a front end and a back end of a web page according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, a configuration file of a webpage back end is obtained, wherein the webpage back end and the webpage front end are respectively developed;
step S104, receiving a simulation request for requesting simulation data sent by a webpage front end;
step S106, determining the type of the data structure of the requested simulation data according to the simulation request and the configuration file;
and step S108, generating simulation data according to the type of the data structure.
Through the steps, the configuration file of the back end of the webpage is obtained, wherein the back end of the webpage and the front end of the webpage are respectively developed; receiving a simulation request for requesting simulation data sent by a webpage front end; determining the type of a data structure of the requested simulation data according to the simulation request and the configuration file; the method for generating the simulation data according to the type of the data structure achieves the purpose of acquiring the simulation data by generating the simulation data according to the configuration file and the simulation request at the rear end, thereby achieving the technical effect of improving the flexibility of acquiring the simulation data, and further solving the technical problem that the data simulation method in the related technology is inflexible to use due to the fact that corresponding simulation fields and related configuration need to be added for application scenes.
The main execution body of the above steps may be a local server, the front end of the web page needs to simulate the back end data in the development process, the front end and the back end data are different in different scenes, for example, in a selection scene, the front end is a plurality of selected buttons, the back end data is a plurality of parallel selected buttons, and the back end generates corresponding data according to the action of the user at the front end. When a development test is performed on a front end of a webpage, data of a back end needs to be simulated, and usually, a request added with a mock simulation field and configuration is sent to the back end by the front end, and the back end generates simulated data according to the request. The front-end interfaces and the back-end interfaces of different scenes are different, and corresponding configurations need to be added to each interface of each scene, so that the problem of inflexibility in use is caused.
In the embodiment, the local server receives the simulation request according to the front end and generates the simulation data from the configuration file acquired from the back end, so that data transmission is avoided between the back end and the front end configuration interface, the purpose of simulating the back end data is achieved, the technical effect of flexibility of obtaining the simulation data is improved, and the technical problem that the data simulation method in the related technology is inflexible in use due to the fact that corresponding simulation fields and related configurations need to be added for application scenes is solved.
The local server is a server where the web page is located, the local server obtains a configuration file of a back end, the configuration file is used for the back end to configure the simulation data according to a plurality of scenes, the specific configuration file can comprise a plurality of scenes which can be used by the front end and simulation parameters of the simulation data corresponding to each scene, and the simulation parameters are used for generating the simulation data.
The type of the data structure of the simulation data is determined according to the simulation request and the configuration file, the type of the data structure includes a basic type, an object type and an array type according to different scenes, the basic type may include a string data type, a blob data type and a number data type, the object type may be an object type, and the array type may be an array type.
The simulation data is determined based on a data structure including a plurality of data items, such as names, lengths, values, etc., and for a simulation data, only fields for determining key simulation parameters according to a scene are required in a scene, such as, for example, for a specific content selected in the above-described selection scene, and whether values of the content are selected, such as 0 representing non-selection and 1 representing selection. The value of whether to select the content is a simulation parameter in the selection scenario. Whereby the simulation data may be generated based on the data structure type and the simulation parameters determined from the configuration file.
Optionally, determining the type of the data structure of the requested simulation data according to the simulation request and the configuration file includes: acquiring a corresponding data structure of simulation data from a configuration file according to the path and the request type of the simulation request, wherein the configuration file comprises the data structures of the simulation data of a plurality of scenes; determining a type of the data structure from the data structure, wherein the type of the data structure comprises at least one of: base type, object type, array type.
The simulation request is sent by a front end, the type of the request can be http, and the data structure of the simulation data corresponding to the request, including the data block of the data structure and the type of the data structure, can be determined from the configuration file according to the request path and the type of the request. The configuration file may include a data structure of simulation data of a plurality of scenes at the back end.
Optionally, before receiving a simulation request for requesting simulation data sent by a front end of a web page, the method includes: setting a scene; acquiring simulation parameters corresponding to a scene according to the configuration file; and taking the value of the simulation parameter as a default value, wherein the configuration file comprises the simulation parameters corresponding to a plurality of scenes.
The configuration file has a default value for each simulation parameter in the scene, for example, in the selection scene, all options are not selected by default, and the default value of the simulation parameter is 0. In the configuration file, the simulation parameter corresponding to the scene has a default value, which also indicates that the scene needs the simulation parameter as the default value, so as to determine the subsequent simulation data according to the default value.
Optionally, the type of the data structure is a basic type, and generating the simulation data according to the return type includes: searching whether the simulation parameters have default values in a data structure of the basic type, wherein the data structure of the basic type comprises a plurality of simulation parameters; under the condition that the simulation parameters in the data structure have default values, updating the initial values of the simulation parameters to the default values so as to update the data structure; and generating simulation data according to the updated data structure of the basic type.
The obtained parameter of the data structure of the basic type is an initial value, for example, a string type may be set as a name of a resource type, a bootean type may be set as a true type, and a number type may be set as 1, and then, whether a default value corresponding to the parameter exists is searched for in the simulation parameter, and if the default value corresponding to a scene is found for the simulation parameter, the initial value is changed to the default value, so as to achieve the purpose of modifying the data structure of the basic type according to the scene.
Optionally, the type of the data structure is an object type, and generating the simulation data according to the return type includes: traversing the identifiers of all simulation parameters in the data structure of the object type, wherein the data structure of the object type comprises a plurality of identifiers; determining the value of the identifier corresponding to the default value according to the default value of the simulation parameter; updating the data structure of the object type according to the identification values corresponding to all the default values; and generating simulation data according to the updated data structure of the object type.
And when the default value of the corresponding parameter is found, replacing the identifier of the corresponding parameter, namely the initial value, with the default value, thereby realizing the purpose of modifying the data structure of the object type according to the scene.
Optionally, the type of the data structure is an array type, and generating the simulation data according to the return type includes: setting simulation parameters of the data structure of the array type as initial values, wherein the simulation parameters of the data structure of the array type are the array length of the data structure of the array type; determining whether the simulation parameters of the data structure have default values; under the condition that the simulation parameters of the data structure have default values, updating the preset values of the simulation parameters of the data structure to the default values so as to update the data structure; and generating simulation data according to the updated data structure of the array type.
The simulation parameter of the data structure of the array type is the array length, whether the array length has a default value under the scene is determined, if the array length has the default value, the array length under the scene needs to be the default value, and the array length needs to be modified; if the default value is not available, the length of the array in the scene does not need to be the default value, and the length of the array is not required to be modified. So as to modify the data structure of the array type according to the scene.
Optionally, after generating the simulation data according to the return type, the method includes: and returning the simulation data to the front end of the webpage.
And developing the front end at the front end according to the simulation data.
It should be noted that this embodiment also provides an optional implementation, and details of this implementation are described below.
The current data simulating mode needs to additionally add mock fields and configuration when a request is sent, and if different data needs to be returned by the same interface in different scenes, different configurations need to be transmitted to realize the mock fields and the configuration. If the automated test under various scenes needs to be executed, corresponding configurations need to be added to each interface of each scene. There is coupling between the analog data and the back-end, which is not flexible enough to be used.
Aiming at the problems of coupling and flexibility of the current analog data and the back end, a configurable analog data mode which runs in an independent server is realized. Therefore, mock fields and configuration do not need to be additionally transmitted when analog data are obtained, and automatic test configuration is simpler and more convenient.
The implementation mode is mainly divided into two parts, namely configuration and use of simulation data at the back end of a webpage.
Fig. 2 is a flowchart of a backend simulation data configuration method according to an embodiment of the present invention, and as shown in fig. 2, the configuration flow is as follows: firstly, a simple server needs to be established locally;
then, obtaining a swagger file corresponding to an API (Application Programming Interface) from a back end;
and finally, presetting special default values of the resources under each scene according to the service scene related to the front end, wherein each set of default values corresponds to the key of each scene one by one. In this way, when the generation logic is executed, the parameters that are passed in by the user can be extracted to generate the required special values.
FIG. 3 is a flowchart of a back-end simulation data acquisition method according to an embodiment of the present invention, as shown in FIG. 3, using the following steps:
firstly, according to a currently developed scene, generating required default data by setting parameters of a corresponding scene, and starting a local server;
then, in the process of front-end development, if data needs to be acquired from the back end, the request is forwarded to a local server through an agent (such as nginx);
then, after receiving the request, the local server may obtain a data structure of the result to be returned from the swagger file in the configuration phase according to the path of the request and the type of the http method, and at this time, the return result may be constructed according to the data structure:
the data structure is a base type (string, coolean, number): firstly, setting an initial value for the value, for example, string type can be set as the name of a resource type, bootean type can be set as true, number type can be set as 1, then searching in a preset resource special default value, and if yes, changing to the preset value;
the data structure is an object type (object): traversing all keys of the object, generating the value of each key according to the method, and finally combining all the keys into a final return object;
the data structure is an array type (array): firstly, setting the length of an array as a default value (for example, 5), then searching whether a length requirement exists in a preset resource special default value, if so, updating, then generating each element of the array according to the method, and finally combining all the elements into a final return object;
and finally, returning the final result to the front end through the proxy.
In the embodiment, 1, each scene default value is preset, and the scene parameters are provided in the local server to generate the specific scene default data when in use, so that the front end does not need to be additionally accompanied with parameters to explain data requirements when requesting data, and different instances can be generated by a container (such as a docker) to run different scenes without changing codes when running an automation test. 2. And generating simulation data logic according to the data structure and the default value in the swagger, so that only a few special values need to be concerned when generating the data, and the data of the whole structure does not need to be simulated. 3. The front end and the local server are determined to be communicated with the formal server through the agent, so that the code written when the front end is developed is the final code, and the request path does not need to be changed when the front end is actually continuously tuned.
Compared with the related art, the embodiment changes the configuration of the mock to the step of generating data, so that parameters and the formal environment are completely consistent when the front end sends the request, and the mock does not need to be switched to the formal environment mode after the mock is finished. The simulation data is generated locally according to the swagger file provided by the back end and the preset default value, a back end providing server is not needed, and decoupling with the back end is achieved. Only some special values are needed to be set when the data are simulated, and the whole structure data are not needed to be simulated.
The method is used for simulating data in product development, front-end data does not need to be modified in the development process, various scenes can be debugged only by generating different scene data in the local server, and when continuous debugging is needed, seamless switching can be realized only by turning the proxy to the real back-end server.
Fig. 4 is a flowchart of a backend data simulation apparatus during web front-end and back-end separation development according to an embodiment of the present invention, and as shown in fig. 4, according to another aspect of the embodiment of the present invention, there is also provided a backend data simulation apparatus during web front-end and back-end separation development, including: an acquisition module 42, a receiving module 44, a determination module 46, and a generation module 48, which are described in detail below.
An obtaining module 42, configured to obtain a configuration file of a back end of a web page, where the back end of the web page and the front end of the web page are developed separately; a receiving module 44, connected to the acquiring module 42, for receiving a simulation request for requesting simulation data sent by a front end of a web page; a determining module 46, connected to the receiving module 44, for determining the type of the data structure of the requested simulation data according to the simulation request and the configuration file; a generating module 48, connected to the determining module 46, for generating simulation data according to the type of the data structure.
By the device, the configuration file of the back end of the webpage is acquired by the acquisition module 42, wherein the back end of the webpage and the front end of the webpage are respectively developed; the receiving module 44 receives a simulation request for requesting simulation data sent by the front end of the webpage; the determining module 46 determines the type of the data structure of the requested simulation data according to the simulation request and the configuration file; the generation module 48 generates the simulation data according to the type of the data structure, and generates the simulation data according to the configuration file and the simulation request at the back end, so as to achieve the purpose of acquiring the simulation data, thereby achieving the technical effect of improving the flexibility of acquiring the simulation data, and further solving the technical problem that the data simulation method in the related art is inflexible to use due to the need of adding corresponding simulation fields and related configurations for application scenes.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, where the storage medium includes a stored program, and when the program runs, the device on which the storage medium is located is controlled to execute the method for simulating backend data when the front and back ends of the web page are separately developed.
According to another aspect of the embodiments of the present invention, there is further provided a processor, configured to run a program, where the program executes the method for simulating backend data when the front and back ends of the web page are separately developed.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
In the above embodiments of the present invention, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described in detail in a certain embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (8)

1. A method for simulating backend data during the separation development of the front end and the back end of a webpage is characterized by comprising the following steps:
acquiring a configuration file of a webpage back end, wherein the webpage back end and the webpage front end are respectively developed;
receiving a simulation request for requesting simulation data sent by a webpage front end;
acquiring a corresponding data structure of the simulation data from the configuration file according to the path and the request type of the simulation request, wherein the configuration file comprises the data structures of the simulation data of a plurality of scenes;
determining a type of the data structure according to the data structure, wherein the type of the data structure at least comprises: a base type, a data structure of the base type comprising: a plurality of simulation parameters;
generating the simulation data according to the type of the data structure, wherein if the type of the data structure is the basic type, searching whether the simulation parameter has a default value in the data structure of the basic type; updating the initial values of the simulation parameters to default values in the case that the simulation parameters in the data structure have the default values, so as to update the data structure; and generating simulation data according to the updated data structure of the basic type.
2. The method of claim 1, prior to receiving a simulation request for requesting simulation data sent by a front end of a web page, comprising:
setting a scene;
acquiring simulation parameters corresponding to the scene according to the configuration file;
and taking the value of the simulation parameter as a default value, wherein the configuration file comprises simulation parameters corresponding to a plurality of scenes.
3. The method of claim 1, wherein the type of the data structure further comprises: the object type generating simulation data according to the data structure of the object type under the condition that the type of the data structure is the object type comprises the following steps:
traversing all identifiers of simulation parameters in a data structure of the object type, wherein the data structure of the object type comprises a plurality of identifiers;
determining the value of the identifier corresponding to the default value according to the default value of the simulation parameter;
updating the data structure of the object type according to the identified values corresponding to all the default values;
and generating the simulation data according to the updated data structure of the object type.
4. The method of claim 1, wherein the type of the data structure further comprises: the method comprises the following steps of generating simulation data according to the data structure of the array type under the condition that the type of the data structure is the array type, and comprises the following steps:
setting the simulation parameter of the data structure of the array type as a preset value, wherein the default parameter of the data structure of the array type is the array length of the data structure of the array type;
determining whether the simulation parameters of the data structure have the default values;
under the condition that the simulation parameters of the data structure have default values, updating the preset values of the simulation parameters of the data structure to the default values so as to update the data structure;
and generating the simulation data according to the updated data structure of the array type.
5. The method of claim 1, after generating the simulation data according to the type of the data structure, comprising:
and returning the simulation data to the front end of the webpage.
6. A backend data simulation device during webpage front-end and back-end separation development is characterized by comprising:
the system comprises an acquisition module, a configuration module and a display module, wherein the acquisition module is used for acquiring a configuration file of a webpage back end, and the webpage back end and the webpage front end are respectively developed;
the receiving module is used for receiving a simulation request for requesting simulation data sent by the front end of the webpage;
a determining module, configured to determine a type of a data structure of the requested simulation data according to the simulation request and the configuration file, where determining the type of the data structure of the requested simulation data according to the simulation request and the configuration file includes: acquiring a corresponding data structure of the simulation data from the configuration file according to the path and the request type of the simulation request, wherein the configuration file comprises the data structures of the simulation data of a plurality of scenes; determining a type of the data structure according to the data structure, wherein the type of the data structure at least comprises: a base type, a data structure of the base type comprising: a plurality of simulation parameters;
a generation module configured to generate the simulation data according to the type of the data structure, wherein generating the simulation data according to the type of the data structure includes: if the type of the data structure is the basic type, searching whether the simulation parameter has a default value in the data structure of the basic type; updating the initial values of the simulation parameters to default values in the case that the simulation parameters in the data structure have the default values, so as to update the data structure; and generating simulation data according to the updated data structure of the basic type.
7. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, the device on which the storage medium is located is controlled to execute the method for simulating backend data when the front and back ends of the web page are separately developed according to any one of claims 1 to 5.
8. A processor, wherein the processor is configured to run a program, wherein the program is configured to execute the backend data simulation method when the front-end and back-end separation development of the web page is performed in the runtime according to any one of claims 1 to 5.
CN202010238508.0A 2020-03-30 2020-03-30 Method for simulating back-end data during separate development of front end and back end of webpage Active CN111459484B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010238508.0A CN111459484B (en) 2020-03-30 2020-03-30 Method for simulating back-end data during separate development of front end and back end of webpage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010238508.0A CN111459484B (en) 2020-03-30 2020-03-30 Method for simulating back-end data during separate development of front end and back end of webpage

Publications (2)

Publication Number Publication Date
CN111459484A CN111459484A (en) 2020-07-28
CN111459484B true CN111459484B (en) 2022-11-29

Family

ID=71685172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010238508.0A Active CN111459484B (en) 2020-03-30 2020-03-30 Method for simulating back-end data during separate development of front end and back end of webpage

Country Status (1)

Country Link
CN (1) CN111459484B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112685023A (en) * 2020-12-31 2021-04-20 招联消费金融有限公司 Front-end development processing method, device, equipment and storage medium based on basic library

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063314A (en) * 2014-05-20 2014-09-24 中国工商银行股份有限公司 Test data automatic generation device and test data automatic generation method
CN107957871A (en) * 2017-11-15 2018-04-24 杭州安恒信息技术有限公司 A kind of front and back end synchronization canonical method of calibration based on JSR303
CN110221858A (en) * 2019-06-17 2019-09-10 深圳前海微众银行股份有限公司 Analogue data generation method, device, equipment and computer readable storage medium
CN110377283A (en) * 2019-07-08 2019-10-25 北京亚鸿世纪科技发展有限公司 The realization of front end valid data and synchronous method when the separation exploitation of the front and back end Web

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10534588B2 (en) * 2018-06-08 2020-01-14 Sap Se Data processing simulator with simulator module and data elements

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104063314A (en) * 2014-05-20 2014-09-24 中国工商银行股份有限公司 Test data automatic generation device and test data automatic generation method
CN107957871A (en) * 2017-11-15 2018-04-24 杭州安恒信息技术有限公司 A kind of front and back end synchronization canonical method of calibration based on JSR303
CN110221858A (en) * 2019-06-17 2019-09-10 深圳前海微众银行股份有限公司 Analogue data generation method, device, equipment and computer readable storage medium
CN110377283A (en) * 2019-07-08 2019-10-25 北京亚鸿世纪科技发展有限公司 The realization of front end valid data and synchronous method when the separation exploitation of the front and back end Web

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
网页数据抓取中的几个关键技术问题;洪平;《育学院学报》;20161231;第18卷(第2期);第66-69页 *

Also Published As

Publication number Publication date
CN111459484A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN106843828B (en) Interface display and loading method and device
US20210240721A1 (en) Application Recommending Method and System, and Server
CN105260420B (en) A kind of method and apparatus for the offer target pages in mobile application
CN110944048B (en) Service logic configuration method and device
CN106383704B (en) Progress bar data processing method and device
CN111104635B (en) Method and device for generating form webpage
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
CN111274512A (en) Page loading method, device and medium
CN105183882A (en) Application software recommending method and device
CN105450461A (en) Shunting method and network equipment
CN108279882B (en) Framework generation method, device, equipment and computer readable medium
CN104679500B (en) Method and device for realizing automatic generation of entity class
CN111934908A (en) Internet of things simulation method, device and system and storage medium
CN111459484B (en) Method for simulating back-end data during separate development of front end and back end of webpage
CN110941634A (en) Data processing method and device, storage medium and electronic device
CN110286981A (en) The display methods and display system of the use state of virtual cloud desktop server
CN105119944B (en) Application starting method and related device
CN110555185A (en) Page customization method and system based on PC client
CN113495723B (en) Method, device and storage medium for calling functional component
CN114579506A (en) Inter-processor communication method, system, storage medium, and processor
CN112989769A (en) Method, device and platform for constructing multi-data-source form based on form engine
CN113973060A (en) Internet of things simulation method, device and system and storage medium
CN111552715A (en) User query method and device
CN110134867A (en) Corporation information query method and Related product
CN111488283B (en) Task generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100094 101, floors 1-5, building 7, courtyard 3, fengxiu Middle Road, Haidian District, Beijing

Applicant after: Beijing Xingchen Tianhe Technology Co.,Ltd.

Address before: 100097 room 806-1, block B, zone 2, Jinyuan times shopping center, indigo factory, Haidian District, Beijing

Applicant before: XSKY BEIJING DATA TECHNOLOGY Corp.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant