CN114567622A - Method for counting user online time based on Java - Google Patents

Method for counting user online time based on Java Download PDF

Info

Publication number
CN114567622A
CN114567622A CN202011359836.2A CN202011359836A CN114567622A CN 114567622 A CN114567622 A CN 114567622A CN 202011359836 A CN202011359836 A CN 202011359836A CN 114567622 A CN114567622 A CN 114567622A
Authority
CN
China
Prior art keywords
time
user
server
interval value
time interval
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.)
Pending
Application number
CN202011359836.2A
Other languages
Chinese (zh)
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.)
Yozosoft Co ltd
Original Assignee
Yozosoft Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yozosoft Co ltd filed Critical Yozosoft Co ltd
Priority to CN202011359836.2A priority Critical patent/CN114567622A/en
Publication of CN114567622A publication Critical patent/CN114567622A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method for counting user online time based on Java, which comprises the following steps: the server sets an effective time interval value for calculating the online time of the user and assigns the online time of the user to zero; a user sends a request to a server through a browser; the server records the sending request time of the user, and the sending request time subtracts the adjacent last sending request time to obtain a time interval value; if the time interval value is less than or equal to the effective time interval value, the server accumulates the time interval value into the online time of the user; the invention realizes that the user carries out multiple request access operations in the browser, and the server judges whether the time interval value of the request sent by the user is within the effective time interval value or not, and calculates more accurate and effective online time.

Description

Method for counting user online time based on Java
Technical Field
The invention relates to the field of user online time statistics, in particular to a method for user online time statistics based on Java.
Background
In general, the calculation of the user online time length usually calculates the difference between the start time and the end time of the user login, and such a calculation method is rough and cannot accurately calculate the actual online time length of the user.
Therefore, in combination with the above-mentioned technical problems, there is a need to provide a new technical solution.
Disclosure of Invention
In order to solve the technical problems in the prior art, the invention provides a method for counting the online time of a user based on Java, which comprises the following specific technical scheme:
the method for counting the online time of the user based on Java comprises the following steps:
s1: the server sets an effective time interval value for calculating the online time of the user and assigns the online time of the user to zero;
s2: a user sends a request to a server through a browser;
s3: the server records the sending request time of the user, and the sending request time subtracts the adjacent last sending request time to obtain a time interval value;
s4: if the time interval value is less than or equal to the effective time interval value, the server accumulates the time interval value into the online time of the user;
s5: the user again sends a request to the server through the browser, and steps S3 and S4 are repeatedly performed.
Further, in step S4, if the time interval value is greater than the valid time interval value, the time interval value is not accumulated into the user online time.
Further, in step S3, if the adjacent previous transmission request time is empty, the time interval value is recorded as zero.
Further, when the user sends a request to the server for the first time, the server records the time of sending the request by the user, and the time interval value is zero because the time of sending the request by the user is empty at the time.
Further preferably, the server is provided with a timer, the timer sends a prompt to the server, and the server stores the online time of the user and the last sending request time in the database after receiving the prompt.
Further preferably, the timer sends a time reminder to the server at regular intervals.
Further, the server persistently stores the user online time and the last time the request was sent in a database.
Further, in step S1, the valid time interval value is flexibly configured according to statistical requirements.
The method for counting the online time of the user based on the Java has the following beneficial effects:
(1) according to the method for counting the online time of the user based on the Java, the server accurately calculates the online time of the user according to the sending request time of the user;
(2) according to the method for counting the online time of the user based on the Java, the user carries out multiple request access operations in a browser, and the server judges whether the time interval value of the request sent by the user is within the effective time interval value or not, so that more accurate and effective online time can be calculated.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flowchart of a method for counting user online time based on Java according to the present invention;
Detailed Description
The embodiments of the present invention are described in detail below, and the technical solutions in the embodiments of the present invention are clearly and completely described. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Examples
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for counting a user online duration based on Java according to the present invention. As shown in fig. 1, the present invention relates to a method for counting user online time based on Java, and the method specifically comprises:
s1: the server sets an effective time interval value for calculating the online time of the user and assigns the online time of the user to zero; preferably, the effective time interval value is flexibly configured according to statistical requirements;
s2: a user sends a request to a server through a browser;
s3: the server records the sending request time of the user, and the sending request time subtracts the adjacent last sending request time to obtain a time interval value; preferably, if the adjacent last sending request time is empty, the time interval value is recorded as zero;
in an example, when a user sends a request to a server for the first time, the server records the time of the user sending the request, and at this time, the time interval value is zero because the adjacent last sending request time is empty.
S4: if the time interval value is less than or equal to the effective time interval value, the server accumulates the time interval value into the online time of the user; preferably, if the time interval value is greater than the valid time interval value, the time interval value is not added to the user online duration, and the step S2 is repeatedly performed.
S5: the user again sends a request to the server through the browser, and steps S3 and S4 are repeatedly performed.
In another embodiment, the server is provided with a timer, the timer sends a prompt to the server, and the server persistently stores the online time of the user and the last sending request time in the database after receiving the prompt, so that the server is prevented from causing data loss under the condition of accidental termination. In an example, the timer sends a time alert to the server at regular intervals.
For the partial codes in the above embodiments, the following is exemplified:
Figure BDA0002803677030000031
the invention has the beneficial effects that:
(1) according to the method for counting the online time of the user based on the Java, the server accurately calculates the online time of the user according to the sending request time of the user;
(2) according to the method for counting the online time of the user based on the Java, the user carries out multiple request access operations in a browser, and the server judges whether the time interval value of the request sent by the user is within the effective time interval value or not, so that more accurate and effective online time can be calculated.
While embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and not to be construed as limiting the present invention, and that changes, modifications and variations may be made therein by those of ordinary skill in the art within the scope of the present invention.

Claims (8)

1. A method for counting the online time of a user based on Java is characterized by comprising the following steps:
s1: the server sets an effective time interval value for calculating the online time of the user and assigns the online time of the user to zero;
s2: a user sends a request to a server through a browser;
s3: the server records the sending request time of the user, and the sending request time subtracts the adjacent last sending request time to obtain a time interval value;
s4: if the time interval value is less than or equal to the effective time interval value, the server accumulates the time interval value into the online time of the user;
s5: the user again sends a request to the server through the browser, and steps S3 and S4 are repeatedly performed.
2. The method according to claim 1, wherein in step S4, if the time interval value is greater than the valid time interval value, the time interval value is not added to the user online time.
3. The method according to claim 1, wherein in step S3, if the time interval between adjacent last-sent requests is empty, the time interval value is recorded as zero.
4. The method according to claim 3, wherein the server records the time when the user first sends the request to the server, and the time interval value is zero because the time when the next last request is sent is empty.
5. The method for counting the online time of the user based on the Java as claimed in claim 1, wherein the server has a timer, the timer sends the reminder to the server, and the server stores the online time of the user and the last sending request time in the database after receiving the reminder.
6. The method according to claim 5, wherein the timer sends a time reminder to the server at regular intervals.
7. The method for counting the online time of the user based on Java as claimed in claim 5, wherein the server persistently stores the online time of the user and the time of the last request sent in the database.
8. The method for counting the online time of the user according to the Java "1", wherein in the step S1, the valid time interval value is flexibly configured according to the statistical requirement.
CN202011359836.2A 2020-11-27 2020-11-27 Method for counting user online time based on Java Pending CN114567622A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011359836.2A CN114567622A (en) 2020-11-27 2020-11-27 Method for counting user online time based on Java

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011359836.2A CN114567622A (en) 2020-11-27 2020-11-27 Method for counting user online time based on Java

Publications (1)

Publication Number Publication Date
CN114567622A true CN114567622A (en) 2022-05-31

Family

ID=81711289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011359836.2A Pending CN114567622A (en) 2020-11-27 2020-11-27 Method for counting user online time based on Java

Country Status (1)

Country Link
CN (1) CN114567622A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007104218A1 (en) * 2006-03-10 2007-09-20 Huawei Technologies Co., Ltd. Method and system for limiting playing time of networked game users, ppp server and networked game server
CN101686289A (en) * 2008-09-27 2010-03-31 华为技术有限公司 Method, device and system for network prepayment
CN101729571A (en) * 2009-12-28 2010-06-09 广州游家信息技术有限公司 Method, server and system for counting network on-line user number
WO2015031014A1 (en) * 2013-08-29 2015-03-05 Aol Inc. Systems and methods for managing resetting of user online identities or accounts
CN105099676A (en) * 2014-04-18 2015-11-25 阿里巴巴集团控股有限公司 User login method, user terminal and server
CN105407013A (en) * 2015-10-28 2016-03-16 北京奇虎科技有限公司 User online state statistical system and method
CN105721227A (en) * 2016-04-14 2016-06-29 武汉斗鱼网络科技有限公司 Method and system for carrying out statistics to online durations of user and state server
CN106027289A (en) * 2016-05-09 2016-10-12 北京奇虎科技有限公司 User state statistics system and user state statistics method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007104218A1 (en) * 2006-03-10 2007-09-20 Huawei Technologies Co., Ltd. Method and system for limiting playing time of networked game users, ppp server and networked game server
CN101686289A (en) * 2008-09-27 2010-03-31 华为技术有限公司 Method, device and system for network prepayment
CN101729571A (en) * 2009-12-28 2010-06-09 广州游家信息技术有限公司 Method, server and system for counting network on-line user number
WO2015031014A1 (en) * 2013-08-29 2015-03-05 Aol Inc. Systems and methods for managing resetting of user online identities or accounts
CN105099676A (en) * 2014-04-18 2015-11-25 阿里巴巴集团控股有限公司 User login method, user terminal and server
CN105407013A (en) * 2015-10-28 2016-03-16 北京奇虎科技有限公司 User online state statistical system and method
CN105721227A (en) * 2016-04-14 2016-06-29 武汉斗鱼网络科技有限公司 Method and system for carrying out statistics to online durations of user and state server
CN106027289A (en) * 2016-05-09 2016-10-12 北京奇虎科技有限公司 User state statistics system and user state statistics method

Similar Documents

Publication Publication Date Title
CN108512876B (en) Data pushing method and device
CN110858843B (en) Service request processing method and device and computer readable storage medium
CN101778105B (en) Method, system and equipment for obtaining real-time performance monitoring indicated numbers based on WEB
TW202046206A (en) Abnormal account detection method and device
CN108415925A (en) Electronic device, data call daily record generation and querying method and storage medium
CN111416883B (en) Address query method, device, terminal and computer readable storage medium
CN114567622A (en) Method for counting user online time based on Java
CN107277624B (en) Duration calculation method and device
CN103957230B (en) A kind of client user's number determines method, server, client and system
CN113194339A (en) Live list generation method and device, electronic equipment and readable storage medium
CN111401874B (en) Self-service transaction system monitoring method and device
CN111311310A (en) Advertisement order pushing method and device, storage medium and electronic device
CN113434729B (en) Video related information aggregation acquisition method and device and terminal equipment
CN110933068B (en) Black and white list real-time optimization method and device, server and storage medium
CN110856040B (en) Method and device for processing monitoring data in client
CN111092959B (en) Request processing method, system and related device for servers in cluster
CN114338255B (en) Group management method and device
CN116132500A (en) Online time length statistics method and device and computer readable storage medium
CN111461868A (en) Network queuing method and device, computer equipment and readable storage medium
CN111580961A (en) Access request processing method, device, server and storage medium
CN117294578A (en) Communication method, system, computer equipment and storage medium
CN115102830B (en) Log reduction method, device, computer equipment and computer readable storage medium
CN111291296B (en) Content issuing method and device
CN115460438B (en) Video pushing method and device, nonvolatile storage medium and electronic equipment
CN111211997B (en) Message processing method, device and system

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