Interface determination method and device
By adding a device unique identification number and activation state ID to the request header, the method and device enable accurate determination of the called interface and its order, addressing the challenge of mobile banking troubleshooting.
Patent Information
- Application Number
- CN202411383565.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-31
AI Technical Summary
The inability to accurately determine the called interface and the calling order of interfaces on the mobile side during troubleshooting in mobile banking operations due to the lack of corresponding tools on the client side, despite the availability of comprehensive tools on the server side.
A method and device that involve adding a device unique identification number, activation state ID, and formatted timestamp to the request header of an interface call request, enabling the server to determine the called interface and the calling order by using these identifiers.
Accurately determines the called interface and the calling order on the server side, facilitating effective troubleshooting by correlating interface calls with device and application states.
Smart Images

Figure CN119225866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an interface determination method and device. Background Art
[0002] As mobile banking functions become more abundant, the frequency of daily operation and maintenance is also increasing. In the bank, the operation and maintenance tools on the server side are rich and complete, but on the client side, there are relatively few operation and maintenance tools, especially for locating feedback on client function problems. At present, there is traceid on the server side to connect the call links of each service interface, but on the mobile side, there is no corresponding way to connect the order of calling each interface on the mobile side, resulting in the inability to accurately determine the problematic interface and the order of interface calls when using the existing server logs for troubleshooting.
[0003] In summary, how to accurately determine the called interface and the calling order of the interfaces on the server side is a problem that technical personnel in this field need to solve urgently. Summary of the invention
[0004] In view of this, the present application provides an interface determination method and device, which aims to accurately determine the called interface and the calling order of the interface on the server side.
[0005] In a first aspect, the present application provides an interface determination method, comprising:
[0006] Before the client initiates an interface call request, the device unique identification number, activation state ID and formatted timestamp are added to the request header of the interface call request;
[0007] In the server, according to the unique identification number of the device, determine the interface called by the device corresponding to the unique identification number of the device;
[0008] In the server, according to the activation state id, the interface called by the application each time is determined;
[0009] In the server, the time sequence of the interface calls is determined according to the formatted timestamps.
[0010] Optionally, before the client initiates the interface call request, before adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0011] Add a class in the client; the class includes logic for processing the request header.
[0012] Optionally, before determining, according to the device unique identification number, an interface called by the device corresponding to the device unique identification number, the method further includes:
[0013] According to the request header, the log parameters of the server are adjusted.
[0014] Optionally, before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0015] Before the interface call request of the client is initiated, the user number is added to the request header of the interface call request;
[0016] In the server, according to the user number, an interface called by the user corresponding to the user number is determined.
[0017] Optionally, before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0018] Before the interface call request of the client is initiated, adding the scene type to the request header of the interface call request;
[0019] In the server, according to the scenario type, an interface to be called in the scenario corresponding to the scenario type is determined.
[0020] Optionally, before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0021] Before the client initiates the interface call request, the unique serial number of the scene is added to the request header of the interface call request;
[0022] In the server, according to the unique serial number of the scene, an interface to be called in the scene corresponding to the unique serial number of the scene is determined.
[0023] Optionally, before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0024] Before the interface call request of the client is initiated, adding the proximal service tag to the request header of the interface call request;
[0025] In the service end, an interface with the proximal service tag is determined according to the proximal service tag.
[0026] Optionally, before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes:
[0027] Before the interface call request of the client is initiated, adding the remote service tag to the request header of the interface call request;
[0028] In the server, an interface with the remote service tag is determined according to the remote service tag.
[0029] In a second aspect, the present application provides an interface determination device, including:
[0030] A first editing module, used for adding a device unique identification number, an activation state ID and a formatted timestamp to a request header of the interface call request before the client initiates the interface call request;
[0031] A first determination module is used to determine, in the server, an interface called by a device corresponding to the unique identification number of the device according to the unique identification number of the device;
[0032] A second determination module is used to determine, in the server, the interface called by the application each time according to the activation state ID;
[0033] The third determination module is used to determine the time sequence of the interface calls in the server according to the formatted timestamp.
[0034] Optionally, the device further comprises:
[0035] An adding module is used to add a class in the client; the class includes logic for processing the request header.
[0036] Optionally, the device further comprises:
[0037] The adjustment module is used to adjust the log parameters of the server according to the request header.
[0038] Optionally, the device further comprises:
[0039] A second editing module, used for adding the user number to the request header of the interface call request before the interface call request of the client is initiated;
[0040] The fourth determining module is used to determine, in the server, the interface called by the user corresponding to the user number according to the user number.
[0041] Optionally, the device further comprises:
[0042] A third editing module, used for adding the scene type to the request header of the interface call request before the interface call request of the client is initiated;
[0043] The fifth determination module is used to determine, in the server, an interface to be called in a scenario corresponding to the scenario type according to the scenario type.
[0044] Optionally, the device further comprises:
[0045] A fourth editing module, used for adding a scene unique serial number to a request header of the interface call request before the interface call request of the client is initiated;
[0046] The sixth determination module is used to determine, in the server, the interface to be called in the scenario corresponding to the unique serial number of the scenario according to the unique serial number of the scenario.
[0047] Optionally, the device further comprises:
[0048] A fifth editing module, used for adding a proximal service tag to a request header of the interface call request before the interface call request of the client is initiated;
[0049] The seventh determination module is used to determine, in the server, an interface with the proximal service tag according to the proximal service tag.
[0050] Optionally, the device further comprises:
[0051] A sixth editing module, used for adding a remote service tag to a request header of the interface call request before the interface call request of the client is initiated;
[0052] An eighth determination module is used to determine, in the server, an interface with the remote service tag according to the remote service tag.
[0053] The present application provides an interface determination method. When executing the method, before the client initiates the interface call request, the device unique identification number, activation state id and formatted timestamp are added to the request header of the interface call request. Then, in the server, the interface called by the device corresponding to the device unique identification number is determined according to the device unique identification number; the interface called by the application each time is determined according to the activation state id; in the server, the time sequence of the interface calls is determined according to the formatted timestamp. In this way, by adding the device unique identification number, activation state id and formatted timestamp to the request header of the interface call request, the device unique identification number and activation state id can be used in the server to determine the called interface, and the formatted timestamp can be used to determine the calling order of the interface. In this way, the called interface and the calling order of the interface can be accurately determined on the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A flowchart of an interface determination method provided in an embodiment of the present application;
[0056] Figure 2 A schematic diagram of the structure of an interface determination device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. The present application provides a method and device for calling an interface, which is used in the field of data processing technology. The above is only an example and does not limit the application field of the method and device name provided by the present application.
[0058] As mobile banking functions become more abundant, the frequency of daily operation and maintenance is also increasing. In the bank, the operation and maintenance tools on the server side are rich and complete, but on the client side, there are relatively few operation and maintenance tools, especially for locating feedback on client function problems. At present, there is traceid on the server side to connect the call links of each service interface, but on the mobile side, there is no corresponding way to connect the order of calling each interface on the mobile side, resulting in the inability to accurately determine the problematic interface and the order of interface calls when using the existing server logs for troubleshooting.
[0059] After research, the inventor proposed the technical solution of the present application. First, before the client initiates the interface call request, the device unique identification number, activation state id and formatted timestamp are added to the request header of the interface call request. Then, in the server, the interface called by the device corresponding to the device unique identification number is determined according to the device unique identification number; the interface called by the application each time is determined according to the activation state id; in the server, the time sequence of the interface calls is determined according to the formatted timestamp. In this way, by adding the device unique identification number, activation state id and formatted timestamp to the request header of the interface call request, the device unique identification number and activation state id can be used in the server to determine the called interface, and the formatted timestamp can be used to determine the calling order of the interface. In this way, the called interface and the calling order of the interface can be accurately determined on the server.
[0060] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. It should be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
[0061] See also Figure 1 , Figure 1 A flowchart of an interface determination method provided in an embodiment of the present application includes:
[0062] S101: before initiating an interface call request, adding a device unique identification number, an activation state ID, and a formatted timestamp to a request header of the interface call request.
[0063] Before the client interface call request is initiated, some fields are added to the request header of the interface call request, where the client can be a mobile terminal, including Android, iOS and H5. Fields can include device unique identification number, activation state id, formatted timestamp, etc. Before adding fields to the request header of the interface call request, two new classes, PCDNetworkHeader and PCDNetworkHeaderManager, can be added to process the request header logic. In an embodiment of the present application, the fields that can be uploaded to the request header are shown in the following table:
[0064] Table 1: Request header field rule table In some implementations, the user number, scenario type, scenario unique serial number, near-end
[0065]
[0066]
[0067] The service tag and one or more of the remote service tags are uploaded to the request header of the interface call request.
[0068] S102: According to the device unique identification number, determine the interface called by the device corresponding to the device unique identification number.
[0069] The server uses the device's unique identification number to associate all the user's interface requests to determine the interface called by the device corresponding to the device's unique identification number. This identification can then be used to query all interfaces called by the user in the past 30 days. Specifically, in combination with the log platform, "trace_device_id+request line" can be used to track which interfaces the user's device has called in the past 30 days.
[0070] S103: Determine the interface called by the application each time according to the activation state id.
[0071] The activation state id is used to associate all the interface requests after the user cold-starts the client or opens a new web page to determine the interface called each time the application is used. With this identifier, all interface requests of the user within the life cycle of an application can be queried. Specifically, "trace_finishLaunch_id+request line" can be used to track which interfaces were called during the last use of the application.
[0072] S104: Determine the time sequence of the interface calls according to the formatted timestamp.
[0073] The server uses a formatted timestamp to determine the actual time when the client interface is issued, so as to determine the time sequence of the interface calls, thereby solving the problem that the server log cannot determine the sequence of mobile interface calls.
[0074] In an embodiment of the present application, before the client initiates the interface call request, the device unique identification number, activation state id and formatted timestamp are added to the request header of the interface call request. Then, in the server, the interface called by the device corresponding to the device unique identification number is determined according to the device unique identification number; the interface called by the application each time is determined according to the activation state id; in the server, the time sequence of the interface calls is determined according to the formatted timestamp. In this way, by adding the device unique identification number, activation state id and formatted timestamp to the request header of the interface call request, the device unique identification number and activation state id can be used in the server to determine the called interface, and the formatted timestamp can be used to determine the calling order of the interface. In this way, the called interface and the calling order of the interface can be accurately determined on the server.
[0075] In some implementations, the log parameters may be adjusted based on the request header. For example, a custom log parameter may be added:
[0076] <property scope="context"name="customLogPattern"
[0077] value="[D:%X{trace_device_id}][U:%X{trace_user_id}]
[0078] [F:%X{trace_finishLaunch_id}][ST:%X{trace_scene_type}]
[0079] [SI:%X{trace_scene_id}][C:%X{trace_client_timestamp}]
[0080] [N:%X{trace_near_service}][F:%X{trace_far_service}]" / >.
[0081] In some implementations, before the client initiates an interface call request, the user number is added to the request header of the interface call request; in the server, the interface called by the user corresponding to the user number can be determined based on the user number.
[0082] In some implementations, before the client initiates an interface call request, the scenario type is added to the request header of the interface call request; in the server, the interface to be called in the scenario corresponding to the scenario type can be determined based on the scenario type.
[0083] In some implementations, before the client initiates an interface call request, the scene-unique serial number is added to the request header of the interface call request; in the server, the interface to be called in the scene corresponding to the scene-unique serial number can be determined based on the scene-unique serial number.
[0084] In some implementations, before the client initiates an interface call request, a proximal service tag is added to the request header of the interface call request; in the server, the interface with the proximal service tag can be determined based on the proximal service tag.
[0085] The above are some specific implementations of the interface determination method provided in the embodiment of the present application. Based on this, the present application also provides a corresponding device. The device provided in the embodiment of the present application will be introduced from the perspective of functional modularization.
[0086] See also Figure 2 , Figure 2 A schematic diagram of the structure of an interface determination device provided in an embodiment of the present application, the interface determination device 200 includes:
[0087] The first editing module 210 is used to add the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request before the client initiates the interface call request;
[0088] A first determination module 220 is used to determine, in the server, an interface called by a device corresponding to the unique device identification number according to the unique device identification number;
[0089] A second determination module 230 is used to determine, in the server, the interface called by the application each time according to the activation state ID;
[0090] The third determination module 240 is used to determine the time sequence of the interface calls in the server according to the formatted timestamps.
[0091] Optionally, the device 200 further includes:
[0092] An adding module is used to add a class in the client; the class includes logic for processing the request header.
[0093] Optionally, the device 200 further includes:
[0094] The adjustment module is used to adjust the log parameters of the server according to the request header.
[0095] Optionally, the device 200 further includes:
[0096] A second editing module, used for adding the user number to the request header of the interface call request before the interface call request of the client is initiated;
[0097] The fourth determining module is used to determine, in the server, the interface called by the user corresponding to the user number according to the user number.
[0098] Optionally, the device 200 further includes:
[0099] A third editing module, used for adding the scene type to the request header of the interface call request before the interface call request of the client is initiated;
[0100] The fifth determination module is used to determine, in the server, an interface to be called in a scenario corresponding to the scenario type according to the scenario type.
[0101] Optionally, the device 200 further includes:
[0102] A fourth editing module, used for adding a scene unique serial number to a request header of the interface call request before the interface call request of the client is initiated;
[0103] The sixth determination module is used to determine, in the server, the interface to be called in the scenario corresponding to the unique serial number of the scenario according to the unique serial number of the scenario.
[0104] Optionally, the device 200 further includes:
[0105] A fifth editing module, used for adding a proximal service tag to a request header of the interface call request before the interface call request of the client is initiated;
[0106] The seventh determination module is used to determine, in the server, an interface with the proximal service tag according to the proximal service tag.
[0107] Optionally, the device 200 further includes:
[0108] A sixth editing module, used for adding a remote service tag to a request header of the interface call request before the interface call request of the client is initiated;
[0109] An eighth determination module is used to determine, in the server, an interface with the remote service tag according to the remote service tag.
[0110] The embodiments of the present application also provide corresponding devices and computer storage media for implementing the solutions provided by the embodiments of the present application.
[0111] The device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes so that the device executes the method described in any embodiment of the present application.
[0112] The computer storage medium stores codes, and when the codes are executed, a device executing the codes implements the method described in any embodiment of the present application.
[0113] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0114] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0115] It should also be noted that the various embodiments in this specification are described in a progressive manner, and the same and similar parts between the various embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the equipment and device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The device embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components prompted as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0116] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An interface determination method, characterized in that: include: Before the client initiates an interface call request, the device unique identification number, activation state ID and formatted timestamp are added to the request header of the interface call request; In the server, according to the unique identification number of the device, determine the interface called by the device corresponding to the unique identification number of the device; In the server, according to the activation state id, the interface called by the application each time is determined; In the server, the time sequence of the interface calls is determined according to the formatted timestamps.
2. The method according to claim 1, characterized in that Before the client initiates the interface call request, before adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Add a class in the client; the class includes logic for processing the request header.
3. The method according to claim 1, characterized in that Before determining the interface called by the device corresponding to the unique device identification number according to the unique device identification number, the method further includes: According to the request header, the log parameters of the server are adjusted.
4. The method according to claim 1, characterized in that: Before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Before the interface call request of the client is initiated, the user number is added to the request header of the interface call request; In the server, according to the user number, an interface called by the user corresponding to the user number is determined.
5. The method according to claim 1, characterized in that Before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Before the interface call request of the client is initiated, adding the scene type to the request header of the interface call request; In the server, according to the scenario type, an interface to be called in the scenario corresponding to the scenario type is determined.
6. The method according to claim 1, characterized in that Before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Before the client initiates the interface call request, the unique serial number of the scene is added to the request header of the interface call request; In the server, according to the unique serial number of the scene, an interface to be called in the scene corresponding to the unique serial number of the scene is determined.
7. The method according to claim 1, characterized in that Before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Before the interface call request of the client is initiated, adding the proximal service tag to the request header of the interface call request; In the service end, an interface with the proximal service tag is determined according to the proximal service tag.
8. The method according to claim 1, characterized in that Before the client initiates the interface call request, after adding the device unique identification number, activation state ID and formatted timestamp to the request header of the interface call request, the method further includes: Before the interface call request of the client is initiated, adding the remote service tag to the request header of the interface call request; In the server, an interface with the remote service tag is determined according to the remote service tag.
9. An interface determination device, characterized in that: include: A first editing module, used for adding a device unique identification number, an activation state ID and a formatted timestamp to a request header of the interface call request before the client initiates the interface call request; A first determination module is used to determine, in the server, an interface called by a device corresponding to the unique identification number of the device according to the unique identification number of the device; A second determination module is used to determine, in the server, the interface called by the application each time according to the activation state ID; The third determination module is used to determine the time sequence of the interface calls in the server according to the formatted timestamp.
10. The device according to claim 9, characterized in that The device also includes: An adding module is used to add a class in the client; the class includes logic for processing the request header.
