Update to v2.8.2 without release

- Try to add support for Anniversary 5 ticket
- Update the song database

> Well, there may be bugs with Anniversary 5 ticket. Remember it can only be used when the pack is on sale.
This commit is contained in:
Lost-MSth
2022-03-09 18:44:00 +08:00
parent 5de274fdf5
commit 3a1c731e24
13 changed files with 81 additions and 27 deletions

View File

@@ -764,6 +764,7 @@ def change_purchase():
orig_price = request.form['orig_price']
discount_from = request.form['discount_from']
discount_to = request.form['discount_to']
discount_reason = request.form['discount_reason']
if price:
price = int(price)
@@ -783,6 +784,10 @@ def change_purchase():
discount_to, "%Y-%m-%dT%H:%M"))) * 1000
else:
discount_to = -1
if not discount_reason:
discount_reason = ''
except:
error = '数据错误 Wrong data.'
flash(error)
@@ -792,8 +797,8 @@ def change_purchase():
c.execute(
'''select exists(select * from purchase where purchase_name=:a)''', {'a': purchase_name})
if c.fetchone() == (0,):
c.execute('''insert into purchase values(?,?,?,?,?)''',
(purchase_name, price, orig_price, discount_from, discount_to))
c.execute('''insert into purchase values(?,?,?,?,?,?)''',
(purchase_name, price, orig_price, discount_from, discount_to, discount_reason))
flash('购买项目添加成功 Successfully add the purchase.')
else:

View File

@@ -288,6 +288,7 @@ def get_all_purchase():
discount_from = None
discount_to = None
discount_reason = 'Yes' if i[5] == 'anni5tix' else 'No'
if i[3] and i[3] >= 0:
discount_from = time.strftime(
@@ -302,13 +303,15 @@ def get_all_purchase():
items = []
if y:
for j in y:
items.append({'item_id': j[1], 'type': j[2], 'amount':j[3]})
items.append(
{'item_id': j[1], 'type': j[2], 'amount': j[3]})
re.append({'purchase_name': i[0],
'price': i[1],
'orig_price': i[2],
'discount_from': discount_from,
'discount_to': discount_to,
'discount_reason': discount_reason,
'items': items
})