Data request method, device, storage medium and electronic device
By maintaining the mapping relationship between the data identifier and the server identifier on the client side, the problem of low data request efficiency in the existing technology is solved, and more efficient data request and stable operation of the website are achieved.
Patent Information
- Application Number
- CN201910867269.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-12
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-09-12
AI Technical Summary
In the existing technology, the data request efficiency between the client and the server is low, resulting in unstable website use. Especially when the server needs to modify the data identifier, it needs to traverse the client logic code for synchronous updates, which is complex and inefficient.
By maintaining the mapping relationship between the data identifier and the server identifier on the client, and using the mapping relationship to map the fixed identifier in the client to the identifier in the server, data requests are made, avoiding the synchronous update operation of the client and server identifiers. .
It reduces the complexity of data requests, improves the efficiency of data requests, and ensures the stable operation of the website. Even if the server modifies the data identification, the client does not need to change its identification, reducing the modification of functional logic.
Smart Images

Figure CN112491943B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data request method, device, storage medium and electronic device. Background Art
[0002] Currently, when a client requests data from a server, it needs to pre-agreed with the server on the identifier of the data to be requested, which may be the key of the data. The client and the server then communicate directly through the agreed identifier of the data.
[0003] However, when the server needs to modify the agreed data identifier for some reason, the client needs to synchronize and update the data identifier because the identifier of the data on the client and the identifier of the data on the server need to be unified, so as to ensure the normal use of the website. If the identifier of the modified data involves a lot of logic in the client, it is necessary to traverse all parts of the data in the client's logic code, replace the original data identifier with the identifier of the modified data, and then conduct a comprehensive test before making a data request to ensure the normal use of the website.
[0004] The above solution is rather cumbersome, and if a problem occurs in any link, it may lead to serious consequences. The effective request for data cannot be guaranteed, resulting in low efficiency in requesting data, and thus the stable use of the website cannot be guaranteed.
[0005] With respect to the problem of low efficiency in requesting data in the prior art, no effective solution has been proposed yet. Summary of the invention
[0006] The main purpose of the present invention is to provide a data request method, device, storage medium and electronic device to at least solve the technical problem of low efficiency in requesting data.
[0007] In order to achieve the above-mentioned purpose, according to one aspect of the present invention, a data request method is provided. The method may include: obtaining a first identifier of the target data to be requested in the client; mapping the first identifier according to a first mapping relationship to obtain a second identifier, wherein the second identifier is used to obtain the target data in the server; sending a target request carrying the second identifier to the server; and obtaining the target data returned by the server in response to the target request.
[0008] Optionally, before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the method also includes: obtaining a pre-established mapping relationship table, wherein the mapping relationship table is used to store the mapping relationship between the identifiers of different data in the client and the identifiers used to obtain data in the server; determining the first mapping relationship in the mapping relationship table.
[0009] Optionally, determining the first mapping relationship in the mapping relationship table includes: determining the first mapping relationship from the mapping relationship table according to the first identifier.
[0010] Optionally, the method further includes: acquiring a third identifier, wherein the third identifier is an identifier obtained by updating the second identifier in the server; and updating the first mapping relationship by using the third identifier to obtain a second mapping relationship.
[0011] Optionally, updating the first mapping relationship through the third identifier to obtain the second mapping relationship includes: establishing a second mapping relationship between the first identifier and the third identifier, and replacing the first mapping relationship with the second mapping relationship; or replacing the second identifier in the first mapping relationship with the third identifier to obtain the second mapping relationship.
[0012] Optionally, obtaining target data returned by the server in response to the target request includes: obtaining a response result returned by the server in response to the target request; and obtaining the target data from the response result.
[0013] Optionally, obtaining target data from the response result includes: parsing the response result to obtain the target data and a second identifier; mapping the second identifier to the first identifier according to a first mapping relationship; associating the mapped first identifier with the target data to process the target data associated with the first identifier.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present invention, a data request device is also provided. The device may include: a first acquisition unit, used to acquire a first identifier of the target data to be requested in the client; a mapping unit, used to map the first identifier according to a first mapping relationship to obtain a second identifier, wherein the second identifier is used to acquire the target data in the server; a sending unit, used to send a target request carrying the second identifier to the server; and a second acquisition unit, used to acquire the target data returned by the server in response to the target request.
[0015] In order to achieve the above object, according to another aspect of the present invention, a storage medium is provided, wherein the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the data request method of the embodiment of the present invention.
[0016] In order to achieve the above-mentioned object, according to another aspect of the present invention, an electronic device is also provided. The electronic device includes a processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; and the processor is used to call program instructions in the memory to execute the data request method of the embodiment of the present invention.
[0017] Through the present invention, the first identifier of the target data to be requested is obtained in the client; the first identifier is mapped according to the first mapping relationship to obtain the second identifier, wherein the second identifier is used to obtain the target data in the server; a target request carrying the second identifier is sent to the server; and the target data returned by the server in response to the target request is obtained. In other words, regardless of whether the identifier of the data in the server is modified, the identifier of the data in the client does not need to be changed. The client only needs to maintain the mapping relationship between the identifier of the data in the client and the identifier of the data in the server. Through the mapping relationship, the fixed identifier of the data in the client is mapped to the identifier of the agreed data in the server, and then the requested data is obtained by carrying the identifier of the data in the server, thereby avoiding the need to synchronize and update the identifier of the data in the client when the server needs to modify the identifier of the agreed data for some reason because the identifier of the data used in the client and the server must be the same, thereby reducing the complexity of the data request, solving the technical problem of low efficiency in requesting data, and achieving the technical effect of improving the efficiency of requesting data. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0019] Figure 1 is a flow chart of a data request method according to an embodiment of the present invention;
[0020] Figure 2 is a flow chart of another data request method according to an embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a data requesting device according to an embodiment of the present invention; and
[0022] Figure 4 is a schematic diagram of a device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0023] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] Example 1
[0027] An embodiment of the present invention provides a data request method.
[0028] There are two types of data in a website: static data, which is basic data of the website, such as the website name, etc.; and dynamic data, which needs to be obtained by initiating a request to the server, such as real-time data, etc. The data targeted by the data request method of this embodiment can be dynamic data.
[0029] Figure 1 FIG. 1 is a flow chart of a data request method according to an embodiment of the present invention. Figure 1 As shown, the method may include:
[0030] Step S102: obtaining a first identifier of the target data to be requested in the client.
[0031] In the technical solution provided in the above step S102 of the present invention, the client obtains the first identifier of the target data to be requested from the server in the client.
[0032] In this embodiment, the client is also the front end, and the server is also the service end and the back end. The target data to be requested can be dynamic data required by the client when performing logical processing. Different functional modules in the client's website need to use the data identifier to request data from the server, where the identifier can be the key of the data.
[0033] Optionally, the target data to be requested in this embodiment has a first identifier in the client, and the logic of the client can be developed using the first identifier. The first identifier can be the key of the target data in the client. The composition rule of the target data in this embodiment can be determined specifically according to the user's operation, wherein the target data may include data type, amount of data, order of data return, etc. It can be data such as projects, media, clicks, exposure, click-through rate, etc., or it can be data in a certain range (for example, 1-100 items), and the data can be sorted in descending order of exposure, etc. There is no restriction here.
[0034] Step S104: Map the first identifier according to the first mapping relationship to obtain a second identifier.
[0035] In the technical solution provided in the above step S104 of the present invention, after obtaining the first identifier of the target data to be requested in the client, the first identifier is mapped according to the first mapping relationship to obtain the second identifier.
[0036] In this embodiment, the client maintains a first mapping relationship between the first identifier and the second identifier, and the first mapping relationship is a rule used to indicate the association relationship and the correspondence relationship between the first identifier and the second identifier. The second identifier can be a key for obtaining target data in the server, that is, the objects targeted by the first identifier and the second identifier are both target data.
[0037] Optionally, the identifier of the target data in the server of this embodiment can be the first identifier agreed upon with the client at the beginning, that is, it is unified with the first identifier of the target data in the client, so that the communication between the client and the server is established through the unified first identifier, and later the server needs to change the first identifier to the second identifier for some reason, but keep the first identifier of the target data in the client 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 changes the first identifier to the second identifier, the client establishes a first mapping relationship between the first identifier and the second identifier, and the second identifier is the identifier agreed upon between the server and the client for obtaining the target data.
[0038] Step S106: Send a target request carrying the second identifier to the server.
[0039] In the technical solution provided in the above step S106 of the present invention, after the first identifier is mapped according to the first mapping relationship to obtain the second identifier, a target request carrying the second identifier is sent to the server.
[0040] In this embodiment, the second identifier is a key agreed upon by the server and the client for obtaining target data. Therefore, when the client needs to send a target request to the server, it needs to send a target request carrying the second identifier that has been converted from the first identifier. The target request can be used to request the server to obtain the target data, that is, a data acquisition request.
[0041] Step S108, obtaining the target data returned by the server in response to the target request.
[0042] In the technical solution provided in the above step S108 of the present invention, after sending a target request carrying a 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. The client obtains the target data, can perform business logic processing on the target data, and then can display the processed data on the client interface.
[0043] Through the above steps S102 to S108, the first identifier of the target data to be requested is obtained in the client; the first identifier is mapped according to the first mapping relationship to obtain the second identifier, wherein the second identifier is used to obtain the target data in the server; a target request carrying the second identifier is sent to the server; and the target data returned by the server in response to the target request is obtained. In other words, regardless of whether the identifier of the data in the server is modified, the identifier of the data in the client does not need to be changed. The client only needs to maintain the mapping relationship between the identifier of the data in the client and the identifier of the data in the server. Through the mapping relationship, the fixed identifier of the data in the client is mapped to the agreed identifier of the data in the server, and then the requested data is obtained by carrying the identifier of the data in the server, thereby avoiding the need to synchronize and update the identifier of the data in the client when the server needs to modify the identifier of the agreed data for some reason because the identifier of the data used in the client and the server must be the same, thereby reducing the complexity of the data request, solving the technical problem of low efficiency in requesting data, and achieving the technical effect of improving the efficiency of requesting data.
[0044] As an optional implementation, in step S104, before the first identifier is mapped according to the first mapping relationship to obtain the second identifier, the method also includes: obtaining a pre-established mapping relationship table, wherein the mapping relationship table is used to store the mapping relationship between the identifiers of different data in the client and the identifiers used to obtain data in the server; and determining the first mapping relationship in the mapping relationship table.
[0045] In this embodiment, a mapping relationship table can be pre-established in the client, and the mapping relationship table is also a dictionary for searching for a second identifier corresponding to a first identifier. Optionally, the identifiers of different data in the client and the identifiers used to obtain the data in the server are pre-acquired, for example, data 1 (Key11, Key21), data 2 (Key12, Key22), data 3 (Key13, Key23), etc., and the mapping relationship between the identifiers of different data in the client and the identifiers used to obtain the data in the server is stored in the mapping relationship table, thereby achieving the purpose of establishing the mapping relationship table, wherein the different data includes the above-mentioned target data.
[0046] Before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the above-mentioned mapping relationship table is obtained, the first mapping relationship is determined in the mapping relationship table, and then the first identifier is mapped according to the first mapping relationship to obtain the second identifier, a target request carrying the second identifier is sent to the server, and the target data returned by the server in response to the target request is obtained, thereby achieving the effect of improving the efficiency of requesting data.
[0047] As an optional implementation manner, determining the first mapping relationship in the mapping relationship table includes: determining the first mapping relationship from the mapping relationship table according to the first identifier.
[0048] In this embodiment, when determining the first mapping relationship in the mapping relationship table, the first mapping relationship can be determined from the mapping relationship table according to the first identifier. Optionally, the first identifier of 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. The first mapping relationship between the first identifier and the second identifier can be determined by searching the first identifier in the column where the first identifier is located, without searching in the column where the second identifier is located, thereby achieving the purpose of accurately determining the first mapping relationship from the mapping relationship table according to the first identifier.
[0049] As an optional implementation, the method further includes: obtaining a third identifier, wherein the third identifier is an identifier obtained by updating the second identifier in the server; and updating the first mapping relationship by using the third identifier to obtain a second mapping relationship.
[0050] In this embodiment, the second identifier of the target data in the server can be modified as needed. Optionally, after obtaining the target data returned by the server in response to the target request, if the second identifier is updated to the third identifier in the server, that is, the third identifier is the identifier agreed upon by the server and the client to be used to obtain the target data next, then the original first mapping relationship indicating the first identifier and the second identifier is no longer applicable. Optionally, the client obtains the third identifier, and only updates the first mapping relationship through the third identifier to obtain the second mapping relationship, and maintains the second mapping relationship on the client, without modifying the first identifier of the target data on the client, and no longer needs to modify the functional logic in the website, thereby avoiding the problem that the client needs to modify too much logic due to the server modifying the second identifier of the target data, making it impossible to ensure the stable use of the website, thereby achieving the effect of improving the efficiency of requesting data.
[0051] Optionally, after the first mapping relationship is updated by the third identifier to obtain the second mapping relationship, when obtaining the first identifier, the first identifier is mapped according to the second mapping relationship to obtain the third identifier, and the third identifier is used to obtain the target data in the server, and then a target request carrying the third identifier is sent to the server to obtain the target data returned by the server in response to the target request.
[0052] As an optional implementation, updating the first mapping relationship through a third identifier to obtain a second mapping relationship includes: establishing a second mapping relationship between the first identifier and the third identifier, and replacing the first mapping relationship with the second mapping relationship; or replacing the second identifier in the first mapping relationship with the third identifier to obtain the second mapping relationship.
[0053] In this embodiment, when the first mapping relationship is updated through the third identifier, the first identifier and the third identifier can be associated first to obtain the second mapping relationship. Since the second identifier of the target data in the server has been changed to the third identifier, the first mapping relationship in the mapping relationship table is no longer applicable. It is necessary to replace the first mapping relationship in the mapping relationship table with the second mapping relationship, thereby achieving the purpose of updating the mapping relationship table.
[0054] 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 with the third identifier, so that the replaced first mapping relationship is determined as the second mapping relationship, thereby achieving the purpose of updating the mapping relationship table.
[0055] Optionally, when the server needs to modify the second identifier, it can communicate with the client's developer to confirm the modified third identifier. The client only needs to modify the first mapping relationship in the mapping relationship table according to the third identifier, thereby greatly reducing the impact on the website function caused by the server's modification of the second identifier.
[0056] In this embodiment, the mapping table can decouple the constraints of the data identification of the client and the server, and the client only needs to ensure the stability of its logic. When the server needs to modify the data identification, the client only needs to modify the mapping relationship in the mapping table to ensure the stable operation of the website.
[0057] As an optional implementation, step S108, obtaining target data returned by the server in response to the target request includes: obtaining a response result returned by the server in response to the target request; and obtaining the target data from the response result.
[0058] In this embodiment, after sending the target request carrying the second identifier to the server, the server responds to the target request, obtains 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.
[0059] As an optional implementation, obtaining target data from the response result includes: parsing the response result to obtain the target data and a second identifier; mapping the second identifier to the first identifier according to a first mapping relationship; associating the mapped first identifier with the target data to process the target data associated with the first identifier.
[0060] In this embodiment, when obtaining the target data from the response result, the response result can be parsed to obtain the target data and the second identifier. Since the first mapping relationship is used to indicate the correspondence between the first identifier and the second identifier, the second identifier is mapped to the first identifier through the first mapping relationship, and then the first identifier is associated with the obtained target data. That is, the target data is mapped back to the client from the server, and the client then processes the target data associated with the first identifier, and the processed target data can be displayed on the client.
[0061] In this embodiment, the first identifier required in the logic of the client does not need to be changed. Only when it is necessary to initiate a target request to the server, it is necessary to make a data request according to the second identifier agreed upon by the client and the server. Therefore, the client maintains the first mapping relationship. When the client uses a fixed first identifier to perform various business logic processing, it can initiate a target request to the backend, map the first identifier to the corresponding second identifier, and then send a target request carrying the second identifier to the server. The server responds to the target request and returns a response result to the client. The client parses the response result and maps the target data therein from the second identifier back to the first identifier. When the server needs to modify the second identifier, the client also needs to modify the first mapping relationship in the mapping relationship table, and no longer needs to modify the functional logic in the website, which greatly reduces the impact of the server's modification of the second identifier on the website function, thereby improving the efficiency of data requests.
[0062] Example 2
[0063] The data request method of the embodiment of the present invention is described below in conjunction with a preferred implementation manner, and is specifically described by taking the identifier of the data as the key of the data as an example.
[0064] This embodiment aims at obtaining dynamic data. When requesting data from the server, it is necessary to tell the server what type of data is needed, how much is needed, and the order in the returned data. For example, data such as projects, media, clicks, exposures, and click-through rates are required, with a quantity of 1-100, and are sorted in descending order of exposure. These rules may require the client to assemble different requests according to the requirements of user operations, and then initiate the assembled requests to the backend. In this process, the key of each data is agreed upon by the client and the server, that is, a unified and identical key agreed upon during the development of the client and the server.
[0065] However, when the server needs to modify the agreed data key for some reason, in order to ensure that the key of the data in the server and the key in the client are the same, the client needs to be updated synchronously to ensure the normal use of the website. If the modified key involves a lot of front-end logic, it is necessary to traverse all parts of the data in the client logic code, replace the original key with the modified key, and then conduct a comprehensive test to ensure the normal use of the website.
[0066] The above solution is more troublesome for data requests. Changes in the key of the data in the server may lead to more serious consequences and affect the stability of website use.
[0067] The data request method of this embodiment can solve the above problems.
[0068] Figure 2 FIG. 1 is a flow chart of another data request method according to an embodiment of the present invention. Figure 2 As shown, the method may include:
[0069] Step S201, obtaining Key1 of the data in the logic of the client.
[0070] The logic of different functional modules of the client is developed using Key 1. Key 1 does not need to be changed in the logic of the client, that is, a fixed Key can be used on the client to process various business logics.
[0071] Step S202: Map the data Key1 to the data Key2 in a mapping relationship table, wherein the mapping relationship table maintains a mapping relationship between Key1 and Key2.
[0072] The client of this embodiment maintains a mapping relationship table, which is also a dictionary and is used to convert Key1 into an agreed Key2.
[0073] Step S203: Send a request carrying the agreed Key2 to the server.
[0074] Step S204, obtaining the data returned by the server in response to the request, wherein the data carries Key2.
[0075] Step S205, parse the returned data, map Key2 to Key1, and associate Key1 with the data.
[0076] Step S206, performing logical processing on the data associated with Key1.
[0077] In this embodiment, when the server needs to modify the Key2 of the data, the client only needs to modify the mapping relationship between Key1 and the original Key2 in the mapping relationship table to the mapping relationship between Key1 and the modified Key2 to complete the modification and maintain the updated mapping relationship table. There is no need to modify the functional logic in the website, thereby greatly reducing the impact on the website function. Optionally, when the server needs to modify Key2, the client developer can communicate and confirm with the client developer, and then the client developer modifies the mapping relationship in the mapping relationship table. Therefore, the client of this embodiment only maintains one mapping relationship table, which can easily solve the problem that after the server modifies the Key2 of the data, the client needs to modify too much logic, resulting in an impact on the client's data request, and greatly reduce the impact that may be caused on the website's function.
[0078] This embodiment can decouple the constraints of the key of the data of the client and the server through the mapping relationship table, and the client only needs to ensure the stability of its own logic. When the server needs to modify the key of the data, the server only needs to modify the mapping relationship in the mapping relationship table to ensure the stable operation of the website, thereby improving the efficiency of requesting data.
[0079] It should be noted that with the development of current technology, the services of the server interface are more inclined to microservices. The interface not only supports the use of the client's website, but also other functions of other teams will use it. If the mapping relationship table is maintained in the background server, it may appear that several teams need several sets of mapping relationship tables, and the microservices of the server interface need to be strongly coupled with the business needs of different clients. In order to reduce coupling or even avoid this situation, this embodiment preferably maintains the mapping relationship table in the client.
[0080] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0081] Example 3
[0082] The embodiment of the present invention further provides a data request device. It should be noted that the data request device of this embodiment can be used to execute the data request method of the embodiment of the present invention.
[0083] Figure 3 is a schematic diagram of a data request device according to an embodiment of the present invention. Figure 3 As shown, the data requesting device 30 may include: a first acquiring unit 31 , a mapping unit 32 , a sending unit 33 and a second acquiring unit 34 .
[0084] The first obtaining unit 31 is used to obtain a first identifier of the target data to be requested in the client.
[0085] The mapping unit 32 is used to map the first identifier according to the first mapping relationship to obtain a second identifier, wherein the second identifier is used to obtain target data in the server.
[0086] The sending unit 33 is used to send a target request carrying a second identifier to the server.
[0087] The second acquisition unit 34 is used to acquire the target data returned by the server in response to the target request.
[0088] Optionally, the device also includes: a third acquisition unit, used to obtain a pre-established mapping relationship table before mapping the first identifier according to the first mapping relationship to obtain the second identifier, wherein the mapping relationship table is used to store the mapping relationship between the identifiers of different data in the client and the identifiers used to obtain data in the server; a determination unit, used to determine the first mapping relationship in the mapping relationship table.
[0089] Optionally, the determining unit includes: a determining module, configured to determine the first mapping relationship from a mapping relationship table according to the first identifier.
[0090] Optionally, the device further includes: a fourth acquisition unit, used to acquire a third identifier, wherein the third identifier is an identifier after the second identifier is updated in the server; and an update unit, used to update the first mapping relationship through the third identifier to obtain a second mapping relationship.
[0091] Optionally, the updating unit includes: an establishing module for establishing a second mapping relationship between the first identifier and the third identifier, and replacing the first mapping relationship with the second mapping relationship; or a replacing module for replacing the second identifier in the first mapping relationship with the third identifier to obtain the second mapping relationship.
[0092] Optionally, the second acquisition unit 34 includes: a first acquisition module, used to acquire a response result returned by the server in response to the target request; and a second acquisition module, used to acquire target data from the response result.
[0093] Optionally, the second acquisition module includes: a parsing module, used to parse the response result to obtain target data and a second identifier; a mapping module, used to map the second identifier to the first identifier according to a first mapping relationship; and an association module, used to associate the mapped first identifier with the target data to process the target data associated with the first identifier.
[0094] In this embodiment, the first identification of the target data to be requested in the client is obtained by the first obtaining unit 31, and the first identification is mapped according to the first mapping relationship by the mapping unit 32 to obtain the second identification, wherein the second identification is used to obtain the target data in the server, and the target request carrying the second identification is sent to the server by the sending unit 33, and the target data returned by the server in response to the target request is obtained by the second obtaining unit 34. That is to say, no matter whether the identification of the data in the server is modified or not, the identification of the data in the client does not need to be changed, and the client only needs to maintain the mapping relationship between the identification of the data in the client and the identification of the data in the server, and the fixed identification of the data in the client is mapped to the agreed identification of the data in the server through the mapping relationship, and then the requested data is obtained by carrying the identification of the data in the server, thereby avoiding the need to perform a synchronous update operation on the identification of the data in the client when the server needs to modify the identification of the agreed data for some reason because the identification of the data used in the client and the server must be the same, thereby reducing the complexity of the data request, solving the technical problem of low efficiency in requesting data, and achieving the technical effect of improving the efficiency of requesting data.
[0095] Example 4
[0096] In this embodiment, the data requesting device includes a processor and a memory. The first acquisition unit 31, mapping unit 32, sending unit 33 and acquisition 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.
[0097] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the efficiency of data requests can be improved by adjusting kernel parameters.
[0098] Example 5
[0099] An embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by a processor, the data request method is implemented.
[0100] Example 6
[0101] An embodiment of the present invention provides an electronic device.
[0102] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 4As shown, the electronic device 40 includes at least one processor 401, at least one memory 402 connected to the processor, and a bus 403; wherein the processor 401 and the memory 402 communicate with each other through the bus 403; the processor 401 is used to call the program instructions in the memory 402 to execute the above data request method. The electronic device 40 in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0103] Example 7
[0104] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the following method steps:
[0105] Obtain a first identifier of the target data to be requested in the client; map the first identifier according to a first mapping relationship to obtain a second identifier, wherein the second identifier is used to obtain the target data in the server; send a target request carrying the second identifier to the server; and obtain the target data returned by the server in response to the target request.
[0106] When executed on a data processing device, it is also suitable for executing an initialized program having the following method steps: before mapping a first identifier according to a first mapping relationship to obtain a second identifier, obtaining a pre-established mapping relationship table, wherein the mapping relationship table is used to store the mapping relationship between identifiers of different data in the client and identifiers used to obtain data in the server; determining the first mapping relationship in the mapping relationship table.
[0107] When executed on a data processing device, the program is also suitable for executing an initialization having the following method steps: determining a first mapping relationship from a mapping relationship table according to a first identifier.
[0108] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: obtaining a third identifier, wherein the third identifier is an identifier after the second identifier is updated in the server; updating the first mapping relationship through the third identifier to obtain a second mapping relationship.
[0109] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: establishing a second mapping relationship between the first identifier and the third identifier, and replacing the first mapping relationship with the second mapping relationship; or replacing the second identifier in the first mapping relationship with the third identifier to obtain the second mapping relationship.
[0110] When executed on a data processing device, the method is also suitable for executing a program that is initialized with the following method steps: obtaining a response result returned by a server in response to a target request; and obtaining target data from the response result.
[0111] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: parsing 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 relationship; associating the mapped first identifier with the target data to process the target data associated with the first identifier.
[0112] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0113] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0114] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0115] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0116] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0117] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0118] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A data request method, characterized in that: include: Obtaining a first identifier of the target data to be requested in the client; Mapping the first identifier according to a first mapping relationship to obtain a second identifier, wherein the second identifier is used to obtain the target data in the server; Sending a target request carrying the second identifier to the server; Acquire the target data returned by the server in response to the target request; The method further includes: when the second identifier is updated to a third identifier, updating the first mapping relationship through the third identifier to obtain a second mapping relationship; mapping the first identifier according to the second mapping relationship to obtain the target data after the second identifier is updated.
2. The method according to claim 1, characterized in that Before mapping the first identifier according to the first mapping relationship to obtain the second identifier, the method further includes: Acquire a pre-established mapping relationship table, wherein the mapping relationship table is used to store mapping relationships between identifiers of different data in the client and identifiers used to acquire the data in the server; The first mapping relationship is determined in the mapping relationship table.
3. The method according to claim 2, characterized in that Determining the first mapping relationship in the mapping relationship table includes: The first mapping relationship is determined from the mapping relationship table according to the first identifier.
4. The method according to claim 1, characterized in that: The first mapping relationship is updated by using the third identifier to obtain a second mapping relationship, including: establishing a second mapping relationship between the first identifier and the third identifier, and replacing the first mapping relationship with the second mapping relationship; or The second identifier in the first mapping relationship is replaced with the third identifier to obtain the second mapping relationship.
5. The method according to claim 1, characterized in that Acquiring the target data returned by the server in response to the target request includes: Obtaining a response result returned by the server in response to the target request; The target data is obtained from the response result.
6. The method according to claim 5, characterized in that Acquiring the target data from the response result includes: Parsing 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 relationship; The mapped first identifier is associated with the target data to process the target data associated with the first identifier.
7. A data requesting device, characterized in that: include: A first obtaining unit, used to obtain a first identifier of the target data to be requested in the client; a mapping unit, configured to map the first identifier according to a first mapping relationship to obtain a second identifier, wherein the second identifier is used to obtain the target data in the server; A sending unit, configured to send a target request carrying the second identifier to the server; A second acquisition unit, configured to acquire the target data returned by the server in response to the target request; The device is also used for: when the second identifier is updated to a third identifier, updating the first mapping relationship through the third identifier to obtain a second mapping relationship; mapping the first identifier according to the second mapping relationship to obtain the target data after the second identifier is updated.
8. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: The electronic device includes a processor, at least one memory and a bus connected to the processor; Wherein, the processor and the memory communicate with each other through the bus; The processor is used to call the program instructions in the memory to execute the method according to any one of claims 1 to 6.
