Interface data backup display method and device, medium and equipment
By putting the interface data into the message queue and storing it according to the status tag, and combining it with the configuration center to obtain the valid time to find the latest data packets, the problem of abnormal display of interface data backup and obsolete data in a disconnected environment is solved, and efficient and flexible are achieved. Interface data display.
Patent Information
- Application Number
- CN202410472977.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2024-08-30
AI Technical Summary
Existing interface data backup technology cannot effectively obtain data in a disconnected environment, and the data is too old, resulting in abnormal or inflexible display.
Put interface-related data into the message queue, form data packets based on data status tags, and store them in the database. Get the valid time through the configuration center to find the latest valid data packet for display, achieving decoupling of data backup and display.
It ensures the normal display of interface data when the network is disconnected, avoids the problem of too old data, improves the flexibility and efficiency of display, and reduces code redundancy.
Smart Images

Figure CN118568366A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface data processing, and in particular to an interface data backup display method, device, medium and equipment. Background Art
[0002] With the advancement of enterprise informatization, digitalization, management modernization and informatization, more and more information systems are emerging in enterprises. With the accumulation of data in enterprise informatization systems, the priority of data analysis needs has gradually increased, and data visualization has become more and more important. Enterprise leaders and middle-level managers need to make decisions based on data, and data visualization is also a window for enterprises to display to the outside world. Therefore, the business scenarios of data visualization have put forward higher and higher requirements on the performance and stability of API interfaces, and some even require normal display in a disconnected environment. Based on this, the interface data backup solution, as the most commonly used technical means at present, has begun to be used.
[0003] Currently, commonly used interface data backup technologies generally include pure static data storage and real-time API interface cache.
[0004] The purely static data storage method generally stores all return values of all input parameters of all interfaces within a certain period of time in a local database. When displaying, the time, interface URL, and input parameters are used as query conditions to query the database, and the query results are displayed to the front end. This method is simple to implement and can still obtain data in an offline environment. However, since the display mechanism obtains data in the database according to conditions, it must strictly require that the return values of all interfaces within the time period are normal. If there is an abnormality, an exception will be displayed. Therefore, manual intervention is generally required to make up the numbers and regularly check whether the data is complete, which is not flexible and labor-intensive. In addition, because it is static data, it will not be updated with the data returned by the interface, and the problem of data being too old may occur.
[0005] The real-time API interface cache method is to cache the latest interface return results in a cache database such as redis after a normal interface call. When the interface access is abnormal, the data is directly obtained from the cache and returned, thereby achieving the effect of interface data backup. However, this method only changes the interface data source to be obtained from the cache, and still requires calling the remote interface. If the network is not good or even disconnected, this method cannot effectively obtain data. Summary of the invention
[0006] In view of at least one of the above technical problems, an embodiment of the present invention provides an interface data backup display method and device, medium, and equipment.
[0007] In a first aspect, an interface data backup display method provided by an embodiment of the present invention includes:
[0008] After accessing the interface, the interface-related data is placed in the message queue; wherein the interface-related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal;
[0009] When the interface-related data is stored in the message queue, the interface-related data is assembled into a data packet, the data packet is marked according to the state of the interface data, and the marked data packet is stored in the interface data table of the database to realize data backup;
[0010] When receiving an interface data display request, obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter;
[0011] Determine a time window according to the data validity period;
[0012] In the time window, the latest valid data packet is searched from the interface data table, and the found valid data packet is fed back to the front end for display; wherein the valid data packet refers to the data packet marked as normal.
[0013] In one embodiment, if the access is successful, the access result also includes the interface return value and the time when the interface access is successful; if the access fails, the access result also includes the failure reason and the time when the interface access fails.
[0014] In one embodiment, assembling the interface-related data into a data packet and marking the data packet according to the interface data status includes:
[0015] Determine whether the interface data state is normal or abnormal;
[0016] If the interface data state is abnormal, assembling the interface related data into a data packet and marking the data packet as abnormal;
[0017] If the interface data status is normal, the corresponding conditional configuration item is obtained from the configuration center according to the interface URL and the input parameter;
[0018] If no matching condition configuration item is obtained, assembling the interface-related data into a data packet and marking the data packet as normal;
[0019] If a matching condition configuration item is obtained, determine whether the interface return value meets the condition configuration item;
[0020] If the interface return value does not meet the condition configuration item, assembling the interface related data into a data packet and marking the data packet as abnormal;
[0021] If the interface return value meets the condition configuration item, and the interface return value is a character string other than the access file address, the interface related data is assembled into a data packet, and the data packet is marked as normal.
[0022] In one embodiment, the method provided by the embodiment of the present invention further includes:
[0023] If the interface return value meets the condition configuration item, and the interface return value is an access file address, then the corresponding file is downloaded to the local according to the access file address;
[0024] If the file is a picture, the file is downloaded to the local computer and converted into a string; if the file is not a picture, the file is downloaded to the local computer and then transferred to a local file server;
[0025] The character string corresponding to the picture or the storage address of the file in the local file server is stored in the interface data table and marked as normal.
[0026] In one embodiment, the method provided by the embodiment of the present invention further includes:
[0027] If the corresponding data validity time is not obtained from the configuration center, the corresponding data packet is searched from the interface data table according to the interface URL and the input parameter, and the found data packet is fed back to the front end as a static data packet for display.
[0028] In one embodiment, the method provided by the embodiment of the present invention further includes:
[0029] After the interface is successfully accessed, it is determined whether there is a data packet marked as abnormal in the interface data table within the valid time of the data;
[0030] If it exists, the data packet marked as abnormal within the data validity period is replaced by a data table marked as normal, so as to supplement the data in the interface data table.
[0031] In one embodiment, the method provided by the embodiment of the present invention further includes:
[0032] If the interface fails to be accessed within a preset number of consecutive data validity times, the interface-related data will be notified to the personnel configured by the configuration center so that the personnel can investigate the cause and re-enter the data.
[0033] In a second aspect, an interface data backup display device provided by an embodiment of the present invention includes:
[0034] A message putting module is used to put the interface related data into the message queue after accessing the interface; wherein the interface related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal;
[0035] A data backup module, for assembling the interface-related data into a data packet when monitoring the interface-related data stored in the message queue, marking the data packet according to the interface data status, and storing the marked data packet in the interface data table of the database to realize data backup;
[0036] A time acquisition module, used to obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter when receiving the interface data display request;
[0037] A window determination module, used to determine a time window according to the valid time of the data;
[0038] The data display module is used to search for the latest valid data packet from the interface data table within the time window, and feed back the found valid data packet to the front end for display; wherein the valid data table refers to the data packet marked as normal.
[0039] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.
[0040] According to a fourth aspect, a computing device provided by an embodiment of the present invention includes a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided by the first aspect is implemented.
[0041] The interface data backup display method, device, medium, and equipment provided by the embodiment of the present invention, after accessing the interface, puts the interface-related data into the message queue; when the interface-related data is stored in the message queue, the interface-related data is assembled into a data packet, the data packet is marked according to the interface data status, and the marked data packet is stored in the interface data table of the database to realize data backup; when the interface data display request is received, the corresponding data validity time is obtained from the configuration center according to the interface URL and the input parameter; according to the data validity time, the time window is determined, and within the time window, the latest valid data packet is searched from the interface data table, and the found valid data packet is fed back to the front end for display. The embodiment of the present invention searches for the latest valid data packet in the interface data table and feeds it back to the front end for display, which can avoid the problem of data being too old. Moreover, the search is for a valid data packet, which is normal data, which can ensure the normal display of the interface data. In addition, since the valid data packet obtained from the interface data table is displayed, and the data in the interface data table is obtained by backing up before, the display function of the interface data can be realized even in the case of network disconnection. Moreover, the embodiment of the present invention puts the interface-related data into the message queue, then forms a data packet and marks the data packet according to the actual situation, and then stores it in the interface data table. This process will not affect the normal reading of data from the interface data table, and realizes the decoupling of reading data and storing data. In short, the method provided by the embodiment of the present invention is simple to use, the code is less invasive, the configurability is high, the flexibility is good, there is no need to modify the code when modifying the configuration, and after the modified configuration is saved, it can take effect immediately. This method reduces the redundancy of the code and improves the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flowchart of an interface data backup and display method according to an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of a data backup process in an interface data backup display method according to an embodiment of the present invention;
[0044] Figure 3 A schematic diagram of a flow chart of abnormal alarm in an interface data backup and display method according to an embodiment of the present invention;
[0045] Figure 4 It is a structural block diagram of an interface data backup display device in one embodiment of the present invention. DETAILED DESCRIPTION
[0046] In a first aspect, an embodiment of the present invention provides an interface data backup display method, see Figure 1 to Figure 3 The method comprises the following steps S110 to S150:
[0047] S110. After accessing the interface, the interface-related data is placed in a message queue; wherein the interface-related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal;
[0048] Specifically, after accessing the interface, the interface-related data will be synchronously put into the message queue. If the access is successful, the access result may include not only the interface data status, but also the interface return value and the time when the interface access is successful. If the access fails, the access result may include not only the interface data status, but also the failure reason and the time when the interface access fails.
[0049] If the access is successful, the interface data status is normal. If the access fails, the interface data status is abnormal.
[0050] S120, when the interface-related data is monitored to be stored in the message queue, assembling the interface-related data into a data packet, marking the data packet according to the interface data status, and storing the marked data packet in the interface data table of the database to realize data backup;
[0051] The message queue may be monitored through the backend service instance, and if a new message is monitored, the interface-related data in the new message is assembled into a data packet.
[0052] In one embodiment, in S120, assembling the interface-related data into a data packet and marking the data packet according to the interface data status may specifically include:
[0053] S121, determining whether the interface data status is normal or abnormal;
[0054] That is, whether the state of the interface data in the interface-related data in the new message in the message queue is normal or abnormal.
[0055] S122, if the interface data state is abnormal, assembling the interface related data into a data packet, and marking the data packet as abnormal;
[0056] It is understandable that if the interface data state is abnormal, it means that the interface call is wrong, so the access fails. At this time, the interface related data is assembled into a data packet, and the data packet is marked as abnormal.
[0057] S123. If the interface data status is normal, obtain the corresponding conditional configuration item from the configuration center according to the interface URL and the input parameter;
[0058] S124, if no matching condition configuration item is obtained, assembling the interface-related data into a data packet, and marking the data packet as normal;
[0059] That is, if the interface data status is normal, the interface URL and the conditional configuration items corresponding to the input parameters are obtained from the configuration center. If the obtained conditional configuration items are empty, that is, no corresponding conditional configuration items are obtained, it means that any return value is normal, so the interface-related data is assembled into a data packet and marked as normal.
[0060] S125. If a matching condition configuration item is obtained, determine whether the interface return value meets the condition configuration item;
[0061] S126. If the interface return value does not meet the conditional configuration item, assembling the interface related data into a data packet, and marking the data packet as abnormal;
[0062] That is, if the interface data status is normal, the interface URL and the conditional configuration items corresponding to the input parameters are obtained from the configuration center. If the obtained conditional configuration items are not empty and the interface return value does not meet the conditional configuration items, the interface return value is problematic, so the interface related data is assembled into a data packet and marked as abnormal.
[0063] For example, if the conditional configuration item requires that the number of rows of the interface return value be 7, but the actual number of rows of the return value is 5, it means that the interface return value does not meet the conditional configuration item, so it is marked as an exception after the data packet is assembled.
[0064] For another example, the conditional configuration item requires that the three data in the interface return value cannot be empty, but two data in the actual return value are not empty and one data is empty, which means that the interface return value is abnormal and the interface return value does not meet the conditional configuration item. Therefore, it is marked as abnormal after the data packet is assembled.
[0065] S127. If the interface return value meets the conditional configuration item, and the interface return value is a character string other than the access file address, assemble the interface related data into a data packet, and mark the data packet as normal.
[0066] That is, if the interface data status is normal, the interface URL and the conditional configuration items corresponding to the input parameters are obtained from the configuration center, the obtained conditional configuration items are not empty, the interface return value meets the requirements of the conditional configuration items, and the interface return value is a string other than the access file address, so the interface related data is assembled into a data packet, and the data packet is marked as normal.
[0067] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0068] If the interface return value meets the condition configuration item, and the interface return value is an access file address, then the corresponding file is downloaded to the local according to the access file address;
[0069] If the file is a picture, the file is downloaded to the local computer and converted into a string; if the file is not a picture, the file is downloaded to the local computer and then transferred to a local file server;
[0070] The character string corresponding to the picture or the storage address of the file in the local file server is stored in the interface data table and marked as normal.
[0071] That is, if the interface data status is normal, the interface URL and the conditional configuration items corresponding to the input parameters are obtained from the configuration center, the obtained conditional configuration items are not empty, and the interface return value meets the requirements of the conditional configuration items, but the interface return value is the access file address. At this time, the file in the access file address is downloaded to the local computer, and then the downloaded image is converted into a string, and the string corresponding to the image is stored in the interface data table, and marked as normal. Alternatively, the downloaded file is transferred to the local file server, and then the storage address of the file in the local file server is written into the interface data table, and marked as normal.
[0072] The image may be in a common format such as png or jpg. The string corresponding to the image may be a base64 string.
[0073] The specific format of the string into which the image is converted depends on the configuration of the configuration center, that is, the configuration center decides which method to use.
[0074] S130. When receiving the interface data display request, obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter;
[0075] That is to say, when interface data needs to be displayed, the corresponding data validity period will be obtained from the configuration center based on the interface URL and input parameters.
[0076] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0077] If the corresponding data validity time is not obtained from the configuration center, the corresponding data packet is searched from the interface data table according to the interface URL and the input parameter, and the found data packet is fed back to the front end as a static data packet for display.
[0078] In other words, if the corresponding data validity time is not obtained, it means that the data packet is actually static data and is not affected by time. That is, when the interface is accessed under any circumstances, the interface return value is the same, which is the same set of data. Therefore, if the corresponding data validity time is not obtained, the data packet stored in the interface data table can be returned to the front end for display.
[0079] S140, determining a time window according to the data validity time;
[0080] That is to say, if the corresponding data validity time is obtained, a time window is determined according to the data validity time.
[0081] If the corresponding data validity period is obtained, for example, 5 minutes, it means that the data returned by the interface after accessing the interface within these 5 minutes is the same set of data.
[0082] For example, the data validity time is added or subtracted from the interface access time to obtain a time range, which can be used as a time window.
[0083] S150. Within the time window, search for the latest valid data packet from the interface data table, and feed back the found valid data packet to the front end for display; wherein the valid data table refers to the data packet marked as normal.
[0084] That is, the interface data table is searched for the latest valid data packet within the time window, and then the valid data packet is fed back to the front end for display.
[0085] Among them, the valid data packet is a normal data packet, which can ensure the correct display of the data.
[0086] Among them, what is searched is the latest valid data packet within the time window. Since it is the latest, there is no need to worry about the data packet being too old.
[0087] Among them, since the valid data packets obtained from the interface data table are displayed, and the data in the interface data table is obtained by previous backup, the interface data display function can be realized even in the case of network disconnection.
[0088] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0089] After the interface is successfully accessed, it is determined whether there is a data packet marked as abnormal in the interface data table within the valid time of the data;
[0090] If it exists, the data packet marked as abnormal within the data validity period is replaced by a data table marked as normal, so as to supplement the data in the interface data table.
[0091] That is to say, after the interface call is successful, the abnormal return value of the last or last few interfaces is modified to a normal return value. After the interface call is successful and the correct interface return value is obtained, it is determined whether there is abnormal data, i.e., a data packet marked as abnormal, within the data validity period in the interface data table. If so, the abnormal data within the data validity period in the interface data table is replaced with normal data. If there is no abnormal data, no operation is performed. For example, the interface has a data validity period of 5 minutes. In the second minute, the interface returns an error due to network jitter or slow application response. At this time, the data packet stored in the interface data table is abnormal data. In the fourth minute, the interface return value is normal. At this time, within the 5-minute data validity period, the abnormal data of the second minute is changed to normal data of the fourth minute.
[0092] In one embodiment, the method provided by the embodiment of the present invention may further include:
[0093] If the interface fails to be accessed within a preset number of consecutive data validity times, the interface-related data will be notified to the personnel configured by the configuration center so that the personnel can investigate the cause and re-enter the data.
[0094] The preset number may be configured by the configuration center. For example, the preset number is 3.
[0095] For example, if the interface fails to be accessed within three consecutive data validity periods, the interface-related data will be notified to the personnel in the configuration center through SMS, email and other notification channels. After receiving the notification, the personnel will investigate the cause and then re-enter the data after it returns to normal, thereby ensuring the normal use of the interface.
[0096] It can be seen that through the above-mentioned abnormal warnings, relevant personnel can intervene in time to perform interface maintenance, data re-entry, etc.
[0097] It is understandable that the present invention aims at the problem of too old data in the purely static data storage method in the prior art. The embodiment of the present invention searches for the latest valid data packet in the interface data table and feeds it back to the front end for display, which can avoid the problem of too old data. Moreover, the search is for a valid data packet, which is normal data, and the normal display of the interface data can be guaranteed. In addition, since the valid data packet obtained from the interface data table is displayed, and the data in the interface data table is obtained by backing up before, the display function of the interface data can be realized even in the case of network disconnection.
[0098] Moreover, the embodiment of the present invention puts the interface-related data into the message queue, then forms and marks the data packet according to the actual situation, and then stores it in the interface data table. This process does not affect the process of searching for valid data packets from the interface data table for display, thus realizing the decoupling of backup and display.
[0099] Moreover, in the embodiment of the present invention, various configuration data such as conditional configuration items, whether files are converted into images for storage or transferred to a local file server, etc. are configured in the configuration center, thereby improving flexibility.
[0100] Moreover, the embodiments of the present invention implement the regular supplementary recording of abnormal data and the alarm operation of abnormal data, and finally realize the integrity of the backup data.
[0101] In summary, the method provided by the embodiment of the present invention is simple to use, has low code intrusion, high configurability, and good flexibility. There is no need to modify the code when modifying the configuration, and the modified configuration can take effect immediately after being saved. This method reduces code redundancy and improves development efficiency.
[0102] In a second aspect, an embodiment of the present invention provides an interface data backup display device, see Figure 4 , the device comprises:
[0103] A message putting module is used to put the interface related data into the message queue after accessing the interface; wherein the interface related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal;
[0104] A data backup module, for assembling the interface-related data into a data packet when monitoring the interface-related data stored in the message queue, marking the data packet according to the interface data status, and storing the marked data packet in the interface data table of the database to realize data backup;
[0105] A time acquisition module, used to obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter when receiving the interface data display request;
[0106] A window determination module, used to determine a time window according to the valid time of the data;
[0107] The first display module is used to search for the latest valid data packet from the interface data table within the time window, and feed back the found valid data packet to the front end for display; wherein the valid data table refers to the data packet marked as normal.
[0108] In one embodiment, if the access is successful, the access result also includes the interface return value and the time when the interface access is successful; if the access fails, the access result also includes the failure reason and the time when the interface access fails.
[0109] In one embodiment, the data backup module includes:
[0110] A first judging unit, used to judge whether the interface data state is normal or abnormal;
[0111] a first marking unit, configured to assemble the interface-related data into a data packet and mark the data packet as abnormal if the interface data state is abnormal;
[0112] A first acquisition unit, configured to acquire a corresponding conditional configuration item from a configuration center according to the interface URL and the input parameter if the interface data state is normal;
[0113] A second marking unit, configured to assemble the interface-related data into a data packet and mark the data packet as normal if no matching conditional configuration item is obtained;
[0114] A second judgment unit is used to judge whether the interface return value meets the conditional configuration item if a matching conditional configuration item is obtained;
[0115] A third marking unit, configured to assemble the interface-related data into a data packet and mark the data packet as abnormal if the interface return value does not meet the conditional configuration item;
[0116] The fourth marking unit is used to assemble the interface-related data into a data packet and mark the data packet as normal if the interface return value meets the conditional configuration item and the interface return value is a character string other than the access file address.
[0117] In one embodiment, the apparatus further comprises:
[0118] A file download module, configured to download the corresponding file to the local computer according to the access file address if the interface return value meets the condition configuration item and the interface return value is an access file address;
[0119] A file processing module, for downloading the file locally and converting it into a string if the file is a picture; for downloading the file locally and transferring it to a local file server if the file is not a picture;
[0120] The first storage module is used to store the character string corresponding to the picture or the storage address of the file in the local file server in the interface data table and mark it as normal.
[0121] In one embodiment, the apparatus further comprises:
[0122] The second display module is used to search for the corresponding data packet from the interface data table according to the interface URL and the input parameter if the corresponding data validity time is not obtained from the configuration center, and feed back the found data packet as a static data packet to the front end for display.
[0123] In one embodiment, the apparatus further comprises:
[0124] A first judgment module is used to judge whether there is a data packet marked as abnormal in the interface within the valid time of the data in the interface data table after the interface is successfully accessed;
[0125] The data supplement module is used to replace the data packet marked as abnormal within the data validity period with the data table marked as normal, so as to supplement the data of the interface data table.
[0126] In one embodiment, the apparatus further comprises:
[0127] The abnormal alarm module is used to notify the personnel configured by the configuration center of the interface-related data if the interface fails to access within a continuous preset number of data validity times, so that the personnel can conduct cause investigation and data supplement.
[0128] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0129] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.
[0130] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.
[0131] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0132] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0133] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0134] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0135] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0136] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.
[0137] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0139] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0140] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for displaying interface data backup, characterized in that: include: After accessing the interface, the interface-related data is placed in the message queue; wherein the interface-related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal; When the interface-related data is stored in the message queue, the interface-related data is assembled into a data packet, the data packet is marked according to the state of the interface data, and the marked data packet is stored in the interface data table of the database to realize data backup; When receiving an interface data display request, obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter; Determine a time window according to the data validity period; In the time window, the latest valid data packet is searched from the interface data table, and the found valid data packet is fed back to the front end for display; wherein the valid data table refers to the data packet marked as normal.
2. The method according to claim 1, characterized in that If the access is successful, the access result also includes the interface return value and the time when the interface access is successful. If the access fails, the access result also includes the failure reason and the time when the interface access fails.
3. The method according to claim 2, characterized in that The step of assembling the interface-related data into a data packet and marking the data packet according to the interface data status includes: Determine whether the interface data state is normal or abnormal; If the interface data state is abnormal, assembling the interface related data into a data packet and marking the data packet as abnormal; If the interface data status is normal, the corresponding conditional configuration item is obtained from the configuration center according to the interface URL and the input parameter; If no matching condition configuration item is obtained, assembling the interface-related data into a data packet and marking the data packet as normal; If a matching condition configuration item is obtained, determine whether the interface return value meets the condition configuration item; If the interface return value does not meet the condition configuration item, assembling the interface related data into a data packet and marking the data packet as abnormal; If the interface return value meets the condition configuration item, and the interface return value is a character string other than the access file address, the interface related data is assembled into a data packet, and the data packet is marked as normal.
4. The method according to claim 3, characterized in that Also includes: If the interface return value meets the condition configuration item, and the interface return value is an access file address, then the corresponding file is downloaded to the local according to the access file address; If the file is a picture, the file is downloaded to the local computer and converted into a string; if the file is not a picture, the file is downloaded to the local computer and then transferred to a local file server; The character string corresponding to the picture or the storage address of the file in the local file server is stored in the interface data table and marked as normal.
5. The method according to claim 1, characterized in that Also includes: If the corresponding data validity time is not obtained from the configuration center, the corresponding data packet is searched from the interface data table according to the interface URL and the input parameter, and the found data packet is fed back to the front end as a static data packet for display.
6. The method according to claim 1, characterized in that Also includes: After the interface is successfully accessed, it is determined whether there is a data packet marked as abnormal in the interface data table within the valid time of the data; If it exists, the data packet marked as abnormal within the data validity period is replaced by a data table marked as normal, so as to supplement the data in the interface data table.
7. The method according to claim 1, characterized in that Also includes: If the interface fails to be accessed within a preset number of consecutive data validity times, the interface-related data will be notified to the personnel configured by the configuration center so that the personnel can investigate the cause and re-enter the data.
8. An interface data backup display device, characterized in that: include: A message putting module is used to put the interface related data into the message queue after accessing the interface; wherein the interface related data includes the interface URL, input parameters and access results, and the access results include the interface data status; when the access is successful, the interface data status is normal, and when the access fails, the interface data status is abnormal; A data backup module, for assembling the interface-related data into a data packet when monitoring the interface-related data stored in the message queue, marking the data packet according to the interface data status, and storing the marked data packet in the interface data table of the database to realize data backup; A time acquisition module, used to obtain the corresponding data validity time from the configuration center according to the interface URL and the input parameter when receiving the interface data display request; A window determination module, used to determine a time window according to the valid time of the data; The data display module is used to search for the latest valid data packet from the interface data table within the time window, and feed back the found valid data packet to the front end for display; wherein the valid data table refers to the data packet marked as normal.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
10. A computing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.
