text
stringlengths
1
93.6k
headers["Host"] = "sg-cg-api.hoyoverse.com"
NotificationURL = "https://sg-cg-api.hoyoverse.com/hk4e_global/cg/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true"
WalletURL = (
"https://sg-cg-api.hoyoverse.com/hk4e_global/cg/wallet/wallet/get"
)
AnnouncementURL = "https://sg-cg-api.hoyoverse.com/hk4e_global/cg/gamer/api/getAnnouncementInfo"
logger.info(
f"正在进行第 {conf.index(config) + 1} 个账号,服务器为{'CN' if region != 'os' else 'GLOBAL'}……"
)
try:
wallet = httpx.get(WalletURL, headers=headers, timeout=60, verify=False)
logger.debug(wallet.text)
if json.loads(wallet.text) == {
"data": None,
"message": "登录已失效,请重新登录",
"retcode": -100,
}:
logger.error(f"当前登录已过期,请重新登陆!返回为:{wallet.text}")
sct_msg += f"当前登录已过期,请重新登陆!返回为:{wallet.text}"
else:
logger.info(
f"你当前拥有免费时长 {json.loads(wallet.text)['data']['free_time']['free_time']} 分钟,畅玩卡状态为 {json.loads(wallet.text)['data']['play_card']['short_msg']},拥有原点 {json.loads(wallet.text)['data']['coin']['coin_num']} 点({int(json.loads(wallet.text)['data']['coin']['coin_num'])/10}分钟)"
)
sct_msg += f"你当前拥有免费时长 {json.loads(wallet.text)['data']['free_time']['free_time']} 分钟,畅玩卡状态为 {json.loads(wallet.text)['data']['play_card']['short_msg']},拥有原点 {json.loads(wallet.text)['data']['coin']['coin_num']} 点({int(json.loads(wallet.text)['data']['coin']['coin_num'])/10}分钟)"
announcement = httpx.get(
AnnouncementURL, headers=headers, timeout=60, verify=False
)
logger.debug(f'获取到公告列表:{json.loads(announcement.text)["data"]}')
res = httpx.get(
NotificationURL, headers=headers, timeout=60, verify=False
)
success, Signed = False, False
logger.debug(res.text)
try:
if list(json.loads(res.text)["data"]["list"]) == []:
success = True
Signed = True
Over = False
elif (
json.loads(json.loads(res.text)["data"]["list"][-1]["msg"])[
"msg"
]
== "每日登录奖励"
):
success = True
Signed = False
Over = False
elif (
json.loads(json.loads(res.text)["data"]["list"][-1]["msg"])[
"over_num"
]
> 0
):
success = True
Signed = False
Over = True
else:
success = False
except IndexError:
success = False
if success:
if Signed:
logger.info(f"获取签到情况成功!今天是否已经签到过了呢?")
sct_msg += f"获取签到情况成功!今天是否已经签到过了呢?"
logger.debug(f"完整返回体为:{res.text}")
elif not Signed and Over:
logger.info(
f'获取签到情况成功!当前免费时长已经达到上限!签到情况为{json.loads(res.text)["data"]["list"][0]["msg"]}'
)
sct_msg += f"获取签到情况成功!当前免费时长已经达到上限!签到情况为{json.loads(res.text)['data']['list'][0]['msg']}"
else:
logger.info(f"已经签到过了!")
sct_msg += f"已经签到过了!"
else:
logger.info(f"当前没有签到!请稍后再试!")
sct_msg += f"当前没有签到!请稍后再试!"
if sct_key:
httpx.get(sct_url, params={"desp": sct_msg})
except Exception as e:
logger.error(f"执行过程中出错:{str(e)}")
sct_msg += f"执行过程中出错:{str(e)}"
if sct_key:
httpx.get(sct_url, params={"desp": sct_msg})
raise RunError(str(e))
logger.info("所有任务已经执行完毕!")
# <FILESEP>
import math
import statistics
import random
from collections import defaultdict
from qgis.PyQt.QtCore import (
QVariant
)
from qgis.utils import iface
from qgis.core import (
QgsProject,