From b505190db3b5b70c2a524082c8e0fb1b9a82fb6c Mon Sep 17 00:00:00 2001 From: qydysky Date: Thu, 27 Jul 2023 13:33:56 +0800 Subject: [PATCH] =?utf8?q?Improve=20=E4=B8=8B=E6=92=AD=E6=80=BB=E7=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/F/liveOver/liveOver.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Reply/F/liveOver/liveOver.go b/Reply/F/liveOver/liveOver.go index 890e143..4b4ead2 100644 --- a/Reply/F/liveOver/liveOver.go +++ b/Reply/F/liveOver/liveOver.go @@ -10,7 +10,7 @@ import ( ) func init() { - if e := comp.Put[c.Common](`bili_danmu.Reply.wsmsg.preparing.sumup`, sumup); e != nil { + if e := comp.Put[c.Common](`bili_danmu.Reply.wsmsg.preparing.liveOver.sumup`, sumup); e != nil { panic(e) } } @@ -18,8 +18,16 @@ func init() { func sumup(ctx context.Context, ptr *c.Common) error { dura := time.Since(ptr.Live_Start_Time).Round(time.Second) if ptr.Live_Start_Time.IsZero() { - dura = 0 + ptr.Log.Base(`功能`, `下播总结`).L(`I: `, fmt.Sprintf("%d 未直播", ptr.Roomid)) + } else { + var pperm = float64(ptr.Watched) / float64(dura/time.Minute) + var yperm = float64(ptr.Rev) / float64(dura/time.Minute) + // 若是中途录制,则使用启动时间 + if ptr.StartT.After(ptr.Live_Start_Time) { + yperm = float64(ptr.Rev) / float64(time.Since(ptr.StartT).Round(time.Second)/time.Minute) + } + ptr.Log.Base(`功能`, `下播总结`).L(`I: `, fmt.Sprintf("%d 时长 %s 营收 %.2f元 %.2f元/分 人数 %d人 %.2f人/分", ptr.Roomid, dura, ptr.Rev, yperm, ptr.Watched, pperm)) + } - ptr.Log.Base(`功能`, `下播总结`).L(`I: `, fmt.Sprintf("%d 时长 %s 总营收 ¥%.2f 观看人数 %d", ptr.Roomid, dura, ptr.Rev, ptr.Watched)) return nil } -- 2.39.2