CN107708084B - Data processing method and device, computer equipment and computer readable storage medium - Google Patents

Data processing method and device, computer equipment and computer readable storage medium Download PDF

Info

Publication number
CN107708084B
CN107708084B CN201710924619.5A CN201710924619A CN107708084B CN 107708084 B CN107708084 B CN 107708084B CN 201710924619 A CN201710924619 A CN 201710924619A CN 107708084 B CN107708084 B CN 107708084B
Authority
CN
China
Prior art keywords
request
data
traffic
flow
server
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
CN201710924619.5A
Other languages
Chinese (zh)
Other versions
CN107708084A (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201710924619.5A priority Critical patent/CN107708084B/en
Publication of CN107708084A publication Critical patent/CN107708084A/en
Application granted granted Critical
Publication of CN107708084B publication Critical patent/CN107708084B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0888Throughput
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/10Flow control between communication endpoints

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application relates to a data processing method and device, computer equipment and a computer readable storage medium. The method comprises the following steps: counting current flow data at regular time; if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server; and if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function refers to a function of locally using traffic data by the terminal. The data processing method and device, the computer equipment and the computer readable storage medium can improve the accuracy of data processing.

Description

Data processing method and device, computer equipment and computer readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus, a computer device, and a computer-readable storage medium.
Background
The intelligent terminal can realize data transmission through wireless signals and realize communication among different intelligent terminals. In order to make users reasonably use wireless signals and enable operators to realize reasonable management of the wireless signals, the service conditions of the wireless signals need to be counted in real time, and the traffic refers to the traffic of data generated when the internet access or data value-added service is realized through the wireless signals.
Disclosure of Invention
The embodiment of the application provides a data processing method and device, computer equipment and a computer readable storage medium, which can improve the accuracy of data processing.
A method of data processing, the method comprising:
counting current flow data at regular time;
if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server;
and if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function refers to a function of locally using traffic data by the terminal.
A data processing apparatus, the apparatus comprising:
the data statistics module is used for regularly counting the current flow data;
the request sending module is used for sending a request for closing a first traffic function to the server if the current traffic data exceeds a traffic threshold, wherein the first traffic function is a function of distributing the traffic data for the terminal by the server;
and the function closing module is used for locally closing a second traffic function if the request fails, and resending the request when a preset condition is met, wherein the second traffic function is a function of locally using traffic data by the terminal.
A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of:
counting current flow data at regular time;
if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server;
and if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function refers to a function of locally using traffic data by the terminal.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
counting current flow data at regular time;
if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server;
and if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function refers to a function of locally using traffic data by the terminal.
According to the data processing method and device, the computer device and the computer readable storage medium, after the request is sent to the server, if the request fails, the flow function is locally closed, and the request is reinitiated when a preset condition is met. Therefore, the flow data can be reasonably managed, and the accuracy of the flow data is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of an application environment of a data processing method in one embodiment;
FIG. 2 is a diagram showing an application environment of a data processing method in another embodiment;
FIG. 3 is a partial architecture diagram of a terminal in one embodiment;
FIG. 4 is a sequence diagram of interactions for implementing a virtual SIM card in one embodiment;
FIG. 5 is a flow diagram of a data processing method in one embodiment;
FIG. 6 is a flowchart of a data processing method in another embodiment;
FIG. 7 is a system architecture diagram for processing traffic data in one embodiment;
FIG. 8 is a flow diagram of a method for accounting for current traffic data in one embodiment;
FIG. 9 is a schematic diagram of an embodiment of a traffic statistics system;
FIG. 10 is a schematic diagram of another embodiment of a traffic statistics system;
FIG. 11 is a flow diagram of a traffic statistics module counting traffic data in one embodiment;
FIG. 12 is a schematic diagram of the structure of a traffic query system in another embodiment;
FIG. 13 is a diagram of a data list storing traffic data in one embodiment;
FIG. 14 is a diagram of data objects storing traffic data in one embodiment;
FIG. 15 is a terminal display of a flow order list page in one embodiment;
FIG. 16 is a terminal display of a flow order detail page in one embodiment;
FIG. 17 is a diagram illustrating a terminal display of traffic statistics in one embodiment;
fig. 18 is a display diagram of a terminal of traffic statistics in another embodiment;
FIG. 19 is a schematic diagram showing the structure of a data processing apparatus according to an embodiment;
fig. 20 is a block diagram of a partial structure of a mobile phone related to a computer device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of the present application. Both the first client and the second client are clients, but they are not the same client.
FIG. 1 is a diagram of an application environment of a data processing method in one embodiment. As shown in fig. 1, the application environment includes a terminal 102 and a server 104. The terminal 102 is configured to count current traffic data and determine whether the current traffic data exceeds a traffic threshold. If the current traffic data exceeds the traffic threshold, the terminal 102 may send a request to the server 104 to close the first traffic function. If the request fails, the terminal 102 locally turns off the second traffic function, and re-sends the request to the server 104 when a preset condition is met. The terminal 102 is an electronic device located at the outermost periphery of the computer network and mainly used for inputting user information and outputting a processing result, and may be, for example, a personal computer, a mobile terminal, a personal digital assistant, a wearable electronic device, or the like. The server 104 is a device, such as one or more computers, for responding to service requests while providing computing services.
Fig. 2 is a diagram of an application environment of a data processing method in another embodiment. As shown in fig. 2, the application environment includes a server 20 and a terminal 22. The server 20 is a server, which may be a cloud server, used by a virtual network operator to provide network traffic to the terminal 22. The server 20 may provide the terminal 22 with virtual SIM (Subscriber Identity Module) card information and services for implementing network communication using the virtual SIM card. The terminal 22 may be provided with a virtual SIM card APP (Application) 220, a virtual SIM card SDK (Software Development Kit) 222, a virtual SIM card operating system 224, and a virtual SIM card adaptation layer 226. The virtual SIM card APP 220, the virtual SIM card SDK 222, the virtual SIM card operating system 224, and the virtual SIM card adapting layer 226 may all be disposed within an Application Processor (AP) on the terminal 22. The server 20 may send virtual SIM card information to the virtual SIM card operating system 224 through the virtual SIM card APP 220; the virtual SIM card operating system 224 may enable communication with radio frequency communication control software disposed in a Baseband Processor (BP) through the virtual SIM card adaptation layer 226, so as to enable network communication using the virtual SIM card. The virtual SIM card SDK 222 may be used for the integration and invocation of the virtual SIM card APP 220. Wherein the server 20 may provide the terminal 22 with a virtual SIM card APP 220 related interface through which communication with the terminal 22 is enabled. The interface may include interfaces for user and equipment management, package and order management, encrypted transmission of SIM resources, etc. The server 20 may provide a relevant Interface to the virtual SIM card APP 220 in the form of a REST full Application Programming Interface (API). The virtual SIM card information may include, but is not limited to, basic information of the virtual SIM card, order information of virtual SIM card purchase, traffic usage information of the virtual SIM card, term information, and the like. The server 20 and the terminal 22 may perform statistics on the generated traffic data, and implement management on the user information corresponding to the virtual SIM card APP 220 through the statistical traffic data. When the current traffic data counted by the terminal 22 exceeds the traffic threshold, a request for closing the first traffic function is sent to the server. Wherein, the flow threshold value can be obtained from the order information purchased by the virtual SIM card.
Fig. 3 is a partial architecture diagram of a terminal, including modules associated with a virtual SIM card, according to one embodiment. As shown in fig. 3, a virtual SIM card operating system, a virtual SIM card adapting layer, a virtual SIM card APP, and a physical SIM card management module may be disposed on the application layer of the terminal. A Telephony Interface Layer and a Radio Interface Layer (Java) Layer may be disposed in the Framework Layer (Framework Layer). The Modem (Modem) can be a module consisting of a baseband processor, radio frequency and other peripheral chips, etc., and is a GSM/GPRS Modem. The Telephony interface layer is used for providing a universal interface, and the virtual SIM card operating system performs Socket interaction with the Modem through the Telephony interface layer, so that whether a virtual card exists or not and the position of a card slot where the virtual card is located can be judged. The virtual SIM card operating system performs Socket interaction with the Modem switched to the virtual SIM card channel through the virtual SIM card adapting layer, and can realize the functions of activating and closing the virtual card, using the virtual SIM card to perform network communication function and the like. It is to be understood that the structure shown in fig. 3 is only a part of the modules related to the present application, and does not constitute a limitation to the computer device to which the present application is applied, and a specific computer device may include more or less modules than those shown in the drawings, or combine some modules, or have a different module arrangement. The entity SIM card management module can communicate with a Telephony interface layer and realize the association of entity card information and the processing of related services of the entity SIM card.
In one embodiment, the terminal may provide a management operation interface of the virtual SIM card to the user through the virtual SIM card APP, and when detecting a relevant operation acting on the management operation interface, generate a corresponding virtual SIM card processing instruction, and send the processing instruction to the virtual SIM card operating system. The virtual SIM operating system can simulate the system logic of a real SIM card, implementing a protocol and file system of relevant specifications required for network communication. The virtual SIM card operating system can receive a processing instruction from the virtual SIM card App, send a message corresponding to the processing instruction to the Modem through the virtual SIM card adapting layer, receive response information made by the Modem and jointly realize the function of using the virtual SIM card to carry out network communication. The above-mentioned related protocols may include protocols of International Organization for Standardization (ISO) 7816 and 3rd Generation Partnership Project (3 GPP) specifications for Universal Integrated Circuit Card (UICC) and Universal Subscriber Identity Module (USIM).
In one embodiment, the processing instructions may include package purchase instructions, enable instructions, disable instructions, close instructions, and the like for the corresponding virtual SIM card. The implemented content of network communication using the virtual SIM card includes, but is not limited to, implementing interactive management of virtual SIM card information, dynamic update of state, statistics and rate limitation of traffic, and the like, such as implementing deletion of storage of the virtual SIM card information and enabling and closing of the virtual SIM card.
In one embodiment, as shown in fig. 4, a timing diagram is provided, which includes the interaction process between the modules in the scenario of package purchase, activation and deactivation of a virtual SIM card. Referring to FIG. 4, the package purchase process includes steps 402-412; the package activation process comprises steps 414-424; the process of package failure comprises steps 426-436.
Step 402, the terminal sends a virtual SIM card purchase request to the server through the virtual SIM card APP.
In one embodiment, the terminal can display a virtual SIM card purchase interface to a user through the virtual SIM card APP, detect a purchase operation acting on the interface, trigger a purchase instruction according to the detected purchase operation, and send a virtual SIM card purchase request to the server. The purchasing interface can provide a virtual button corresponding to purchasing operation, and when the clicking operation of the virtual button is received, a purchasing instruction can be triggered, or when preset voice information or preset motion information corresponding to the purchasing instruction is detected, the purchasing instruction can be triggered. For example, the purchase instruction may be triggered when voice information including "purchase virtual card" is detected or preset motion information such as up and down shaking of the terminal is detected.
In one embodiment, the terminal may send the virtual SIM card purchase request to the server through a corresponding communication interface between a preset virtual SIM card APP and the server. Wherein, the purchase request includes the user identification. The user identifier is used for uniquely identifying the identity of the corresponding user and can be composed of numbers, letters or other characters with preset digits.
And step 404, the server acquires the corresponding meal information of the virtual SIM card according to the received virtual SIM card purchase request.
In one embodiment, the server may be a server for providing network traffic to the terminal, and the server may obtain one or more types of virtual SIM card meal information matching the purchase request according to the purchase request. In one embodiment, the purchase request may further include location information of the terminal, and the server may obtain one or more types of virtual SIM card meal information matching the location information. Each package information includes one or more kinds of field information such as corresponding flow total amount, valid time and price. The total traffic indicates the total amount of internet traffic available for the package, for example, 10GB internet traffic. The validity period may comprise a validity period of the package, such as 24 hours, 3 days, 7 days, or the like. The price represents information on the fee to be paid for purchasing the corresponding package.
Step 406, the server sends the virtual SIM card meal information to the terminal.
In one embodiment, the server may transmit virtual SIM card meal information corresponding to the virtual SIM card purchase request matching the request to the terminal. In one embodiment, multiple virtual SIM card package meal information may be sent for selection by the user.
And step 408, the terminal receives the package information through the virtual SIM card APP and sends a package selection instruction to the server.
In one embodiment, the terminal may receive the package information through the virtual SIM card APP and perform displaying. The terminal can detect a selection operation acting on the package information display interface through the virtual SIM card APP, determine a corresponding selected package according to the detected selection operation, generate a package selection instruction for the package, and send the package selection instruction to the server. Wherein the selected set of meals may comprise one or more.
And step 410, the server receives the package selection instruction and sends package data corresponding to the package selection instruction to the terminal.
In one embodiment, the server may receive a package selection instruction sent by the terminal, and identify package information corresponding to the package selection instruction. The package selection instruction can contain package identification of the selected package information, and the server can determine the package information corresponding to the package identification and acquire package data corresponding to the package information. The package identifier is used for uniquely identifying package information of a package. The package data contains basic data and flow data of the virtual SIM card. The basic data comprises necessary data such as operator information, network access parameter information, virtual SIM card identification and the like of the virtual SIM card for realizing virtual SIM card network communication. The traffic data includes information such as the size and the effective time of the corresponding network communication available traffic.
In step 412, the terminal receives the package data through the virtual SIM card APP, and stores the package data through the virtual SIM card operating system.
In one embodiment, the terminal may receive package data sent by the server through the virtual SIM card APP and forward the package data to the virtual SIM card operating system. The virtual SIM card operating system can send the received package data to a Modem of the terminal through a virtual SIM card adapting layer and instruct the Modem to store the package data.
And step 414, the terminal acquires the package activating instruction through the virtual SIM card APP.
In one embodiment, the terminal can display the package activation interface through the virtual SIM card APP, detect activation operation acting on the package information display interface through the virtual SIM card APP, determine a package corresponding to activation according to the detected activation operation, generate a package activation instruction for the package, and send the package activation instruction to the server.
And step 416, sending the package activating instruction to the virtual SIM card operating system through the virtual SIM card APP.
In one embodiment, the virtual SIM card APP sends a package activation instruction to the virtual SIM card operating system in a preset communication mode with the virtual SIM card operating system, where the package activation instruction includes a package identifier corresponding to a package to be activated, so that the virtual SIM card operating system can determine the package to be activated according to the package identifier and the user identifier.
And 418, the terminal performs package activation processing through the virtual SIM card operating system.
The virtual SIM card operating system can forward the package activating instruction to the Modem through the Telephony interface layer, and the Modem extracts corresponding package data according to the received package activating instruction and activates the corresponding package data.
And step 420, feeding back an activation processing result to the virtual SIM card APP through the virtual SIM card operating system.
The virtual SIM card operating system can acquire the processing result of the activation processing performed by the Modem, send the acquired processing result to the virtual SIM card APP, and instruct the virtual SIM card APP to further feed back the activation processing result to the server. The virtual SIM card APP can display an activation processing result on a terminal interface for a user to look up. The activation processing result may include results of activation success and activation failure.
Step 422, the terminal sends an activation use request to the server through the virtual SIM card APP.
In an embodiment, the virtual SIM card APP may send the obtained activation processing result to the server through the preset interface, and when the activation processing result is successful, the terminal further sends an activation use notification to the server through the virtual SIM card APP, where the notification is used to instruct the server to start providing a service for using the virtual SIM card to perform network communication.
Step 424, the server receives the request for activating use, and feeds back response information for starting package monitoring to the terminal.
In an embodiment, after receiving the activation use request, the server starts the use service for the activated package data, and may monitor the use state of the package data according to a certain frequency, so as to provide a service for performing network communication using the corresponding package data, and feed back response information of package monitoring to the APP of the terminal. So that the user can know the server to successfully open the network communication service.
And 426, the terminal acquires a package invalidation instruction through the virtual SIM card APP.
The virtual SIM card APP can count the service time of the package data by using a timer arranged in the terminal, or can acquire the current time, and when the package data is judged to be invalid according to the service time or the current acquisition time, a package invalidation instruction is automatically triggered. Or the terminal can also display the package management interface through the virtual SIM card APP, detect the failure operation acting on the package information display interface through the virtual SIM card APP, determine the corresponding failed package according to the detected failure operation, generate a package failure request for the package, and send the package failure request to the server.
In one embodiment, the terminal may count the current traffic data in real time, and send a package invalidation request to the server if the current traffic data exceeds a traffic threshold. The flow threshold is an upper limit value of flow data allocated in the package.
In step 428, the terminal sends a package invalidation request to the server through the virtual SIM card APP.
In one embodiment, the virtual SIM card APP may send a package invalidation request to the server after detecting that package data is invalid, where the request is used to instruct the server to perform a confirmation check on whether the relevant package is invalid. Wherein, the request carries package identification.
In step 430, the server receives the package invalidation request and performs package invalidation processing.
In one embodiment, the server may detect whether the corresponding package is invalid according to the received package invalidation request, and if the package invalidation request is confirmed to be invalid, the server may perform package invalidation processing to terminate the network communication service of the corresponding package data.
And step 432, the server feeds back package failure confirmation information to the terminal.
And 434, the terminal receives the confirmation information through the virtual SIM card APP and sends a package invalidation processing instruction to the virtual SIM card operating system.
After receiving the confirmation information that the package is invalid, the terminal generates a package invalidation processing instruction and sends the processing instruction to the virtual SIM card operating system, wherein the instruction carries a package identifier. If the confirmation information obtained by the terminal is the information of the request failure, the terminal can directly carry out failure processing on the package locally, and when the preset condition is met, the package failure request is initiated to the server again.
And 436, carrying out package failure processing by the terminal virtual SIM card operating system.
In one embodiment, the virtual SIM card operating system may further forward a package invalidation processing instruction to the Modem to instruct the Modem to delete the corresponding package data, or terminate the virtual SIM card communication using the package data, and may further resume the normal communication of the involved physical SIM cards in the terminal.
FIG. 5 is a flow diagram of a data processing method in one embodiment. As shown in fig. 5, the data processing method includes steps 502 to 506. Wherein:
and 502, counting the current flow data at regular time.
In the embodiments provided in the present application, the current traffic data refers to traffic data generated from a time before the current time to the current time. When counting the current flow data, the corresponding statistical parameters may be input first, and then the flow data may be obtained according to the statistical parameters. The statistical parameter refers to a parameter required for statistical flow data, and may generally include a start time and an end time. When the current traffic data is counted, the start time refers to the start time of the counted traffic data, and the end time refers to the current time.
The traffic data refers to the amount of data generated when the mobile communication technology is used for surfing the internet or using related value-added services. The mobile communication technology refers to a technology for enabling communication between a mobile user and a fixed-point user or between mobile users, and may be not limited to GPRS (General Packet Radio Service), EDGE (Enhanced Data Rate for GSM Evolution), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), HSDPA (High Speed Downlink Packet Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), and the like.
It can be understood that, when the intelligent terminal uses wireless signals for communication, data needs to be transmitted through dedicated communication channels, and the data volume generated in the communication channels is counted to be the counted traffic data. When different wireless signals transmit data, the used communication channels are different, and the traffic data generated by each wireless network can be counted by counting the data volume of each communication channel. Generally, various application programs are installed in an intelligent terminal, and man-machine interaction application is realized through the application programs, so that each application program consumes flow data when executing tasks.
Step 504, if the current traffic data exceeds the traffic threshold, a request for closing a first traffic function is sent to the server, where the first traffic function is a function in which the server distributes traffic data to the terminal.
In one embodiment, the traffic threshold refers to a preset threshold using traffic data. The intelligent terminal can count the current flow data in real time, and if the current flow data exceeds a flow threshold, a request for closing the first flow function is sent to the server. The first traffic function is a function in which the server distributes traffic data to the terminal. Generally speaking, when an intelligent terminal initiates a demand for surfing the internet, a server provides a traffic server for the intelligent terminal, and the intelligent terminal and the server can count used traffic data. When the current flow data counted by the intelligent terminal exceeds the flow threshold, a request for closing the first flow function is sent to the server.
For example, a mobile phone user may purchase a certain amount of traffic data from an operator, the operator server allocates the purchased traffic data to the mobile phone user through an account, and the mobile phone may log in the account to use the traffic data to surf the internet. The account information corresponding to the account can record information such as account identification, flow threshold value, flow validity period and the like. The account information can be integrated in the entity SIM card, and can also be issued through the virtual SIM card. When the flow data in the account is used up, the operator server closes the flow function of the account, and prohibits the account from reusing the flow data.
It can be understood that the intelligent terminal regularly counts the current traffic data, which may be counting the current traffic data once every preset time interval, and comparing the counted current traffic data with a traffic threshold. For example, the current traffic data is counted once every one minute, and if the current traffic data exceeds the traffic threshold, a request for closing the first traffic function is sent to the server.
Step 506, if the request fails, locally closing the second traffic function, and resending the request when the preset condition is met, wherein the second traffic function is a function of locally using traffic data by the terminal.
After receiving the request, the server processes the request and sends a processing result to the intelligent terminal. If the first traffic function is closed, sending a message of successful processing to the intelligent terminal; and if the first traffic function fails to be closed, sending a message of processing failure to the intelligent terminal. And if the intelligent terminal receives the message of processing failure, the request is failed. After the intelligent terminal sends the request, the server may not receive the request due to the problems of data packet loss and the like, so that the server cannot respond to the request. A response time may be set for the request, and if the processing result returned by the server is not received after the response time is exceeded, the request is considered to have failed.
If the processing result returned by the server is not received after the response time is exceeded, or the processing failure result is received, the request failure is indicated. If the request fails, the intelligent terminal closes the second traffic function locally, and resends the request when the preset condition is met. The second traffic function is a function of locally using traffic data by the intelligent terminal, and the preset condition refers to a preset condition for reinitiating the request. Specifically, the request may be resent to the server when the current terminal is detected to be connected to the wireless network; and timing from the current moment, and resending the request to the server after a preset time interval.
In the data processing method provided in the foregoing embodiment, after the request is sent to the server, if the request fails, the traffic function is locally turned off, and the request is reinitiated when a preset condition is met. Therefore, the situation that the flow data cannot be reasonably managed when the request fails can be prevented, and the accuracy of the flow data is ensured.
Fig. 6 is a flowchart of a data processing method in another embodiment. As shown in fig. 6, the data processing method includes steps 602 to 618. Wherein:
in step 602, statistical parameters are periodically obtained, where the statistical parameters include a start time and an end time.
In one embodiment, the statistical parameters refer to parameters required for performing traffic data statistics, and the statistical parameters may include, but are not limited to, a start time and an end time. Generally, the statistical flow refers to the flow data in a certain time period. For example, flow data is counted for a month, or flow data is counted for a day. The start time refers to the start time of the statistical traffic data, and the end time refers to the deadline of the traffic statistics. For example, if the flow rate in 8 months in 2017 is counted, the start time may be 00:00 in 1 month in 8 months in 2017, and the end time may be 24:00 in 31 months in 8 months in 2017. The ending time refers to a certain time before the current time, and may also refer to the current time, and the current time may be generally obtained directly through a time function. For example, if the current time is 14:22, the end time is a time before 14:22, or 14: 22. If the current time is obtained, the current year can be obtained through a date.
And step 604, acquiring a flow query mode according to the statistical parameters, querying historical flow according to the flow query mode, and counting current flow data according to the historical flow.
In one embodiment, the flow data of all application modules in the intelligent terminal is recorded and counted by a kernel flow counting module, the flow data counted by the kernel flow counting module is recorded in a database, and the application layer can query the flow data recorded in the database by calling a flow counting interface. By inputting the start time and the end time, the traffic data generated from the start time to the end time can be queried. The flow query mode refers to a mode of querying flow data, the start time and the end time of the statistical flow can be obtained through the statistical parameters, and the statistical duration can be calculated according to the start time and the end time. The statistical time duration refers to the calculation time duration of the statistical flow data, and may be the time duration of the interval between the start time and the end time. For example, if the flow rate is counted between 1/00/2017 and 11/1/00/2017, the counting time is 10 days. Then, the traffic query mode may be obtained according to the start time, the end time, and the statistical duration, where different start times, end times, and statistical durations correspond to different traffic query modes.
In one embodiment, the historical traffic refers to traffic data generated in a certain time period before the current time of the intelligent terminal, and the current traffic data refers to traffic data generated between a certain time before the current time and the current time. Historical flow is first obtained, and then current flow data can be calculated according to the historical flow. For example, if the current time is 19:00, the historical traffic may be traffic generated between 12:00 and 17:00, or may be traffic generated between 17:00 and 19: 00. The current traffic data may refer to traffic generated between 12:00 and 19: 00.
Furthermore, the intelligent terminal can realize the flow statistics through a flow statistics module in the kernel layer, the kernel flow statistics module can perform the statistics on the flows generated by all application modules in the intelligent terminal, and the application layer can obtain the flow data counted by the kernel flow statistics module through a special flow statistics interface. When the traffic statistics interface is called to obtain the traffic data, the statistics parameters may include a start time and an end time, where the end time is a time before the current time. By searching the traffic data counted by the traffic counting module, the historical traffic generated from the starting time to the ending time can be searched. Generally, traffic data generated by a certain application module is counted, and the traffic data may include a receiving amount and a sending amount of the data, where the receiving amount refers to a total number of bytes of a received data packet, and the sending amount refers to a total number of bytes of a sent data packet. The statistical parameters may specifically include a module identifier, a start time, an end time, and the like, and then the historical traffic generated between the start time and the end time by the corresponding application module may be identified by the statistical module. The module identifier is a unique identifier of an application module which needs to be counted and generates flow consumption, and the application module is a functional module corresponding to an application program. For example, when installing an application program, the smart terminal assigns a User Identification (UID) to each application program, and when performing flow statistics, inputs the UID, the start time, and the end time, so as to count flow data generated between the start time and the end time of the application program corresponding to the UID.
Specifically, the application layer may include a physical SIM card module and a virtual SIM card module. The difference is that the entity SIM card module realizes the mobile communication function by integrating user identity information through hardware, and the virtual SIM card module realizes the mobile communication function by storing the user identity information through software. The entity SIM card module can call a special flow counting interface in real time to inquire the flow data, so that the flow data in a certain time period is counted. In one embodiment, the entity SIM card module only counts the flow data in the current month each time, that is, counts the flow data between the starting time of the current month and the current time in real time, and counts the flow data again after the next month, and clears the flow data counted in the previous month. For example, if the current time is 12:00 in 21/9/2017, the entity SIM card module counts the traffic data generated between 00:00 in 1/2017/9/2017 and 12:00 in 21/2017/9/12/00. When the number 1 of each month is reached 00: and when 00, clearing the flow data of the current statistics and restarting the statistics.
The entity SIM card module records the counted flow data in a database in an application layer, so that the virtual SIM card module can be directly read through the database when needing to count the flow every time, a flow counting interface is not required to be called every time to read the flow data from the kernel, and a large amount of power consumption is reduced. However, since the entity SIM card module counts the traffic data in a certain time period, if the virtual SIM card module needs to count the time period exceeding the time period counted by the entity SIM card module, the virtual SIM card module can read a part of the traffic data from the database corresponding to the entity SIM card module, and read a part of the traffic from the kernel by calling the traffic counting interface. For example, the virtual SIM card module needs to count the traffic generated between 8/00/2017 and 21/2017 and 9/21/12/00, while the entity SIM card module only counts the traffic data between 9/1/00/2017 and 9/21/2017, so that the traffic data generated between 9/1/00/2017 and 9/21/2017 can be directly read from the database corresponding to the entity SIM card module, and the traffic data generated between 8/00/2017 and 9/1/00/2017 needs the virtual SIM card module to call the traffic counting interface and be acquired from the kernel.
Step 606, if the current traffic data exceeds the traffic threshold, a request for closing the first traffic function is sent to the server.
Step 608, if the request fails, the second traffic function is closed locally, and the number of times of request failure is obtained.
In one embodiment, after each request failure, statistics may be made on the number of request failures. For example, a field for the number of requests is defined, and after each request failure, the value corresponding to the field is incremented by 1. After each request fails, counting the request failure times, then acquiring the request failure times, and acquiring the condition for re-initiating the request according to the request failure times.
Step 610, obtaining a signal strength threshold according to the number of times of request failure.
In one embodiment, after a request fails, a determination may be made as to whether to reinitiate the request based on a number of conditions. When one or more of the conditions are satisfied, the request is re-initiated to the server. Whether the request is reinitiated can be judged according to the signal strength of the wireless network, the relation between the number of times of request failure and the signal strength threshold value is established in advance, the signal light threshold value is obtained according to the number of times of request failure, and whether the connected wireless network meets the conditions or not is judged according to the signal strength threshold value. The signal strength threshold is a value of the signal strength for judging whether the signal strength of the wireless network meets the condition.
Step 612, if it is detected that the current terminal is connected to the wireless network and the signal strength of the wireless network is greater than the signal strength threshold, resending the request to the server.
Specifically, whether the current intelligent terminal is connected to a wireless network or not is detected in real time or at regular time, if the current intelligent terminal is connected to the wireless network, the signal intensity of the wireless network is obtained, whether the signal intensity is larger than a signal intensity threshold value or not is judged, and if the signal intensity is larger than the signal intensity threshold value, the request is sent to the server again. The intelligent terminal can read the interface of the wireless network and judge whether the wireless network is connected. If at least one wireless network is connected, the current terminal is connected to the wireless network.
In one embodiment, each time a wireless network is detected, the interface of each wireless network is traversed and whether the wireless networks are connected is determined. If a plurality of wireless networks are connected, the wireless network that transmits the request can be acquired by the signal strength. Specifically, the signal strength corresponding to each wireless network that has been connected may be acquired, and the wireless network with the largest signal strength may be acquired, and if the largest signal strength is greater than the signal strength threshold, the request may be retransmitted to the server through the wireless network corresponding to the largest signal strength. And the wireless network corresponding to the maximum signal strength sends a request to the server again, and other wireless networks can be closed.
It can be understood that if no wireless network is currently connected, the intelligent terminal can detect whether a connectable wireless network exists in real time, and if the connectable wireless network is detected, the intelligent terminal prompts the user to open the wireless network and connect. After connecting to the wireless network, the request is resent.
And 614, acquiring preset time length according to the failure times of the request.
And step 616, timing from the time of the last request failure, and resending the request to the server after a preset time interval.
In one embodiment, whether to resend the request may also be determined by the time of the request. And timing from the time when the last request fails, and retransmitting the request to the server after a preset time interval. The preset time length can be obtained according to the request failure times, the corresponding relation between the request failure times and the preset time length is established in advance, and the preset time length is obtained according to the request failure times. For example, the number of times of request failure is in inverse proportion to the preset time length, and the larger the number of times of request failure, the shorter the preset time length, that is, the larger the number of times of request failure, the shorter the time interval for retransmitting the request.
If the request is successful, the current traffic data is uploaded to the server, step 618.
In one embodiment, the server, upon receiving the request, closes the function of providing traffic service to the terminal according to the request. It can be understood that the server will provide the traffic service for a plurality of terminals, when the terminal sends a request for closing the first traffic function to the server, the request may include an account identifier, and the server will close the traffic service of the corresponding account according to the account identifier in the request. If the information of successful processing returned by the server is received, it is indicated that the traffic service corresponding to the account is closed, that is, the request is successful. After the request is successful, the terminal may upload the current traffic data to the server.
Generally, when a server issues account information for providing a traffic service to a terminal, both the terminal and the server generate an order according to the account information, and record information such as traffic data and status of the account through the order. If the current flow data exceeds the flow threshold, the orders in the server and the terminal are modified to be in an exhausted state, so that the terminal cannot use the flow data.
FIG. 7 is a system architecture diagram for processing traffic data in one embodiment. As shown in fig. 7, the system may include a server and a terminal including an application, a virtual SIM card module and an operating system therein. The virtual SIM card module counts the current flow data at intervals of preset time, judges whether the flow data corresponding to the current account is used up or not according to the counted current flow data, and closes the virtual SIM card module if the flow data corresponding to the current account is used up. Specifically, when the virtual SIM card module counts current traffic data, a traffic counting interface is enabled, then a core service module of the framework layer is called, the traffic data is read by the core service module, and the current traffic data is counted according to the read traffic data. The application program can trigger the flow query instruction and send the flow query instruction to the virtual SIM card module to perform flow statistics. The user can query order information corresponding to the account through an application program, and the order information specifically comprises an order list page and an order detail page. The application program can calculate the residual flow of the account by inquiring the current flow data and the flow threshold value, and display the calculated residual flow through a display interface of the terminal for a user to view. If the flow corresponding to the account is used up, the terminal locally modifies the order into a used-up state and sends a request to the server, wherein the request indicates the server to modify the order into a used state, and if the user needs to continue to use the flow data, the flow data can be obtained from the server again.
In the data processing method provided in the foregoing embodiment, after the request is sent to the server, if the request fails, the traffic function is locally turned off, and the request is reinitiated when a preset condition is met. Therefore, the situation that the flow data cannot be reasonably managed when the request fails can be prevented, and the accuracy of the flow data is ensured.
FIG. 8 is a flow diagram of a method for accounting for current traffic data in one embodiment. As shown in fig. 8, the traffic statistic method includes steps 802 to 816. Wherein:
step 802, obtaining statistical parameters, wherein the statistical parameters include a start time and an end time.
In one embodiment, step 802 may specifically include: and when a statistical instruction is detected, acquiring statistical parameters. The statistical instruction refers to an instruction for triggering flow statistics, and the statistical instruction can be manually triggered by a user or automatically triggered when a system meets a preset condition. Generally, the statistical instructions are initiated by an application program in an application layer of the intelligent terminal.
For example, a user may purchase a virtual SIM card from an operator through the smart terminal, after purchasing the virtual SIM card, the server may allocate user information, traffic information, and a corresponding location code corresponding to the virtual SIM card to the smart terminal, and then the user may surf the internet through traffic data corresponding to the virtual SIM card. The user information refers to information for identifying different users, the position code refers to a geographical position identification code corresponding to the virtual SIM card, and the flow statistics is started only when the intelligent terminal is within the geographical position range. The geo-location identifier may be, but not limited to, an MCC (Mobile Country Code), an MSIN (Mobile Subscriber identity Number), and the like. The intelligent terminal can acquire the current geographic position in real time, and if the current geographic position is within the geographic position range corresponding to the geographic position identifier of the virtual SIM card, a statistical instruction is triggered to start traffic statistics. Meanwhile, after the statistical instruction is triggered, the intelligent terminal can also send a statistical request to the server, wherein the statistical request is used for indicating the server to perform statistics on the flow used by the virtual SIM card.
It is understood that the statistical parameter may further include a network interface type, where the network interface type refers to a type of an interface for accessing a network, and may generally include Wi-Fi (Wireless Fidelity ) network interfaces, 2G network interfaces, 3G network interfaces, 4G network interfaces, and the like. The data traffic generated by the different network interfaces may be counted separately. The statistical parameters may further include module identifiers, and the module identifiers are unique identifiers for distinguishing different application modules. Then, the current flow data is obtained according to the statistical parameters, and the data flow corresponding to each application module can be counted.
And step 804, calculating the statistical duration according to the statistical parameters.
In one embodiment, the statistical duration is calculated according to a statistical parameter, which may include a start time and an end time, and the statistical duration is the duration of the interval between the start time and the end time. And then acquiring a flow query mode according to the statistical duration. Further, if the statistical duration is within the preset duration range, the traffic query mode is the first traffic query mode. And if the statistical duration exceeds the preset duration range, the flow query mode is a second flow query mode. If the flow query mode is the first flow query mode, reading first historical flow, and taking the first historical flow as current flow data; and if the flow query mode is the second flow query mode, reading the first historical flow and the second historical flow, and acquiring current flow data according to the first historical flow and the second historical flow.
In step 806, if the counted duration is within the preset duration range, the traffic query mode is the first traffic query mode.
In one embodiment, the preset duration range refers to a duration range calculated according to a preset rule. It is understood that the preset duration range may be a fixed duration range, or may be calculated by a statistical parameter. Step 806 may be preceded by: and calculating a preset duration range according to the statistical parameters. For example, if the current time is 12:00 days on 12 days 9 month and 12:00 days 9 month and 1 day and 12:00 days 9 month and 12 days 12:00 are 12.5 days, the preset time period may be 0 to 12.5 days. If the calculated statistical duration is between 0 and 12.5 days, the flow query mode is a first flow query mode; and if the calculated statistical time duration exceeds 12.5 days, the flow query mode is a second flow query mode. The first traffic query mode and the first traffic query mode are two different methods for querying historical traffic.
Step 808, reading the first historical flow from the first flow database.
In the embodiment provided by the application, the intelligent terminal can uniformly count the flow generated by each application program through the flow counting module of the kernel layer, then record the counted flow in a database corresponding to the kernel layer, when the application program of the application layer needs to query the flow, the database of the kernel layer can be read through a special flow counting interface to obtain the flow data, and then the read flow data is stored in the database of the application layer. When the part of the traffic needs to be queried next time, the part of the traffic can be directly read from the database of the application layer without calling a traffic statistical interface, so that the power consumption of the system can be reduced. In one embodiment, the first traffic database may be a database corresponding to the application layer and used for recording statistical traffic, and the second database may be a database corresponding to the kernel layer and used for recording statistical traffic. The first historical flow refers to historical consumed flow data obtained from the first flow database, and the second historical flow refers to historical consumed flow data obtained from the second flow database.
It will be appreciated that the traffic data may be stored in the form of a data structure. The data structure refers to a collection for storing data and relations between data elements, and for example, the data structure may be in the form of a hash table, a red-black tree, a binary tree, or the like. Generally, traffic data is stored for a long period of time to facilitate querying the traffic data as needed. The flow data counted by the flow counting module is stored in the memory at the beginning, when the flow data is stored, an upper limit value is set for the total amount of the flow data, and when the total amount of the flow data reaches the upper limit value, the flow data in the memory is transferred to a specified file, so that the recorded flow data cannot be lost even if the intelligent terminal is closed.
In one embodiment, when the traffic statistics module performs traffic statistics, it performs statistics on consumed traffic data of each application module in each time period, and stores the consumed traffic data in each time period and the corresponding module identifier. The application module refers to a function module corresponding to an application program in the intelligent terminal, and the module identifier is a unique identifier for distinguishing the application module. For example, when an application is installed in an Android system, a UID is assigned to the installed application, and the system can distinguish the function modules corresponding to the applications through the UID. When historical flow is inquired, flow data corresponding to each time period from the starting time to the ending time can be inquired, and the historical flow is calculated according to the inquired flow data corresponding to each time period. For example, the flow statistics module records flow data every half hour, the recorded flow data representing the flow consumed during the recorded half hour. If historical traffic between 12:00 and 14:00 is to be counted, traffic data in four time periods of 12: 00-12: 30, 12: 30-13: 00, 13: 00-13: 30 and 13: 30-14: 00 can be searched from a database, wherein the traffic data are respectively 10MB, 20MB, 30MB and 12MB, and the counted historical traffic is the sum of the traffic data in the time period, namely 72 MB.
And step 810, taking the first historical flow as current flow data.
In one embodiment, if the statistical duration is within the preset duration range, the flow data in the statistical time period may be all obtained from the first flow database. The first historical flow rate can be directly obtained from the first flow rate database according to the statistical parameters, and the first historical flow rate is taken as the current flow rate data.
For example, the application layer in the intelligent terminal may include a first application program and a second application program, and the first application program may count the historical traffic in a first time period in real time and store the counted historical traffic in the first time period in a first traffic database. When the second application program needs to count the flow, the second application program may first input a statistical parameter, and calculate a second time period according to the statistical parameter, and if the second time period is within the first time period, the second application program may directly obtain the historical flow by reading the flow data in the first flow database.
In step 812, if the statistical duration exceeds the preset duration range, the traffic query mode is the second traffic query mode.
Step 814, reading the first historical traffic from the first traffic database, inputting query parameters through the traffic statistics interface, and obtaining a second historical traffic returned through the traffic statistics interface, where the second historical traffic is obtained from the second traffic database according to the query parameters.
In one embodiment, the first flow database stores flow data for only a certain time period, and the second database stores all flow data. If the statistical time length exceeds the preset time length range, the flow data in the statistical time period cannot be completely acquired from the first flow database, one part of the flow data needs to be acquired from the first flow database, and the other part of the flow data needs to be acquired from the second flow database. The flow rate statistics interface is a special interface for acquiring a second historical flow rate from a second flow rate database, query parameters can be input through the flow rate statistics interface, flow rate data is read from the second flow rate database according to the query parameters, and the second historical flow rate is calculated according to the acquired flow rate data.
Specifically, a first query parameter and a second query parameter are calculated according to the statistical parameter and a preset duration range, a first historical flow rate is read from a first flow rate database according to the first query parameter, and a second historical flow rate is read from a second flow rate database according to the second query parameter. For example, if the historical flow rates of 10:00 to 15:00 are stored in the first flow rate database, the preset time duration range is 5 hours, if statistics on the historical flow rates of 5:00 to 15:00 are needed, the first query parameters may be 10:00 and 15:00, and the second query parameters may be 5:00 and 10: 00.
Fig. 9 is a schematic structural diagram of a traffic statistic system in one embodiment. As shown in fig. 9, the traffic query system includes a traffic statistics application 902, a traffic statistics framework 904, and a kernel traffic statistics module 906. The traffic statistics application 902 is located in an application layer of the system, and is configured to initiate a traffic query request. It is to be appreciated that traffic statistics application 902 can send a traffic query request to traffic statistics framework 904, the request including a statistical parameter. The statistical parameters include a start time and a network interface type, the start time refers to a start time and an end time, the network type refers to a type of a network using traffic data, and a general network interface type includes a Wi-Fi network interface, a data network interface, and the like. The traffic statistics frame 904 is located in a frame layer of the system, and is configured to receive a traffic query request of the traffic statistics application 902, obtain historical traffic from the core traffic statistics module 906 according to a statistical parameter in the traffic query request, and send a query result to the traffic statistics application 902.
Fig. 10 is a schematic structural diagram of a flow rate statistics system in another embodiment. As shown in fig. 10, the system is divided into an application layer, a framework layer, and a kernel layer. The application layer includes a traffic consumption application, which is an application that consumes traffic data. For example, the flow consumption application may be a game APP, and a user plays a game through the game APP in a mobile phone, and during the playing process using the game APP, the game APP may generate consumption of flow data. When the intelligent terminal runs the traffic consumption application program and performs data transmission with the server, traffic data consumption can be generated. The traffic consuming application communicates with the kernel layer through an interface in the framework layer. When network access occurs, the traffic counting module inquires which application program accesses the network, then counts the data volume of the sent and received traffic data, and records the counted traffic data into the memory. When the framework layer needs to query the traffic data, the kernel layer maps the traffic data into a file through the file system. The framework layer can acquire and read the files through a system interface to acquire flow data. The transport layer is used to transport data and files, and the network layer is used to define data packets for transmission between different terminals.
For example, the flow statistics function of the Android kernel layer is performed by the module Xt _ qtaguid. This module main code is located in kernel/net/netfilter/xt _ qtaguid.c. The Xt _ qtaguid module utilizes a netfilter architecture of the kernel layer, realizes a network matcher, and sets a certain network interface matching rule. When the system is started, the matcher is loaded and operated by a netd process through an iptables command. When network access occurs, the netfilter framework informs the Xt _ qtaguid module to process, mainly inquires which uid module has access to the network access, and the quantity of data sent and received, and records the flow data into the memory. When the frame layer needs to access the flow data, the Xt _ qtaguid module maps out a proc file through the proc file system and writes the flow data into the file for the frame layer to read.
In one embodiment, the flow of the traffic statistic module for counting the traffic is shown in fig. 11. The traffic statistics module needs to initialize the data before starting to count the traffic data. Firstly creating a directory, then creating a traffic statistics proc file system and a network interface state proc file system, and registering a network matcher. Finally, the matcher is added to the iptable and the misc _ register module is registered. When network access occurs, receiving a network data receiving and sending notice, and starting to count the flow data. And matching the processing function through a matcher, analyzing and counting the flow data, and storing the counted flow data. The data can be stored in a binary tree form, the index value is the UID of the application module, the branch nodes are a plurality of multi-dimensional array structures, and the flow data are stored. When the upper layer application needs to read the flow data, the memory data is written into the file by calling a read function associated with the proc file, and the data is read from the file.
Fig. 12 is a schematic structural diagram of a traffic query system in another embodiment. As shown in fig. 12, the traffic statistics application program initiates a traffic query request, and the core service module in the framework layer is configured to respond to the traffic query request, coordinate the data query module, and serialize the storage module. The data query module provides an interface for querying flow through a flow reading interface, the flow query service reads data of a flow statistics proc file system in the kernel layer, and then the data is returned to the core service module. And the core service module sends the flow data to the serialization storage module. After the data are received by the serialization storage module, the flow data are firstly cached in the memory according to a certain format. When the flow data needs to be read, the cache content is stored in the serialized file or the data is recovered from the serialized file to the cache. Generally, the traffic data may be stored in a form of a data list, and is distinguished by a module identifier of an application module, each element is a data object, and the traffic data corresponding to the module identifier is stored.
It can be understood that, when the traffic statistics module performs traffic statistics, it performs traffic statistics on consumed traffic of each application module in each time period, and stores the traffic in each time period and a corresponding module identifier, which may be stored in a form of a data list. FIG. 13 is a diagram of a data list to store traffic data in one embodiment. As shown in fig. 13, the flow data is stored in the form of a Hash table. The index Key of the Hash table is mainly distinguished by the UID of the application module and a network interface, and the data in the data object stores the flow data of each time period according to a time axis. The data objects include traffic received volume, received packets, transmitted volume, and transmitted packets. The reception/transmission amount is the total number of bytes of the received and transmitted data packet, and the reception/transmission packet is the number of received and transmitted data packets.
FIG. 14 is a diagram of data objects storing traffic data, in one embodiment. As shown in fig. 14, a time axis is divided into time segments of a fixed size in one data object, and traffic data counted in each time segment is stored. When the flow data needs to be acquired, the starting time and the ending time are input, and the flow data corresponding to each time period from the starting time to the ending time is acquired, so that the total flow data generated between the starting time and the ending time can be known.
And step 816, acquiring current flow data according to the first historical flow and the second historical flow.
In one embodiment, the obtained first historical flow and the second historical flow are added, and then the current flow data can be obtained. The statistical current flow data can be displayed on an interface of the intelligent terminal, a data report is generated through the statistical current flow data each time, and the data report is displayed, so that a user can check the flow use condition in real time. And generating prompt information according to the statistical current flow data, and displaying the prompt information on an interface of the intelligent terminal. For example, when the consumed flow rate is more than 500MB within one day, the user is prompted through a prompt box.
FIG. 15 is a terminal display of a flow order list page in one embodiment. As shown in fig. 15, the flow order list page can be queried for all orders of the user's purchase flow, including in-use orders, inactive orders, and historical orders, and clicking on an order can view the corresponding order details.
FIG. 16 is a terminal display of a flow order details page in one embodiment. As shown in fig. 16, the order detail page displays the detailed information of available orders, including order number, remaining flow rate, effective time, and order status.
Fig. 17 is a terminal display diagram of traffic statistics in one embodiment. As shown in fig. 17, the traffic statistics includes statistics of traffic data of different network interfaces and current remaining traffic. And the flow statistical results are respectively displayed through the curve chart, and a user can check the flow data of each day through a display interface.
Fig. 18 is a terminal display diagram of traffic statistics in another embodiment. As shown in fig. 18, the traffic statistic result includes the traffic data consumed by each application program, and is displayed separately. The variation of the flow data consumed by the various applications is shown by a graph.
FIG. 19 is a block diagram of a data processing apparatus according to an embodiment. As shown in fig. 19, the data processing apparatus 1900 includes a data statistics module 1902, a request sending module 1904, and a function shutdown module 1906. Wherein:
the data statistics module 1902 is configured to perform statistics on current traffic data at regular time.
A request sending module 1904, configured to send, to the server, a request for closing a first traffic function if the current traffic data exceeds a traffic threshold, where the first traffic function is a function in which the server allocates traffic data to the terminal.
A function closing module 1906, configured to close a second traffic function locally if the request fails, and resend the request when a preset condition is met, where the second traffic function is a function of using traffic data locally by the terminal.
The data processing apparatus provided in the foregoing embodiment, after sending the request to the server, if the request fails, locally turns off the traffic function, and re-initiates the request when a preset condition is met. Therefore, the situation that the flow data cannot be reasonably managed when the request fails can be prevented, and the accuracy of the flow data is ensured.
In one embodiment, the data statistics module 1902 is further configured to periodically obtain statistical parameters, and obtain current traffic data according to the statistical parameters, where the statistical parameters include a start time and an end time.
In the embodiments provided in this application, the data statistics module 1902 is further configured to obtain a traffic query mode according to the statistical parameter; and inquiring historical flow according to the flow inquiry mode, and counting current flow data according to the historical flow.
In one embodiment, the function shutdown module 1906 is further configured to detect that the current terminal is connected to the wireless network, and resend the request to the server; and timing from the time when the last request fails, and retransmitting the request to the server after a preset time interval.
In another embodiment, the function shutdown module 1906 is further configured to obtain a number of request failures, and obtain a signal strength threshold according to the number of request failures; and if the current terminal is detected to be connected to the wireless network and the signal strength of the wireless network is greater than the signal strength threshold value, the request is sent to the server again.
In this embodiment of the application, the function shutdown module 1906 is further configured to obtain the number of times of request failure; and timing from the time of the last request failure, and resending the request to the server after a preset time corresponding to the request failure times.
In an embodiment, the data processing apparatus 1900 may further include a data sending module, configured to upload the current traffic data to the server if the request is successful.
The division of the modules in the data processing apparatus is only for illustration, and in other embodiments, the data processing apparatus may be divided into different modules as needed to complete all or part of the functions of the data processing apparatus.
The embodiment of the application also provides a computer readable storage medium. One or more non-transitory computer-readable storage media embodying computer-executable instructions that, when executed by one or more processors, cause the processors to perform the steps of:
counting current flow data at regular time;
if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server;
and if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function refers to a function of locally using traffic data by the terminal.
In one embodiment, said counting current traffic data performed by said processor comprises:
and acquiring statistical parameters at fixed time, and acquiring current flow data according to the statistical parameters, wherein the statistical parameters comprise start time and end time.
In one embodiment, the obtaining current traffic data according to the statistical parameter performed by the processor includes:
acquiring a flow query mode according to the statistical parameters;
and inquiring historical flow according to the flow inquiry mode, and counting current flow data according to the historical flow.
In one embodiment, the resending of the request when a preset condition is met includes at least one of:
if the current terminal is detected to be connected to the wireless network, the request is sent to the server again;
and timing from the time when the last request fails, and retransmitting the request to the server after a preset time interval.
In one embodiment, the method performed by the processor further comprises:
acquiring request failure times, and acquiring a signal strength threshold according to the request failure times;
the detecting that the current terminal is connected to the wireless network, and then resending the request to the server comprises:
and if the current terminal is detected to be connected to the wireless network and the signal strength of the wireless network is greater than the signal strength threshold value, the request is sent to the server again.
In one embodiment, the counting from the current time and the resending of the request to the server after a preset time interval by the processor includes:
acquiring the number of request failures;
and timing from the time of the last request failure, and resending the request to the server after a preset time corresponding to the request failure times.
In one embodiment, the method performed by the processor further comprises:
and if the request is successful, uploading the current flow data to the server.
The embodiment of the application also provides computer equipment. As shown in fig. 20, for convenience of explanation, only the portions related to the embodiments of the present application are shown, and details of the specific techniques are not disclosed, please refer to the method portion of the embodiments of the present application. The computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking the computer device as the mobile phone as an example:
fig. 20 is a block diagram of a partial structure of a mobile phone related to a computer device provided in an embodiment of the present application. Referring to fig. 20, the handset includes: radio Frequency (RF) circuitry 2010, memory 2020, input unit 2030, display unit 2040, sensor 2050, audio circuitry 2060, wireless fidelity (WiFi) module 2070, processor 2080, and power supply 2090. Those skilled in the art will appreciate that the handset configuration shown in fig. 20 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The RF circuit 2010 may be configured to receive and transmit signals during information transmission and reception or during a call, and may receive downlink information of a base station and then process the downlink information to the processor 2080; the uplink data may also be transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuit 2010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE)), e-mail, Short Messaging Service (SMS), and the like.
The memory 2020 can be used for storing software programs and modules, and the processor 2080 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 2020. The memory 2020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as an application program for a sound playing function, an application program for an image playing function, and the like), and the like; the data storage area may store data (such as audio data, an address book, etc.) created according to the use of the mobile phone, and the like. Further, the memory 2020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The input unit 2030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone 2000. Specifically, the input unit 2030 may include a touch panel 2031 and other input devices 2032. The touch panel 2031, which may also be referred to as a touch screen, may collect touch operations by a user (e.g., operations by a user on or near the touch panel 2031 using a finger, a stylus, or any other suitable object or accessory) and drive the corresponding connection device according to a preset program. In one embodiment, the touch panel 2031 can include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 2080, and can receive and execute commands sent by the processor 2080. In addition, the touch panel 2031 can be implemented by various types, such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 2030 may include other input devices 2032 in addition to the touch panel 2031. In particular, other input devices 2032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), and the like.
The display unit 2040 may be used to display information input by the user or information provided to the user, and various menus of the cellular phone. The display unit 2040 may include a display panel 2041. In one embodiment, the Display panel 2041 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. In one embodiment, the touch panel 2031 can cover the display panel 2041, and when the touch panel 2031 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 2080 to determine the type of touch event, and then the processor 2080 provides a corresponding visual output on the display panel 2041 according to the type of touch event. Although the touch panel 2031 and the display panel 2041 are shown in fig. 20 as two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 2031 and the display panel 2041 may be integrated to implement the input and output functions of the mobile phone.
The cell phone 2000 may also include at least one sensor 2050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 2041 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 2041 and/or the backlight when the mobile phone is moved to the ear. The motion sensor can comprise an acceleration sensor, the acceleration sensor can detect the magnitude of acceleration in each direction, the magnitude and the direction of gravity can be detected when the mobile phone is static, and the motion sensor can be used for identifying the application of the gesture of the mobile phone (such as horizontal and vertical screen switching), the vibration identification related functions (such as pedometer and knocking) and the like; the mobile phone may be provided with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor.
The audio circuitry 2060, speaker 2061, and microphone 2062 may provide an audio interface between a user and a cell phone. The audio circuit 2060 may transmit the electrical signal converted from the received audio data to the speaker 2061, and convert the electrical signal into a sound signal for output by the speaker 2061; on the other hand, the microphone 2062 converts the collected sound signal into an electrical signal, converts the electrical signal into audio data after being received by the audio circuit 2060, and then outputs the audio data to the processor 2080 for processing, and then the audio data can be transmitted to another mobile phone through the RF circuit 2010, or the audio data is output to the memory 2020 for subsequent processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 2070, and provides wireless broadband internet access for the user. Although fig. 20 shows the WiFi module 2070, it is understood that it does not belong to the essential components of the handset 2000 and may be omitted as needed.
The processor 2080 is a control center of the mobile phone, connects various parts of the entire mobile phone through various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 2020 and calling data stored in the memory 2020, thereby integrally monitoring the mobile phone. In one embodiment, the processor 2080 may include one or more processing units. In one embodiment, the processor 2080 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, application programs, and the like; the modem processor handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 2080.
The phone 2000 further includes a power source 2090 (e.g., a battery) for providing power to the various components, and preferably, the power source is logically connected to the processor 2080 via a power management system, so as to implement functions of managing charging, discharging, and power consumption via the power management system.
In one embodiment, the cell phone 2000 may also include a camera, a bluetooth module, and the like.
In the embodiment of the present application, the processor 2080 included in the mobile terminal implements the data processing method provided in the above-described embodiment when executing the computer program stored in the memory.
A computer program product comprising instructions which, when run on a computer, cause the computer to perform the data processing method provided by the above embodiments.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. Suitable non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (14)

1. A method of data processing, the method comprising:
counting current flow data at regular time;
if the current flow data exceeds a flow threshold, sending a request for closing a first flow function to the server, wherein the first flow function is a function of distributing the flow data to the terminal by the server;
if the request fails, locally closing a second traffic function, and resending the request when a preset condition is met, wherein the second traffic function is a function of locally using traffic data by the terminal; the resending of the request when the preset condition is met comprises at least one of the following steps: if the current terminal is detected to be connected to the wireless network, the request is sent to the server again; and timing from the time when the last request fails, and retransmitting the request to the server after a preset time interval.
2. The data processing method of claim 1, wherein the timing statistics of current traffic data comprises:
and acquiring statistical parameters at fixed time, and acquiring current flow data according to the statistical parameters, wherein the statistical parameters comprise start time and end time.
3. The data processing method of claim 2, wherein the obtaining current traffic data according to the statistical parameter comprises:
acquiring a flow query mode according to the statistical parameters;
and inquiring historical flow according to the flow inquiry mode, and counting current flow data according to the historical flow.
4. The data processing method of claim 1, wherein the method further comprises:
acquiring request failure times, and acquiring a signal strength threshold according to the request failure times;
the detecting that the current terminal is connected to the wireless network, and then resending the request to the server comprises:
and if the current terminal is detected to be connected to the wireless network and the signal strength of the wireless network is greater than the signal strength threshold value, the request is sent to the server again.
5. The data processing method according to claim 1 or 4, wherein the retransmitting the request to the server after the timing is started from the time when the last request fails and the interval is a preset time length comprises:
acquiring the number of request failures;
and timing from the time of the last request failure, and resending the request to the server after a preset time corresponding to the request failure times.
6. The data processing method of claim 1, wherein the method further comprises:
and if the request is successful, uploading the current flow data to the server.
7. A data processing apparatus, characterized in that the apparatus comprises:
the data statistics module is used for regularly counting the current flow data;
the request sending module is used for sending a request for closing a first traffic function to the server if the current traffic data exceeds a traffic threshold, wherein the first traffic function is a function of distributing the traffic data for the terminal by the server;
the function closing module is used for closing a second traffic function locally if the request fails, and resending the request when a preset condition is met, wherein the second traffic function is a function of locally using traffic data by the terminal;
the function closing module is also used for resending the request to the server when detecting that the current terminal is connected to the wireless network; and timing from the time when the last request fails, and retransmitting the request to the server after a preset time interval.
8. The data processing apparatus of claim 7,
the data statistics module is further configured to obtain statistics parameters at regular time, and obtain current flow data according to the statistics parameters, where the statistics parameters include start time and end time.
9. The data processing apparatus of claim 8,
the data statistics module is also used for acquiring a flow query mode according to the statistics parameters;
and inquiring historical flow according to the flow inquiry mode, and counting current flow data according to the historical flow.
10. The data processing apparatus of claim 7, wherein the apparatus further comprises:
the function closing module is also used for acquiring the request failure times and acquiring the signal strength threshold value according to the request failure times;
the detecting that the current terminal is connected to the wireless network, and then resending the request to the server comprises:
and if the current terminal is detected to be connected to the wireless network and the signal strength of the wireless network is greater than the signal strength threshold value, the request is sent to the server again.
11. The data processing apparatus of claim 7 or 10,
the function closing module is also used for acquiring the number of times of request failure;
and timing from the time of the last request failure, and resending the request to the server after a preset time corresponding to the request failure times.
12. The data processing apparatus of claim 7, wherein the apparatus further comprises:
and the data sending module is used for uploading the current flow data to the server if the request is successful.
13. A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, cause the processor to perform the method of any of claims 1 to 6.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
CN201710924619.5A 2017-09-30 2017-09-30 Data processing method and device, computer equipment and computer readable storage medium Active CN107708084B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710924619.5A CN107708084B (en) 2017-09-30 2017-09-30 Data processing method and device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710924619.5A CN107708084B (en) 2017-09-30 2017-09-30 Data processing method and device, computer equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107708084A CN107708084A (en) 2018-02-16
CN107708084B true CN107708084B (en) 2021-02-26

Family

ID=61184523

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710924619.5A Active CN107708084B (en) 2017-09-30 2017-09-30 Data processing method and device, computer equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107708084B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108668336A (en) * 2018-06-01 2018-10-16 中国联合网络通信集团有限公司 Hotspot management method, device, terminal and system
CN109327866B (en) * 2018-12-19 2022-01-04 惠州Tcl移动通信有限公司 Flow control method, flow control device, mobile terminal and storage medium
CN112152971A (en) * 2019-06-28 2020-12-29 北京奇虎科技有限公司 Method and apparatus for controlling network usage behavior, electronic device, and medium
CN112436949A (en) * 2019-08-26 2021-03-02 北京小米移动软件有限公司 Terminal, charging method and device
CN111932882B (en) * 2020-08-13 2022-05-06 广东飞达交通工程有限公司 Real-time early warning system, method and equipment for road accidents based on image recognition
CN113342908B (en) * 2021-06-30 2022-03-11 北京天融信网络安全技术有限公司 Object-oriented kernel layer database construction method
CN114138810B (en) * 2022-01-27 2022-04-12 中国民航信息网络股份有限公司 Access flow statistical method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1842064A (en) * 2005-03-29 2006-10-04 腾讯科技(深圳)有限公司 Data transmission method and system in instant communication
CN103414647A (en) * 2013-07-15 2013-11-27 苏州阔地网络科技有限公司 Communication processing method and system
CN106454794A (en) * 2016-10-17 2017-02-22 上海传英信息技术有限公司 Method and apparatus for automatically turning off mobile data network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1842064A (en) * 2005-03-29 2006-10-04 腾讯科技(深圳)有限公司 Data transmission method and system in instant communication
CN103414647A (en) * 2013-07-15 2013-11-27 苏州阔地网络科技有限公司 Communication processing method and system
CN106454794A (en) * 2016-10-17 2017-02-22 上海传英信息技术有限公司 Method and apparatus for automatically turning off mobile data network

Also Published As

Publication number Publication date
CN107708084A (en) 2018-02-16

Similar Documents

Publication Publication Date Title
CN107708084B (en) Data processing method and device, computer equipment and computer readable storage medium
CN107770746B (en) Data processing method and device, computer equipment and computer readable storage medium
CN107682910B (en) Traffic resource sharing method and device, mobile terminal and storage medium
CN103475996A (en) Network connecting method, network sharing method and devices
CN107484154B (en) Data switching method and device, terminal and computer readable storage medium
WO2018014745A1 (en) Network search method and device after roaming ends
CN109450949B (en) Method for unbinding numbers of multiple applications, mobile terminal and readable storage medium
CN106341809B (en) A kind of data transmission method and equipment
CN107734495B (en) Information processing method, device, storage medium and terminal
CN107484201B (en) Flow statistical method and device, terminal and computer readable storage medium
CN107623612B (en) Flow display method and device, computer equipment and computer readable storage medium
CN107682851A (en) Information processing method, device, mobile terminal and computer-readable recording medium
CN104424211A (en) Microblog-based service data release method, device and system
CN107743303B (en) Information processing method, device, mobile terminal and computer readable storage medium
US11109226B2 (en) Information process method, computer readable storage medium and computer device
CN107743080B (en) Flow statistical method and device, computer equipment, computer readable storage medium
CN107708092B (en) Flow information update method and device, terminal, computer readable storage medium
CN107566398B (en) Flow control methods and device, computer equipment, computer readable storage medium
CN103561155B (en) Send the method for note, device and terminal
CN107682552B (en) Information processing method, device, mobile terminal and computer readable storage medium
CN107770767B (en) Information processing method, device, mobile terminal and computer readable storage medium
CN107682832B (en) Data processing method and device, computer equipment and computer readable storage medium
CN107682892B (en) Flow control method and device, computer equipment and computer readable storage medium
CN104869550A (en) Communication event processing method and device
CN107102913B (en) Data back up method, device and computer equipment

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant