Detailed Description
In the development and application process, in order to improve the development efficiency, the user terminal can call the Mcok interface to obtain the simulation data by setting the simulation data Mcok interface, so that the simulation data is used for testing the developed content.
FIG. 1 is an application scenario diagram illustrating an exemplary embodiment.
As shown in fig. 1, when multiple services are developed in parallel, multiple user terminals 11 call the same Mock interface 12, so that the data returned by the Mock interface 12 to different user terminals 11 are the same, and customized data cannot be provided to the user.
In addition, a plurality of user terminals can call the Mock interface, and can modify interface parameters and types, so that Mock data confusion is easy to cause.
Fig. 2 is a flow chart of an analog data service implementation method according to an exemplary embodiment of the present application.
As shown in fig. 2, the method for implementing analog data service provided by the present application includes:
Step 201, receiving a copy request sent by a user terminal for copying the analog data service, and generating a copy service corresponding to the user terminal according to the copy request.
The method provided by the application can be executed by an electronic device with computing capability, such as a computer. The electronic device may be one device or a plurality of devices. The electronic devices can be used as a Mock service management platform to provide simulation data for users.
In particular, an analog data service, in particular a Mock interface, may be provided in the electronic device, which analog data service may feed back analog data to the user terminal. For example, the user terminal may send a data acquisition request to the electronic device, and the electronic device may simulate corresponding data based on the simulated data service and feed back to the user terminal.
Furthermore, in the method provided by the application, the user can also operate the user terminal, so that the user terminal sends a copy request for copying the analog data service to the electronic equipment. A key for copying the analog data service may be provided in the user interface of the user terminal, and the user may click on the key, so that the user terminal sends a corresponding request to the electronic device.
In practical application, the electronic device receives a copy request for copying the analog data service, and may generate a copy service corresponding to the user terminal according to the copy request. The replication service is capable of providing analog data.
The electronic equipment can copy the set analog data service to obtain the copy service corresponding to the user terminal. The electronic device may also perform instantiation based on the code content of the analog data service to obtain a copy service corresponding to the user terminal.
Specifically, the electronic device may analyze the replication request to obtain a user terminal identifier for sending the request, and may further associate the generated replication service with the user terminal identifier, so as to be able to distinguish the replication service corresponding to different user terminals.
Fig. 3 is a schematic diagram illustrating interaction between a user terminal and an electronic device according to an exemplary embodiment of the present application.
As shown in fig. 3, any one of the user terminals 31 may transmit a copy request for copying an analog data service to the electronic device 32. Upon receipt of the copy request, the electronic device 32 may generate a copy service 33, the copy service 33 having an identification of the user terminal 31 that sent the copy request. For example, if the identifier of the user terminal 31 is the first identifier, the copy service 33 generated based on the copy request transmitted by the user terminal has the first identifier.
Step 202, receiving a simulation data request sent by a user terminal and used for indicating feedback simulation data, and determining the simulation data according to a replication service corresponding to the user terminal.
In an optional implementation manner, after the electronic device generates the copy service, a message that the copy is successful may also be sent to the user terminal, and the user terminal may display a prompt message that the copy is successful or the operation is successful in the user interface, so that the user knows that the electronic device generates the copy service.
The user can also operate the user terminal to enable the user terminal to send an analog data request for indicating feedback analog data to the electronic device. For example, if the user needs to use the data i for testing, the user terminal may be controlled to send an analog data request for feeding back the data i to the electronic device.
Specifically, after receiving the analog data request, the electronic device may analyze the analog data request to obtain information of the user terminal, so as to determine a copy service corresponding to the information of the user terminal. For example, the identifier of the user terminal may be parsed, and then the copy service corresponding to the identifier of the user terminal may be determined.
Further, the electronic device may process the received analog data request using the determined replication service. For example, if the identifier of the user terminal is the first identifier, the copy service corresponding to the first identifier may be used to process the analog data request. In this embodiment, when the user terminal invokes the Mock interface, the copy service corresponding to each user terminal may be used to process the data request sent by the user terminal, so that personalized custom data may be returned.
For example, if the analog data request is used to indicate feedback data i, the replication service may determine specific data corresponding to i according to the request.
In this embodiment, the copy services are isolated from each other, and the analog data can be determined according to the copy service corresponding to the user terminal, so that the data customized to the user terminal can be fed back to the user terminal, and the data confusion in the analog data service can be avoided.
Step 203, the analog data is sent to the user terminal.
In practical application, the electronic device may send the determined analog data to the user terminal, so that the user terminal can perform a test using the analog data.
Fig. 4 is a schematic diagram of acquiring analog data according to an exemplary embodiment of the present application.
As shown in fig. 4, each user terminal 41 may send an analog data request to the electronic device 42. The electronic device processes the received analog data requests according to the replication service 43 corresponding to these user terminals 41.
For example, an analog data request sent by the first user terminal 41 is processed by the first replication service 43, and an analog data request sent by the second user terminal 41 is processed by the second replication service 44. When the first user terminal 41 sends a request for modifying data to the electronic device, the request is also processed by the first replication service 43 corresponding to the request, so that the data acquired by other user terminals is not affected.
For example, in an analog data service, the variable i is set to 1. The first user terminal 41 sends a data modification request to the electronic device, setting i to 0, and the electronic device processes the request with a first copy service in which the variable i is set to 0. Then the first user terminal again sends an analog data request for feedback data i, where i fed back by the electronic device is 0. And the second user terminal sends an analog data request for feedback data i, the electronic device processes the request with a second replication service, which determines that the variable i has a value of 1.
In the method provided by the application, the customized analog data can be fed back to the user terminal by generating the copy service of the analog data service corresponding to the user terminal.
The method for realizing the simulated data service comprises the steps of receiving a copying request sent by a user terminal and used for copying the simulated data service, generating copying service corresponding to the user terminal according to the copying request, receiving a simulated data request sent by the user terminal and used for indicating feedback simulated data, determining the simulated data according to the copying service corresponding to the user terminal, and sending the simulated data to the user terminal. In the method provided by the application, the copy service of the analog data service corresponding to the user terminal can be generated, and the request of the user terminal is processed by utilizing the copy service corresponding to the user terminal, so that the problem of frequent data change can be avoided when a plurality of persons call the same Mock interface, personalized custom data return can be realized, and the collaborative development efficiency of the plurality of persons is improved.
Fig. 5 is a flow chart of an analog data service implementation method according to another exemplary embodiment of the present application.
As shown in fig. 5, the method for implementing an analog data service provided by the present application includes:
Step 501, a replication request sent by a user terminal for replicating an analog data service is received.
Step 501 is similar to the step 301 of receiving the copy request sent by the user terminal for copying the analog data service, and will not be described again.
Step 502, determining whether the user terminal has authority to operate the analog data service according to the copy request.
Specifically, the electronic device may determine the user terminal identifier or the user identifier according to the replication request, and determine whether the user terminal that sends the replication request has authority to operate the analog data service by using the identifiers.
Further, a user list or a terminal list with authority for operating the analog data service may be preset, and a user identifier or a terminal identifier capable of operating the analog data service is recorded in the list. The electronic device can analyze the user identifier or the terminal identifier included in the received copy request according to the received copy request, and further can determine whether the user terminal sending the copy request has the authority to operate the analog data service according to a preset user list or terminal list.
If the user terminal has the right to operate the analog data service, step 503 may be performed. Otherwise, ending the flow, or sending a message without copy permission to the user terminal by the electronic equipment.
Step 503, determining a terminal identifier according to the copy request, and generating a copy service corresponding to the user terminal according to the terminal identifier.
Specifically, in the method provided by the application, the electronic equipment can analyze the received copy request and identify the terminal identification of the user terminal sending the copy request.
Further, the terminal identifier may be, for example, a user account identifier, or may be a network identifier of the user terminal. If it is determined in step 502 whether the terminal identifier has authority, the step may directly obtain the terminal identifier determined previously, so as to avoid repetitive processing.
In actual application, the electronic device may generate a copy service corresponding to the user terminal according to the terminal identifier. The replication service is generated for an analog data based service.
The generated copy service is associated with a terminal identifier corresponding to the user terminal. In such an embodiment, for different user terminals, the electronic device may generate a copy service for it, which copy service is capable of providing analog data to the user terminal corresponding thereto.
In particular, the replication service generated by the electronic device may include data and instances.
When generating the copy service corresponding to the user terminal according to the terminal identification, service data of the analog data service can be obtained, and the service data with the terminal identification can be stored in a database.
Further, the analog data service may have service data therein, and the service data may be tree-structured data, for example. For example, multiple business levels may be included in a simulated data service, and then the data for each business level may be considered the service data for the simulated data service.
The electronic device may obtain service data of the analog data service, and store a backup of the service data in the database, where the backup of the service data has a user terminal identifier. For example, when the user terminal a and the user terminal B both send a copy request to the electronic device, the electronic device may store two service data in the database, where one service data has the identifier of the user terminal a and the other service data has the identifier of the user terminal B.
In practice, multiple interfaces may be included in the analog data service, such as multiple business levels in the analog data service, and multiple interfaces need to be maintained in each business. The electronic device may instantiate all interfaces in the analog data service, resulting in instances of these interfaces. Wherein, the examples corresponding to the interfaces have terminal identifications.
For example, when the user terminal a and the user terminal B both send a copy request to the electronic device, the electronic device may instantiate the interface in the analog data service for the first time to obtain a plurality of instances, where the instances have the identity of the user terminal a. The electronic device may further perform a second instantiation of the interface in the analog data service to obtain a plurality of instances, where the second instantiation obtains an instance with the identifier of the user terminal B.
By this embodiment, it is possible to generate a copy service corresponding to the user terminal, the copy service having therein service data and an instance corresponding to the user terminal identification.
Fig. 6 is a schematic diagram of a replication service according to an exemplary embodiment of the present application.
As shown in fig. 6, in the solution provided by the present application, the electronic device 61 may generate the copy service 63 corresponding to the user terminal 62 according to the copy request sent by the user terminal 62. The electronic device 61 may also generate a copy service 65 corresponding to the user terminal 64 according to the copy request transmitted by the user terminal 64.
Among other things, the replication service 63 may include service data 631 and instances 632, where the service data 631 may be stored in a database, where the service data 631 and instances 632 have an identification of the user terminal 62. The replication service 65 may include therein service data 651 and instances 652, the service data 651 may be stored in a database, the service data 651 and instances 652 having an identification of the user terminals 64.
Wherein the number of instances in the replication service may be multiple.
Step 504, receiving an analog data request sent by the user terminal and used for indicating feedback analog data.
Step 504 is similar to the implementation manner and principle of receiving the analog data request sent by the user terminal in step 202 and used for indicating feedback analog data, and will not be described again.
Step 505, determining a terminal identifier according to the analog data request, and determining a copy service corresponding to the user terminal according to the terminal identifier.
After receiving the analog data request for indicating the feedback analog data, the electronic device can analyze the analog data request to obtain the terminal identification included in the analog data request, and further can determine the copy service corresponding to the user terminal according to the terminal identification.
For example, if the analog data request is sent by the user terminal a, the electronic device may determine, according to the identifier of the user terminal a, the copy service corresponding to the user terminal a. The determined copy service includes service data corresponding to the user terminal a and also includes an instance corresponding to the user terminal a.
And step 506, processing the simulation data request based on the replication service corresponding to the user terminal to obtain the simulation data.
The electronic device can process the simulation data request based on the determined replication service corresponding to the user terminal, so that simulation data is obtained.
For example, if the analog data request is a request for indicating the feedback variable i, the electronic device may obtain the value of the variable i according to the replication service corresponding to the user terminal, so as to obtain the analog data.
Specifically, the replication service includes service data and an instance, so that the simulation data can be obtained by processing the simulation data request based on the instance of the replication service corresponding to the user terminal and the service data.
Further, the electronic device may invoke service data in the database corresponding to the determined user terminal identifier according to the content in the simulated data request, and execute an instance in the replication service corresponding to the user terminal. For example, if the value of the variable i is the sum of the value of the variable a and the value of the variable b, and the user terminal identifier is a, the electronic device may read the value of the variable a and the value of the variable b with the terminal identifier a from the database, and execute an instance by using the read variable values, thereby obtaining the value of the variable i.
In this embodiment, the copy services between the user terminals are independent, and when the user terminals operate the data, only the service data in the copy service corresponding to the user terminal is modified, but the copy services of other user terminals are not affected, so that personalized data can be provided for each user terminal, and the condition that the same service data is modified by a plurality of user terminals to cause data confusion can be avoided.
Step 507, the analog data is sent to the user terminal.
Step 507 is similar to the implementation and principle of step 203, and will not be described again.
And 508, when the simulated data service is changed, synchronously changing the content to the copy service corresponding to the simulated data service according to the identifier of the simulated data service, wherein the copy service has the identifier of the simulated data service.
In practical application, the electronic device may also obtain the identifier of the analog data service when generating the copy service, and associate the generated copy service with the identifier of the analog data service. For example, there is a first analog data service and a second analog data service, and when generating a replica of the first analog data service, the replica may have an identification of the first analog data service. When generating a replica service of the second analog data service, the replica service may have an identification of the second analog data service.
When the simulated data service changes, the electronic device can determine each copy service generated according to the simulated data service according to the identifier of the simulated data service, and synchronously change the content to the copy services.
For example, there are a first replication service, a second replication service, and a third replication service, where the first replication service and the second replication service have an identifier of a first analog data service, and the third replication service has an identifier of a second analog data service. When the electronic device monitors that the first analog data service changes, the change content can be determined and synchronized to the first copy service and the second copy service.
In particular, the altered content of an analog data service may be synchronized into a replica service of the analog data service by a websocket (a protocol for full duplex communication over a single TCP connection) message synchronization mechanism.
Fig. 7 is a block diagram of an analog data service implementation apparatus according to an exemplary embodiment of the present application.
As shown in fig. 7, an analog data service implementation apparatus 700 provided by the present application includes:
a receiving unit 710, configured to receive a replication request sent by a user terminal for replicating an analog data service;
A copying unit 720, configured to generate a copying service corresponding to the user terminal according to the copying request, where the copying service is used to provide analog data;
the receiving unit 710 is further configured to receive an analog data request sent by the user terminal and used for indicating feedback analog data
A determining unit 730, configured to determine analog data according to a replication service corresponding to the user terminal;
And a sending unit 740, configured to send the analog data to the user terminal.
The analog data service implementation device comprises a receiving unit, a copying unit, an analog data request determining unit and a transmitting unit, wherein the receiving unit is used for receiving a copying request which is sent by a user terminal and used for copying analog data service, the copying unit is used for generating copying service corresponding to the user terminal according to the copying request, the receiving unit is also used for receiving an analog data request determining unit which is sent by the user terminal and used for indicating feedback analog data and used for determining the analog data according to the copying service corresponding to the user terminal, and the transmitting unit is used for sending the analog data to the user terminal. The simulated data service realizing device provided by the application can generate the copy service of the simulated data service corresponding to the user terminal, and process the request of the user terminal by utilizing the copy service corresponding to the user terminal, so that when a plurality of persons call the same Mock interface, the problem of frequent data change can be avoided, personalized customized data return can be realized, and the collaborative development efficiency of the plurality of persons is improved.
The specific principle and implementation manner of the analog data service implementation device provided in this embodiment are similar to those of the embodiment shown in fig. 2, and will not be described herein again.
Fig. 8 is a block diagram of an analog data service implementation apparatus according to another exemplary embodiment of the present application.
As shown in fig. 8, in the analog data service implementation apparatus 800 provided by the present application, optionally, the replication service is associated with a terminal identifier corresponding to the user terminal.
Optionally, the replication unit 720 includes:
An identity determining module 721 for determining the terminal identity according to the replication request;
and the service generating module 722 is configured to generate a copy service corresponding to the user terminal according to the terminal identifier.
Optionally, the replication service includes data and instances;
The service generation module 722 is specifically configured to:
Acquiring service data of the analog data service, and storing the service data with the terminal identifier in a database;
and instantiating all interfaces in the analog data service, wherein the examples corresponding to the interfaces have the terminal identification.
Optionally, the determining unit 730 includes:
A service determining module 731, configured to determine the terminal identifier according to the analog data request, and determine a copy service corresponding to the user terminal according to the terminal identifier;
and a processing module 732, configured to process the analog data request based on a replication service corresponding to the user terminal, and obtain the analog data.
Optionally, the processing module 732 is specifically configured to:
and processing the simulation data request based on the instance of the copy service corresponding to the user terminal and service data to obtain the simulation data.
Optionally, the apparatus further comprises an auditing unit 750 for:
Determining whether the user terminal has authority to operate the analog data service according to the copy request, and if so, the copy unit 720 performs the step of generating a copy service corresponding to the user terminal according to the copy request.
Optionally, the replication service has an identification of the analog data service;
The apparatus further includes a synchronization unit 760 for synchronizing, when the analog data service is changed, changing contents to a copy service corresponding to the analog data service according to an identification of the analog data service.
The specific principle and implementation manner of the analog data service implementation device provided in this embodiment are similar to those of the embodiment shown in fig. 5, and will not be described herein again.
Fig. 9 is a block diagram of an analog data service implementation apparatus according to an exemplary embodiment of the present application.
As shown in fig. 9, the analog data service implementation apparatus provided in this embodiment includes:
a memory 91;
A processor 92, and
A computer program;
wherein the computer program is stored in the memory 91 and is configured to be executed by the processor 92 to implement any of the analog data service implementation methods described above.
The present embodiment also provides a computer-readable storage medium, having stored thereon a computer program,
The computer program is executed by a processor to implement any of the analog data service implementation methods described above.
A computer program product comprising a computer program which, when executed by a processor, implements any of the analogue data services methods as described above.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of implementing the various method embodiments described above may be implemented by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs the steps comprising the method embodiments described above, and the storage medium described above includes various media capable of storing program code, such as ROM, RAM, magnetic or optical disk.
It should be noted that the above embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solution described in the above embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present invention.