mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🐛 Fix pay log AttributeError
This commit is contained in:
parent
bb260260cd
commit
b590463699
@ -178,7 +178,6 @@ class PayLog:
|
||||
month_data.clear()
|
||||
if not month_datas:
|
||||
raise PayLogNotFound
|
||||
month_datas.sort(key=lambda k: k["amount"], reverse=True)
|
||||
return all_amount, month_datas
|
||||
|
||||
async def get_analysis(self, user_id: int, client: Client):
|
||||
@ -201,18 +200,19 @@ class PayLog:
|
||||
price_data_name = ["大月卡", "小月卡", "648", "328", "198", "98", "30", "6"]
|
||||
real_price = [68, 30, 648, 328, 198, 98, 30, 6]
|
||||
all_amount, month_datas = await PayLog.get_month_data(pay_log, price_data)
|
||||
month_data = sorted(month_datas, key=lambda k: k["amount"], reverse=True)
|
||||
all_pay = sum((price_data[i]["count"] * real_price[i]) for i in range(len(price_data)))
|
||||
datas = [
|
||||
{"value": f"¥{all_pay:.0f}", "name": "总消费"},
|
||||
{"value": all_amount, "name": "总结晶"},
|
||||
{"value": f"{month_datas[0]['month']}", "name": "消费最多"},
|
||||
{"value": f"{month_data[0]['month']}", "name": "消费最多"},
|
||||
{
|
||||
"value": f"¥{month_datas[0]['amount'] / 10:.0f}",
|
||||
"name": f"{month_datas[0]['month']}消费",
|
||||
"value": f"¥{month_data[0]['amount'] / 10:.0f}",
|
||||
"name": f"{month_data[0]['month']}消费",
|
||||
},
|
||||
*[
|
||||
{
|
||||
"value": price_data[i]["count"],
|
||||
"value": price_data[i]["count"] if i != 0 else "*",
|
||||
"name": f"{price_data_name[i]}",
|
||||
}
|
||||
for i in range(len(price_data))
|
||||
|
@ -101,7 +101,7 @@ class PayLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
||||
await message.reply_text(
|
||||
"<b>开始导入充值历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
|
||||
"(非 paimon.moe 导出的文件数据)</b>\n\n"
|
||||
"> 在绑定 Cookie 时添加 stoken 可能有特殊效果哦(仅限国服)\n"
|
||||
"> 在绑定 Cookie 时添加 stoken 可能有特殊效果哦(国服)\n"
|
||||
"<b>注意:导入的数据将会与旧数据进行合并。</b>",
|
||||
parse_mode="html",
|
||||
)
|
||||
@ -122,9 +122,9 @@ class PayLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
||||
async def import_data_from_message(self, update: Update, _: CallbackContext) -> int:
|
||||
message = update.effective_message
|
||||
user = update.effective_user
|
||||
if message.document:
|
||||
await self.import_from_file(user, message)
|
||||
return ConversationHandler.END
|
||||
if not message.text:
|
||||
await message.reply_text("输入错误,请重新输入")
|
||||
return INPUT_URL
|
||||
authkey = from_url_get_authkey(message.text)
|
||||
reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后")
|
||||
await message.reply_chat_action(ChatAction.TYPING)
|
||||
|
@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<div class="data_line">
|
||||
<div class="data_line_item">
|
||||
<div class="num">1</div>
|
||||
<div class="num">*</div>
|
||||
<div class="lable">大月卡</div>
|
||||
</div>
|
||||
<div class="data_line_item">
|
||||
@ -97,7 +97,7 @@
|
||||
const barData = JSON.parse(`[{"month": "1月", "amount": 1000}]`);
|
||||
const myChart1 = echarts.init(document.querySelector('#chartContainer'), null, { renderer: 'svg' });
|
||||
const xData = barData.map(v => v.month)
|
||||
const yData = barData.map(v => v.amount / 10)
|
||||
const yData = barData.map(v => v.amount)
|
||||
// 指定图表的配置项和数据
|
||||
const option = {
|
||||
animation: false,
|
||||
@ -109,14 +109,14 @@
|
||||
x:'left',
|
||||
y:'top',
|
||||
show: true,
|
||||
data: [{ name: '金额' }]
|
||||
data: [{ name: '结晶' }]
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'金额',
|
||||
name:'结晶',
|
||||
data: yData,
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
|
@ -67,7 +67,7 @@
|
||||
const barData = {{ bar_data | tojson }};
|
||||
const myChart1 = echarts.init(document.querySelector('#chartContainer'), null, {renderer: 'svg'});
|
||||
const xData = barData.map(v => v.month)
|
||||
const yData = barData.map(v => v.amount / 10)
|
||||
const yData = barData.map(v => v.amount)
|
||||
const option = {
|
||||
animation: false,
|
||||
xAxis: {
|
||||
@ -78,14 +78,14 @@
|
||||
x:'left',
|
||||
y:'top',
|
||||
show: true,
|
||||
data: [{ name: '金额' }]
|
||||
data: [{ name: '结晶' }]
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'金额',
|
||||
name:'结晶',
|
||||
data: yData,
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
|
Loading…
Reference in New Issue
Block a user