From 675a8c0cc4b4876c07829ec9ba30f96f15b14234 Mon Sep 17 00:00:00 2001 From: clover420 <748883120@qq.com> Date: Sun, 28 Aug 2022 18:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud_genshin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cloud_genshin.py b/cloud_genshin.py index 2643122..bbfd267 100644 --- a/cloud_genshin.py +++ b/cloud_genshin.py @@ -24,7 +24,13 @@ class CloudGenshin: 'User-Agent': 'okhttp/4.9.0' } - def sign_account(self): + # 分钟转小时 + def Time_Conversion(self,minute : int) -> str: + h = minute//60 + s = minute%60 + return f"{h}小时{s}分钟" + + def sign_account(self) -> str: ret_msg = "云原神:\r\n" req = http.get(url=setting.cloud_genshin_Inquire, headers=self.headers) data = req.json() @@ -33,7 +39,7 @@ class CloudGenshin: log.info('签到失败,未获得免费时长,可能是已经签到过了或者超出免费时长上线') else: log.info(f'签到成功,已获得{data["data"]["free_time"]["free_time"]}分钟免费时长') - ret_msg = f'你当前拥有免费时长 {data["data"]["free_time"]["free_time"]} 分钟,' \ + ret_msg = f'你当前拥有免费时长 {self.Time_Conversion(int(data["data"]["free_time"]["free_time"]))} ,' \ f'畅玩卡状态为 {data["data"]["play_card"]["short_msg"]},拥有米云币 {data["data"]["coin"]["coin_num"]} 枚' log.info(ret_msg) elif data['retcode'] == -100: