HK1224483B - Method and device for uploading terminal information and client device - Google Patents
Method and device for uploading terminal information and client device Download PDFInfo
- Publication number
- HK1224483B HK1224483B HK16112431.4A HK16112431A HK1224483B HK 1224483 B HK1224483 B HK 1224483B HK 16112431 A HK16112431 A HK 16112431A HK 1224483 B HK1224483 B HK 1224483B
- Authority
- HK
- Hong Kong
- Prior art keywords
- status information
- summary file
- currently collected
- terminal
- file
- Prior art date
Links
Description
技术领域Technical Field
本申请涉及网络技术领域,尤其涉及一种终端信息上传的方法、装置及客户端设备。The present application relates to the field of network technology, and in particular to a method, apparatus, and client device for uploading terminal information.
背景技术Background Art
随着移动互联网的发展,越来越多的移动应用需要感知移动终端所处环境的变化,并将移动终端的状态信息定期上传至服务器,以便服务器提供更好的服务。其中,移动终端的状态信息可以包括:IMEI(International Mobile Equipment Identity,移动设备国际身份码)、IMSI(International Mobile Subscriber Identification Number,国际移动用户识别码)、屏幕分辨率、WI-FI(Wireless-Fidelity,无线保真)名等信息。With the development of the mobile internet, more and more mobile applications need to sense changes in the mobile terminal's environment and regularly upload mobile terminal status information to servers to provide better services. This mobile terminal status information may include: IMEI (International Mobile Equipment Identity), IMSI (International Mobile Subscriber Identification Number), screen resolution, Wi-Fi (Wireless Fidelity) name, and other information.
但实际应用中,移动终端所处的环境并不总是发生大的变化。当移动终端所处环境变化不大时,则在一段时间内,该移动终端的状态信息可能很相似甚至于完全相同。如果将每次获取的状态信息都上传至服务器,会出现相似甚至于相同的状态信息被重复上传,占用大量的网络带宽,耗费移动终端的网络流量;同时,会导致服务器对相似甚至于相同的终端状态信息进行重复存储,造成服务器存储资源的浪费。However, in real-world applications, the environment in which a mobile terminal resides doesn't always undergo significant changes. When the environment in which a mobile terminal resides doesn't change significantly, the mobile terminal's status information may be very similar or even identical over a period of time. If each acquired status information is uploaded to the server, similar or even identical status information will be uploaded repeatedly, occupying a large amount of network bandwidth and consuming the mobile terminal's network traffic. Furthermore, the server will repeatedly store similar or even identical terminal status information, wasting server storage resources.
发明内容Summary of the Invention
本申请提供一种终端信息上传的方法、装置及客户端设备,以解决现有技术中移动终端的相似甚至于相同的状态信息被重复上传的问题。The present application provides a method, apparatus and client device for uploading terminal information to solve the problem in the prior art that similar or even identical status information of mobile terminals is repeatedly uploaded.
根据本申请实施例的第一方面,提供一种终端信息上传的方法,所述方法包括:According to a first aspect of an embodiment of the present application, a method for uploading terminal information is provided, the method comprising:
定时收集终端的状态信息;Regularly collect terminal status information;
计算得到当前收集的状态信息的摘要文件;Calculate the summary file of the currently collected status information;
加载得到前一次上传的状态信息的摘要文件;Load the summary file of the status information of the previous upload;
如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离小于预设的距离阈值时,则放弃将所述当前收集的状态信息上传至服务器。If the similarity distance between the summary file of the currently collected state information and the summary file of the previously uploaded state information is less than a preset distance threshold, uploading the currently collected state information to the server is abandoned.
根据本申请实施例的第二方面,提供一种终端信息上传的装置,所述装置包括:According to a second aspect of an embodiment of the present application, a device for uploading terminal information is provided, the device comprising:
收集单元,用于定时收集终端的状态信息;A collection unit, configured to periodically collect terminal status information;
计算单元,用于计算得到当前收集的状态信息的摘要文件;A calculation unit, used for calculating a summary file of the currently collected status information;
加载单元,用于加载得到前一次上传的状态信息的摘要文件;A loading unit, used to load a summary file of the status information of the previous upload;
上传判断单元,用于如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离小于预设的距离阈值时,则放弃将所述当前收集的状态信息上传至服务器。The upload judgment unit is configured to abandon uploading the currently collected status information to the server if the similarity distance between the summary file of the currently collected status information and the summary file of the previously uploaded status information is less than a preset distance threshold.
根据本申请实施例的第三方面,提供一种客户端设备,包括:According to a third aspect of an embodiment of the present application, a client device is provided, including:
处理器;用于存储所述处理器可执行指令的存储器;a processor; a memory for storing instructions executable by the processor;
其中,所述处理器被配置为:Wherein, the processor is configured to:
定时收集终端的状态信息;Regularly collect terminal status information;
计算得到当前收集的状态信息的摘要文件;Calculate the summary file of the currently collected status information;
加载得到前一次上传的状态信息的摘要文件;Load the summary file of the status information of the previous upload;
如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离小于预设的距离阈值时,则放弃将所述当前收集的状态信息上传至服务器。If the similarity distance between the summary file of the currently collected state information and the summary file of the previously uploaded state information is less than a preset distance threshold, uploading the currently collected state information to the server is abandoned.
应用本申请实施例,在终端侧,计算得到当前收集得到的状态信息的摘要文件,并将当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息进行比较,如果二者比较相似,则认为当前收集的状态信息与前一次上传的状态信息相同,放弃将当前收集的状态信息上传至服务器。由此,有效避免了相似或相同的终端状态信息的重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。In the embodiment of the present application, a summary file of the currently collected state information is calculated on the terminal side, and the summary file of the currently collected state information is compared with the previously uploaded state information stored in the system. If the two are similar, the currently collected state information is considered to be the same as the previously uploaded state information, and uploading the currently collected state information to the server is abandoned. This effectively avoids the repeated uploading of similar or identical terminal state information, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请终端信息上传的方法的一个实施例的流程图;FIG1 is a flow chart of an embodiment of a method for uploading terminal information of the present application;
图2为本申请终端信息上传的方法的另一个实施例的流程图;FIG2 is a flow chart of another embodiment of the method for uploading terminal information of the present application;
图3为本申请终端信息上传的方法的另一个实施例的流程图;FIG3 is a flow chart of another embodiment of the method for uploading terminal information of the present application;
图4为本申请终端信息上传的装置所在设备的一种硬件结构图;FIG4 is a hardware structure diagram of the device where the terminal information uploading device of this application is located;
图5为本申请终端信息上传的装置的一个实施例框图。FIG5 is a block diagram of an embodiment of a device for uploading terminal information of the present application.
具体实施方式DETAILED DESCRIPTION
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本申请可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
在基于移动互联网的场景中,移动终端定期获取当前所处环境的状态信息,例如IMEI、IMSI、屏幕分辨率、WI-FI名等,并上传至服务器。如果在一段时间内,移动终端所处环境变化不大,则该移动终端的状态信息可能很相似甚至于完全相同。如果将每次获取的状态信息都上传服务器,会出现相似甚至于相同的状态信息被重复上传的问题。In mobile internet-based scenarios, mobile terminals regularly acquire status information about their current environment, such as IMEI, IMSI, screen resolution, and Wi-Fi ID, and upload it to a server. If the mobile terminal's environment doesn't change much over a period of time, the status information may be very similar or even identical. If each acquired status information is uploaded to the server, similar or even identical status information may be uploaded repeatedly.
基于此,本申请实施例提供一种终端信息上传的方法,可以通过在终端设备侧识别状态信息的变化程度,仅上传与前一时刻不相似或不相同的状态信息,由此来避免相似甚至于相同的状态信息被重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。Based on this, an embodiment of the present application provides a method for uploading terminal information, which can identify the degree of change of status information on the terminal device side and only upload status information that is not similar or identical to the previous moment, thereby avoiding similar or even identical status information from being uploaded repeatedly, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
参见图1,为本申请终端信息上传的方法的一个实施例的流程图,该实施例从实现信息上传的终端设备侧进行描述:1 is a flowchart of an embodiment of a method for uploading terminal information of the present application. This embodiment is described from the perspective of a terminal device that implements information uploading:
步骤101:定时收集终端的状态信息。Step 101: Periodically collect terminal status information.
步骤102:计算得到当前收集的状态信息的摘要文件。Step 102: Calculate and obtain a summary file of the currently collected status information.
步骤103:加载得到前一次上传的状态信息的摘要文件。Step 103: Load the summary file of the status information uploaded last time.
步骤104:如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离小于预设的距离阈值时,则放弃将所述当前收集的状态信息上传至服务器。Step 104: If the similarity distance between the summary file of the currently collected state information and the summary file of the previously uploaded state information is less than a preset distance threshold, then giving up uploading the currently collected state information to the server.
本申请实施例中,在终端侧,计算得到当前收集得到的状态信息的摘要文件,并将当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息进行比较,如果二者比较相似,则认为当前收集的状态信息与前一次上传的状态信息相同,放弃将当前收集的状态信息上传至服务器。由此,有效避免了相似或相同的终端状态信息的重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。In the embodiment of the present application, a summary file of the currently collected state information is calculated on the terminal side, and the summary file of the currently collected state information is compared with the previously uploaded state information stored in the system. If the two are similar, the currently collected state information is considered to be the same as the previously uploaded state information, and uploading the currently collected state information to the server is abandoned. This effectively avoids the repeated uploading of similar or identical terminal state information, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
参见图2,为本申请终端信息上传的方法另一个实施例的流程图,该实施例从实现信息上传的终端设备侧进行描述:2 is a flow chart of another embodiment of the method for uploading terminal information of the present application. This embodiment is described from the perspective of the terminal device that implements information uploading:
步骤201:终端定时收集状态信息。Step 201: The terminal collects status information regularly.
本申请实施例中,终端定期收集自身的状态信息。在实际应用中,终端收集状态信息的周期可以根据需要具体设定,在此不做限定。In the embodiment of the present application, the terminal collects its own status information regularly. In actual application, the period of collecting status information by the terminal can be specifically set as needed and is not limited here.
步骤202:终端计算得到当前收集的状态信息的摘要文件。Step 202: The terminal calculates and obtains a summary file of the currently collected status information.
本申请实施例中,可以采用哈希Hash计算的方式得到当前收集的状态信息的摘要文件。In the embodiment of the present application, a summary file of the currently collected status information can be obtained by using a hash calculation method.
Hash计算就是:把任意长度的输入,通过散列算法,变换成固定长度的输出,该输出就是散列值,也称为Hash值。Hash计算是一种压缩映射,生成的Hash值的空间通常远小于输入的空间。也就是说,Hash计算就是一种将任意长度的消息压缩到某一固定长度的消息摘要的函数。因此,本申请实施例中,可以通过Hash计算来获得当前收集的状态信息的摘要文件,以方便后续对摘要文件的比对的实现。Hash calculation is the process of transforming an input of arbitrary length into an output of fixed length through a hash algorithm. This output is the hash value, also known as the hash value. Hash calculation is a compression mapping, and the space of generated hash values is typically much smaller than the space of the input. In other words, hash calculation is a function that compresses a message of arbitrary length into a message digest of a fixed length. Therefore, in the embodiments of the present application, a summary file of the currently collected state information can be obtained through hash calculation, facilitating subsequent comparison of the summary file.
下面结合Hash算法,对计算得到当前收集的状态信息的摘要文件的过程进行详细的描述。具体的,步骤202可以包括以下步骤:The following describes in detail the process of calculating the summary file of the currently collected status information in conjunction with the Hash algorithm. Specifically, step 202 may include the following steps:
步骤2021:将当前收集的状态信息按照一定的顺序构成一字符串。Step 2021: Construct a character string of the currently collected status information in a certain order.
本申请实施例中,将当前收集到的该终端的IMEI、IMSI、屏幕分辨率、WI-FI名等信息,按照一定的顺序排列,构成一字符串。其中,该一定的顺序可以根据用户的需要具体设定,在此并不做限制。In the embodiment of the present application, the currently collected information of the terminal, such as IMEI, IMSI, screen resolution, and Wi-Fi name, is arranged in a certain order to form a string. The certain order can be set according to the needs of the user and is not limited here.
需要说明的是,在实际应用中,终端受到OS(Operating System,操作系统)的限制,在当前环境内,对于某些状态信息,可能收集不到。例如,以WI-FI名为例,假设当前环境中,为保护网络隐私,必须通过授权才能收集到当前的WI-FI名,对于未授权用户,并不能获悉当前的WI-FI名。此时,在收集到的状态信息中,WI-FI名对应的信息为空。为保证Hash计算的顺利进行,在构成字符串时,对信息为空的WI-FI名这一项,以预设的固定字符进行填写,以保证仍能构成一个完整的字符串。It should be noted that in actual applications, the terminal is subject to the limitations of the OS (Operating System), and in the current environment, some status information may not be collected. For example, taking the WI-FI name as an example, assuming that in the current environment, in order to protect network privacy, authorization is required to collect the current WI-FI name. Unauthorized users cannot know the current WI-FI name. At this time, in the collected status information, the information corresponding to the WI-FI name is empty. In order to ensure the smooth progress of the Hash calculation, when constructing the string, the WI-FI name item with empty information is filled with preset fixed characters to ensure that a complete string can still be formed.
其中,该预设的固定字符串可以是用户根据实际的需要预先设定的;也可以是系统自动给出的默认固定值。The preset fixed character string may be pre-set by the user according to actual needs, or may be a default fixed value automatically given by the system.
这样做的目的在于,为了实现后续对摘要文件的比较步骤,需要保证不同时刻收集得到的状态信息构成的字符串的长度是一致的。对于无法采集得到的状态信息,其得到的信息内容为空,如果不用预设的固定值进行填写,可会导致该字符串中对应该项信息的内容为空,导致字符串缺位。为避免缺位现象的出现,当所述状态信息中的某一项或某几项为空时,该项或该几项对应的字符串为固定值。This is done to ensure that the length of the character strings comprising the status information collected at different times is consistent, enabling subsequent comparison of summary files. For status information that cannot be collected, the resulting information is left blank. If this information is not filled with a preset fixed value, the corresponding information in the character string may be empty, resulting in missing strings. To avoid missing strings, when one or more items in the status information are empty, the corresponding character strings are fixed.
步骤2022:对该字符串进行Hash计算,得到Hash值,将该Hash值作为该状态信息的摘要文件,保存在终端的文件系统中。Step 2022: Perform hash calculation on the character string to obtain a hash value, and save the hash value as a summary file of the status information in the file system of the terminal.
本申请实施例中,对当前收集的状态信息构成的字符串进行Hash计算。根据常识可知,对于不同的字符串,其计算得到的Hash值是不相同的;对于相同的字符串,其计算得到的Hash值是相同的。In the embodiment of the present application, a hash calculation is performed on the character string composed of the currently collected state information. According to common sense, for different character strings, the calculated hash values are different; for the same character string, the calculated hash values are the same.
本申请实施例中,将该计算得到的Hash值作为该状态信息的摘要文件,保存在终端的文件系统中。In the embodiment of the present application, the calculated Hash value is used as a summary file of the status information and saved in the file system of the terminal.
结合本申请上述实施例,如果当前终端所处的环境不变或变化不大,则终端当前收集到的状态信息与上一次收集到的状态信息不会发生变化,则当前收集到的状态信息构成的字符串与上一次收集到的状态信息构成的字符串相同,则二者分别计算生成的Hash值也会相同。而如果当前终端所处的环境发生了变化,则终端当前收集到的状态信息中的某一项或某几项,与上一次收集到的状态信息相比,可能会发生变化,例如,WI-FI名不同了。则当前收集到的状态信息构成的字符串与上一次收集到的状态信息构成的字符串不再相同,则二者分别计算生成的Hash值也不会相同。In conjunction with the above-mentioned embodiments of the present application, if the environment in which the current terminal is located remains unchanged or does not change much, the status information currently collected by the terminal will not change from the status information collected last time, and the string composed of the status information currently collected will be the same as the string composed of the status information collected last time, and the hash values calculated and generated by the two will also be the same. However, if the environment in which the current terminal is located has changed, one or more items of the status information currently collected by the terminal may change compared to the status information collected last time, for example, the WI-FI name is different. Then the string composed of the status information currently collected will no longer be the same as the string composed of the status information collected last time, and the hash values calculated and generated by the two will also be the same.
当然,本申请实施例中,仅是以Hash计算为例对计算得到当前收集的状态信息的摘要文件进行说明。在实际应用中,计算得到状态信息的摘要文件可以但不限于上述方法,任何可以实现该目的的方法均可以用于本申请实施例中。Of course, in the embodiment of the present application, only Hash calculation is used as an example to illustrate the calculation of the summary file of the currently collected state information. In actual applications, the summary file of the state information can be calculated by, but is not limited to, the above method. Any method that can achieve this purpose can be used in the embodiment of the present application.
步骤203:终端尝试是否能够加载到前一次上传的状态信息的摘要文件,如果能够加载到,则进入步骤204;如果加载不到,则进入步骤206。Step 203: The terminal attempts to see if it can load the summary file of the status information uploaded last time. If it can, the process proceeds to step 204; if it cannot, the process proceeds to step 206.
步骤204:计算当前收集的状态信息的摘要文件与前一次上传的状态信息的摘要文件的相似距离,如果二者的相似距离小于预设的距离阈值,则进入步骤205;如果二者的相似距离大于等于预设阈值,则进入步骤206。Step 204: Calculate the similarity distance between the summary file of the currently collected status information and the summary file of the previously uploaded status information. If the similarity distance between the two is less than a preset distance threshold, proceed to step 205; if the similarity distance between the two is greater than or equal to the preset threshold, proceed to step 206.
步骤205:放弃此次信息上传。Step 205: Abandon uploading the information.
步骤206:将当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端中,并通过网络将当前收集的状态信息上传至服务器。Step 206: Save the summary file of the currently collected state information and the timestamp of the current terminal in the terminal, and upload the currently collected state information to the server via the network.
本申请实施例中,终端尝试加载前一次上传的状态信息的摘要文件,具体实现为:终端查找文件系统中,是否保存有前一次上传的状态信息的摘要文件。In the embodiment of the present application, the terminal attempts to load the summary file of the status information uploaded last time, which is specifically implemented as follows: the terminal searches the file system to see whether the summary file of the status information uploaded last time is saved.
当该终端是第一次执行本申请实施例的终端信息上传的方法,即为终端以前没有计算状态信息的摘要文件并保存过,则终端会加载失败,即为文件系统中找不到前一次上传的状态信息的摘要文件。则终端无法判断当前收集得到的状态信息与前一次上传的状态信息是否相似或相同。为避免终端信息的遗漏,确保服务器能够及时且完整的获取到终端的状态信息,则无论当前收集得到的状态信息与前一次上传的状态信息是否相似或相同,终端均通过网络将当前收集的状态信息上传至服务器,并将当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端的文件系统中。When the terminal executes the terminal information uploading method of the embodiment of the present application for the first time, that is, the terminal has not calculated and saved the summary file of the status information before, the terminal will fail to load, that is, the summary file of the status information uploaded last time cannot be found in the file system. The terminal cannot determine whether the currently collected status information is similar or identical to the status information uploaded last time. In order to avoid omission of terminal information and ensure that the server can obtain the status information of the terminal in a timely and complete manner, regardless of whether the currently collected status information is similar or identical to the status information uploaded last time, the terminal uploads the currently collected status information to the server through the network, and saves the summary file of the currently collected status information and the timestamp of the current terminal in the file system of the terminal.
当该终端的用户对终端的文件系统进行存储内容的清理时,很可能会删除文件系统中保存的,该终端以前保存的状态信息的摘要文件。则这种情况下,终端也会加载失败,即为文件系统中找不到前一次上传的状态信息的摘要文件。则终端无法判断当前收集得到的状态信息与前一次上传的状态信息是否相似或相同。为避免终端信息的遗漏,确保服务器能够及时且完整的获取到终端的状态信息,则无论当前收集得到的状态信息与前一次上传的状态信息是否相似或相同,终端均通过网络将当前收集的状态信息上传至服务器,并将当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端的文件系统中。When the user of the terminal cleans up the storage content of the terminal's file system, it is very likely that the summary file of the terminal's previously saved status information stored in the file system will be deleted. In this case, the terminal will also fail to load, that is, the summary file of the previously uploaded status information cannot be found in the file system. The terminal cannot then determine whether the currently collected status information is similar or identical to the previously uploaded status information. In order to avoid omissions of terminal information and ensure that the server can obtain the terminal's status information in a timely and complete manner, regardless of whether the currently collected status information is similar or identical to the previously uploaded status information, the terminal will upload the currently collected status information to the server via the network, and save the summary file of the currently collected status information and the timestamp of the current terminal in the terminal's file system.
当终端加载成功时,即为在文件系统中找到了前一次上传的状态信息的摘要文件,则终端将当前收集的状态信息的摘要文件和前一次上传的状态信息的摘要文件进行比对,计算二者的相似距离。When the terminal loads successfully, that is, the summary file of the previously uploaded state information is found in the file system, the terminal compares the summary file of the currently collected state information with the summary file of the previously uploaded state information, and calculates the similarity distance between the two.
如果二者的相似距离小于预设阈值,即为当前收集的状态信息的摘要文件和前一次上传的状态信息的摘要文件非常相似,则说明当前收集的状态信息和前一次上传的状态信息非常相似,基本没有发生什么大的变化,则可以认为当前收集的状态信息和前一次上传的状态信息为重复信息,则放弃此次信息上传,即为不再将当前收集的状态信息上传至服务器。If the similarity distance between the two is less than the preset threshold, that is, the summary file of the currently collected status information is very similar to the summary file of the previously uploaded status information, then it means that the currently collected status information is very similar to the previously uploaded status information, and basically no major changes have occurred. It can be considered that the currently collected status information and the previously uploaded status information are duplicate information, and the information upload is abandoned, that is, the currently collected status information will no longer be uploaded to the server.
如果二者的相似距离大于等于预设阈值,即为当前收集的状态信息的摘要文件和前一次上传的状态信息的摘要文件不相同,则说明当前收集的状态信息与前一次上传的状态信息有区别,终端的某些状态信息发生了变化,为了确保服务器能够及时且完整的获取到终端的状态信息,需要将当前收集到的状态信息上传至服务器,同时将当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端的文件系统中。If the similarity distance between the two is greater than or equal to the preset threshold, that is, the summary file of the currently collected status information is different from the summary file of the previously uploaded status information, it means that the currently collected status information is different from the previously uploaded status information, and some status information of the terminal has changed. In order to ensure that the server can obtain the status information of the terminal in a timely and complete manner, the currently collected status information needs to be uploaded to the server, and the summary file of the currently collected status information and the timestamp of the current terminal need to be saved in the file system of the terminal.
需要说明的是,本申请实施例中,当采用哈希Hash计算的方式得到当前收集的状态信息的摘要文件时,该计算当前收集的状态信息的摘要文件与前一次上传的状态信息的摘要文件的相似距离具体为:比较当前收集的状态信息对应的Hash值与所述前一次上传的状态信息的Hash值是否相同,如果相同,则说明二者完全相同,则认为二者的相似距离小于预设的距离阈值;如果二者不相同,则认为二者的相似距离大于等于预设阈值。It should be noted that, in an embodiment of the present application, when a hash calculation method is used to obtain a summary file of the currently collected status information, the similarity distance between the summary file of the currently collected status information and the summary file of the previously uploaded status information is calculated as follows: compare whether the hash value corresponding to the currently collected status information is the same as the hash value of the previously uploaded status information. If they are the same, it means that the two are exactly the same, and it is considered that the similarity distance between the two is less than the preset distance threshold; if they are not the same, it is considered that the similarity distance between the two is greater than or equal to the preset threshold.
本申请实施例中,在终端侧,计算得到当前收集得到的状态信息的摘要文件,并将当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息进行比较,如果二者比较相似,则认为当前收集的状态信息与前一次上传的状态信息相同,放弃将当前收集的状态信息上传至服务器。由此,有效避免了相似或相同的终端状态信息的重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。In the embodiment of the present application, a summary file of the currently collected state information is calculated on the terminal side, and the summary file of the currently collected state information is compared with the previously uploaded state information stored in the system. If the two are similar, the currently collected state information is considered to be the same as the previously uploaded state information, and uploading the currently collected state information to the server is abandoned. This effectively avoids the repeated uploading of similar or identical terminal state information, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
参见图3,为本申请移动终端信息上传的方法另一个实施例的流程图,该实施例从实现信息上传的终端设备侧进行描述:3 is a flow chart of another embodiment of the method for uploading information from a mobile terminal of the present application. This embodiment is described from the perspective of a terminal device that implements information uploading:
步骤301:终端定时收集状态信息。Step 301: The terminal collects status information regularly.
步骤302:终端计算得到当前收集的状态信息的摘要文件。Step 302: The terminal calculates and obtains a summary file of the currently collected status information.
本申请实施例中,可以采用哈希Hash计算的方式得到当前收集的状态信息的摘要文件。其具体计算过程与上述实施例相同。In the embodiment of the present application, a hash calculation method can be used to obtain a summary file of the currently collected state information. The specific calculation process is the same as that of the above embodiment.
步骤303:终端尝试是否能够加载到前一次上传的状态信息的摘要文件,如果能够加载到,则进入步骤304;如果加载不到,则进入步骤306。Step 303: The terminal attempts to see if it can load the summary file of the status information uploaded last time. If it can, the process proceeds to step 304; if it cannot, the process proceeds to step 306.
步骤304:计算当前收集的状态信息的摘要文件与前一次上传的状态信息的摘要文件的相似距离,如果二者的相似距离小于预设阈值,则进入步骤305;如果二者的相似距离大于等于预设阈值,则进入步骤306。Step 304: Calculate the similarity distance between the summary file of the currently collected status information and the summary file of the previously uploaded status information. If the similarity distance between the two is less than a preset threshold, proceed to step 305; if the similarity distance between the two is greater than or equal to the preset threshold, proceed to step 306.
步骤305:放弃此次信息上传,并对系统文件中保存的前一次上传的状态信息的摘要文件进行更新。Step 305: Abandon the current information upload and update the summary file of the status information of the previous upload stored in the system file.
本申请实施例中,对系统文件中保存的摘要文件的更新可以通过以下几种方式实现。In the embodiment of the present application, updating of the summary file stored in the system file can be achieved in the following ways.
第一种实现方式:用当前收集的状态信息的摘要文件以及当前终端的时间戳覆盖系统文件中保存的前一次上传的状态信息的摘要文件以及前一次上传时的时间戳。The first implementation method is to overwrite the summary file of the previously uploaded status information and the timestamp of the previous upload stored in the system file with the summary file of the currently collected status information and the timestamp of the current terminal.
本申请实施例中,虽然通过比对得到,当前收集的状态信息的摘要文件与前一次上传的状态信息的摘要文件很相似,但为了保证系统文件中文件的新鲜度,仍然执行对系统文件的更新步骤。该更新可以具体为直接用当前收集的状态信息的摘要文件覆盖系统中保存的前一次上传的状态信息的摘要文件,并用当前终端的时间戳覆盖前一次上传时的时间戳。In the embodiment of the present application, although the summary file of the currently collected state information is found to be very similar to the summary file of the previously uploaded state information through comparison, in order to ensure the freshness of the file in the system file, the system file update step is still performed. This update can specifically be to directly overwrite the summary file of the previously uploaded state information stored in the system with the summary file of the currently collected state information, and to overwrite the timestamp of the previously uploaded state information with the timestamp of the current terminal.
第二种实现方式:比较当前终端的时间戳与系统文件中保存的前一次上传时的时间戳,如果二者的差距超过预设的时间阈值,则用当前收集的状态信息的摘要文件以及当前终端的时间戳覆盖系统文件中保存的前一次上传的状态信息的摘要文件以及前一次上传时的时间戳;否则,如果二者的差距未超过预设的时间阈值,则不执行更新步骤。The second implementation method is: compare the timestamp of the current terminal with the timestamp of the previous upload saved in the system file. If the difference between the two exceeds the preset time threshold, the summary file of the currently collected status information and the timestamp of the current terminal are used to overwrite the summary file of the previous uploaded status information and the timestamp of the previous upload saved in the system file; otherwise, if the difference between the two does not exceed the preset time threshold, the update step is not performed.
本申请实施例中,为避免更新步骤的频繁执行,可以比较摘要文件对应的时间戳,具体为比较当前终端的时间戳与前一次上传的时间戳,如果两个时间戳的差距超过了预设的时间阈值,说明在一定长的时间内该终端的状态信息都没有发生变化,且一直没有执行过更新步骤,为确保系统文件中保存的文件的新鲜度,对其中保存的摘要文件和对应的时间戳进行更新。如果两个时间戳的差距没有超过预设的时间阈值,说明刚刚执行过摘要文件保存的步骤或者是系统文件的更新步骤,该系统文件中保存的文件还很新鲜,暂时不需要执行更新步骤,以避免对系统文件的频繁操作。In an embodiment of the present application, to avoid frequent execution of the update step, the timestamps corresponding to the summary files can be compared, specifically comparing the timestamp of the current terminal with the timestamp of the previous upload. If the difference between the two timestamps exceeds a preset time threshold, it indicates that the status information of the terminal has not changed for a certain period of time and the update step has not been executed. To ensure the freshness of the files stored in the system file, the summary file and the corresponding timestamp stored therein are updated. If the difference between the two timestamps does not exceed the preset time threshold, it indicates that the summary file saving step or the system file update step has just been executed, and the files stored in the system file are still fresh, and the update step does not need to be executed temporarily, thereby avoiding frequent operations on the system file.
步骤306:将当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端中,并通过网络将当前收集的状态信息上传至服务器。Step 306: Save the summary file of the currently collected state information and the timestamp of the current terminal in the terminal, and upload the currently collected state information to the server via the network.
本申请实施例中,在终端侧,计算得到当前收集得到的状态信息的摘要文件,并将当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息进行比较,如果二者比较相似,则认为当前收集的状态信息与前一次上传的状态信息相同,放弃将当前收集的状态信息上传至服务器。由此,有效避免了相似或相同的终端状态信息的重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。In the embodiment of the present application, a summary file of the currently collected state information is calculated on the terminal side, and the summary file of the currently collected state information is compared with the previously uploaded state information stored in the system. If the two are similar, the currently collected state information is considered to be the same as the previously uploaded state information, and uploading the currently collected state information to the server is abandoned. This effectively avoids the repeated uploading of similar or identical terminal state information, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
进一步的,本申请实施例中,如果当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息比较相似,不需要上传至服务器时,还可以执行对系统文件中保存的摘要文件的更新步骤,以确保系统文件的新鲜度。Furthermore, in an embodiment of the present application, if the summary file of the currently collected status information is similar to the previously uploaded status information stored in the system and does not need to be uploaded to the server, an update step of the summary file stored in the system file can also be performed to ensure the freshness of the system file.
与本申请终端信息上传的方法的实施例相对应,本申请还提供了终端信息上传的装置及客户端设备的实施例。Corresponding to the embodiment of the method for uploading terminal information of the present application, the present application also provides embodiments of an apparatus for uploading terminal information and a client device.
本申请终端信息上传的装置的实施例可以应用在客户端设备上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图4所示,为本申请终端信息上传装置所在设备的一种硬件结构图,除了图4所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的设备通常根据该设备的实际功能,还可以包括其他硬件,如对于客户端设备来说,可能包括摄像头、触摸屏子、通信组件等,对于服务器,可能包括负责处理报文的转发芯片等等。The embodiment of the device for uploading terminal information of the present application can be applied to a client device. The embodiment of the device can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the device where it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, as shown in Figure 4, it is a hardware structure diagram of the device where the terminal information uploading device of the present application is located. In addition to the processor, memory, network interface, and non-volatile memory shown in Figure 4, the device where the device is located in the embodiment can usually include other hardware according to the actual function of the device. For example, for a client device, it may include a camera, a touch screen, a communication component, etc. For a server, it may include a forwarding chip responsible for processing messages, etc.
参见图5,为本申请终端信息上传的装置的一个实施例框图,该信息上传装置可以应用在客户端设备上:See FIG5 , which is a block diagram of an embodiment of a device for uploading terminal information of the present application. The device for uploading information can be applied to a client device:
所述装置包括:收集单元501、计算单元502、加载单元503和上传判断单元504。The device includes: a collecting unit 501 , a calculating unit 502 , a loading unit 503 and an uploading determination unit 504 .
所述收集单元501,用于定时收集终端的状态信息;The collecting unit 501 is used to collect terminal status information at regular intervals;
所述计算单元502,用于计算得到当前收集的状态信息的摘要文件;The calculation unit 502 is used to calculate and obtain a summary file of the currently collected status information;
所述加载单元503,用于加载得到前一次上传的状态信息的摘要文件;The loading unit 503 is used to load the summary file of the status information uploaded last time;
所述上传判断单元504,用于如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离小于预设的距离阈值时,则放弃将所述当前收集的状态信息上传至服务器。The upload judgment unit 504 is configured to abandon uploading the currently collected status information to the server if the similarity distance between the summary file of the currently collected status information and the summary file of the previously uploaded status information is less than a preset distance threshold.
在一个可选的实现方式中,所述计算单元502可以包括:构成子单元、哈希计算子单元和保存子单元。其中,In an optional implementation, the calculation unit 502 may include: a composition subunit, a hash calculation subunit, and a storage subunit.
所述构成子单元,用于将所述当前收集的状态信息按照一定的顺序构成一字符串;The composing subunit is used to compose a character string from the currently collected status information in a certain order;
所述哈希计算子单元,用于对所述字符串进行哈希Hash计算,得到对应的Hash值;The hash calculation subunit is used to perform hash calculation on the string to obtain a corresponding hash value;
所述保存子单元,用于将所述Hash值作为所述当前收集的状态信息的摘要文件,保存在终端的文件系统中。The saving subunit is configured to save the Hash value as a summary file of the currently collected status information in a file system of the terminal.
在一个可选的实现方式中,所述装置还可以包括:上传单元和第一保存单元。In an optional implementation, the device may further include: an uploading unit and a first saving unit.
所述上传单元,用于如果所述当前收集的状态信息的摘要文件与所述前一次上传的状态信息的摘要文件的相似距离大于或等于所述预设的距离阈值时,则将所述当前收集的状态信息上传至服务器;The uploading unit is configured to upload the currently collected state information to the server if a similarity distance between the summary file of the currently collected state information and the summary file of the previously uploaded state information is greater than or equal to a preset distance threshold;
所述第一保存单元,用于将所述当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端的文件系统中。The first saving unit is configured to save the summary file of the currently collected status information and the timestamp of the current terminal in a file system of the terminal.
在一个可选的实现方式中,所述装置还可以包括:第一更新单元。In an optional implementation, the apparatus may further include: a first updating unit.
所述第一更新单元,用于用所述当前收集的状态信息的摘要文件以及当前终端的时间戳覆盖系统文件中保存的所述前一次上传的状态信息的摘要文件以及前一次上传时的时间戳。The first updating unit is configured to overwrite the summary file of the previously uploaded status information and the timestamp of the previous upload stored in the system file with the summary file of the currently collected status information and the timestamp of the current terminal.
在一个可选的实现方式中,所述装置还可以包括:第二更新单元In an optional implementation, the device may further include: a second updating unit
所述第二更新单元,用于比较当前终端的时间戳与系统文件中保存的前一次上传时的时间戳,如果二者的差距超过预设的时间阈值,则用所述当前收集的状态信息的摘要文件以及当前终端的时间戳覆盖系统文件中保存的所述前一次上传的状态信息的摘要文件以及前一次上传时的时间戳。The second updating unit is used to compare the timestamp of the current terminal with the timestamp of the previous upload saved in the system file. If the difference between the two exceeds a preset time threshold, the summary file of the currently collected status information and the timestamp of the current terminal are used to overwrite the summary file of the status information of the previous upload and the timestamp of the previous upload saved in the system file.
在一个可选的实现方式中,所述装置还可以包括:第二保存单元。In an optional implementation, the device may further include: a second storage unit.
所述第二保存单元,用于如果加载不到所述前一次上传的状态信息的摘要文件,则将所述当前收集的状态信息上传至服务器,并将所述当前收集的状态信息的摘要文件以及当前终端的时间戳保存在终端的文件系统中。The second saving unit is configured to upload the currently collected status information to the server if the summary file of the previously uploaded status information cannot be loaded, and save the summary file of the currently collected status information and the timestamp of the current terminal in the file system of the terminal.
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
应用本申请实施例,在终端侧,计算得到当前收集得到的状态信息的摘要文件,并将当前收集的状态信息的摘要文件与系统中保存的前一次上传的状态信息进行比较,如果二者比较相似,则认为当前收集的状态信息与前一次上传的状态信息相同,放弃将当前收集的状态信息上传至服务器。由此,有效避免了相似或相同的终端状态信息的重复上传,从而减少移动终端的网络流量消耗,并进一步减少了服务器存储资源的开销浪费。In the embodiment of the present application, a summary file of the currently collected state information is calculated on the terminal side, and the summary file of the currently collected state information is compared with the previously uploaded state information stored in the system. If the two are similar, the currently collected state information is considered to be the same as the previously uploaded state information, and uploading the currently collected state information to the server is abandoned. This effectively avoids the repeated uploading of similar or identical terminal state information, thereby reducing the network traffic consumption of the mobile terminal and further reducing the waste of server storage resources.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims (11)
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410575772.8A CN105592444B (en) | 2014-10-24 | 2014-10-24 | A kind of method, apparatus and client device of end message upload |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1224483A1 HK1224483A1 (en) | 2017-08-18 |
| HK1224483B true HK1224483B (en) | 2020-07-17 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TWI477981B (en) | System and method for avoiding data parts stored in servers repeatedly | |
| CN110661829B (en) | File downloading method and device, client and computer readable storage medium | |
| CN107577711B (en) | Method and device for caching pictures | |
| CN109359263B (en) | A kind of user behavior feature extraction method and system | |
| TW201423426A (en) | System and method for diving document into data parts and uploading the data parts | |
| CN105120003A (en) | Method for realizing data backup in cloud environment | |
| US20190014016A1 (en) | Data acquisition device, data acquisition method and storage medium | |
| CN113342746A (en) | File management system, file management method, electronic device, and storage medium | |
| CN110866265A (en) | Data storage method, device and storage medium based on block chain | |
| CN107430582A (en) | Thin client system, connection management device, virtual machine operating device, method and storage medium | |
| CN111770153A (en) | Object downloading method, device, electronic device and storage medium | |
| JP5880315B2 (en) | System management apparatus, system management method, and system management program | |
| CN106203179B (en) | A system and method for checking the integrity of files | |
| US9286055B1 (en) | System, method, and computer program for aggregating fragments of data objects from a plurality of devices | |
| CN109324801A (en) | Algorithm downloading method, equipment and related products | |
| CN105592444B (en) | A kind of method, apparatus and client device of end message upload | |
| CN105205011A (en) | Method for obtaining file block reference count, ordinary client side and management client side | |
| HK1224483B (en) | Method and device for uploading terminal information and client device | |
| US20210042271A1 (en) | Distributed garbage collection for dedupe file system in cloud storage bucket | |
| CN112559460B (en) | File storage method, device, equipment and storage medium based on artificial intelligence | |
| CN114205424B (en) | Bill file decompression method, device, computer equipment and storage medium | |
| US20140149499A1 (en) | Remote request fulfillment and delivery | |
| CN107846429B (en) | File backup method, device and system | |
| CN111427708B (en) | Message consumption method, device, computer equipment and storage medium | |
| CN107623692A (en) | Method and device for data verification |