CN112491943A - Data request method, device, storage medium and electronic equipment - Google Patents
Data request method, device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN112491943A CN112491943A CN201910867269.2A CN201910867269A CN112491943A CN 112491943 A CN112491943 A CN 112491943A CN 201910867269 A CN201910867269 A CN 201910867269A CN 112491943 A CN112491943 A CN 112491943A
- Authority
- CN
- China
- Prior art keywords
- identifier
- data
- server
- mapping
- mapping relation
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 73
- 238000013507 mapping Methods 0.000 claims abstract description 208
- 230000004044 response Effects 0.000 claims abstract description 48
- 230000008569 process Effects 0.000 claims description 13
- 238000004891 communication Methods 0.000 claims description 5
- 230000000694 effects Effects 0.000 abstract description 6
- 238000012545 processing Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 8
- 238000004590 computer program Methods 0.000 description 6
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a data request method, a data request device, a storage medium and electronic equipment. The method comprises the following steps: acquiring a first identifier of target data to be requested in a client; mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in a server; sending a target request carrying a second identifier to a server; and acquiring target data returned by the server in response to the target request. By the method and the device, the effect of improving the efficiency of requesting the data is achieved.
Description
Technical Field
The invention relates to the field of computers, in particular to a data request method, a data request device, a storage medium and electronic equipment.
Background
Currently, when a client requests data from a server, an identifier of the data to be requested needs to be defined in advance with the server, and the identifier may be a key of the data. And then the client and the server directly communicate through the agreed data identification.
However, when the server needs to modify the agreed data identifier for some reason, the client needs to update the data identifier synchronously because the data identifier at the client and the data identifier at the server need to be unified, so that the normal use of the website can be ensured. If the modified data identification is more related in the logic of the client, all parts of data in the logic code of the client must be traversed, the original data identification is replaced by the modified data identification, and then a comprehensive test is carried out, so that the data request can be carried out, and the normal use of the website is ensured.
The solution is troublesome, and if a problem occurs in a certain link, a serious result may be caused, and an effective request for data cannot be guaranteed, so that the problem of low efficiency of requesting data exists, and stable use of a website cannot be guaranteed.
Aiming at the problem of low efficiency of requesting data in the prior art, no effective solution is provided at present.
Disclosure of Invention
The invention mainly aims to provide a data request method, a data request device, a storage medium and electronic equipment, which at least solve the technical problem of low efficiency of requesting data.
To achieve the above object, according to one aspect of the present invention, a data request method is provided. The method can comprise the following steps: acquiring a first identifier of target data to be requested in a client; mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in a server; sending a target request carrying a second identifier to a server; and acquiring target data returned by the server in response to the target request.
Optionally, before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the method further includes: acquiring a pre-established mapping relation table, wherein the mapping relation table is used for storing the mapping relation between the identification of different data in a client and the identification used for acquiring the data in a server; a first mapping relationship is determined in a mapping relationship table.
Optionally, determining the first mapping relationship in the mapping relationship table includes: and determining a first mapping relation from the mapping relation table according to the first identifier.
Optionally, the method further comprises: acquiring a third identifier, wherein the third identifier is an identifier updated by the second identifier in the server; and updating the first mapping relation through the third identifier to obtain a second mapping relation.
Optionally, the updating the first mapping relationship through the third identifier, and obtaining the second mapping relationship includes: establishing a second mapping relation between the first identifier and the third identifier, and replacing the first mapping relation with the second mapping relation; or replacing the second identifier in the first mapping relation with the third identifier to obtain a second mapping relation.
Optionally, the obtaining target data returned by the server in response to the target request includes: acquiring a response result returned by the server in response to the target request; and acquiring target data from the response result.
Optionally, the obtaining the target data from the response result includes: analyzing the response result to obtain target data and a second identifier; mapping the second identifier to the first identifier according to a first mapping relation; and associating the mapped first identifier with the target data so as to process the target data associated with the first identifier.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a data request apparatus. The apparatus may include: the first acquisition unit is used for acquiring a first identifier of target data to be requested in the client; the mapping unit is used for mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in the server; the sending unit is used for sending a target request carrying the second identifier to the server; and the second acquisition unit is used for acquiring the target data returned by the server in response to the target request.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a storage medium. The storage medium includes a stored program, wherein the apparatus on which the storage medium is located is controlled to execute the data request method according to the embodiment of the present invention when the program runs.
In order to achieve the above object, according to another aspect of the present invention, there is also provided an electronic device. The electronic equipment comprises a processor, at least one memory connected with the processor, and a bus; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory to execute the data request method of the embodiment of the invention.
According to the method, a first identifier of target data to be requested in a client is acquired; mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in a server; sending a target request carrying a second identifier to a server; and acquiring target data returned by the server in response to the target request. That is, the identification of the data at the client does not need to be changed whether the identification of the data at the server is modified or not, the client only needs to maintain the mapping relationship between the identification of the data at the client and the identification of the data at the server, the fixed identification of the data in the client is mapped to the appointed identification of the data in the server through the mapping relation, and then the requested data is obtained by carrying the identification of the data in the server, thereby avoiding the problem that the identification of the data used in the client and the server is the same, when the server needs to modify the agreed data identifier for some reason, the identifier of the data in the client needs to be updated synchronously, so that the complexity of data request is reduced, the technical problem of low efficiency of data request is solved, and the technical effect of improving the efficiency of data request is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method of data request according to an embodiment of the present invention;
FIG. 2 is a flow diagram of another data request method according to an embodiment of the invention;
FIG. 3 is a schematic diagram of a data request device according to an embodiment of the present invention; and
fig. 4 is a schematic diagram of an apparatus according to an embodiment of the invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all 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 application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application 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 should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, 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.
Example 1
The embodiment of the invention provides a data request method.
The data in the website includes two types, one type is static data, and the static data is basic data of the website, such as website names and the like; the other is dynamic data, which needs to initiate a request to a server to obtain, for example, real-time data. The data for which the data request method of this embodiment is directed may be dynamic data.
Fig. 1 is a flow chart of a data request method according to an embodiment of the present invention. As shown in fig. 1, the method may include:
step S102, a first identifier of target data to be requested in a client is obtained.
In the technical solution provided by step S102 of the present invention, the client obtains a first identifier of target data to be requested from the server in the client.
In this embodiment, the client, that is, the front end, and the server, that is, the server and the back end, may be dynamic data required by the client when performing logic processing. Different functional modules in the client's website need to request data from the server using an identification of the data, where the identification can be a Key (Key) of the data.
Optionally, the target data to be requested in this embodiment has a first identifier in the client, and logic of the client may be developed by using the first identifier, where the first identifier may be a key of the target data in the client, and a composition rule of the target data in this embodiment may be specifically determined according to an operation of a user, where the target data may include a data type, a data amount, a data return order, and the like, may be data of an item, a media, a click amount, an exposure amount, a click rate, and the like, and may also be data of a certain number (for example, 1 to 100 pieces) and sort the data in a descending order of the exposure amount, and the like, and no limitation is made here.
And step S104, mapping the first identifier according to the first mapping relation to obtain a second identifier.
In the technical solution provided in step S104 of the present invention, after the first identifier of the target data to be requested in the client is obtained, the first identifier is mapped according to the first mapping relationship, so as to obtain the second identifier.
In this embodiment, the client maintains a first mapping relationship between the first identifier and the second identifier, where the first mapping relationship is a rule used to indicate an association relationship and a correspondence between the first identifier and the second identifier, and the second identifier may be a key used to obtain target data in the server, that is, objects targeted by the first identifier and the second identifier are both target data.
Optionally, the identifier of the target data in the server in this embodiment may be a first identifier agreed with the client at the beginning, that is, the first identifier of the target data in the client is unified, so that communication between the client and the server is established through the unified first identifier, and then the server needs to modify the first identifier to be a second identifier for some reason, but the first identifier of the target data in the client is kept unchanged, that is, the first identifier of the target data in the client is fixed, and the client performs stable business logic processing through the fixed first identifier. After the server modifies the first identifier into a second identifier, the client establishes a first mapping relationship between the first identifier and the second identifier, and the second identifier is the identifier for acquiring the target data agreed between the server and the client.
And step S106, sending a target request carrying the second identifier to the server.
In the technical solution provided in step S106 of the present invention, after the first identifier is mapped according to the first mapping relationship and the second identifier is obtained, the target request carrying the second identifier is sent to the server.
In this embodiment, the second identifier is a key that is agreed by the server and the client and used for acquiring the target data, so that when the client needs to send a target request to the server, the client needs to send the target request carrying the second identifier obtained by converting the first identifier, and the target request may be used to request the server to acquire the target data, that is, a data acquisition request.
Step S108, target data returned by the server responding to the target request is obtained.
In the technical solution provided in step S108 of the present invention, after sending the target request carrying the second identifier to the server, the server obtains the target request, responds to the target request, obtains the target data according to the second identifier, and sends the target data to the client, and the client obtains the target data, and can perform service logic processing on the target data, and further can display the processed data on the interface of the client.
Through the steps S102 to S108, acquiring a first identifier of target data to be requested in the client; mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in a server; sending a target request carrying a second identifier to a server; and acquiring target data returned by the server in response to the target request. That is, the identification of the data at the client does not need to be changed whether the identification of the data at the server is modified or not, the client only needs to maintain the mapping relationship between the identification of the data at the client and the identification of the data at the server, the fixed identification of the data in the client is mapped to the appointed identification of the data in the server through the mapping relation, and then the requested data is obtained by carrying the identification of the data in the server, thereby avoiding the problem that the identification of the data used in the client and the server is the same, when the server needs to modify the agreed data identifier for some reason, the identifier of the data in the client needs to be updated synchronously, so that the complexity of data request is reduced, the technical problem of low efficiency of data request is solved, and the technical effect of improving the efficiency of data request is achieved.
As an optional implementation manner, in step S104, before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the method further includes: acquiring a pre-established mapping relation table, wherein the mapping relation table is used for storing the mapping relation between the identification of different data in a client and the identification used for acquiring the data in a server; a first mapping relationship is determined in a mapping relationship table.
In this embodiment, a mapping relationship table, that is, a dictionary for looking up the second identifier corresponding to the first identifier, may be pre-established in the client. Optionally, the identifier of different data in the client and the identifier for acquiring the data in the server are obtained in advance, for example, data 1(Key11, Key21), data 2(Key12, Key22), data 3(Key13, Key23), and the like, and the mapping relationship between the identifier of different data in the client and the identifier for acquiring the data in the server is stored in a mapping relationship table, so as to achieve the purpose of establishing the mapping relationship table, where the different data includes the target data.
Before the first identifier is mapped according to the first mapping relation to obtain the second identifier, the mapping relation table is obtained, the first mapping relation is determined in the mapping relation table, the first identifier is further mapped according to the first mapping relation to obtain the second identifier, a target request carrying the second identifier is sent to the server, and target data returned by the server in response to the target request are obtained, so that the effect of improving the efficiency of requesting data is achieved.
As an optional implementation manner, determining the first mapping relationship in the mapping relationship table includes: and determining a first mapping relation from the mapping relation table according to the first identifier.
In this embodiment, when the first mapping relationship is determined in the mapping relationship table, the first mapping relationship may be determined from the mapping relationship table according to the first identifier. Optionally, the first identifier in this embodiment has a corresponding column in the mapping relationship table, and the second identifier also has a corresponding column in the mapping relationship table, and the first mapping relationship between the first identifier and the second identifier may be determined by searching the first identifier from the column in which the first identifier is located, but not by searching the second identifier from the column in which the second identifier is located, so as to achieve the purpose of accurately determining the first mapping relationship from the mapping relationship table according to the first identifier.
As an optional implementation, the method further comprises: acquiring a third identifier, wherein the third identifier is an identifier updated by the second identifier in the server; and updating the first mapping relation through the third identifier to obtain a second mapping relation.
In this embodiment, the second identification of the target data in the server is modifiable as needed. Optionally, after the target data returned by the server in response to the target request is obtained, if the second identifier is updated in the server to be the third identifier, that is, the third identifier is an identifier agreed by the server and the client and used for obtaining the target data next, the original first mapping relationship used for indicating the first identifier and the second identifier is no longer applicable, optionally, the client obtains the third identifier, only the first mapping relationship is updated through the third identifier to obtain the second mapping relationship, and the second mapping relationship is maintained at the client, without modifying the first identifier of the target data at the client and without modifying functional logic in the website, so as to avoid the problem that the client cannot ensure stable use of the website due to excessive logic required to be modified by the server for modifying the second identifier of the target data, and then the effect of improving the efficiency of requesting data is achieved.
Optionally, after the first mapping relationship is updated through the third identifier to obtain the second mapping relationship, when the first identifier is obtained, the first identifier is mapped according to the second mapping relationship to obtain a third identifier, and the third identifier is used for obtaining target data in the server, further sending a target request carrying the third identifier to the server, and obtaining the target data returned by the server in response to the target request.
As an optional implementation manner, updating the first mapping relationship through the third identifier to obtain the second mapping relationship includes: establishing a second mapping relation between the first identifier and the third identifier, and replacing the first mapping relation with the second mapping relation; or replacing the second identifier in the first mapping relation with the third identifier to obtain a second mapping relation.
In this embodiment, when the first mapping relationship is updated through the third identifier, the first identifier and the third identifier may be associated to obtain the second mapping relationship, and since the second identifier of the target data in the server has been modified into the third identifier, the first mapping relationship in the mapping relationship table is no longer applicable, and the first mapping relationship in the mapping relationship table needs to be replaced by the second mapping relationship, so as to achieve the purpose of updating the mapping relationship table.
The first mapping relationship of this embodiment includes a first identifier and a second identifier. When the first mapping relationship is updated through the third identifier, the first mapping relationship can also be located, and the second identifier in the first mapping relationship is directly replaced by the third identifier, so that the replaced first mapping relationship is determined as the second mapping relationship, and the purpose of updating the mapping relationship table is achieved.
Optionally, when the second identifier needs to be modified, the server may communicate with a developer of the client to confirm the modified third identifier, and the client only needs to modify the first mapping relationship in the mapping relationship table according to the third identifier, so that the influence on the website function caused by the modification of the second identifier by the server is greatly reduced.
In this embodiment, the mapping relationship table may decouple the constraints of the identifiers of the data of the client and the server, and the client only needs to ensure the logical stability of itself. When the server needs to modify the identifier of the data, the client only needs to modify the mapping relation in the mapping relation table, and the stable operation of the website can be ensured.
As an optional implementation manner, in step S108, the obtaining of the target data returned by the server in response to the target request includes: acquiring a response result returned by the server in response to the target request; and acquiring target data from the response result.
In this embodiment, after sending the target request carrying the second identifier to the server, the server responds to the target request to obtain a response result, and sends the response result to the client. After receiving the response result, the client extracts the required target data from the response result.
As an optional implementation, the obtaining the target data from the response result includes: analyzing the response result to obtain target data and a second identifier; mapping the second identifier to the first identifier according to a first mapping relation; and associating the mapped first identifier with the target data so as to process the target data associated with the first identifier.
In this embodiment, when the target data is obtained from the response result, the response result may be analyzed to obtain the target data and the second identifier, and since the first mapping relationship is used to indicate a corresponding relationship between the first identifier and the second identifier, the second identifier is mapped to the first identifier through the first mapping relationship, and the first identifier is further associated with the obtained target data, that is, the target data is mapped from the server to the client, and the client further processes the target data associated with the first identifier, so that the processed target data may be displayed on the client.
In this embodiment, the first identifier required in the logic of the client is not required to be changed, and only when a target request needs to be initiated to the server, a data request needs to be performed according to the second identifier agreed by the client and the server. Therefore, the client maintains the first mapping relationship, and when the client uses the fixed first identifier to perform various service logic processing, the client can initiate a target request to the backend, map the first identifier to the corresponding second identifier, and then send the target request carrying the second identifier to the server. The server responds to the target request, returns a response result to the client, and the client analyzes the response result and maps the target data in the response result back to the first identifier through the second identifier. When the server needs to modify the second identifier, the client needs to modify the first mapping relation in the mapping relation table, and does not need to modify the function logic in the website any more, so that the influence of the modification of the second identifier by the server on the website function is greatly reduced, and the efficiency of requesting data is improved.
Example 2
The data request method according to the embodiment of the present invention is described below with reference to a preferred embodiment, specifically, a key with a data identifier as data is exemplified.
This embodiment is directed to the acquisition of dynamic data, which when requesting data from a server, needs to tell the server what type of data is needed, how much is needed, the order in the data returned, etc. For example, data such as items, media, click rate, exposure, click rate, etc. are required, the number of the data is 1-100, and the data is sorted according to the descending order of the exposure. These rules may require the client to assemble different requests as required by the user operation, and then initiate the assembled requests to the backend. In the process, keys (keys) of all data are agreed by the client and the server, namely, agreed keys which are unified and the same in the development process of the client and the server.
However, when the server needs to modify the Key of the agreed data for some reason, the client needs to perform synchronous update to ensure normal use of the website in order to ensure that the Key of the data in the server is the same as the Key of the data in the client. If the modified Key is more involved in the front-end logic, all parts of data in the code in the client logic must be traversed, the original Key is replaced by the modified Key, and then the website can be ensured to be normally used after comprehensive testing.
The above solution is troublesome for data request, and the change of Key of data in the server may cause serious consequences and affect the stability of website use.
The data request method of this embodiment can solve the above-described problems.
Fig. 2 is a flow chart of another data request method according to an embodiment of the invention. As shown in fig. 2, the method may include:
in step S201, a Key1 of data in the logic of the client is acquired.
The logic of the different functional modules of the client is developed using Key 1. The Key1 does not need to be changed in the logic of the client, that is, a fixed Key can be used for processing various business logics at the client.
Step S202, mapping the data Key1 to the data Key2 in a mapping relationship table, wherein the mapping relationship table maintains the mapping relationship between Key1 and Key 2.
The client of this embodiment maintains a mapping table, which is a dictionary, for converting the Key1 into the agreed Key 2.
Step S203, a request carrying the agreed Key2 is sent to the server.
And step S204, acquiring data returned by the server responding to the request, wherein the data carries a Key 2.
Step S205, the returned data is analyzed, mapped to Key1 according to Key2, and Key1 is associated with the data.
In step S206, the data associated with Key1 is logically processed.
In this embodiment, when the server needs to modify the Key2 of the data, the client only needs to modify the mapping relationship between the Key1 and the original Key2 in the mapping relationship table into the mapping relationship between the Key1 and the modified Key2, and can complete the modification, and maintain the updated mapping relationship table, and it is no longer necessary to modify the functional logic in the website, thereby greatly reducing the influence on the website function. Alternatively, when the server needs to modify the Key2, after performing communication confirmation with the client developer, the client developer modifies the mapping relationship in the mapping relationship table. Therefore, the client of the embodiment only maintains one mapping relationship table, which can conveniently solve the problem that after the server modifies the Key2 of the data, the logic that the client needs to modify is too much, which causes the influence on the data request of the client, and greatly reduces the influence on the functions of the website.
According to the embodiment, the restriction of Key of data of the client and the server can be decoupled through the mapping relation table, and the client only needs to ensure the logic stability of the client. When the server needs to modify the Key of the data, the server only needs to modify the mapping relation in the mapping relation table, so that the stable operation of the website can be ensured, and the efficiency of requesting the data is improved.
It should be noted that, with the development of the current technology, the service of the server interface is more prone to be micro-serviced, and the interface not only supports the use of the website of the client, but also can be used by other functions of other teams. If the mapping table is maintained in the background server, it may happen that several teams need several sets of mapping tables, and the micro-service of the server interface needs to be strongly coupled with the services of different clients. To reduce coupling, and even avoid this, this embodiment preferably maintains a mapping table in the client.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
Example 3
The embodiment of the invention also provides a data request device. It should be noted that the data request apparatus of this embodiment may be used to execute the data request method of this embodiment of the present invention.
Fig. 3 is a schematic diagram of a data request device according to an embodiment of the present invention. As shown in fig. 3, the data request apparatus 30 may include: a first acquisition unit 31, a mapping unit 32, a sending unit 33 and a second acquisition unit 34.
A first obtaining unit 31, configured to obtain a first identifier of target data to be requested in the client.
And the mapping unit 32 is configured to map the first identifier according to the first mapping relationship to obtain a second identifier, where the second identifier is used to obtain the target data in the server.
A sending unit 33, configured to send a target request carrying the second identifier to the server.
And a second obtaining unit 34, configured to obtain the target data returned by the server in response to the target request.
Optionally, the apparatus further comprises: a third obtaining unit, configured to obtain a mapping relationship table that is established in advance before mapping the first identifier according to the first mapping relationship to obtain the second identifier, where the mapping relationship table is used to store mapping relationships between identifiers of different data in the client and identifiers used for obtaining data in the server; and the determining unit is used for determining the first mapping relation in the mapping relation table.
Optionally, the determining unit includes: and the determining module is used for determining the first mapping relation from the mapping relation table according to the first identifier.
Optionally, the apparatus further comprises: a fourth obtaining unit, configured to obtain a third identifier, where the third identifier is an identifier obtained after the second identifier is updated in the server; and the updating unit is used for updating the first mapping relation through the third identifier to obtain a second mapping relation.
Optionally, the update unit includes: the establishing module is used for establishing a second mapping relation between the first identifier and the third identifier and replacing the first mapping relation with the second mapping relation; or the replacing module is used for replacing the second identifier in the first mapping relation with the third identifier to obtain a second mapping relation.
Optionally, the second obtaining unit 34 includes: the first acquisition module is used for acquiring a response result returned by the server in response to the target request; and the second acquisition module is used for acquiring the target data from the response result.
Optionally, the second obtaining module includes: the analysis module is used for analyzing the response result to obtain target data and a second identifier; the mapping module is used for mapping the second identifier to the first identifier according to a first mapping relation; and the association module is used for associating the mapped first identifier with the target data so as to process the target data associated with the first identifier.
In this embodiment, a first obtaining unit 31 obtains a first identifier of target data to be requested in a client, and a mapping unit 32 maps the first identifier according to a first mapping relationship to obtain a second identifier, where the second identifier is used to obtain the target data in a server, a sending unit 33 sends a target request carrying the second identifier to the server, and a second obtaining unit 34 obtains the target data returned by the server in response to the target request. That is, the identification of the data at the client does not need to be changed whether the identification of the data at the server is modified or not, the client only needs to maintain the mapping relationship between the identification of the data at the client and the identification of the data at the server, the fixed identification of the data in the client is mapped to the appointed identification of the data in the server through the mapping relation, and then the requested data is obtained by carrying the identification of the data in the server, thereby avoiding the problem that the identification of the data used in the client and the server is the same, when the server needs to modify the agreed data identifier for some reason, the identifier of the data in the client needs to be updated synchronously, so that the complexity of data request is reduced, the technical problem of low efficiency of data request is solved, and the technical effect of improving the efficiency of data request is achieved.
Example 4
In this embodiment, the data request device includes a processor and a memory, the first acquiring unit 31, the mapping unit 32, the sending unit 33, and the acquiring unit 34 are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the purpose of improving the efficiency of requesting data is achieved by adjusting the kernel parameters.
Example 5
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the data requesting method when executed by a processor.
Example 6
The embodiment of the invention provides electronic equipment.
Fig. 4 is a schematic diagram of an electronic device according to an embodiment of the invention. As shown in fig. 4, the electronic device 40 includes at least one processor 401, and at least one memory 402 connected to the processor, a bus 403; the processor 401 and the memory 402 complete communication with each other through the bus 403; the processor 401 is used to call program instructions in the memory 402 to perform the data request method described above. The electronic device 40 herein may be a server, a PC, a PAD, a cell phone, etc.
Example 7
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
acquiring a first identifier of target data to be requested in a client; mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring target data in a server; sending a target request carrying a second identifier to a server; and acquiring target data returned by the server in response to the target request.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: before mapping the first identifier according to the first mapping relation to obtain a second identifier, acquiring a pre-established mapping relation table, wherein the mapping relation table is used for storing the mapping relation between identifiers of different data in a client and identifiers used for acquiring data in a server; a first mapping relationship is determined in a mapping relationship table.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: and determining a first mapping relation from the mapping relation table according to the first identifier.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: acquiring a third identifier, wherein the third identifier is an identifier updated by the second identifier in the server; and updating the first mapping relation through the third identifier to obtain a second mapping relation.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: establishing a second mapping relation between the first identifier and the third identifier, and replacing the first mapping relation with the second mapping relation; or replacing the second identifier in the first mapping relation with the third identifier to obtain a second mapping relation.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: acquiring a response result returned by the server in response to the target request; and acquiring target data from the response result.
When executed on a data processing device, is further adapted to perform a procedure for initializing the following method steps: analyzing the response result to obtain target data and a second identifier; mapping the second identifier to the first identifier according to a first mapping relation; and associating the mapped first identifier with the target data so as to process the target data associated with the first identifier.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method of requesting data, comprising:
acquiring a first identifier of target data to be requested in a client;
mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring the target data in a server;
sending a target request carrying the second identifier to the server;
and acquiring the target data returned by the server in response to the target request.
2. The method of claim 1, wherein before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the method further comprises:
acquiring a pre-established mapping relation table, wherein the mapping relation table is used for storing the mapping relation between the identification of different data in a client and the identification used for acquiring the data in a server;
and determining the first mapping relation in the mapping relation table.
3. The method of claim 2, wherein determining the first mapping in the mapping table comprises:
and determining the first mapping relation from the mapping relation table according to the first identifier.
4. The method of claim 1, further comprising:
acquiring a third identifier, wherein the third identifier is an identifier of the second identifier after being updated in the server;
and updating the first mapping relation through the third identifier to obtain a second mapping relation.
5. The method of claim 4, wherein updating the first mapping relationship through the third identifier to obtain a second mapping relationship comprises:
establishing a second mapping relation between the first identifier and the third identifier, and replacing the first mapping relation with the second mapping relation; or
And replacing the second identifier in the first mapping relation with the third identifier to obtain the second mapping relation.
6. The method of claim 1, wherein obtaining the target data returned by the server in response to the target request comprises:
acquiring a response result returned by the server in response to the target request;
and acquiring the target data from the response result.
7. The method of claim 6, wherein obtaining the target data from the response result comprises:
analyzing the response result to obtain the target data and the second identifier;
mapping the second identifier to the first identifier according to the first mapping relation;
and associating the mapped first identifier with the target data so as to process the target data associated with the first identifier.
8. A data request apparatus, comprising:
the first acquisition unit is used for acquiring a first identifier of target data to be requested in the client;
the mapping unit is used for mapping the first identifier according to a first mapping relation to obtain a second identifier, wherein the second identifier is used for acquiring the target data in a server;
a sending unit, configured to send a target request carrying the second identifier to the server;
and the second acquisition unit is used for acquiring the target data returned by the server in response to the target request.
9. A storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the storage medium is located to perform the method of any one of claims 1 to 7.
10. An electronic device comprising to a processor, and at least one memory, bus connected to the processor;
the processor and the memory complete mutual communication through the bus;
the processor is configured to invoke program instructions in the memory to perform the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910867269.2A CN112491943B (en) | 2019-09-12 | 2019-09-12 | Data request method, device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910867269.2A CN112491943B (en) | 2019-09-12 | 2019-09-12 | Data request method, device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112491943A true CN112491943A (en) | 2021-03-12 |
CN112491943B CN112491943B (en) | 2024-08-27 |
Family
ID=74920933
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910867269.2A Active CN112491943B (en) | 2019-09-12 | 2019-09-12 | Data request method, device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112491943B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113343088A (en) * | 2021-06-09 | 2021-09-03 | 北京奇艺世纪科技有限公司 | Data processing method, system, device, equipment and storage medium |
CN114363339A (en) * | 2022-01-07 | 2022-04-15 | 中国工商银行股份有限公司 | Traffic switching method, apparatus, system, device, medium, and program product |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105357329A (en) * | 2015-10-12 | 2016-02-24 | 广州市百果园网络科技有限公司 | Business data transmission method, device and system for use in cross-Internet data center (IDC) network environment |
CN105516389A (en) * | 2015-12-23 | 2016-04-20 | 郑州悉知信息科技股份有限公司 | Method and device for modifying domain name and IP mapping relation |
CN105975352A (en) * | 2016-04-28 | 2016-09-28 | 努比亚技术有限公司 | Cache data processing method and server |
CN106484820A (en) * | 2016-09-26 | 2017-03-08 | 华为技术有限公司 | A kind of renaming method, access method and device |
CN108200110A (en) * | 2016-12-08 | 2018-06-22 | 杭州海康威视系统技术有限公司 | A kind of data processing method, apparatus and system |
CN108572986A (en) * | 2017-03-13 | 2018-09-25 | 华为软件技术有限公司 | A kind of method and node device of data update |
CN109873839A (en) * | 2017-12-01 | 2019-06-11 | 华为技术有限公司 | Method, server and the distributed system of data access |
-
2019
- 2019-09-12 CN CN201910867269.2A patent/CN112491943B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105357329A (en) * | 2015-10-12 | 2016-02-24 | 广州市百果园网络科技有限公司 | Business data transmission method, device and system for use in cross-Internet data center (IDC) network environment |
CN105516389A (en) * | 2015-12-23 | 2016-04-20 | 郑州悉知信息科技股份有限公司 | Method and device for modifying domain name and IP mapping relation |
CN105975352A (en) * | 2016-04-28 | 2016-09-28 | 努比亚技术有限公司 | Cache data processing method and server |
CN106484820A (en) * | 2016-09-26 | 2017-03-08 | 华为技术有限公司 | A kind of renaming method, access method and device |
CN108200110A (en) * | 2016-12-08 | 2018-06-22 | 杭州海康威视系统技术有限公司 | A kind of data processing method, apparatus and system |
CN108572986A (en) * | 2017-03-13 | 2018-09-25 | 华为软件技术有限公司 | A kind of method and node device of data update |
CN109873839A (en) * | 2017-12-01 | 2019-06-11 | 华为技术有限公司 | Method, server and the distributed system of data access |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113343088A (en) * | 2021-06-09 | 2021-09-03 | 北京奇艺世纪科技有限公司 | Data processing method, system, device, equipment and storage medium |
CN114363339A (en) * | 2022-01-07 | 2022-04-15 | 中国工商银行股份有限公司 | Traffic switching method, apparatus, system, device, medium, and program product |
CN114363339B (en) * | 2022-01-07 | 2024-01-30 | 中国工商银行股份有限公司 | Traffic switching method, device, system, apparatus, medium and program product |
Also Published As
Publication number | Publication date |
---|---|
CN112491943B (en) | 2024-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109614823B (en) | Data processing method, device and equipment | |
CN109002362B (en) | Service method, device and system and electronic equipment | |
CN112074815B (en) | Input and output pattern mapping | |
CN109033406B (en) | Method, apparatus and storage medium for searching blockchain data | |
CN110162512B (en) | Log retrieval method, device and storage medium | |
CN111786984B (en) | Pod communication connection method and device, electronic equipment and storage medium | |
CN106649488B (en) | Method and device for calling multi-data-source interactive interface | |
US20210357461A1 (en) | Method, apparatus and storage medium for searching blockchain data | |
CN107103011B (en) | Method and device for realizing terminal data search | |
CN112579118B (en) | Method, device, system, medium and equipment for updating configuration information of micro-service | |
CN103064960A (en) | Method and equipment for database query | |
CN114116065A (en) | Method and device for acquiring topological graph data object and electronic equipment | |
CN109062906B (en) | Translation method and device for program language resources | |
CN113448985A (en) | API (application program interface) interface generation method, calling method and device and electronic equipment | |
CN112491943A (en) | Data request method, device, storage medium and electronic equipment | |
CN108647102B (en) | Service request processing method and device of heterogeneous system and electronic equipment | |
CN107395663B (en) | Data acquisition method and device | |
CN114675982A (en) | General method and system for acquiring data of service integration system | |
CN110532248B (en) | CMDB-based server application information acquisition and adjustment method | |
CN112597105A (en) | Processing method of file associated object, server side equipment and storage medium | |
CN109068286B (en) | Information analysis method, medium and equipment | |
CN110489392A (en) | Data access method, device, system, storage medium and equipment between multi-tenant | |
CN116049114A (en) | Processing method, processor and storage medium for internationalization log | |
CN113672660B (en) | Data query method, device and equipment | |
CN116382640A (en) | Method, device, equipment and storage medium for managing micro-service |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |