An Internet of Things digital connection method, platform, electronic device and storage medium
By first configuring the tripartite IoT interface information and using cache to quickly obtain target data, the problem of frequent adjustment of code when connecting and maintaining IoT interfaces in the existing technology is solved, efficient docking and rapid adaptation are achieved, and development efficiency and compatibility are improved.
Patent Information
- Application Number
- CN202410485464.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2044-04-22
AI Technical Summary
When connecting and maintaining IoT interfaces, existing technologies need to frequently adjust codes and parameters, resulting in longer project implementation time, wasted human resources, and the inability to respond to changes in demand in a timely manner.
By first configuring the configuration information of the tripartite IoT interface, quickly searching the configuration information based on the call request of the IoT interface, integrating the information to be configured and the call request, and using the cache to quickly obtain the target key-value pairs to achieve fast adaptation and efficient docking.
It improves compatibility and development efficiency for tripartite IoT interfaces, reduces the risks brought by code modification, saves development time and development volume, and achieves rapid deployment and production.
Smart Images

Figure CN119094583B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of the Internet of Things, and in particular, to an Internet of Things digital connection method, platform, electronic device, and storage medium. Background Art
[0002] Generally, when a system is implemented, most of them require the support of third-party Internet of Things interface services. In this case, most systems connect to third-party Internet of Things interfaces by writing code. Another scenario is that the third party provides an SDK, and the user can use it by calling functions; essentially, the SDK encapsulates the third-party Internet of Things interface service.
[0003] Generally, to connect to an Internet of Things interface, the R & D personnel of the system need to connect with the R & D personnel of the Internet of Things interface provider. After writing the code, the two parties conduct joint debugging of the Internet of Things interface call. Then it is submitted to testing for business verification; or after encapsulation, the Internet of Things interface is provided for direct use by the front end of the system.
[0004] However, in the above methods, once the Internet of Things interface of the Internet of Things interface provider changes, such as when the performance of the Internet of Things interface is poor or caching needs to be increased, it is necessary to rewrite the business code or adjust the parameters, and then redevelop and put into production, which not only slows down the project implementation duration, but also requires investment in human and material resources, and cannot respond to the change of requirements in time; in addition, relevant R & D personnel need to be invested to complete the connection by writing code, so it is inevitable to invest a large amount of manpower and a large amount of time, and when the third-party Internet of Things interface cannot provide the call ability in time, the front-end and back-end developers need to wait until the third-party Internet of Things interface can be used to complete the joint debugging work. Summary of the Invention
[0005] The present invention provides an Internet of Things digital connection method, platform, electronic device, and storage medium, so as to improve the compatibility and development efficiency of the third-party Internet of Things interface.
[0006] The technical solution for the present invention to solve the above technical problems is as follows:
[0007] An Internet of Things digital connection method includes:
[0008] According to the received Internet of Things interface call request, search for the previously configured third-party Internet of Things interface configuration information to obtain the information to be configured;
[0009] According to the Internet of Things interface call request and the information to be configured, obtain the target configuration information;
[0010] Based on the cache field in the target configuration information being write cache, determine whether there is a target key-value pair corresponding to the target configuration information in the cache. If so, obtain the corresponding target key-value pair as the return data and return it; wherein, the target key-value pair in the cache is cached in the form of a key-value pair by previously taking the return target value obtained by calling a third-party Internet of Things interface based on the target configuration information and the target key generated according to the target configuration information.
[0011] According to the Internet of Things digital connection method provided by the present invention, determining whether there is a target key-value pair corresponding to the target configuration information in the cache includes:
[0012] If there is no target key-value pair corresponding to the target configuration information in the cache, determine whether the baffle field in the target configuration information is an open baffle;
[0013] In the case of determining that the baffle field in the target configuration information is an open baffle, return the baffle data as the return data.
[0014] According to the Internet of Things digital connection method provided by the present invention, after obtaining the target configuration information, it includes:
[0015] Based on the cache field in the target configuration information being not write cache, determine whether the baffle field in the target configuration information is an open baffle;
[0016] In the case of determining that the baffle field in the target configuration information is an open baffle, return the baffle data as the return data.
[0017] According to the Internet of Things digital connection method provided by the present invention, determining whether the baffle field in the target configuration information is an open baffle includes:
[0018] In the case of determining that the baffle field in the target configuration information is not an open baffle, initiate a third-party Internet of Things interface call request according to the target configuration information and parse the return result to obtain a target value;
[0019] According to the target value and the target configuration information, obtain a target key-value pair;
[0020] Determine whether the cache field in the target configuration information is write cache;
[0021] If it is determined that the cache field in the target configuration information is write cache, write the target key-value pair into the cache and return the target key-value pair as the return data;
[0022] Otherwise, return the target key-value pair as the return data.
[0023] According to the Internet of Things digital connection method provided by the present invention, obtaining a target key-value pair according to the target value and the target configuration information includes:
[0024] Using a preset encryption algorithm to encrypt the target configuration information to obtain a target key;
[0025] According to the target value and the target key, obtaining a target key-value pair in the form of a key-value pair.
[0026] According to the Internet of Things digital connection method provided by the present invention, initiating a third-party Internet of Things interface call request according to the target configuration information includes:
[0027] Selecting a corresponding request method according to the request method field in the target configuration information and initiating a third-party Internet of Things interface call request.
[0028] According to the Internet of Things digital connection method provided by the present invention, the Internet of Things interface call request includes an application programming Internet of Things interface source file and a request source;
[0029] Before obtaining the target configuration information according to the request parameters in the Internet of Things interface call request and the information to be configured, it includes:
[0030] Determining that the application programming Internet of Things interface source file is valid; or,
[0031] Determining that the application programming Internet of Things interface source file is valid and determining whether the request source is legal.
[0032] The present invention also provides an Internet of Things digital connection platform, including:
[0033] An information search module, which searches for pre-configured third-party Internet of Things interface configuration information according to the received Internet of Things interface call request in advance to obtain the information to be configured;
[0034] A data integration module, which obtains the target configuration information according to the Internet of Things interface call request and the information to be configured;
[0035] A data acquisition module, based on writing the target configuration information into the cache according to the cache field in the target configuration information, determines whether there is a target key-value pair corresponding to the target configuration information in the cache. If so, obtains the corresponding target key-value pair as the return data and returns it; wherein, the target key-value pair in the cache is cached in the form of a key-value pair in advance by using the return target value obtained by calling the third-party Internet of Things interface based on the target configuration information and the target key generated according to the target configuration information.
[0036] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method for digital connection of the Internet of Things as described in any one of the above is implemented.
[0037] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for digital connection of the Internet of Things as described in any one of the above is implemented.
[0038] The present invention also provides a computer product, on which a computer program is stored. When the computer program is executed by a processor, the method for digital connection of the Internet of Things as described in any one of the above is implemented.
[0039] The beneficial effects of the present invention are as follows: By pre-configuring the configuration information of the three-party Internet of Things interface, the configuration information of the three-party Internet of Things interface can be quickly found according to the Internet of Things interface call request, and the information to be configured is obtained. Then, the information to be configured and the Internet of Things interface call request are integrated, and the target key-value pair is quickly obtained from the cache according to the integrated target configuration information as the return data of the Internet of Things interface call request, achieving the purpose of quickly adapting to the requirements of various three-party Internet of Things interfaces, efficiently docking with the three-party Internet of Things interfaces, improving the compatibility with the three-party Internet of Things interfaces, facilitating rapid deployment and production, greatly reducing various risks brought by modifying the code, saving development time and development volume, and improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is one of the flow diagrams of the method for digital connection of the Internet of Things provided by the present invention;
[0041] Figure 2 is the second flow diagram of the method for digital connection of the Internet of Things provided by the present invention;
[0042] Figure 3 is the structural diagram of the Internet of Things digital connection platform provided by the present invention;
[0043] Figure 4 is the structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application. 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 those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0045] In the description of the present application, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the said features. In the description of the present application, "a plurality of" means two or more unless otherwise specifically defined.
[0046] In the description of the present application, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present application is not necessarily construed as being more preferred or having more advantages than other embodiments. The following description is provided to enable any person skilled in the art to implement and use the present invention. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without the use of these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the present application.
[0047] Refer to Figure 1 and Figure 2 , Figure 1 is one of the flow diagrams of the Internet of Things digital connection method provided by the present invention. Figure 2 is the second flow diagram of the Internet of Things digital connection method provided by the present invention, and the method includes steps 10 to step 30:
[0048] Step 10, according to the previously received Internet of Things interface call request, search for the previously configured third-party Internet of Things interface configuration information to obtain the information to be configured.
[0049] In this embodiment, according to the previously received Internet of Things interface call request, searching for the previously configured third-party Internet of Things interface configuration information to obtain the information to be configured includes: passing the previously received Internet of Things interface call request into a preset call entry to obtain entry parameters; according to the entry parameters, searching for the previously configured third-party Internet of Things interface configuration information to obtain the information to be configured. It should be noted that the preset call entry can be set in advance based on actual configuration requirements and will not be further limited here. For example:
[0050] / **api code* /
[0051] private String code;
[0052] / **Request source* /
[0053] private String source;
[0054] / **Parameter* /
[0055] private Map<String,Object> data;
[0056] In addition, the Internet of Things interface call request includes the application programming Internet of Things interface source file (API code), the request source, and the request parameters. By passing the information in the Internet of Things interface call request into a preset call entry, it is convenient to unify the forms of different requests, facilitate subsequent search for configuration information, and achieve the purpose of quickly adapting to changes in requirements.
[0057] In an alternative embodiment, before obtaining the target configuration information based on the request parameters and the information to be configured in the Internet of Things interface call request, it includes: determining that the application programming Internet of Things interface source file is valid; or, determining that the application programming Internet of Things interface source file is valid and determining whether the request source is legal.
[0058] It should be added that determining that the application programming Internet of Things interface source file is valid includes: determining whether corresponding information is configured in the previously configured third-party Internet of Things interface configuration information. If so, it is valid; otherwise, it is invalid; and / or, determining whether an error occurs in the request sent by the request side. If so, it is invalid; otherwise, it is valid.
[0059] It should be noted that when the corresponding information is not configured in the previously configured third-party Internet of Things interface configuration information, it is also necessary to confirm whether corresponding Internet of Things interface information is newly added to the third-party Internet of Things interface configuration information for the Internet of Things interface called in the Internet of Things interface call request. After the corresponding new information is configured in the third-party Internet of Things interface configuration information, the configuration information corresponding to the Internet of Things interface call request is searched again. Thus, when the third-party Internet of Things interface changes, only by changing or newly adding the corresponding Internet of Things interface information in the third-party Internet of Things interface configuration information, it is possible to quickly dock the third-party Internet of Things interface for front-end use, so as to quickly adapt to various requirements. Especially in the business scenario where a large amount of data of third-party Internet of Things interfaces needs to be displayed in the system, only through the above configuration method, it is possible to quickly dock the third-party Internet of Things interface for front-end display use.
[0060] In addition, determining whether the request source is legal includes: determining whether there is a corresponding request source in the preset sources. If so, it is legal; otherwise, it is illegal; where the preset sources can be set in advance based on the request sources corresponding to the request permissions, and no further limitations are made here.
[0061] In an alternative embodiment, the three-party Internet of Things interface configuration information includes fields, types, lengths, and whether they are controllable. Among them, the fields include primary key id, business source, business type, Internet of Things interface name, request address, request method, parameter type, request headers, parameters, timeout setting, return value type, fields to be given out in the return value, field name corresponding to the total quantity in the return value, field name corresponding to the content in the return value, field name corresponding to the status in the return value, remarks, cache field indicating whether to cache, data source field in excel, timeout time for calling the Internet of Things interface, baffle field indicating whether to enable the baffle, default return value of the Internet of Things interface, whether to record the call times, name of the creating user, whether to verify data permissions, updater, creator, update time, and creation time; the types include varchar for storing variable-length strings, int for storing integers, and datetime type for date and time.
[0062] Furthermore, the id type is int, with a length of 4 and is uncontrollable; the business_source type is varchar, with a length of 30 and is uncontrollable; the business_type type is varchar, with a length of 20 and is uncontrollable; the name type is varchar, with a length of 30 and is uncontrollable; the url type is varchar, with a length of 2000 and is uncontrollable; the method type is varchar, with a length of 20 and is uncontrollable; the content_type type is varchar, with a length of 30 and is uncontrollable; the headers type is varchar, with a length of 200 and is controllable; the paras type is varchar, with a length of 600 and is controllable; the timout type is int, with a length of 4 and is uncontrollable; the return_type type is varchar, with a length of 20 and is controllable; the return_fields type is varchar, with a length of 300 and is controllable; the return_count_field type is varchar, with a length of 20 and is controllable; the return_data_field type is varchar, with a length of 20 and is controllable; the return_status_field type is varchar, with a length of 20 and is controllable; the remarks type is varchar, with a length of 200 and is controllable; the cache_second type is int, with a length of 8 and is uncontrollable; the excelexcel_data_field type is varchar, with a length of 60 and is controllable; the timeout_second type is int, with a length of 8 and is controllable; the has_forward type is int, with a length of 8 and is controllable; the api_data type is varchar, with a length of 5000 and is controllable; the has_record_call type is varchar, with a length of 11 and is controllable; the create_by_name type is varchar, with a length of 255 and is uncontrollable; the check_permission type is varchar, with a length of 11 and is uncontrollable; the update_by type is varchar, with a length of 30 and is controllable; the create_by type is varchar, with a length of 30 and is controllable; the modified_time type is datetime, with a length of 16 and is uncontrollable; the created_time type is datetime, with a length of 16 and is uncontrollable.
[0063] In addition, return_type includes returning any object (reference data type) object and ordered string list list; cache_second is 0, which means no cache is used, and greater than 0 means the cache duration, the default value is 0; timeout_second is in seconds, the default value is 30 seconds; check_permission is 1 for verification, and 0 for no verification.
[0064] Step 20, obtaining target configuration information according to the Internet of Things interface call request and the information to be configured.
[0065] In this embodiment, the target configuration information is obtained according to the Internet of Things interface call request and the information to be configured, including: integrating the request parameters and the corresponding parameters in the information to be configured to obtain the target configuration information.
[0066] Step 30, based on the cache field in the target configuration information, determines whether there is a target key-value pair corresponding to the target configuration information in the cache. If so, obtains the corresponding target key-value pair and returns it as return data; wherein, the target key-value pair in the cache is first cached in the form of a key-value pair by first calling a third-party IoT interface based on the target configuration information and obtaining the return target value and the target key generated according to the target configuration information.
[0067] It should be noted that the target key-value pairs in the cache are cached during the previous request, so they can be directly obtained and returned during subsequent requests, thereby quickly connecting to the third-party IoT interface for front-end use, greatly saving development and implementation time.
[0068] In an optional embodiment, determining whether there is a target key-value pair corresponding to the target configuration information in the cache includes: if there is no target key-value pair corresponding to the target configuration information in the cache, determining whether the baffle field in the target configuration information is an open baffle; when it is determined that the baffle field in the target configuration information is an open baffle, returning the baffle data as return data.
[0069] In an optional embodiment, after obtaining the target configuration information, it includes: based on the cache field in the target configuration information being not written to the cache, determining whether the baffle field in the target configuration information is an open baffle; when it is determined that the baffle field in the target configuration information is an open baffle, returning the baffle data as return data.
[0070] It should be noted that by opening the baffle and returning simulated data, it is possible to avoid the situation where effective access cannot be provided in time due to failure of the third-party IoT interface during joint debugging with the third-party IoT interface, thereby not affecting the development progress of the front end.
[0071] In an optional embodiment, determining whether the baffle field in the target configuration information is an open baffle includes: when it is determined that the baffle field in the target configuration information is a non-open baffle, initiating a third-party Internet of Things (IoT) interface call request according to the target configuration information and parsing the returned result to obtain a target value; obtaining a target key-value pair based on the target value and the target configuration information; determining whether the cache field in the target configuration information is for writing to the cache; if it is determined that the cache field in the target configuration information is for writing to the cache, writing the target key-value pair to the cache and returning the target key-value pair as the return data; otherwise, returning the target key-value pair as the return data.
[0072] It should be noted that through the above method, when a new third-party IoT interface is added or a third-party IoT interface changes, only adaptation adjustments are required to achieve compatibility with changes in the third-party IoT interface. And in the case of poor performance of the IoT interface, the problem of poor performance of the IoT interface can be solved in a timely manner by adjusting the IoT interface response timeout time in a timely manner or by configuring to increase the cache, so as to achieve rapid deployment and production, greatly reducing various risks brought by modifying the code and saving development time and development volume.
[0073] Specifically, obtaining a target key-value pair based on the target value and the target configuration information includes: encrypting the target configuration information using a preset encryption algorithm to obtain a target key; obtaining the target key-value pair in the form of a key-value pair based on the target value and the target key. It should be added that the encryption algorithm can be selected according to actual design requirements, such as the MAD digest algorithm, etc., and no further limitation is made here.
[0074] In addition, initiating a third-party IoT interface call request according to the target configuration information includes: selecting the corresponding request method according to the request method field in the target configuration information and initiating a third-party IoT interface call request. It should be noted that if the request methods in the configuration information include GET, POST, and SOCKET, any of them can be selected to initiate a third-party IoT interface call request.
[0075] In an optional embodiment, for the convenience of subsequently determining the situation of third-party IoT interface calls, that is, whether this request is successfully called and whether data is obtained, etc., therefore, after returning the target key-value pair as the return data, it includes: writing this request into the IoT interface call statistics information. It should be noted that the IoT interface call information can record the situation of this third-party IoT interface call in text form or table form. For example, when it is in table form, see Table 1 below.
[0076] Table 1 IoT Interface Call Statistics Information Table
[0077]
[0078] In the embodiment of the present invention, by pre-configuring the configuration information of the third-party Internet of Things interface, the configuration information of the third-party Internet of Things interface can be quickly found according to the Internet of Things interface call request, and the information to be configured is obtained. Then, the information to be configured and the Internet of Things interface call request are integrated, and the target key-value pair is quickly obtained from the cache according to the integrated target configuration information as the return data of the Internet of Things interface call request, achieving the purpose of quickly adapting to the requirements of various third-party Internet of Things interfaces, efficiently docking with the third-party Internet of Things interfaces, improving the compatibility with the third-party Internet of Things interfaces, facilitating rapid deployment and production, greatly reducing various risks brought by modifying the code, saving development time and development volume, and improving development efficiency.
[0079] The Internet of Things digital connection platform provided by the present invention will be described below. The Internet of Things digital connection platform described below can be mutually corresponding and referred to the Internet of Things digital connection method described above. Figure 3 It is a schematic structural diagram of the Internet of Things digital connection platform provided by the embodiment of the present invention. As Figure 3 shown, the Internet of Things digital connection platform provided by the embodiment of the present invention includes:
[0080] An information search module 301, which searches for the pre-configured configuration information of the third-party Internet of Things interface according to the received Internet of Things interface call request in advance, and obtains the information to be configured;
[0081] A data integration module 302, which obtains the target configuration information according to the Internet of Things interface call request and the information to be configured;
[0082] A data acquisition module 303, based on the cache field in the target configuration information for writing to the cache, determines whether there is a target key-value pair corresponding to the target configuration information in the cache. If so, the corresponding target key-value pair is obtained and returned as the return data; wherein, the target key-value pair in the cache is cached in the form of a key-value pair by previously taking the return target value obtained by calling the third-party Internet of Things interface based on the target configuration information and the target key generated according to the target configuration information.
[0083] In this embodiment, the information search module 301 includes: a parameter acquisition unit, which passes the received Internet of Things interface call request in advance to a preset call entry to obtain the entry parameters; an information search unit, which searches for the pre-configured configuration information of the third-party Internet of Things interface according to the entry parameters, and obtains the information to be configured.
[0084] In an alternative embodiment, the device includes: a validity judgment module, which determines that the application programming Internet of Things interface source file is valid before obtaining the target configuration information according to the request parameters and the information to be configured in the Internet of Things interface call request; or, determines that the application programming Internet of Things interface source file is valid and determines whether the request source is legal.
[0085] It should be added that the validity judgment module is used to: determine whether the corresponding information is configured in the previously configured third-party Internet of Things interface configuration information, if so, it is valid, otherwise, it is invalid; and / or determine whether the request on the requesting side is sent incorrectly, if so, it is invalid, otherwise, it is valid.
[0086] In addition, the validity judgment module is used to determine whether there is a corresponding request source in the preset source. If so, it is legal, otherwise, it is illegal. Among them, the preset source can be set in advance based on the request source corresponding to the request authority, and no further limitation is made here.
[0087] The data integration module 302 includes: an integration unit that integrates the request parameters and corresponding parameters in the information to be configured to obtain target configuration information.
[0088] In an optional embodiment, the data acquisition module 303 also includes: a baffle judgment unit, which determines whether the baffle field in the target configuration information is an open baffle if the target key-value pair corresponding to the target configuration information does not exist in the cache; and a data return unit, which returns the baffle data as return data when it is determined that the baffle field in the target configuration information is an open baffle.
[0089] In an optional embodiment, the data acquisition module 303 also includes: a baffle judgment unit, after obtaining the target configuration information, determines whether the baffle field in the target configuration information is an open baffle based on the cache field in the target configuration information being not written to the cache; and a data return unit, when it is determined that the baffle field in the target configuration information is an open baffle, returns the baffle data as return data.
[0090] In an optional embodiment, the data acquisition module 303 also includes: a value acquisition unit, which, when determining that the baffle field in the target configuration information is not to open the baffle, initiates a third-party Internet of Things interface call request and parses the return result according to the target configuration information to obtain the target value; a key-value pair acquisition unit, which obtains the target key-value pair according to the target value and the target configuration information; a cache judgment unit, which determines whether the cache field in the target configuration information is a write cache; a cache writing unit, which writes the target key-value pair to the cache if it is determined that the cache field in the target configuration information is a write cache, and a data return unit that returns the target key-value pair as return data; otherwise, the data return unit returns the target key-value pair as return data.
[0091] Specifically, the key-value pair acquisition unit includes: an encryption subunit that encrypts the target configuration information using a preset encryption algorithm to obtain a target key; and a key-value pair acquisition subunit that obtains a target key-value pair in the form of a key-value pair according to the target value and the target key. It should be added that the encryption algorithm can be selected according to actual design requirements, such as the MAD digest algorithm, etc., and no further limitation is made here.
[0092] In addition, the value acquisition unit includes: a request initiation subunit that selects a corresponding request method according to the request method field in the target configuration information and initiates a third-party Internet of Things interface call request. It should be noted that if the request methods in the configuration information include GET, POST, and SOCKET, any of them can be selected to initiate a third-party Internet of Things interface call request.
[0093] In an alternative embodiment, in order to facilitate subsequent determination of the third-party Internet of Things interface call situation, that is, whether the current request is successfully called and whether data is obtained, etc., therefore, the device further includes: a statistics module that writes the current request into the Internet of Things interface call statistics information after returning the target key-value pair as the return data.
[0094] In the embodiment of the present invention, by pre-configuring the third-party Internet of Things interface configuration information, the third-party Internet of Things interface configuration information can be quickly found according to the Internet of Things interface call request, and the required information to be configured can be obtained, so as to integrate the information to be configured and the Internet of Things interface call request, and quickly obtain the target key-value pair from the cache as the return data of the Internet of Things interface call request according to the integrated target configuration information, achieving the purpose of quickly adapting to the requirements of various third-party Internet of Things interfaces, efficiently docking with third-party Internet of Things interfaces, improving the compatibility with third-party Internet of Things interfaces, facilitating quick deployment and production, greatly reducing various risks brought by modifying the code, saving development time and development volume, and improving development efficiency.
[0095] Please refer to Figure 4 , Figure 4 which is a schematic diagram of an embodiment of the electronic device provided by the present invention. As Figure 4 shown, the embodiment of the present invention provides an electronic device 400, including a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and executable on the processor 420. When the processor 420 executes the computer program 411, the following steps are implemented:
[0096] Search for the pre-configured third-party Internet of Things interface configuration information according to the previously received Internet of Things interface call request to obtain the information to be configured;
[0097] Obtain the target configuration information according to the Internet of Things interface call request and the information to be configured;
[0098] Based on the cache field in the target configuration information being write cache, determine whether there is a target key-value pair corresponding to the target configuration information in the cache. If it exists, obtain the corresponding target key-value pair as the return data and return it; wherein, the target key-value pair in the cache is cached in the form of a key-value pair by previously taking the return target value obtained by calling a third-party Internet of Things interface based on the target configuration information and the target key generated according to the target configuration information.
[0099] According to the Internet of Things digital connection method provided by the present invention, determining whether there is a target key-value pair corresponding to the target configuration information in the cache includes:
[0100] If there is no target key-value pair corresponding to the target configuration information in the cache, determine whether the baffle field in the target configuration information is an open baffle;
[0101] In the case of determining that the baffle field in the target configuration information is an open baffle, return the baffle data as the return data.
[0102] According to the Internet of Things digital connection method provided by the present invention, after obtaining the target configuration information, it includes:
[0103] Based on the cache field in the target configuration information being not write cache, determine whether the baffle field in the target configuration information is an open baffle;
[0104] In the case of determining that the baffle field in the target configuration information is an open baffle, return the baffle data as the return data.
[0105] According to the Internet of Things digital connection method provided by the present invention, determining whether the baffle field in the target configuration information is an open baffle includes:
[0106] In the case of determining that the baffle field in the target configuration information is not an open baffle, initiate a third-party Internet of Things interface call request according to the target configuration information and parse the return result to obtain a target value;
[0107] According to the target value and the target configuration information, obtain a target key-value pair;
[0108] Determine whether the cache field in the target configuration information is write cache;
[0109] If it is determined that the cache field in the target configuration information is write cache, write the target key-value pair into the cache and return the target key-value pair as the return data;
[0110] Otherwise, return the target key-value pair as the return data.
[0111] According to the Internet of Things digital connection method provided by the present invention, obtaining a target key-value pair according to the target value and the target configuration information includes:
[0112] Using a preset encryption algorithm to encrypt the target configuration information to obtain a target key;
[0113] According to the target value and the target key, obtaining a target key-value pair in the form of a key-value pair.
[0114] According to the Internet of Things digital connection method provided by the present invention, initiating a third-party Internet of Things interface call request according to the target configuration information includes:
[0115] Selecting a corresponding request method according to the request method field in the target configuration information and initiating a third-party Internet of Things interface call request.
[0116] According to the Internet of Things digital connection method provided by the present invention, the Internet of Things interface call request includes an application programming Internet of Things interface source file and a request source;
[0117] Before obtaining the target configuration information according to the request parameters in the Internet of Things interface call request and the information to be configured, it includes:
[0118] Determining that the application programming Internet of Things interface source file is valid; or,
[0119] Determining that the application programming Internet of Things interface source file is valid and determining whether the request source is legal.
[0120] It should be noted that in the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0121] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, platforms, or computer program products. Therefore, the present invention can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0122] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (platforms), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded computers, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices produce a platform for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or one or more of the blocks.
[0123] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction platform that implements the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or one or more of the blocks.
[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or one or more of the blocks.
[0125] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the present invention.
[0126] Obviously, those skilled in the art can make various changes and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A digital connection method for the Internet of Things, characterized in that: include: According to the previously received IoT interface call request, searching for previously configured third-party IoT interface configuration information to obtain the information to be configured; Obtain target configuration information according to the Internet of Things interface call request and the information to be configured; Based on the cache field in the target configuration information being a write cache, determine whether there is a target key-value pair corresponding to the target configuration information in the cache, and if so, obtain the corresponding target key-value pair and return it as return data; wherein the target key-value pair in the cache is a return target value obtained by calling a third-party Internet of Things interface based on the target configuration information and a target key generated according to the target configuration information, which are cached in the form of a key-value pair; The step of determining whether a target key-value pair corresponding to the target configuration information exists in the cache includes: If the target key-value pair corresponding to the target configuration information does not exist in the cache, determining whether the baffle field in the target configuration information is an open baffle; When it is determined that the baffle field in the target configuration information is a baffle-on field, returning baffle data as the return data; After obtaining the target configuration information, the following steps are included: Based on the cache field in the target configuration information being not to write to the cache, determining whether the baffle field in the target configuration information is to open the baffle; When it is determined that the baffle field in the target configuration information is a baffle-on field, returning baffle data as the return data; Determining whether the baffle field in the target configuration information is an open baffle includes: When it is determined that the baffle field in the target configuration information is not to open the baffle, a third-party Internet of Things interface call request is initiated according to the target configuration information, and a return result is parsed to obtain a target value; Obtaining a target key-value pair according to the target value and the target configuration information; Determine whether the cache field in the target configuration information is a write cache; If it is determined that the cache field in the target configuration information is a write cache, writing the target key-value pair into the cache, and returning the target key-value pair as the return data; Otherwise, the target key-value pair is returned as the return data.
2. The method for digital connection of the Internet of Things according to claim 1, characterized in that: According to the target value and the target configuration information, a target key-value pair is obtained, including: Using a preset encryption algorithm, encrypt the target configuration information to obtain a target key; A target key-value pair is obtained according to the target value and the target key in the form of a key-value pair.
3. The method for digital connection of the Internet of Things according to claim 1, characterized in that: Initiate a third-party IoT interface call request based on the target configuration information, including: According to the request method field in the target configuration information, select the corresponding request method and initiate a third-party Internet of Things interface call request.
4. The method for digital connection of the Internet of Things according to claim 1, characterized in that: The Internet of Things interface call request includes an application programming Internet of Things interface source file and a request source; Before obtaining the target configuration information according to the request parameters in the Internet of Things interface call request and the information to be configured, the method includes: Determine that the application programming Internet of Things interface source file is valid; or, Determine whether the application programming Internet of Things interface source file is valid, and determine whether the request source is legal.
5. An Internet of Things digital connection platform, characterized in that: include: The information search module searches for the previously configured third-party IoT interface configuration information according to the previously received IoT interface call request to obtain the information to be configured; A data integration module obtains target configuration information according to the Internet of Things interface call request and the information to be configured; A data acquisition module, based on the cache field in the target configuration information being a write cache, determines whether there is a target key-value pair corresponding to the target configuration information in the cache, and if so, acquires the corresponding target key-value pair and returns it as return data; wherein the target key-value pair in the cache is a return target value obtained by calling a third-party Internet of Things interface based on the target configuration information and a target key generated according to the target configuration information, which are cached in the form of a key-value pair; The step of determining whether a target key-value pair corresponding to the target configuration information exists in the cache includes: If the target key-value pair corresponding to the target configuration information does not exist in the cache, determining whether the baffle field in the target configuration information is an open baffle; When it is determined that the baffle field in the target configuration information is a baffle-on field, returning baffle data as the return data; After obtaining the target configuration information, the following steps are included: Based on the cache field in the target configuration information being not to write to the cache, determining whether the baffle field in the target configuration information is to open the baffle; When it is determined that the baffle field in the target configuration information is a baffle-on field, returning baffle data as the return data; Determining whether the baffle field in the target configuration information is an open baffle includes: When it is determined that the baffle field in the target configuration information is not to open the baffle, a third-party Internet of Things interface call request is initiated according to the target configuration information, and a return result is parsed to obtain a target value; Obtaining a target key-value pair according to the target value and the target configuration information; Determine whether the cache field in the target configuration information is a write cache; If it is determined that the cache field in the target configuration information is a write cache, writing the target key-value pair into the cache, and returning the target key-value pair as the return data; Otherwise, the target key-value pair is returned as the return data.
6. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for digital connection of the Internet of Things as described in any one of claims 1 to 4 is implemented.
7. A non-transitory computer-readable storage medium, characterized in that: The storage medium stores a computer software program, and when the computer software program is executed by the processor, the method for digital connection of the Internet of Things as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Mock data acquisition method and device, terminal equipment and readable storage medium
CN117251385A