CN109885347B - Method, device, terminal, system and storage medium for acquiring configuration data - Google Patents
Method, device, terminal, system and storage medium for acquiring configuration data Download PDFInfo
- Publication number
- CN109885347B CN109885347B CN201711255291.9A CN201711255291A CN109885347B CN 109885347 B CN109885347 B CN 109885347B CN 201711255291 A CN201711255291 A CN 201711255291A CN 109885347 B CN109885347 B CN 109885347B
- Authority
- CN
- China
- Prior art keywords
- configuration data
- target
- terminal
- character string
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a method, a device, a terminal, a system and a storage medium for acquiring configuration data, wherein the method comprises the following steps: acquiring initial configuration data of a configuration server, wherein the initial configuration data is used for configuring functional parameters of sub-applications set in a target application of a terminal; calling conversion middleware to extract a first character string from the initial configuration data, wherein the first character string is extracted based on a matching rule set in the conversion middleware; calling the conversion middleware to convert the first character string into a second character string, wherein the second character string is obtained by conversion based on a conversion rule set in the conversion middleware; and processing the initial configuration data according to the second character string to obtain target configuration data, so that the sub-application can effectively analyze the configuration data.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a terminal, a system, and a storage medium for acquiring configuration data.
Background
With the continuous development of computer technology, the number of applications installed in the terminal is also increasing, which not only occupies a large amount of storage space, but also slows down the operation speed of the terminal, and therefore, for services with low frequency of use, i.e. throw-and-play (such as alarm setting, ticket reservation, etc.), setting sub-applications in some applications in the terminal becomes a development trend for this type of services.
The sub-application (such as the small program in the WeChat) does not occupy the original interface of the original application (such as the chat interface of the WeChat small program which does not occupy the WeChat), is an application which can be used without installation, can realize the use and the throwing of the application, and is a very convenient and reliable application form. Therefore, how to better configure sub-applications becomes a popular research direction.
Disclosure of Invention
The embodiment of the invention provides a method and a device for acquiring configuration data, a terminal, a system and a storage medium, which can acquire the configuration data capable of configuring sub-applications arranged in some applications.
In one aspect, an embodiment of the present invention provides a method for acquiring configuration data, where the method includes:
acquiring initial configuration data of a configuration server, wherein the initial configuration data is used for configuring functional parameters of sub-applications set in a target application of a terminal;
calling conversion middleware to extract a first character string from the initial configuration data, wherein the first character string is extracted based on a matching rule set in the conversion middleware;
calling the conversion middleware to convert the first character string into a second character string, wherein the second character string is obtained by conversion based on a conversion rule set in the conversion middleware;
and processing the initial configuration data according to the second character string to obtain target configuration data.
In another aspect, an embodiment of the present invention provides an apparatus for acquiring configuration data, where the apparatus includes:
the terminal comprises an acquisition module, a configuration module and a processing module, wherein the acquisition module is used for acquiring initial configuration data of a configuration server, and the initial configuration data is used for configuring functional parameters of a sub-application set in a target application of the terminal;
the extraction module is used for calling the conversion middleware to extract a first character string from the initial configuration data, wherein the first character string is extracted based on a matching rule set in the conversion middleware;
the conversion module is used for calling the conversion middleware to convert the first character string into a second character string, and the second character string is obtained by conversion based on a conversion rule set in the conversion middleware;
and the processing module is used for processing the initial configuration data according to the second character string to obtain target configuration data.
In another aspect, an embodiment of the present invention further provides a system for processing configuration data, where the system is characterized in that: configuring a server and a terminal;
the configuration server is used for storing initial configuration data;
the terminal is provided with a target application, a sub-application set in the target application, and the terminal is used for executing the configuration data acquisition method.
In another aspect, an embodiment of the present invention further provides an intelligent terminal, which is characterized by including a processor and a storage device, where the storage device is configured to store a computer application program instruction, and the processor is configured to call the computer application program instruction and execute the above method for acquiring configuration data.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer storage medium stores a computer program, where the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to execute the above-mentioned method for acquiring configuration data.
In the embodiment of the invention, the initial configuration data of the configuration server is obtained, the conversion middleware is called to extract the first character string from the initial configuration data, the first character string is converted into the second character string, and the initial configuration data is processed according to the second character string to obtain the target configuration data, so that the configuration data can be effectively analyzed when the sub-application set in the target application needs to configure the functional parameters, and the configuration of the sub-application is realized.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1a is a schematic structural diagram of a system for performing configuration data processing according to an embodiment of the present invention;
FIG. 1b is a schematic view of a configuration interface according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of obtaining configuration data according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of another embodiment of the present invention for configuration data acquisition;
FIG. 4 is a schematic flow chart of another embodiment of the present invention for obtaining configuration data;
FIG. 5 is a schematic flow chart of another embodiment of the present invention for configuration data acquisition;
FIG. 6 is a schematic diagram of configuration data provided by an embodiment of the present invention;
fig. 7 is a schematic flowchart of a configuration data obtaining method according to an embodiment of the present invention;
fig. 8 is a schematic flowchart of another configuration data obtaining method according to an embodiment of the present invention;
fig. 9 is a schematic flowchart of a further configuration data obtaining method according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an apparatus for acquiring configuration data according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of another terminal according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of another system for performing configuration data processing according to an embodiment of the present invention.
Detailed Description
In the embodiment of the present invention, for a target application installed in a terminal, sub-applications capable of implementing a certain small function may be directly set, and these sub-applications may implement some functions in combination with the target application without downloading or installing, for example, some small programs (mini programs) that may be set in an instant messaging application. Based on these sub-applications, certain functions may be implemented. The user can generate specific configuration data through a configuration platform, and the sub-applications can realize corresponding functions based on the configuration data. For example, an applet for announcing a temporary announcement of a bank can be set on an instant messaging application installed in a terminal, a user configures specific announcement content to be announced through a configuration platform, and the configuration platform generates configuration data; any terminal installed with the instant messaging application and provided with the applet in the instant messaging application can request to acquire the configuration data, and specific announcement contents of the bank are displayed on the terminal by combining the instant messaging application based on the configuration data.
The configuration data corresponding to the configuration data generated by the configuration platform may be a piece of configuration data based on a JavaScript Object Notation (JSON) format, and a corresponding configuration server in the configuration platform may send the generated configuration data to a required terminal. In the configuration data based on the JSON format, there may be contents that cannot be parsed by the sub application, for example, the sub application cannot parse a character string in the configuration data into a JSON object that can be directly called by the sub application, or the sub application cannot convert a non-standard character string in the configuration data into a JSON object that can be directly called by the sub application. In the embodiment of the invention, the conversion middleware comprising the matching rule and the conversion rule is set, and the configuration data based on the JSON format is correspondingly processed by the conversion middleware so as to ensure that the sub-application can normally analyze and use the configuration data. The configuration data may be a piece of executable code.
FIG. 1a provides a system for configuration data processing according to the present application. The system may include: configuration terminal 100, configuration platform, configuration server 200, and terminal 300. The configuration platform and the configuration server 200 are located at a service side, and the terminal 300 may be an intelligent terminal with a function of a smart phone, a tablet computer, and a smart wearable device waiting for a network. The terminal 300 has installed thereon a target application, which may be, for example, an application of the type of an instant messaging application.
The configuration platform is a system capable of visually managing configuration items of an application and can be composed of one or more servers. The configuration platform can provide a configuration interface for a user, so that the user can conveniently configure related function parameters in some sub-applications, for example, related parameters of functions such as displaying temporary announcements in the sub-applications. The configuration terminal 100 displays the configuration interface to the user, so that the user can complete the configuration of the relevant parameters, wherein one configuration interface can be shown in fig. 1 b. Based on these functional parameters, the configuration platform may generate configuration data, and the configuration data corresponding to the configuration data may be issued by the specified configuration server 200 to the terminal that needs the configuration data. In one embodiment, the functions of the configuration platform may also be implemented solely by the configuration server 200.
The configuration server 200 may be a file server for managing configuration data, the configuration server 200 may be a server, and in other embodiments, the functions of the configuration server 200 may be implemented by multiple servers in cooperation. The configuration server 200 may be used to manage configuration data corresponding to sub-applications under certain target applications.
The terminal 300 may be stationary, such as a personal computer, etc., or mobile, such as a smart phone, etc., and the terminal 300 is installed with a target application, in which one or more sub-applications having certain functions may be set.
In one embodiment, the configuration platform may be connected to the configuration server 200 via a network, and the configuration server 200 may be connected to the terminal 300 via the network.
In the configuration platform, for more convenient interaction with a front-end language, the data format in the generated configuration data is a special format, and in one embodiment, the interaction of the configuration data between the service side and the terminal can be based on the JSON format.
In the embodiment of the present invention, there may be two kinds of representation structures in the JSON format: objects, and arrays. Wherein the structure of the object starts with "{" left brace and ends with "}" right brace, the middle part can be composed of 0 or more "key/value" key value pairs divided by "comma", and the key and the value are divided by "colon", and the key needs to use double quotation marks. In one embodiment, the configuration data (JSON) return format may be returned in two ways as shown in fig. 6. Therein, the executable code in the two JSON formats shown in fig. 6 constitutes configuration data, and the executable code constitutes configuration data of a sub-application or an interactive web page (also called HTML5, abbreviated as H5 page) that can be provided to the terminal.
When the H5 page parses the configuration data shown in fig. 6, the character string in the configuration data in the JSON format may be converted into an executable object that can be executed by the H5 page, and the H5 page may be configured with corresponding function parameters according to the executable object.
In an embodiment, the executable object may be a JSON object, and in an H5 page, configuration data in the configuration server may be pulled in a Script (Script) or JSONP (JSON with Padding, which is a usage pattern of the JSON format), and a character string in the configuration data is successfully parsed to obtain the JSON object.
It can be seen that the character string b in the key-value pair "{ b:1}" extracted in fig. 6 is a character string in a non-standard format, and the character string b does not use a double quotation mark, so that the sub-application set in the target application may not be able to parse and use the configuration data corresponding to fig. 6.
In a sub-application such as an applet provided in a target application, the requirement for configuration data in the JSON format is strict. In one embodiment, the strings in the configuration data may be converted to JSON objects using a particular conversion function, such as the conversion function JSON. The conversion function needs to strictly comply with the standard format of the JSON format, so that the character strings in the configuration data can be converted into the JSON objects. In one embodiment, if a character string which does not conform to the JSON standard format exists in configuration data generated by the configuration server, the sub-application cannot parse the character string, the sub-application cannot obtain a usable JSON object, and the configuration of the file cannot be completed. Therefore, in the embodiment of the invention, the conversion middleware is arranged to obtain the JSON object for the child application to use.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a process for acquiring configuration data according to an embodiment of the present invention. In S101 of fig. 2, the configuration platform may generate and push configuration data to a configuration server, which stores the configuration data; in S102, the H5 page requests the configuration server for the configuration data, in S103, the configuration server receives the request and returns the configuration data to the H5 page, and the H5 page may obtain an executable object according to the configuration data by conversion, and execute the executable object, thereby completing configuration of corresponding functional parameters, and facilitating subsequent normal execution of services, such as publishing of announcement content.
In S104, the sub-application set in the target application requests the configuration data from the configuration server, and in S105, the configuration server receives an acquisition request of the sub-application for the configuration data and returns the configuration data to the sub-application.
If the configuration data comprises a character string which does not conform to the JSON standard format, a plurality of modes can be adopted to avoid the situation that the sub-application of the terminal cannot analyze the configuration data to obtain the JSON object. In one embodiment, dedicated software and hardware resources can be called, configuration data dedicated to configuring the sub-application is generated strictly according to the JSON standard format, one configuration data is separately output for the sub-application, and all character strings in the separately output configuration data conform to the set matching rule.
In an embodiment, the target configuration data may be obtained by configuring a conversion middleware, invoking the conversion middleware to use original initial configuration data of a configuration platform, and performing format conversion on the initial configuration data according to the configuration conversion middleware, where the target configuration data may be configuration data in which a non-standard character string is modified and replaced by a standard character string, or may be an executable object that can be directly used by a child application, and a child application set in the target application may use the target configuration data.
Please refer to fig. 3, which is a schematic flow chart illustrating another method for acquiring configuration data according to an embodiment of the present invention. In S301 of fig. 3, the configuration platform may generate and push initial configuration data to the configuration server, the initial configuration data being data that has not been processed by the conversion middleware. In S302, the H5 page requests the initial configuration data from the configuration server, where the initial configuration data is a segment of executable code for configuration. In S303, the configuration server may return configuration data to the H5 page after receiving the request, where the configuration data returned to the H5 page may be an executable code that can be executed by the H5 page obtained according to the initial configuration data, and the H5 page is converted according to the configuration data to obtain an executable object. The configuration data returned to the H5 page may be the initial configuration data itself.
In one embodiment, if the sub-application in the target application needs to obtain the configuration data, an API interface may be called, and in S304, the configuration data is requested to obtain the configuration data from a configuration data buffer in the terminal; in S305, the terminal queries whether there is target configuration data available for the sub-application, where the target configuration data is configuration data processed by the conversion middleware. In one embodiment, the target configuration data may be configuration data that can be normally executed by the sub-application, or may be a JSON object that can be directly used by the sub-application.
In one embodiment, if the target configuration data exists in the configuration data buffer, in S306, whether the target configuration data is expired may be queried, and if the target configuration data is within the validity period, in S307, the target configuration data may be returned to the sub-application for the sub-application to parse.
In one embodiment, if the target configuration data is not within the valid period or the target configuration data is not in the configuration data buffer, the initial configuration data may be requested from the configuration server in S308; the configuration server receives the request of the terminal and returns the initial configuration data content to the terminal.
In one embodiment, the terminal may call a set conversion middleware to convert the initial configuration data into the target configuration data, and at 210, write the target configuration data into the configuration data buffer of the terminal and update the validity period of the target configuration data.
In one embodiment, the terminal invokes a conversion middleware to convert the initial configuration data into the target configuration data, which may also include the steps shown in fig. 4:
in S401, the terminal may request to acquire configuration data; the provisioning server may return the initial provisioning data content in S402 after receiving the request.
In one embodiment, the terminal may directly call an Application Programming Interface (API) to pull the configuration data from the configuration server.
In S403, the terminal may call the set conversion middleware, and obtain, by using the regular matching, a first character string that does not conform to the set matching rule in the initial configuration data, for example, the first character string is a JSON character string in a non-standard format.
In S404, the terminal may call the conversion middleware to convert the first character string into a second character string conforming to the matching rule by using the regular matching, for example, the second character string is a JSON character string in a standard format.
In S405, the terminal may convert the second string into an executable object (e.g., JSON object) using a conversion function (e.g., JSON. Parse (str)), and in S406, transfer the executable object callback to a sub-application in the target application, so that the sub-application executes a corresponding service, and completes configuration of a corresponding function parameter.
In one embodiment, the terminal may further generate the target configuration data according to the second character string, and store the target configuration data in a configuration data buffer of the terminal.
In one embodiment, the terminal invokes the conversion middleware to convert the initial configuration data into the target configuration data, and may also include the steps shown in fig. 5:
in S501, the terminal requests the configuration server to acquire configuration data.
In S502, the configuration server receives the request and obtains initial configuration data stored in the configuration server.
In S503, the configuration server may call the set conversion middleware, and obtain, by using regular matching, a first character string that does not conform to the set matching rule in the initial configuration data, for example, the first character string is a JSON character string in a non-standard format.
In S504, the configuration server may invoke the conversion middleware to convert the first string into a second string conforming to the matching rule by using the regular matching.
The configuration server may generate target configuration data according to the second character string in S505, and transmit the target configuration data to the terminal in S506.
In S507, the terminal may parse the character string in the target configuration data to obtain an executable object (e.g., a JSON object), and may call back the executable object to a sub-application in the target application, so that the sub-application executes a corresponding service to complete configuration of the function parameter.
In one embodiment, the terminal may further store the target configuration data in a configuration data buffer of the terminal.
Therefore, the original configuration platform is not required to be transformed and optimized, the H5 page and the sub-applications share the same configuration data, the sub-applications can effectively analyze the configuration data through the configuration conversion middleware, the labor maintenance cost can be reduced, and the product operation efficiency can be improved. Meanwhile, the target configuration data is stored in the configuration data buffer to realize caching, so that repeated pulling of the configuration data from the configuration server can be avoided, the page performance can be improved, and the operating pressure of the configuration server can be reduced.
Method embodiments of the present application are described below. It should be noted that the method according to the present application may be executed by a terminal, and the terminal may be, for example, a mobile device, a mobile station (mobile station), a mobile unit (mobile unit), a smart phone, a tablet computer, a wearable device, a wireless unit, a remote unit, a user agent, a mobile client, and the like, which is not limited in this respect in this embodiment of the present invention.
Fig. 7 is a schematic flowchart of a method for acquiring configuration data according to an embodiment of the present invention. The method as shown in fig. 7 may include:
s701, acquiring initial configuration data of a configuration server.
The configuration server is used to manage configuration data, and in one embodiment, initial configuration data is generated by a configuration platform and sent to the configuration server, which stores the initial configuration data.
The initial configuration data represents a file that has not been processed by the conversion middleware, and can be used to configure functional parameters for sub-applications set in the target application of the terminal. The functional parameter may refer to an application interface parameter of the sub-application, and for example, the functional parameter may include addition and deletion of an announcement, adjustment of an interface color, and change of an interface advertisement.
It should be noted that the target application may refer to such an application in which one or more sub-applications are set, and the sub-application set in the target application may refer to an application that can be implemented and used without being installed in a terminal, using the target application as a platform. For example, the target application may be a WeChat and the sub-application may be an applet in the WeChat.
In one embodiment, the terminal may pull the initial-configuration data from the configuration server through an API interface.
In one embodiment, a terminal may send a request for obtaining configuration data to the configuration server, the configuration server responds to the request and sends the initial configuration data to the terminal after receiving the request of the terminal, and the terminal receives the initial configuration data of the configuration server.
S702, calling a conversion middleware to extract a first character string from the initial configuration data.
It should be noted that the conversion middleware may be an independent system service, and may be used to connect two independent applications or independent systems, and through the conversion middleware, the two systems or applications with different interfaces may also exchange information with each other, thereby implementing resource sharing.
In one embodiment, the conversion middleware can be set by a terminal and can also be set by a configuration server.
It should be further noted that the first character string is extracted based on a matching rule set in the conversion middleware.
In one embodiment, the matching rule set in the conversion middleware includes a rule set based on a regular expression for finding a character string, and the matching rule may be a regular match.
For example, the terminal may set a character string in a non-standard format as a first character string, and extract the first character string from the initial configuration data by using the regular matching based on a rule set by the regular expression.
Wherein the non-standard format is for the standard format. For example, in the JSON format, a type of format in which a keyword needs to use a double quotation mark "" and no space can appear before and after the keyword is set is a standard format, and a key-value pair format like "{" b ":1}" is a standard format, so other formats other than the standard format are called as nonstandard formats like "{ b:1}". Of course, the above-mentioned modes are only examples, not exhaustive, and include but are not limited to the above-mentioned alternatives.
And S703, calling the conversion middleware to convert the first character string into a second character string.
The second character string is converted based on a conversion rule set in the conversion middleware.
In one embodiment, the conversion rules set in the conversion middleware include string conversion rules set based on regular expressions.
For example, the second character string may be a character string formatted in a standard format, and the terminal may convert the first character string into the second character string by using regular matching based on a conversion rule set by the regular expression.
S704, processing the initial configuration data according to the second character string to obtain target configuration data.
It should be noted that the target configuration data is configuration data that can be successfully parsed by a sub-application in the target application after being processed by the conversion middleware.
In an embodiment, the processing the initial configuration data according to the second character string to obtain target configuration data may include: converting the initial configuration data according to the second character string to obtain an executable object, wherein the executable object is the target configuration data; and configuring the functional parameters of the sub-application set in the target application according to the executable object.
Note that the executable Object may be a JSON Object, for example, the JSON Object may be shaped as Object { b:1}, and so on.
In an embodiment, the terminal may convert the initial character string and the second character string in the initial configuration data, where the format of the initial character string is a standard format, by using a conversion function to obtain the executable object, and the terminal may transfer the executable object to a sub-application in a target application, where the sub-application executes a corresponding service according to the executable object, and the service may include configuration or update of a function parameter of the sub-application. And the terminal can store the executable object as target configuration data so that the executable object can be directly used by the sub-application after the sub-application is used at this time and when the functional parameters need to be configured again.
In an embodiment, the processing the initial configuration data according to the second character string to obtain target configuration data may include: replacing the first character string in the initial configuration data with the second character string, and obtaining target configuration data according to the replaced initial configuration data; and analyzing the sub-application set in the target application according to the target configuration data to obtain an executable object of the sub-application.
For example, after the terminal calls the conversion middleware to obtain the second character string, the terminal may replace the first character string in the initial configuration data with the second character string, so that the character strings in the initial configuration data are character strings in a standard format, and the terminal may save the replaced initial configuration data as the target configuration data, so that after the sub-application is used at this time, when the functional parameter is configured again as needed, the terminal may directly parse the character string in the target configuration data to obtain the executable object.
In one embodiment, the configuration server may also obtain the target configuration data according to the initial configuration data. The specific implementation process may refer to the above S701 to S704, where the steps shown in the terminal may also be completed by the configuration server.
In an embodiment, after obtaining the target configuration data according to the initial configuration data, the configuration server sends the target configuration data to the terminal, and the terminal may obtain an executable object according to a character string of the target configuration data and return the executable object to a sub-application in a target application for use.
Therefore, according to the embodiment of the invention, the terminal firstly obtains the initial configuration data of the configuration server, then the conversion middleware is called to convert the first character string in the initial configuration data into the second character string, the target configuration data is obtained according to the second character string, and the target configuration data can be ensured to be effectively analyzed by the sub-application without manually maintaining one configuration data for the sub-application, so that the labor maintenance cost is reduced, and the product operation efficiency is improved.
Please refer to fig. 8, which is a flowchart illustrating another configuration data obtaining method according to an embodiment of the present invention. The method as shown in fig. 8 may include:
s801, acquiring initial configuration data of a configuration server. The initial configuration data is used for configuring the functional parameters of the sub-applications set in the target application of the terminal. In one embodiment, before performing the S801, the method may further include: detecting whether the sub-application requests to call a target interface, where the target interface is a set interface for acquiring configuration data, for example, detecting whether to call wx. Or before executing the S801, it may further be determined whether the configuration data buffer of the terminal is queried to determine whether the required configuration data exists, and if not, sending a query request for requesting the initial configuration data to the configuration server, and acquiring the initial configuration data from the configuration server, so as to obtain final target configuration data. And if the configuration data exists, directly configuring parameters of the sub-application according to the required configuration data.
S802, calling a conversion middleware to extract a first character string from the initial configuration data.
The first character string is extracted based on a matching rule set in the conversion middleware.
And S803, calling the conversion middleware to convert the first character string into a second character string.
The second character string is converted based on a conversion rule set in the conversion middleware.
S804, the initial configuration data is processed according to the second character string, and target configuration data is obtained.
It should be noted that, the specific implementation process of S801 to S804 may refer to the steps shown in S701 to S704 in the foregoing method embodiment, which is not described herein again.
S805, storing the target configuration data into a configuration data buffer of the terminal.
In one embodiment, the terminal may use a local storage mode to store data in the configuration data buffer. In one embodiment, the data buffer may be configured in a localstorage storage manner, which is a data storage manner without time limitation and may be used for persistent local storage, and unless data is deleted actively, the data has no storage period.
In one embodiment, the terminal may use a browser cache (cookie) approach to complete data storage in the configuration data cache of the terminal.
In one embodiment, the configuration data buffer may be a memory of the terminal, such as the memory shown in fig. 11.
S806, setting an effective period for the target configuration data, and storing the effective period of the target configuration data into the configuration data buffer.
In one embodiment, the expiration date may be set according to the contents in the target configuration data. For example, the target configuration data may be used to update a bulletin board of an application interface in a sub-application in the target application, where the validity period of the bulletin board is 2 days, and then the terminal may set the validity period of the target configuration data to 2 days. The target configuration data is within the valid period within 2 days, and the target configuration data is not within the valid period beyond two days.
In one embodiment, the validity period may also be set automatically by the user or the terminal. The user or the terminal may set the target configuration data according to the average update frequency of the configuration data of the sub-application or other basis, so as to avoid the terminal repeatedly pulling the configuration data from the configuration server.
In a possible embodiment, there is a corresponding relationship between the target configuration data and the valid period of the target configuration data, and when storing, the target configuration data and the valid period of the target configuration data are stored in the configuration data buffer correspondingly.
S807, querying a configuration data buffer of the terminal to determine whether the target configuration data exists.
In the process of running the sub-application, if it is detected that the sub-application needs to call a set interface for acquiring the configuration data, for example, call a wx. Request (req) API interface, the S807 is started to execute, and data is preferentially queried from the configuration data cache. And if the data is not inquired, requesting to acquire the data from a configuration server at the service side. When a sub-application needs to obtain configuration data, it may first query the configuration data buffer for the presence of the target configuration data. If the target configuration data does not exist in the configuration data buffer, the steps S801 to S806 are performed. If the target configuration data exists, the following step S808 is performed. In one embodiment, the terminal may communicate internally with the configuration data cache, and the querying of the configuration data cache for the presence of the target configuration data is performed through an internal communication interface.
For example, the query process for configuring the data buffer may be the process involved in steps S305 and S306 shown in fig. 3.
And S808, if the target configuration data exists, configuring the functional parameters of the sub-application set in the target application of the terminal according to the target configuration data.
In an embodiment, if the target configuration data exists in the configuration data buffer, the terminal may directly parse the character string in the target configuration data to obtain an executable object, and transmit the executable object back to the sub-application in the target application to execute the corresponding service, so as to complete the configuration of the function parameter.
In one embodiment, if the target configuration data does not exist, a query request is sent to the configuration server, and the query request is used for requesting initial configuration data.
After the configuration server receives the query request, the configuration server sends the initial configuration data to the terminal in response to the query request, and the terminal further performs the steps shown in S801 to S806.
In one embodiment, please refer to fig. 9, which illustrates an implementation manner of S808 according to the present invention. The method as shown in fig. 9 may include:
s901, if the target configuration data exists, inquiring the valid period of the target configuration data.
It should be noted that, if the target configuration data exists in the configuration data buffer, the validity period of the target configuration data may be further queried, and whether the target configuration data is within the validity period may be determined.
In one embodiment, if the target configuration data is within the validity period, step S902 may be performed.
In one embodiment, if the target configuration data is not within the valid period, the initial configuration data may be requested from the configuration server, the configuration server responds to the request and sends the initial configuration data to the terminal, and the terminal may perform steps S801 to S806 as shown in fig. 8.
And S902, if the current time is within the valid period of the target configuration data, configuring the functional parameters of the sub-applications set in the target application of the terminal according to the target configuration data.
It should be noted that, if the current time of the target configuration data is within the valid period, it may be determined that the target configuration data is not expired and is a file that can be directly used by the sub-application.
In one embodiment, the target configuration data may include a character string in a standard format (including the converted second character string and a character string in an original format standard in the initial configuration data), and the terminal may convert the character string in the standard format to obtain an executable object, which may be, for example, a JSON object, for use by a sub-application.
In one embodiment, the target configuration data may include the executable object, and the terminal may directly transmit the target configuration data back to the sub-application, so that the sub-application configures the functional parameters according to the executable object in the target configuration data.
Therefore, according to the embodiment of the invention, the terminal firstly obtains the initial configuration data of the configuration server, then calls the conversion middleware to convert the first character string in the initial configuration data into the second character string, obtains the target configuration data according to the second character string, and stores the target configuration data in the configuration data buffer, so that the target configuration data can be ensured to be effectively analyzed by the sub-application without manually maintaining a configuration data for the sub-application, the terminal is prevented from repeatedly obtaining the initial configuration data from the configuration server, the page performance is improved, and the operating pressure of the configuration server is reduced.
The following describes embodiments of the apparatus to which the present application relates.
Fig. 10 is a schematic structural diagram of an apparatus for acquiring configuration data according to an embodiment of the present invention. The configuration data acquisition means shown in fig. 10 may include:
an obtaining module 1001 is configured to obtain initial configuration data of the configuration server. The initial configuration data is used for configuring the functional parameters of the sub-applications set in the target application of the terminal.
In one embodiment, the obtaining module 1001 may be combined with a communication interface of a terminal, such as the input interface 1102 shown in fig. 11.
The extracting module 1002 is configured to invoke conversion middleware to extract a first character string from the initial configuration data. The first character string is extracted based on a matching rule set in the conversion middleware.
A conversion module 1003, configured to invoke the conversion middleware to convert the first character string into a second character string. The second character string is converted based on a conversion rule set in the conversion middleware.
And the processing module 1004 is configured to process the initial configuration data according to the second character string to obtain target configuration data.
In one embodiment, the extracting module 1002, the converting module 1003, and the processing module 1004 may be combined with a processor of the terminal, such as the processor 1101 shown in fig. 11.
In one embodiment, the terminal further includes: a storage module 1005, configured to store the target configuration data in a configuration data buffer of a terminal, set a valid period for the target configuration data, and store the valid period of the target configuration data in the configuration data buffer.
In one embodiment, the configuration data buffer may be a memory of the terminal, such as memory 1104 shown in FIG. 11.
In one embodiment, the terminal further includes: a query module 1006, configured to query the configuration data buffer whether the target configuration data exists.
A configuration module 1007, configured to configure, according to the target configuration data, the function parameters of the sub-application set in the target application of the terminal if the target configuration data exists.
In one embodiment, the query module 1006 and the configuration module 1007 may be combined with a processor of the terminal, such as the processor 1101 shown in fig. 11.
A sending module 1008, configured to send, if the target configuration data does not exist, an inquiry request to the configuration server, where the inquiry request is used to request the initial configuration data.
In one embodiment, the sending module 1008 may be combined with a communication interface of a terminal, such as the output interface 1103 shown in fig. 11.
In an embodiment, the configuring module 1007 is specifically configured to query an expiration date of the target configuration data if the target configuration data exists, and configure the function parameter of the sub application set in the target application of the terminal according to the target configuration data if the current time is within the expiration date of the target configuration data.
In one embodiment, the matching rules set in the conversion middleware include rules set based on regular expressions for finding character strings; the conversion rules set in the conversion middleware comprise character string conversion rules set based on regular expressions.
In an embodiment, the processing module 1004 is specifically configured to convert the initial configuration data into an executable object according to the second character string, where the executable object is the target configuration data.
And configuring functional parameters of the sub-applications set in the target application according to the executable object.
In an embodiment, the processing module 1004 is specifically configured to replace the first character string in the initial configuration data with the second character string, and obtain the target configuration data according to the replaced initial configuration data.
And analyzing the sub-application set in the target application according to the target configuration data to obtain an executable object of the sub-application.
Referring to fig. 11, fig. 11 is a schematic structural diagram of another terminal according to an embodiment of the present invention. The terminal shown in fig. 11 may be an intelligent terminal, including: a processor 1101, an input interface 1102, an output interface 1103, and a memory 1104.
The memory 1104 may represent a storage device, including a volatile memory (volatile memory), such as a random-access memory (RAM); the memory may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory 1104 may also comprise a combination of memories of the kind described above.
The input interface 1103 may be used to input data to be processed to the processor 1101. In one embodiment, the input interface 1103 may comprise a plurality of independent interfaces, such as an ethernet interface, an LCD interface, etc., each responsible for communication of data input by different peripherals to the processor 1101.
The output interface 1102 may be configured to output data to other peripheral devices (e.g., a configuration server, etc.) connected to the terminal, and may output a processing result of the processor 1101. Output interface 1102 may also include a plurality of separate interfaces, such as an ethernet interface, a camera interface, etc., responsible for the communication of data output by processor 1101 to various peripheral devices.
In one embodiment, output interface 1102 and Input interface 1103 can be General Purpose Input Output (GPIO) interfaces.
The processor 1101 may be configured to read and execute computer instructions. In one embodiment, processor 1101 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
In one embodiment, the memory 1104 is also used to store program instructions. The processor 1101 may call the program instructions to implement:
acquiring initial configuration data of a configuration server, wherein the initial configuration data is used for configuring functional parameters of sub-applications set in a target application of a terminal;
calling conversion middleware to extract a first character string from the initial configuration data, wherein the first character string is extracted based on a matching rule set in the conversion middleware;
calling the conversion middleware to convert the first character string into a second character string, wherein the second character string is obtained by conversion based on a conversion rule set in the conversion middleware;
and processing the initial configuration data according to the second character string to obtain target configuration data.
In this application, the processor 1101 may be configured to call, from the memory, an implementation program of the configuration data obtaining method provided in one or more embodiments of the present application on the terminal side, and execute instructions included in the program. The input interface 1102 may be used to input data to be processed to the processor 1101, and in this application, the input interface 1102 may be specifically used to input initial configuration data of a configuration server. The output interface may be configured to output an execution result of the processor 1101, and in this application, the output interface 1103 may be specifically configured to output target configuration data of the processor 1101, so that a sub-application set in a target application of the terminal performs configuration of a function parameter.
It should be further noted that, for the method for acquiring configuration data provided in one or more embodiments of the present application, reference may be made to the foregoing embodiments, and details are not described here again.
It should be noted that the functions corresponding to the above devices of the terminal may be implemented by hardware design, may also be implemented by software design, and may also be implemented by a combination of software and hardware, which is not limited herein.
The embodiment of the invention also provides another system for processing the configuration data. Fig. 12 is a schematic structural diagram of a system for performing configuration data processing according to an embodiment of the present invention. As shown in fig. 12, the system includes: a terminal 1201 and at least one configuration server 1202.
The terminal 1201 is a terminal disclosed in the embodiments of the present invention, the terminal 1201 is installed with a target application, the target application is provided with one or more sub-applications, and the principle and implementation of the terminal are similar to those of the embodiments, and are not described herein again.
The configuration server 1202 may be a file server for managing configuration data, and the configuration server 1202 stores initial configuration data.
In one embodiment, the initial-configuration data is generated by a configuration platform that sends the initial-configuration data to configuration server 1202 for storage. In one embodiment, the configuration platform may be the configuration platform 101 shown in FIG. 1.
The system can be applied to the configuration of the functional parameters of the sub-applications in the target application of the terminal. In one embodiment, the configuration server 1202 stores and transmits initial configuration data to the terminal, which receives the initial configuration data and is configured to perform the methods shown in the above-described method embodiments.
It should be noted that, for a specific implementation process of the terminal 1201, reference may be made to the method embodiment, and details are not described herein.
In another embodiment, the configuration server 1202 in the system may store initial configuration data and be used to implement:
acquiring initial configuration data of a configuration server, wherein the initial configuration data is used for configuring functional parameters of sub-applications set in a target application of a terminal;
calling conversion middleware to extract a first character string from the initial configuration data, wherein the first character string is extracted based on a matching rule set in the conversion middleware;
calling the conversion middleware to convert the first character string into a second character string, wherein the second character string is obtained by conversion based on a conversion rule set in the conversion middleware;
and processing the initial configuration data according to the second character string to obtain target configuration data.
In one embodiment, the matching rules set in the conversion middleware comprise rules set based on regular expressions for finding character strings; the conversion rules set in the conversion middleware include character string conversion rules set based on regular expressions.
In an embodiment, the configuration server is configured to process the initial configuration data according to the second character string to obtain target configuration data, and specifically may include: converting the initial configuration data according to the second character string to obtain an executable object, wherein the executable object is the target configuration data; and configuring functional parameters of the sub-applications set in the target application according to the executable object.
In an embodiment, the configuration server is configured to process the initial configuration data according to the second character string to obtain target configuration data, and specifically may include: replacing the first character string in the initial configuration data with the second character string, and obtaining target configuration data according to the replaced initial configuration data; and analyzing the sub-application set in the target application according to the target configuration data to obtain an executable object of the sub-application.
In one embodiment, the configuration server 1202 may send the target configuration data to the terminal 1201, and the terminal 1201 receives the target configuration data and completes configuration of the functional parameters of the sub-applications in the target application according to the target configuration data.
In an embodiment, after receiving the target configuration data, the terminal 1201 may perform the steps shown in S805 to S808 shown in fig. 8 and the steps shown in fig. 9, which are not described herein again.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a computer program for acquiring configuration data, and the computer program enables a computer to execute part or all of the steps of any one of the methods for acquiring configuration data described in the above method embodiments.
Embodiments of the present invention also provide a computer program product, which includes a computer-readable storage medium storing a computer program, and when the computer program product runs on a computer, the computer executes some or all of the steps of any one of the configuration data acquisition methods described in the above method embodiments. In one embodiment, the computer program product may be a software installation package.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is intended to be illustrative of only some embodiments of the invention, and is not intended to limit the scope of the invention.
Claims (11)
1. A method for acquiring configuration data is applied to a configuration server, and comprises the following steps:
receiving initial configuration data generated and pushed by a configuration platform;
when a request for requesting initial configuration data of an interactive webpage is received, acquiring the initial configuration data of the configuration server and returning an executable code for the interactive webpage, which is obtained according to the initial configuration data, to the interactive webpage;
when a request for acquiring initial configuration data sent by a terminal aiming at a sub-application in a target application of the terminal is received, acquiring the initial configuration data of a configuration server, wherein the initial configuration data is configuration data based on a JSON format; if the target configuration data does not exist in the configuration data buffer of the terminal or the target configuration data is not in the validity period, the terminal sends the request for obtaining the initial configuration data to the configuration server, wherein the validity period of the target configuration data is determined according to the average updating frequency of the configuration data of the sub-application of the target application;
calling a conversion middleware to extract a JSON character string in a non-standard format from initial configuration data by using regular matching to serve as a first character string, wherein the first character string is extracted based on a matching rule set in the conversion middleware;
calling the conversion middleware to convert the first character string into a second character string by utilizing the regular matching, wherein the second character string is a JSON character string in a standard format and is obtained by conversion based on a conversion rule set in the conversion middleware;
generating target configuration data according to the second character string and sending the target configuration data to the terminal; and the terminal analyzes the target configuration data to obtain an executable object and transfers the executable object call back to a sub-application in the target application.
2. The method of claim 1, further comprising: the terminal stores the target configuration data into a configuration data buffer of the terminal; and setting an effective period for the target configuration data, and storing the effective period of the target configuration data into the configuration data buffer.
3. The method of claim 1 or 2, wherein the method further comprises: the terminal inquires whether the target configuration data exists in a configuration data buffer of the terminal; and if the target configuration data exists, configuring the functional parameters of the sub-applications set in the target application of the terminal according to the target configuration data.
4. The method of claim 3, wherein the configuring, if the target configuration data exists, the functional parameters of the sub-applications set in the target application of the terminal according to the target configuration data comprises: the terminal inquires the valid period of the target configuration data when the target configuration data exists; and if the current time is within the valid period of the target configuration data, configuring the functional parameters of the sub-applications set in the target application of the terminal according to the target configuration data.
5. The method of claim 1, wherein the matching rules set in the conversion middleware include rules for finding character strings set based on regular expressions; the conversion rules set in the conversion middleware comprise character string conversion rules set based on regular expressions.
6. The method of claim 1, wherein generating target configuration data based on the second string comprises:
and converting the initial configuration data according to the second character string to obtain an executable object, wherein the executable object is the target configuration data.
7. The method of claim 1, wherein generating target configuration data based on the second string comprises:
and replacing the first character string in the initial configuration data with the second character string, and obtaining target configuration data according to the replaced initial configuration data.
8. The method of claim 3, wherein before said querying a configuration data buffer of the terminal for the presence of the target configuration data, further comprising: the terminal detects whether the sub-application requests to call a target interface, wherein the target interface is a set interface for acquiring configuration data; and if so, executing the query of the configuration data buffer of the terminal for whether the target configuration data exists.
9. An apparatus for acquiring configuration data, the apparatus being applied to a configuration server, the apparatus comprising:
a unit for receiving initial configuration data generated and pushed by a configuration platform;
a unit for acquiring initial configuration data of the configuration server and returning executable codes for the interactive web page obtained according to the initial configuration data to the interactive web page when a request for requesting the initial configuration data of the interactive web page is received;
the terminal comprises an acquisition module, a configuration module and a processing module, wherein the acquisition module is used for acquiring initial configuration data of a configuration server when receiving a request which is sent by the terminal aiming at a sub application in a target application of the terminal and is used for acquiring the initial configuration data, and the initial configuration data is configuration data based on a JSON format; if it is determined that the target configuration data does not exist in the configuration data buffer of the terminal or the target configuration data is not in the validity period, the terminal sends the request for obtaining the initial configuration data, wherein the validity period of the target configuration data is determined according to the average update frequency of the configuration data of the sub-application of the target application;
the extraction module is used for calling the conversion middleware to extract a JSON character string in a non-standard format from initial configuration data by using regular matching to serve as a first character string, wherein the first character string is extracted and obtained on the basis of a matching rule set in the conversion middleware;
the conversion module is used for calling the conversion middleware to convert the first character string into a second character string by utilizing the regular matching, the second character string is a JSON character string in a standard format, and the second character string is obtained by conversion based on a conversion rule set in the conversion middleware;
and the terminal analyzes the target configuration data to obtain an executable object and transfers the executable object to a sub-application in the target application in a callback manner.
10. A system for performing configuration data processing, comprising: configuring a server and a terminal;
the configuration server is used for storing initial configuration data and executing the configuration data acquisition method of any one of claims 1, 6 and 7;
the terminal is provided with a target application, and the target application is provided with a sub-application.
11. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711255291.9A CN109885347B (en) | 2017-12-01 | 2017-12-01 | Method, device, terminal, system and storage medium for acquiring configuration data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711255291.9A CN109885347B (en) | 2017-12-01 | 2017-12-01 | Method, device, terminal, system and storage medium for acquiring configuration data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109885347A CN109885347A (en) | 2019-06-14 |
CN109885347B true CN109885347B (en) | 2023-02-14 |
Family
ID=66923046
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711255291.9A Active CN109885347B (en) | 2017-12-01 | 2017-12-01 | Method, device, terminal, system and storage medium for acquiring configuration data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109885347B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112486583A (en) * | 2019-08-21 | 2021-03-12 | 北京中关村科金技术有限公司 | System, method, apparatus and storage medium for configuring parameters |
CN112882741A (en) * | 2019-11-29 | 2021-06-01 | 北京沃东天骏信息技术有限公司 | Application management system and method |
CN113468866B (en) * | 2021-06-30 | 2022-09-16 | 建信金融科技有限责任公司 | Method and device for analyzing non-standard JSON string |
CN113742008B (en) * | 2021-09-13 | 2024-04-02 | 挂号网(杭州)科技有限公司 | Interface calling method and device, electronic equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066618A (en) * | 2017-05-09 | 2017-08-18 | 灯塔财经信息有限公司 | Display methods and device after a kind of Webpage conversion |
-
2017
- 2017-12-01 CN CN201711255291.9A patent/CN109885347B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066618A (en) * | 2017-05-09 | 2017-08-18 | 灯塔财经信息有限公司 | Display methods and device after a kind of Webpage conversion |
Also Published As
Publication number | Publication date |
---|---|
CN109885347A (en) | 2019-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20190251143A1 (en) | Web page rendering method and related device | |
US10798056B2 (en) | Method and device for processing short link, and short link server | |
CN109885347B (en) | Method, device, terminal, system and storage medium for acquiring configuration data | |
US20170371974A1 (en) | Method for loading webpage, client and programmable device | |
KR102185864B1 (en) | Server-side rendering method and system of native content for presentation | |
US9075893B1 (en) | Providing files with cacheable portions | |
US9503540B2 (en) | Method and apparatus for asynchronous distribution of content | |
US9282137B2 (en) | Dynamic package creation for predictive page load optimization | |
WO2019154353A1 (en) | System running parameter query method, matching method and apparatus, and node device | |
JP5236581B2 (en) | Transmitting apparatus, control method therefor, program, and information processing system | |
CN106776761A (en) | A kind of mobile browser renders the method and device of webpage | |
CN104135536A (en) | Data interaction method of Web management system based on Json data protocols | |
US20150067013A1 (en) | Methods for servicing web service requests using parallel agile web services and devices thereof | |
CN112905928B (en) | Webpage refreshing method and device, electronic equipment and storage medium | |
EP3813326B1 (en) | Method and apparatus for processing webpage, device, and storage medium | |
CN115039392A (en) | Message processing method, device and system and server | |
WO2017143747A1 (en) | Network request method and system for network terminal | |
CN113806104A (en) | Interface access request processing method, API gateway, server and system | |
CN110633443B (en) | Method, device, equipment and medium for intra-page data communication | |
CN104932910A (en) | Method and system for application program interface extension | |
EP3872630A2 (en) | Request processing method and apparatus, electronic device, and computer storage medium | |
US20230412694A1 (en) | Communication system for micro-frontends of a web application | |
US20180103114A1 (en) | Display control method, display control device, and recording medium | |
US20140297736A1 (en) | Data interchange system | |
JP2013229021A (en) | Mobile broadband device, and mobile broadband service processing method for mobile broadband device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |