CN106487861B - Network data providing method and device - Google Patents

Network data providing method and device Download PDF

Info

Publication number
CN106487861B
CN106487861B CN201510553118.1A CN201510553118A CN106487861B CN 106487861 B CN106487861 B CN 106487861B CN 201510553118 A CN201510553118 A CN 201510553118A CN 106487861 B CN106487861 B CN 106487861B
Authority
CN
China
Prior art keywords
data
terminal
scene
configuration information
target network
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
Application number
CN201510553118.1A
Other languages
Chinese (zh)
Other versions
CN106487861A (en
Inventor
闫小坤
谷萍萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN201510553118.1A priority Critical patent/CN106487861B/en
Publication of CN106487861A publication Critical patent/CN106487861A/en
Application granted granted Critical
Publication of CN106487861B publication Critical patent/CN106487861B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • H04L67/303Terminal profiles

Abstract

The invention discloses a network data providing method and device, and belongs to the technical field of internet. The method comprises the following steps: receiving a data acquisition request sent by a terminal, wherein the data acquisition request is used for requesting to acquire target network data; acquiring scene parameters corresponding to the terminal according to the data acquisition request; inquiring data configuration information corresponding to the scene parameters in a scene configuration file; inquiring business logic corresponding to the target network data in a business configuration file; and providing the target network data to the terminal according to the data configuration information and the service logic. The problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved.

Description

Network data providing method and device
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method and an apparatus for providing network data.
Background
In order to better meet the requirements of users, a plurality of websites support the users to use computers for access and also support the users to use mobile phones for access.
In the prior art, in order to meet the above requirements, a web page developer needs to encode a computer version web page and a mobile phone version web page respectively, and a server stores the two sets of codes. Therefore, when the server receives a webpage access request sent by the terminal, the server can select the corresponding code to further generate the corresponding webpage file according to whether the terminal is a computer or a mobile phone, and the generated webpage file is provided for the terminal.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems: the server needs to set different versions of codes for different types of terminals, consuming a lot of resources of the server.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for providing network data. The technical scheme is as follows:
in a first aspect, a network data providing method is provided, including:
receiving a data acquisition request sent by a terminal, wherein the data acquisition request is used for requesting to acquire target network data;
acquiring scene parameters corresponding to the terminal according to the data acquisition request;
inquiring data configuration information corresponding to the scene parameters in a scene configuration file;
inquiring business logic corresponding to the target network data in a business configuration file;
and providing the target network data to the terminal according to the data configuration information and the service logic.
In a second aspect, there is provided a network data providing apparatus, including:
the device comprises a request receiving module, a data obtaining module and a data sending module, wherein the request receiving module is used for receiving a data obtaining request sent by a terminal, and the data obtaining request is used for requesting to obtain target network data;
a parameter obtaining module, configured to obtain, according to the data obtaining request received by the request receiving module, a scene parameter corresponding to the terminal;
the information acquisition module is used for inquiring data configuration information corresponding to the scene parameters acquired by the parameter acquisition module in a scene configuration file;
the logic acquisition module is used for inquiring the service logic corresponding to the target network data in a service configuration file;
and the network data providing module is used for providing the target network data to the terminal according to the data configuration information and the service logic.
The technical scheme provided by the embodiment of the invention has the beneficial effects that:
storing the service logic corresponding to the webpage in the service configuration file, storing the data configuration information corresponding to the scene parameter in the scene configuration file, further acquiring the scene parameter according to the data acquisition request after receiving the data acquisition request, and directly providing target network data to the terminal according to the data configuration information and the service logic in the service configuration file after inquiring the corresponding data configuration information in the scene configuration file; the problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved. Meanwhile, different versions of the same network data are designed to share the same set of business logic, so that developers do not need to repeatedly develop the same business logic for different versions, the problem of high development cost in the prior art is solved, and the effect of reducing the development cost is achieved. In addition, developers only need to maintain one set of business logic in the later period, and the effect of reducing the maintenance cost is achieved.
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 description of the embodiments will be briefly introduced 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 to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method of providing network data according to an embodiment of the present invention;
fig. 2A is a flowchart of a method of providing network data according to another embodiment of the present invention;
fig. 2B is a schematic structural diagram of a network data providing method according to another embodiment of the present invention;
fig. 2C is a schematic diagram of a correspondence relationship stored in a scene configuration file according to another embodiment of the present invention;
fig. 3 is a block diagram illustrating a configuration of a network data providing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart of a method of providing network data according to an embodiment of the present invention is shown, and as shown in fig. 1, the method of providing network data may include:
step 101, receiving a data acquisition request sent by a terminal, where the data acquisition request is used for requesting to acquire target network data.
And 102, acquiring scene parameters corresponding to the terminal according to the data acquisition request.
Step 103, inquiring data configuration information corresponding to the scene parameters in the scene configuration file.
And 104, inquiring business logic corresponding to the target network data in the business configuration file.
And 105, providing the target network data to the terminal according to the data configuration information and the service logic.
To sum up, in the network data providing method provided in this embodiment, the service logic corresponding to the web page is stored in the service configuration file, and the data configuration information corresponding to the scene parameter is stored in the scene configuration file, so that after the data acquisition request is received, the scene parameter is acquired according to the data acquisition request, and after the corresponding data configuration information is queried in the scene configuration file, the target network data is directly provided to the terminal according to the data configuration information and the service logic in the service configuration file; the problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved. Meanwhile, different versions of the same network data are designed to share the same set of business logic, so that developers do not need to repeatedly develop the same business logic for different versions, the problem of high development cost in the prior art is solved, and the effect of reducing the development cost is achieved. In addition, developers only need to maintain one set of business logic in the later period, and the effect of reducing the maintenance cost is achieved.
Referring to fig. 2A, a flowchart of a method of providing network data according to another embodiment of the present invention is shown, and as shown in fig. 2A, the method of providing network data may include:
step 201, receiving a data acquisition request sent by a terminal, where the data acquisition request is used to request to acquire target network data.
The data obtaining request may be a request for obtaining web page data of a target web page, or may be a request for obtaining other data from a server, for example, a request for obtaining a background service from a server by a client, which is not limited in this embodiment. In addition, the present embodiment exemplifies a data acquisition request as a request for acquiring web page data of a target web page.
Step 202, acquiring scene parameters corresponding to a terminal according to a data acquisition request; the scene parameters include: at least one of a network state of the terminal, a terminal type, an acquisition path for acquiring target network data, an interaction mode with the server, an acquisition right possessed by the terminal, and an IP address of the terminal.
After the server receives the data acquisition request sent by the terminal, the server may acquire the scene parameter corresponding to the terminal according to the data acquisition request.
Specifically, the step may include at least one of the following steps:
firstly, the server reads the network state of the terminal carried in the data acquisition request, and takes the read network state as a scene parameter.
When the terminal sends the data acquisition request, the terminal may carry a network identifier in the data acquisition request in the transmitted HTML5(Hyper Text Markup Language5, fifth edition hypertext Markup Language), where the network identifier is used to identify a network state of the terminal.
For example, the terminal carries a network identifier for identifying 2G (2-Generation Wireless telephone technology, second-Generation mobile phone communication technology), 3G, 4G, WiFi (Wireless Fidelity ), or ADSL (Asymmetric Digital Subscriber Line) (the computer end dials up the network), in the data acquisition request, and then the server can acquire the network state of the terminal according to the network identifier.
The server takes the network state identified by the network identification as a scene parameter.
In this embodiment, the example is only that the server acquires the network state of the terminal through the above acquisition method, and optionally, the server may further acquire the network speed of the terminal from the terminal, and then determine the network state of the terminal according to the acquired network speed.
Specifically, the terminal may send the first request to the server by using a characteristic that HTTP (Hyper Text Transfer Protocol) 1.1 supports persistent connection, and receive first feedback fed back by the server for responding to the first request. Wherein, the first request carries 0k of data and the identifier for maintaining the persistent connection. The terminal determines a time difference between the time when the first feedback is received and the time when the first request is sent as a total time when the terminal performs a Domain Name System (DNS) analysis, establishes a connection with the server, and delays round trip. Thereafter, the terminal sends a second request to the server, and receives second feedback fed back by the server for responding to the second request. Wherein the second request carries 0k of data. Since the DNS resolution and the connection with the server are already established when the terminal sends the second request, the terminal can know that the time difference between the time when the terminal receives the second feedback and the time when the terminal sends the second request is the round-trip delay. And finally, the terminal sends a third request to the server and receives third feedback fed back by the server and used for responding to the third request. And the third request carries data with a preset size. Then, since the DNS resolution and the connection with the server are already established when the terminal sends the third request, the terminal can know that the time difference between the time when the third feedback is received and the time when the third request is sent is the total time of the time for transmitting the data of the preset size and the round trip delay. Therefore, the terminal can know the time for sending the data with the preset size, and the network speed is calculated according to the transmission time and the data size. The domain names of the web pages requested to be accessed by the first request, the second request and the third request are the same.
After the network speed is calculated by the terminal, the terminal can send the network speed to the server. Optionally, the server may send a network speed obtaining request to the terminal, and after receiving the network speed obtaining request, the terminal sends the network speed to the server. Of course, the terminal may also actively send the determined network speed to the server, which is not limited in this embodiment.
Secondly, the server reads the identification information in the data acquisition request and determines the read identification information as the scene parameters. The identification information is used for identifying the terminal type of the terminal and/or a browser used when the terminal sends a data acquisition request.
The data acquisition request sent by the terminal may carry a User Agent, where the User Agent is used to identify a terminal type of the terminal and/or a browser used when the terminal sends the data acquisition request.
For example, the User Agent is used to identify the terminal type of the terminal, and when the User Agent is Windows, the server may determine that the terminal is a computer. And if the User Agent is an iPhone, the server can determine that the terminal is an iPhone mobile phone.
Similarly, if the User Agent is used to identify a browser, the server may obtain the browser used when the terminal sends the data acquisition request according to the User Agent. For example, if the User Agent is 'wx', the server can know that the browser used by the terminal is a WeChat browser.
And thirdly, the server reads the head information of the data acquisition request, and the acquisition path carried in the head information for acquiring the target network data is used as a scene parameter.
The acquisition path refers to an acquisition mode for acquiring target network data by the terminal. For example, a user requests to acquire target network data by scanning a two-dimensional code; or, the target network data is requested to be acquired by inputting a website in the address bar; or requesting to acquire the target network data by selecting the shared link in the social application.
Specifically, when the terminal sends the data acquisition request, the terminal may carry Refer in the header information of the data acquisition request, where the Refer is used to indicate how the terminal requests to access the target network data, that is, the Refer indicates an acquisition path for the terminal to acquire the target network data, so that the server may read the acquisition path from the header information, and use the read acquisition path as the scene parameter.
Fourthly, the server can determine the interaction mode of the terminal and the server according to the received data acquisition request, and the determined interaction mode is used as the scene parameter.
Specifically, the terminal may interact with the server through synchronous page output, AJAX (Asynchronous Javascript And XML), or WebSocket, so the server may determine that the interaction mode is synchronous page output, AJAX, or WebSocket.
And fifthly, the server reads the acquisition permission of the terminal carried in the data acquisition request, and the read acquisition permission is used as the scene parameter.
When the terminal sends the data acquisition request, the terminal may carry the acquisition permission of the terminal in Cookies at the head of the data acquisition request, for example, when the terminal is an administrator user, the terminal may carry an identifier for identifying the terminal as an administrator in Cookies; when the terminal is a member user, the terminal can carry an identifier for identifying the terminal as the member user in Cookies. Correspondingly, the server can determine the acquisition permission of the terminal according to the Cookies.
Sixthly, the server acquires an IP (Internet Protocol, Protocol for interconnecting networks) address of the terminal, and uses the IP address as a scene parameter.
Step 203, inquiring data configuration information corresponding to the scene parameters in the scene configuration file.
Referring to fig. 2B, a scene configuration file is stored in the server, and the scene configuration file includes a corresponding relationship between a scene parameter and data configuration information of web page data of a target web page. Also, referring to fig. 2C, different scene parameters may correspond to different data configuration information, or may correspond to the same data configuration information.
After the server determines the scene parameters of the terminal, the server may query data configuration information corresponding to the determined scene parameters in each correspondence stored in the scene configuration file. Specifically, the step of querying the data configuration information corresponding to the scene parameter by the server may include:
firstly, if the scene parameter includes a network state of the terminal, determining a picture type corresponding to the network state according to a corresponding relationship between the network state and the picture type in the scene configuration file, and using the determined picture type as data configuration information, wherein the picture type includes picture resolution and/or picture size.
The terminal needs to consume a certain flow of the terminal when acquiring data from the server by using the 2G, 3G or 4G network, and in order to reduce the flow required to be consumed when the terminal accesses the internet, the server may pre-store, in the scene configuration file, a corresponding relationship between the picture resolution lower than the first threshold and the picture size smaller than the second threshold and the 2G, 3G or 4G network.
If the terminal uses WiFi or ADSL dial-up to access the internet, the user does not need to consider traffic and worry about the slow speed of the network, and at this time, in order to improve the user experience, the server may pre-store the corresponding relationship between the WiFi or ADSL dial-up and the resolution ratio higher than the third threshold and the picture size larger than the fourth threshold.
After the server determines the network state of the terminal, the server may query the picture type corresponding to the network state in the correspondence, and use the queried picture type as the data configuration information corresponding to the network state.
In actual implementation, since the network speed is usually faster when the terminal uses 3G or 4G to surf the internet, in order to improve the user experience of the user, the server may also set the corresponding picture type in the scene configuration file such that the resolution is higher than the third threshold and the picture size is larger than the fourth threshold, which is not limited in this embodiment.
Secondly, if the scene parameters include the terminal type of the terminal, determining the version of the target network data corresponding to the terminal type according to the corresponding relation between the terminal type in the scene configuration file and the version of the target network data, and using the determined version as data configuration information, wherein the version of the target network data includes a computer version or a mobile phone version.
When different types of terminals access the target network data, the network data provided by the server may be different. For example, when a user accesses a target web page using a computer, the server may provide a computer version of the web page; if the user uses the iPhone to access the webpage, the server can provide the iPhone version webpage; similarly, if the user is using a non-smart phone to surf the internet, the server may provide an extremely fast version of the web page.
Therefore, the server may previously store the correspondence between the terminal type and the version of the target network data in the scene configuration file. After determining the terminal type of the terminal, the server may query, in the correspondence relationship, a version of the target network data corresponding to the terminal type, and use the queried version as data configuration information corresponding to the terminal type.
Similarly, if the scene parameter includes a browser identifier used by the terminal, the server may also store a correspondence between the browser and the data content in the scene configuration file in advance. Further, after the server determines the browser used by the terminal, the server may search for the data content corresponding to the browser in the correspondence relationship.
Thirdly, if the scene parameters include an acquisition path for acquiring the target network data, determining data content corresponding to the acquisition path according to a corresponding relationship between the acquisition path and the data content in the scene configuration file, and taking the determined data content as data configuration information.
When the terminal acquires the target network data through different acquisition ways, the server can provide different data contents for the terminal. For example, when the terminal accesses the target web page by inputting the web address, the server may provide default web page content to the terminal; if the terminal accesses the target webpage by selecting the link shared in the social application, the server may provide the terminal with a simple version of the webpage (the webpage content only includes core content in the webpage content of the default target webpage).
Therefore, the server may store the correspondence between the acquisition route and the data content in the scene configuration file in advance. After the server determines the acquisition path of the terminal, the server inquires the data content corresponding to the determined acquisition path in the corresponding relation between the acquisition path and the data content, and takes the inquired data content as the data configuration information corresponding to the acquisition path.
And fourthly, if the scene parameters comprise an interactive mode with the server, determining a data format corresponding to the interactive mode according to the corresponding relation between the interactive mode in the scene configuration file and the data format of the target network data, and taking the determined data format as data configuration information.
When the terminal sends a data acquisition request to the server, the terminal can interact with the server in various interaction modes, and the server needs to return data in corresponding formats corresponding to each interaction mode.
Therefore, the server may store the correspondence between the interaction means and the data format of the target network data in the scene configuration file in advance. After the server determines the interaction mode of the terminal and the server, the server can query the data format corresponding to the determined interaction mode according to the corresponding relation between the interaction mode and the data format, and the queried data format is used as the data configuration information corresponding to the interaction mode.
And fifthly, if the scene parameters comprise the acquisition permission of the terminal, determining the data content corresponding to the acquisition permission according to the corresponding relation between the acquisition permission and the data content in the scene configuration file, and taking the determined data content as data configuration information.
Generally, a terminal has multiple acquisition rights when acquiring target network data, and data contents provided by a server when terminals with different acquisition rights access the same network data are usually different. For example, when the terminal has the administrator right, the terminal may access all the contents in the web page; when the terminal is a member user, the terminal can access the webpage after the advertisement is removed; when the terminal is a common user, the terminal can only access the webpage containing the advertisement.
Therefore, in order to provide target network data of different contents to terminals of different acquisition rights, the server may store the correspondence between the acquisition rights and the data contents in the scene configuration file in advance. After the server determines the acquisition right of the terminal, the server may query the data content corresponding to the determined acquisition right in the correspondence between the acquisition right and the data content.
Sixthly, if the scene parameter includes the IP address of the terminal, determining the data content corresponding to the IP address according to the corresponding relationship between the IP address and the data content in the scene configuration file, and using the determined data content as the data configuration information.
When the terminal accesses the target network data, the region where the terminal is located is different, and the data content of the target network data provided by the server may also be different. For example, when the terminal accesses a certain property website, the server may provide property information of a corresponding city to the terminal. When the server determines the area where the terminal is located, the server can generally determine according to the IP address of the terminal.
Therefore, the server may store the correspondence between the IP address and the data content in the scene configuration file in advance. After the server determines the IP address of the terminal, the server may query the data content corresponding to the IP address of the terminal in the correspondence between the IP address and the data content.
It should be added that, in this embodiment, the data configuration information corresponding to the scene parameter is determined only by the foregoing method, optionally, the server may also determine the data configuration information corresponding to the scene parameter by other methods, and this embodiment is not limited to this. In addition, this embodiment is also only exemplified by that each scene parameter corresponds to the data configuration information, and in actual implementation, a developer may configure other data configuration information for each scene parameter according to actual requirements, which is not limited in this embodiment.
Step 204, inquiring the service logic corresponding to the target network data in the service configuration file.
With reference to fig. 2B, a service configuration file may also be stored in advance in the server, and the service configuration file stores service logic corresponding to the target network data. Optionally, the service configuration file may store service logic corresponding to each network data. After receiving the data acquisition request for acquiring the target network data, the server may query the service logic corresponding to the target network data in the service configuration file.
It should be added that, in this embodiment, the step 202 and the step 203 are only executed before the step 204, optionally, the step 204 may also be executed before the step 202, or between the step 202 and the step 203, and only the step 205 needs to be executed before the actual implementation, and the actual execution sequence of this embodiment is not limited.
And step 205, providing the target network data to the terminal according to the data configuration information and the service logic.
After the server determines the data configuration information and the service logic, the server may provide the target network data to the terminal according to the data configuration information and the service logic.
Optionally, this step may include:
first, target network data is generated according to data configuration information and service logic.
The data configuration information may include first configuration information for configuring data content of the target network data, may also include second configuration information for configuring a data format of the target network data, or may also include both the first configuration information and the second configuration information. Therefore, depending on the content of the data configuration information, this step may include:
(1) if the data configuration information comprises first configuration information used for configuring the data content of the target network data, selecting data meeting the requirement of the first configuration information from the material library according to the business logic; and generating target network data in a default format according to the service logic and the data.
If the data configuration information includes first configuration information for configuring data content of the target network data, for example, the data acquisition request is a request for acquiring website data of a house website, the data configuration information includes: the picture type is the property information with picture resolution lower than a first threshold value, picture size smaller than a second threshold value and no tin. Then, the server can determine which pictures are needed according to the service logic, and acquire corresponding picture materials according to the picture types; meanwhile, the server determines what kind of house information is needed, such as new house information, according to the service logic, and obtains the tin-free new house information. And then, the server generates webpage data in a default format according to the acquired picture materials, the acquired tin-free new house information and the service logic.
(2) If the data configuration information contains second configuration information of a data format for configuring the target network data, selecting data meeting the default requirement from the material library according to the service logic; and generating target network data in a data format required by the second configuration information according to the service logic and the data.
If the data configuration information includes second configuration information for configuring a data format of the target network data, for example, the data configuration information includes: and (4) data format corresponding to AJAX. Then, after the server acquires the data of the default requirement from the material library according to the service logic, the server can generate the target network data in the data format corresponding to AJAX according to the service logic.
(3) If the data configuration information simultaneously comprises first configuration information for configuring the data content of the target network data and second configuration information for configuring the data format of the target network data, selecting data meeting the requirement of the first configuration information from a material library according to business logic; and generating target network data in a data format required by the second configuration information according to the service logic and the data.
If the data configuration information contains the first configuration information and the second configuration information at the same time, the server can firstly acquire data meeting the requirement of the first configuration information from the material library according to the service logic, and then generate target network data in a data format required by the second configuration information according to the service logic and the data. For specific implementation, reference is made to the above two steps, and details of this embodiment are not repeated herein.
Secondly, the generated target network data is sent to the terminal.
After the server generates the target network data, the server may transmit the generated target network data to the terminal. And after receiving the target network data, the terminal can display the target network data according to the received target network data.
It should be noted that, while the scene configuration file and the service configuration file are stored in the server, the server may also store a data reporting configuration file, where the data reporting configuration file is used to instruct the terminal to perform log reporting. Therefore, the same data reporting configuration file can be shared by all the versions, the server does not need to store the data reporting configuration file corresponding to each version, and resources occupied by the data reporting configuration file in the server are reduced. Meanwhile, developers only need to compile one data reporting configuration file, and need to compile configuration files with the same function for each version, so that the development complexity of the developers is reduced, and the development efficiency is improved.
To sum up, in the network data providing method provided in this embodiment, the service logic corresponding to the web page is stored in the service configuration file, and the data configuration information corresponding to the scene parameter is stored in the scene configuration file, so that after the data acquisition request is received, the scene parameter is acquired according to the data acquisition request, and after the corresponding data configuration information is queried in the scene configuration file, the target network data is directly provided to the terminal according to the data configuration information and the service logic in the service configuration file; the problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved. Meanwhile, different versions of the same network data are designed to share the same set of business logic, so that developers do not need to repeatedly develop the same business logic for different versions, the problem of high development cost in the prior art is solved, and the effect of reducing the development cost is achieved. In addition, developers only need to maintain one set of business logic in the later period, and the effect of reducing the maintenance cost is achieved.
In the embodiment, the corresponding relations between various scene parameters and the data configuration information are stored in the scene configuration file, the data configuration information corresponding to the scene parameters of the terminal is inquired according to the corresponding relations, and then the corresponding target network data is generated according to the data configuration information, so that after developers safely configure the corresponding relations in the scene configuration file, the server can provide the target network data with higher safety for the terminal, the problem that when the developers respectively develop the target network data of various versions, design errors or design omission caused by personal negligence further cause poor safety of the target network data provided by the server is avoided, and the effect of improving data safety of the target network data provided for the terminal is achieved.
In addition, in this embodiment, the scene parameter of the terminal is determined, the data configuration information corresponding to the scene parameter is obtained, and then the target network data is provided to the terminal according to the data configuration information and the service logic, so that the server can provide the corresponding target network data to the terminal according to the scene parameter of the terminal, and the effect of improving the user experience of the user is achieved.
Referring to fig. 3, a block diagram of a network data providing apparatus according to an embodiment of the present invention is shown, where the network data providing apparatus may include: a request receiving module 310, a parameter obtaining module 320, an information obtaining module 330, a logic obtaining module 340, and a network data providing module 350.
A request receiving module 310, configured to receive a data obtaining request sent by a terminal, where the data obtaining request is used to request to obtain target network data;
a parameter obtaining module 320, configured to obtain a scene parameter corresponding to the terminal according to the data obtaining request received by the request receiving module 310;
an information obtaining module 330, configured to query, in the scene configuration file, data configuration information corresponding to the scene parameters obtained by the parameter obtaining module 320;
a logic obtaining module 340, configured to query, in the service configuration file, a service logic corresponding to the target network data;
and a network data providing module 350, configured to provide the target network data to the terminal according to the data configuration information and the service logic.
To sum up, the network data providing apparatus provided in this embodiment stores the service logic corresponding to the web page in the service configuration file, stores the data configuration information corresponding to the scene parameter in the scene configuration file, further obtains the scene parameter according to the data acquisition request after receiving the data acquisition request, and directly provides the target network data to the terminal according to the data configuration information and the service logic in the service configuration file after querying the corresponding data configuration information in the scene configuration file; the problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved. Meanwhile, different versions of the same network data are designed to share the same set of business logic, so that developers do not need to repeatedly develop the same business logic for different versions, the problem of high development cost in the prior art is solved, and the effect of reducing the development cost is achieved. In addition, developers only need to maintain one set of business logic in the later period, and the effect of reducing the maintenance cost is achieved.
With reference to fig. 3, each functional module in the network data providing apparatus may further implement the following functions:
optionally, the network data providing module 350 is further configured to:
if the data configuration information contains first configuration information used for configuring the data content of the target network data, selecting data meeting the requirements of the first configuration information from a material library according to business logic; generating target network data in a default format according to the service logic and the data;
if the data configuration information contains second configuration information of a data format for configuring target network data, selecting data meeting default requirements from a material library according to business logic; generating default network data in a data format required by the second configuration information according to the service logic and the data;
if the data configuration information simultaneously contains first configuration information for configuring the data content of the target network data and second configuration information for configuring the data format of the target network data, selecting data meeting the requirement of the first configuration information from a material library according to business logic; generating target network data in a data format required by the second configuration information according to the service logic and the data;
and sending the generated target network data to the terminal.
Optionally, the scene parameters include: at least one of a network state of the terminal, a terminal type, an acquisition path for acquiring target network data, an interaction mode with the server, an acquisition right possessed by the terminal, and an IP address of the terminal.
Optionally, the information obtaining module 330 is further configured to:
if the scene parameters comprise the network state of the terminal, determining a picture type corresponding to the network state according to the corresponding relation between the network state and the picture type in the scene configuration file, and taking the determined picture type as data configuration information, wherein the picture type comprises picture resolution and/or picture size;
if the scene parameters comprise the terminal type of the terminal, determining the version of the target network data corresponding to the terminal type according to the corresponding relation between the terminal type in the scene configuration file and the version of the target network data, and taking the determined version as data configuration information;
if the scene parameters comprise an acquisition path for acquiring the target network data, determining data content corresponding to the acquisition path according to the corresponding relation between the acquisition path and the data content in the scene configuration file, and taking the determined data content as data configuration information;
if the scene parameters comprise an interactive mode with the server, determining a data format corresponding to the interactive mode according to a corresponding relation between the interactive mode in the scene configuration file and the data format of the target network data, and taking the determined data format as data configuration information;
if the scene parameters comprise the acquisition permission of the terminal, determining the data content corresponding to the acquisition permission according to the corresponding relation between the acquisition permission and the data content in the scene configuration file, and taking the determined data content as data configuration information;
and if the scene parameters comprise the IP address of the terminal, determining the data content corresponding to the IP address according to the corresponding relation between the IP address and the data content in the scene configuration file, and taking the determined data content as data configuration information.
Optionally, the server further stores a data reporting configuration file, where the data reporting configuration file is used to instruct the terminal to perform log reporting.
To sum up, the network data providing apparatus provided in this embodiment stores the service logic corresponding to the web page in the service configuration file, stores the data configuration information corresponding to the scene parameter in the scene configuration file, further obtains the scene parameter according to the data acquisition request after receiving the data acquisition request, and directly provides the target network data to the terminal according to the data configuration information and the service logic in the service configuration file after querying the corresponding data configuration information in the scene configuration file; the problem that in the prior art, codes of different versions need to be set for different terminals, and a large amount of resources of a server are consumed is solved; the effect that the network data of each version can share the same service logic and the resources occupied by the service logic in the server are reduced is achieved. Meanwhile, different versions of the same network data are designed to share the same set of business logic, so that developers do not need to repeatedly develop the same business logic for different versions, the problem of high development cost in the prior art is solved, and the effect of reducing the development cost is achieved. In addition, developers only need to maintain one set of business logic in the later period, and the effect of reducing the maintenance cost is achieved.
In the embodiment, the corresponding relations between various scene parameters and the data configuration information are stored in the scene configuration file, the data configuration information corresponding to the scene parameters of the terminal is inquired according to the corresponding relations, and then the corresponding target network data is generated according to the data configuration information, so that after developers safely configure the corresponding relations in the scene configuration file, the server can provide the target network data with higher safety for the terminal, the problem that when the developers respectively develop the target network data of various versions, design errors or design omission caused by personal negligence further cause poor safety of the target network data provided by the server is avoided, and the effect of improving data safety of the target network data provided for the terminal is achieved.
In addition, in this embodiment, the scene parameter of the terminal is determined, the data configuration information corresponding to the scene parameter is obtained, and then the target network data is provided to the terminal according to the data configuration information and the service logic, so that the server can provide the corresponding target network data to the terminal according to the scene parameter of the terminal, and the effect of improving the user experience of the user is achieved.
It should be noted that: in the network data providing device provided in the above embodiment, when providing network data, only the division of the above functional modules is exemplified, and in practical applications, the above functions may be distributed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the network data providing apparatus and the method embodiment of the network data providing method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (7)

1. A method for providing network data, the method comprising:
receiving a data acquisition request sent by a terminal, wherein the data acquisition request is used for requesting to acquire target network data;
acquiring scene parameters corresponding to the terminal according to the data acquisition request, wherein the scene parameters comprise an acquisition path, a network state of the terminal and an interaction mode with a server, the acquisition path refers to a mode of acquiring the target network data by the terminal, and the acquisition path comprises a mode of requesting to acquire the target network data by scanning a two-dimensional code, or requesting to acquire the target network data by inputting a website in an address bar, or requesting to acquire the target network data by selecting a mode of sharing a link in a social application;
inquiring data configuration information corresponding to the scene parameters in a scene configuration file, wherein the data configuration information comprises first configuration information and second configuration information;
inquiring service logic corresponding to the target network data in a pre-stored service configuration file;
generating the target network data according to the data configuration information and the service logic, and sending the generated target network data to the terminal;
wherein, the querying the data configuration information corresponding to the scene parameter in the scene configuration file includes: determining data content corresponding to the acquisition path according to a corresponding relation between the acquisition path and the data content in the scene configuration file, determining a picture type corresponding to the network state according to a corresponding relation between the network state and the picture type in the scene configuration file, wherein the picture type comprises picture resolution and/or picture size, determining a data format corresponding to the interaction mode according to a corresponding relation between the interaction mode in the scene configuration file and the data format of the target network data, and taking the determined data content and the picture type as the first configuration information and the data format as the second configuration information; and the number of the first and second groups,
the generating the target network data according to the data configuration information and the service logic and sending the generated target network data to the terminal includes: and selecting data meeting the requirement of the first configuration information from a material library according to the service logic, generating the target network data in a data format required by the second configuration information according to the service logic and the data, and sending the generated target network data to the terminal.
2. The method of claim 1, wherein the scene parameters further comprise: at least one of a terminal type of the terminal, an acquisition right possessed by the terminal, and an IP address of the terminal, wherein the querying of the data configuration information corresponding to the scene parameter in the scene configuration file further includes:
if the scene parameter includes the terminal type of the terminal, determining the version of the target network data corresponding to the terminal type according to the corresponding relationship between the terminal type and the version of the target network data in the scene configuration file, and taking the determined version as the first configuration information;
if the scene parameter includes the acquisition permission of the terminal, determining the data content corresponding to the acquisition permission according to the corresponding relation between the acquisition permission and the data content in the scene configuration file, and taking the determined data content as the first configuration information;
if the scene parameter includes the IP address of the terminal, determining the data content corresponding to the IP address according to the corresponding relationship between the IP address and the data content in the scene configuration file, and using the determined data content as the first configuration information.
3. The method according to any one of claims 1 to 2, wherein a data reporting configuration file is further stored in the server, and the data reporting configuration file is used for instructing the terminal to perform log reporting.
4. A network data providing apparatus, the apparatus comprising:
the device comprises a request receiving module, a data obtaining module and a data sending module, wherein the request receiving module is used for receiving a data obtaining request sent by a terminal, and the data obtaining request is used for requesting to obtain target network data;
a parameter obtaining module, configured to obtain, according to the data obtaining request received by the request receiving module, a scene parameter corresponding to the terminal, where the scene parameter includes an obtaining route, a network state of the terminal, and an interaction manner with a server, where the obtaining route refers to a manner in which the terminal obtains the target network data, and the obtaining route includes requesting to obtain the target network data by scanning a two-dimensional code, or requesting to obtain the target network data by inputting a website in an address bar, or requesting to obtain the target network data by selecting a manner of a link shared in a social application;
the information acquisition module is used for inquiring data configuration information corresponding to the scene parameters acquired by the parameter acquisition module in a scene configuration file, wherein the data configuration information comprises first configuration information and second configuration information;
the logic acquisition module is used for inquiring the service logic corresponding to the target network data in a pre-stored service configuration file;
a network data providing module, configured to generate the target network data according to the data configuration information and the service logic, and send the generated target network data to the terminal;
the information acquisition module is configured to determine, according to a correspondence between an acquisition pathway and data content in the scene configuration file, data content corresponding to the acquisition pathway, and according to a correspondence between a network state and a picture type in the scene configuration file, determine a picture type corresponding to the network state, where the picture type includes a picture resolution and/or a picture size, and according to a correspondence between an interaction manner in the scene configuration file and a data format of the target network data, determine a data format corresponding to the interaction manner, use the determined data content and the picture type as the first configuration information, and use the determined data format as the second configuration information; and the number of the first and second groups,
the network data providing module is used for selecting data meeting the requirement of the first configuration information from a material library according to the service logic, generating the target network data in a data format required by the second configuration information according to the service logic and the data, and sending the generated target network data to the terminal.
5. The apparatus of claim 4, wherein the scene parameters further comprise: the information obtaining module is further configured to:
if the scene parameter includes the terminal type of the terminal, determining the version of the target network data corresponding to the terminal type according to the corresponding relationship between the terminal type and the version of the target network data in the scene configuration file, and taking the determined version as the first configuration information;
if the scene parameter includes the acquisition permission of the terminal, determining the data content corresponding to the acquisition permission according to the corresponding relation between the acquisition permission and the data content in the scene configuration file, and taking the determined data content as the first configuration information;
if the scene parameter includes the IP address of the terminal, determining the data content corresponding to the IP address according to the corresponding relationship between the IP address and the data content in the scene configuration file, and using the determined data content as the first configuration information.
6. The apparatus according to any one of claims 4 to 5, wherein a data reporting configuration file is further stored in the server, and the data reporting configuration file is used for instructing the terminal to perform log reporting.
7. A computer-readable storage medium, characterized in that a program is stored in the computer-readable storage medium, which is loaded and executed by a processor to implement the network data providing method according to any one of claims 1 to 3.
CN201510553118.1A 2015-09-01 2015-09-01 Network data providing method and device Active CN106487861B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510553118.1A CN106487861B (en) 2015-09-01 2015-09-01 Network data providing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510553118.1A CN106487861B (en) 2015-09-01 2015-09-01 Network data providing method and device

Publications (2)

Publication Number Publication Date
CN106487861A CN106487861A (en) 2017-03-08
CN106487861B true CN106487861B (en) 2021-04-02

Family

ID=58237866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510553118.1A Active CN106487861B (en) 2015-09-01 2015-09-01 Network data providing method and device

Country Status (1)

Country Link
CN (1) CN106487861B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339128B (en) * 2018-12-18 2023-09-26 北京嘀嘀无限科技发展有限公司 Data acquisition method and device, electronic equipment and storage medium
CN110134461B (en) * 2019-04-09 2021-08-06 苏宁易购集团股份有限公司 Universal processing method and device for data interaction

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1897529A (en) * 2005-07-11 2007-01-17 中国移动通信集团公司 Automatic adapter for mobile telecommunication terminal display page
CN102497420A (en) * 2011-12-12 2012-06-13 中国电信股份有限公司 Content adaptation method and server
CN104601522A (en) * 2013-10-30 2015-05-06 中国移动通信集团北京有限公司 Method, device and system for realizing interaction between mobile client and service system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3753244B2 (en) * 2002-11-27 2006-03-08 日本電気株式会社 Real-time web sharing system
CN100481088C (en) * 2007-06-07 2009-04-22 北京大学 Web page resource issuing method and issuing system
CN101996206B (en) * 2009-08-11 2013-07-03 阿里巴巴集团控股有限公司 Method, device and system for displaying web page
CN101778168B (en) * 2010-02-05 2012-07-18 中国电信股份有限公司 Method and system for optimization display of wed pages on browser of mobile terminal
CN101815093A (en) * 2010-03-11 2010-08-25 深圳市嘉讯软件有限公司 Method for adapting webpage to mobile terminal and mobile terminal page adaptation device
CN101883089B (en) * 2010-04-22 2014-11-26 深圳市酷开网络科技有限公司 Method, device and system for displaying Internet webpage on play terminal
CN102253986A (en) * 2011-06-30 2011-11-23 北京新媒传信科技有限公司 Method and device for improving webpage displaying effect in multiple terminals
CN102882705B (en) * 2012-09-03 2015-03-25 青岛海信传媒网络技术有限公司 Method for reporting log through terminal equipment and log reporting system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1897529A (en) * 2005-07-11 2007-01-17 中国移动通信集团公司 Automatic adapter for mobile telecommunication terminal display page
CN102497420A (en) * 2011-12-12 2012-06-13 中国电信股份有限公司 Content adaptation method and server
CN104601522A (en) * 2013-10-30 2015-05-06 中国移动通信集团北京有限公司 Method, device and system for realizing interaction between mobile client and service system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《7个步骤让PC网站自动适配手机网页》;专注做前端;《https://www.cnblogs.com/qietuwang/p/4584521.html》;20150617;第1-6页 *
《CSS3 Media Query响应式媒体查询》;Dimpurr;《http://blog.dimpurr.com/css-media/》;20130703;第1-6页 *

Also Published As

Publication number Publication date
CN106487861A (en) 2017-03-08

Similar Documents

Publication Publication Date Title
US10027742B2 (en) Techniques for sharing application states
KR101362384B1 (en) The method and system for browsing things of internet of things on ip using web platform
JP6093482B2 (en) Method and apparatus for displaying search results on portable terminal
CN106331149A (en) Webpage code adapting method applicable to client environment
CN110730208A (en) Local device calling method and device, storage medium and device
CN102694830B (en) A kind of mthods, systems and devices realizing Web content and share
CN104410711A (en) Cross-domain network resource request method and device for client
WO2010051766A1 (en) Method and device for acquiring target resource information
US11032683B2 (en) Method and apparatus for publishing cloud resource
CN101771928B (en) Method and system and proxy server for Webpage transmitting
CN103023870A (en) Method, device and equipment for outputting data in message
CN103354556A (en) Message prompt method used for realizing sharing user and equipment thereof
CN103618779A (en) Method and system for resource sharing
CN106487861B (en) Network data providing method and device
KR101265164B1 (en) System for providing shorten URL browsing with branding , method thereof, and web client thereof
KR100926780B1 (en) Wired and wireless widget service system and method
CN103561068A (en) Method and device for improving speed of web page browsing
WO2011116558A1 (en) Method and terminal for processing short message
CN112836148B (en) Report display method and device, storage medium and electronic equipment
CN109600452B (en) Server cluster, message pushing method and related server
WO2014169497A1 (en) Method and server for pushing media file
CN102202139A (en) Internet searching method, searching equipment and searching system
CN109600403B (en) Method and device for sending information
KR20080073469A (en) System and method of improving transmitting data rate for web image
KR100925644B1 (en) Object Transmission System and Control Method thereof

Legal Events

Date Code Title Description
C06 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