From d766ba6df07afcb4faccbd2c73b3fa040db9d577 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sun, 8 May 2022 02:55:04 +0800 Subject: [PATCH] =?utf8?q?=E5=B9=B3=E5=9D=87=E8=A7=82=E7=9C=8B=E4=BA=BA?= =?utf8?q?=E6=95=B0=E5=88=B0=E5=B0=8F=E6=95=B0=E7=82=B9=E5=90=8E1=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/Reply.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Reply/Reply.go b/Reply/Reply.go index c094f08..81adbd7 100644 --- a/Reply/Reply.go +++ b/Reply/Reply.go @@ -321,9 +321,9 @@ func (replyF) user_toast_msg(s string) { //HeartBeat-心跳用来传递人气值 var ( - renqi_old int - watched_old int - continuity int + renqi_old int + pperm_old float64 + continuity int ) func (replyF) heartbeat(s int) { @@ -358,17 +358,20 @@ func (replyF) heartbeat(s int) { tmp = `(` + tmp + `)` } - var pperm = c.C.Watched / int(time.Since(c.C.Live_Start_Time)/time.Minute) - if watched_old != 0 { - tmp2 += `(avg: ` + strconv.Itoa(pperm) + `人/分 ` - tmp2 += strconv.Itoa(pperm-watched_old) + `)` + var pperm = float64(c.C.Watched) / float64(time.Since(c.C.Live_Start_Time)/time.Minute) + if pperm_old != 0 { + tmp2 += `(avg: ` + fmt.Sprintf("%.1f", pperm) + `人/分 ` + if pperm-pperm_old > 0 { + tmp2 += `+` + } + tmp2 += fmt.Sprintf("%.1f", pperm-pperm_old) + `)` } if renqi_old != s { fmt.Printf("\t人气:%d %s\t观看人数:%d %s\n", s, tmp, c.C.Watched, tmp2) } reply_log.Base_add(`人气`).Log_show_control(false).L(`I: `, "当前人气", s) renqi_old = s - watched_old = pperm + pperm_old = pperm } //Msg-房间特殊活动 -- 2.39.2