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