3 Commits

Author SHA1 Message Date
Lost-MSth
1235733ddf Update to v2.8.6 2022-04-01 13:37:38 +08:00
Lost-MSth
cb6425a0d1 Update to v2.8.3 without release
- Unlock the character **linka**.
- Update the song database.
2022-03-24 16:30:46 +08:00
Lost-MSth
3a1c731e24 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.
2022-03-09 18:44:00 +08:00
17 changed files with 142 additions and 55 deletions

View File

@@ -66,23 +66,20 @@ It is just so interesting. What it can do is under exploration.
> Tips: When updating, please keep the original database in case of data loss. > Tips: When updating, please keep the original database in case of data loss.
### Version 2.8.1 ### Version 2.8.4
- 适用于Arcaea 3.12.0版本 For Arcaea 3.12.0 - &spades;适用于Arcaea 4.0.&infin;<!--3.12.6-->版本&spades; For Arcaea 3.12.6
- 更新了歌曲数据库 Update the song database. - &hearts;修复616==sb?PTT:PPT<!--**凛可**-->缺少Bug<!--语音-->的问题&hearts; Fix missing voices of **Linka**.
- 新搭档**维塔**已解锁 Unlock the character **Vita**.
- 新增对**维塔**的技能支持 Add support for the skill of **Vita**.
- 修正世界模式进度计算方式 Revise the algorithm of world mode progress.
- 修复世界模式下 **对立(风暴)** 数值计算错误的问题 Fix the wrong value of **Tairitsu(Tempest)** in the World Mode.
- 以下是累积更新 The following are cumulative updates:
- #35 集成式接口优化By Young-Lord Optimize `aggregate` interface. (By Young-Lord)
- 新增填写Link Play服务器地址的选项解决地址无法正确自动获取的问题 Add the option of filling in Link Play server address, which can solve the problem that the address cannot be obtained automatically.
- 修复高版本iOS客户端无法登陆的问题 Fix a bug that the high version of iOS client cannot log in.
- 修复有关下载的安全性问题 Fix a safety problem about downloading.
- 修复有不同音频的Beyond谱面无法下载的问题 Fix a bug about unable to download a beyond chart which has another audio file.
- 以下大概可能也许不得不是累积更新 The following are cumulative updates:
- &clubs;更新了█████[](歌曲数据库)&clubs; Update the song database.
- &diams;尝试对!@#$%^<!--5周年兑换券-->提供支持&diams; Try to add support for Anniversary 5 ticket.
- &iquest;新搭档' or name = 'Taikari'--<!--**凛可**-->已解锁&iquest; Unlock the character **Linka**.
<!--
本项目不会像lowiro一样为各位用户制造各种奇奇怪怪的麻烦即便是在愚人节这种盛大的节日大家也能放心使用
Happy April Fool's Day!
Sorry for no joke in English.
-->
## 运行环境与依赖 Running environment and requirements ## 运行环境与依赖 Running environment and requirements

Binary file not shown.

View File

@@ -4,7 +4,7 @@ import json
# 数据库初始化文件删掉arcaea_database.db文件后运行即可谨慎使用 # 数据库初始化文件删掉arcaea_database.db文件后运行即可谨慎使用
ARCAEA_SERVER_VERSION = 'v2.8.1' ARCAEA_SERVER_VERSION = 'v2.8.4'
def main(path='./'): def main(path='./'):
@@ -223,7 +223,8 @@ def main(path='./'):
price int, price int,
orig_price int, orig_price int,
discount_from int, discount_from int,
discount_to int discount_to int,
discount_reason text
);''') );''')
c.execute('''create table if not exists purchase_item(purchase_name text, c.execute('''create table if not exists purchase_item(purchase_name text,
item_id text, item_id text,
@@ -311,34 +312,34 @@ def main(path='./'):
0, 0, 0, 8, 0, 14, 0, 0, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0] 0, 0, 0, 8, 0, 14, 0, 0, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0]
frag1 = [55, 55, 60, 50, 47, 0, 47, 57, 41, 22, 50, 54, 60, 56, 78, 42, 41, 61, 52, 50, 52, 32, frag1 = [55, 55, 60, 50, 47, 0, 47, 57, 41, 22, 50, 54, 60, 56, 78, 42, 41, 61, 52, 50, 52, 32,
42, 55, 45, 58, 43, 0.5, 68, 50, 62, 45, 45, 52, 44, 27, 59, 0, 45, 50, 50, 47, 47, 61, 43, 42, 50, 25, 58, 50, 61, 45, 45, 38, 34] 42, 55, 45, 58, 43, 0.5, 68, 50, 62, 45, 45, 52, 44, 27, 59, 0, 45, 50, 50, 47, 47, 61, 43, 42, 38, 25, 58, 50, 61, 45, 45, 38, 34]
prog1 = [35, 55, 47, 50, 60, 0, 60, 70, 58, 45, 70, 45, 42, 46, 61, 67, 49, 44, 28, 45, 24, 46, 52, prog1 = [35, 55, 47, 50, 60, 0, 60, 70, 58, 45, 70, 45, 42, 46, 61, 67, 49, 44, 28, 45, 24, 46, 52,
59, 62, 33, 58, 25, 63, 69, 50, 45, 45, 51, 34, 70, 62, 70, 45, 32, 32, 61, 47, 47, 37, 42, 50, 50, 45, 41, 61, 45, 45, 58, 50] 59, 62, 33, 58, 25, 63, 69, 50, 45, 45, 51, 34, 70, 62, 70, 45, 32, 32, 61, 47, 47, 37, 42, 50, 50, 45, 41, 61, 45, 45, 58, 50]
overdrive1 = [35, 55, 25, 50, 47, 0, 72, 57, 41, 7, 10, 32, 65, 31, 61, 53, 31, 47, 38, 12, 39, 18, overdrive1 = [35, 55, 25, 50, 47, 0, 72, 57, 41, 7, 10, 32, 65, 31, 61, 53, 31, 47, 38, 12, 39, 18,
48, 65, 45, 55, 44, 25, 46, 44, 33, 45, 45, 37, 25, 27, 50, 20, 45, 63, 21, 47, 61, 47, 65, 80, 50, 30, 49, 15, 34, 45, 45, 38, 67] 48, 65, 45, 55, 44, 25, 46, 44, 33, 45, 45, 37, 25, 27, 50, 20, 45, 63, 21, 47, 61, 47, 65, 80, 38, 30, 49, 15, 34, 45, 45, 38, 67]
frag20 = [78, 80, 90, 75, 70, 0, 70, 79, 65, 40, 50, 80, 90, 82, 0, 61, 67, 92, 85, 50, 86, 52, frag20 = [78, 80, 90, 75, 70, 0, 70, 79, 65, 40, 50, 80, 90, 82, 0, 61, 67, 92, 85, 50, 86, 52,
65, 85, 67, 88, 64, 0.5, 95, 70, 95, 50, 80, 87, 71, 50, 85, 0, 80, 75, 50, 70, 70, 90, 65, 80, 100, 50, 68, 60, 90, 67, 50, 60, 51] 65, 85, 67, 88, 64, 0.5, 95, 70, 95, 50, 80, 87, 71, 50, 85, 0, 80, 75, 50, 70, 70, 90, 65, 80, 61, 50, 68, 60, 90, 67, 50, 60, 51]
prog20 = [61, 80, 70, 75, 90, 0, 90, 102, 84, 78, 105, 67, 63, 68, 0, 99, 80, 66, 46, 83, 40, 73, prog20 = [61, 80, 70, 75, 90, 0, 90, 102, 84, 78, 105, 67, 63, 68, 0, 99, 80, 66, 46, 83, 40, 73,
80, 90, 93, 50, 86, 78, 89, 98, 75, 80, 50, 64, 55, 100, 90, 110, 80, 50, 74, 90, 70, 70, 56, 80, 100, 55, 65, 59, 90, 50, 90, 90, 75] 80, 90, 93, 50, 86, 78, 89, 98, 75, 80, 50, 64, 55, 100, 90, 110, 80, 50, 74, 90, 70, 70, 56, 80, 79, 55, 65, 59, 90, 50, 90, 90, 75]
overdrive20 = [61, 80, 47, 75, 70, 0, 95, 79, 65, 31, 50, 59, 90, 58, 0, 78, 50, 70, 62, 49, 64, overdrive20 = [61, 80, 47, 75, 70, 0, 95, 79, 65, 31, 50, 59, 90, 58, 0, 78, 50, 70, 62, 49, 64,
46, 73, 95, 67, 84, 70, 78, 69, 70, 50, 80, 80, 63, 25, 50, 72, 55, 50, 95, 55, 70, 90, 70, 99, 80, 100, 40, 69, 62, 51, 90, 67, 60, 100] 46, 73, 95, 67, 84, 70, 78, 69, 70, 50, 80, 80, 63, 25, 50, 72, 55, 50, 95, 55, 70, 90, 70, 99, 80, 61, 40, 69, 62, 51, 90, 67, 60, 100]
frag30 = [88, 90, 100, 75, 80, 0, 70, 79, 65, 40, 50, 90, 100, 92, 0, 61, 67, 92, 85, 50, 86, 62, frag30 = [88, 90, 100, 75, 80, 0, 70, 79, 65, 40, 50, 90, 100, 92, 0, 61, 67, 92, 85, 50, 86, 62,
65, 85, 67, 88, 74, 0.5, 105, 80, 95, 50, 80, 87, 71, 50, 95, 0, 80, 75, 50, 70, 80, 100, 65, 80, 100, 50, 68, 60, 90, 67, 50, 60, 51] 65, 85, 67, 88, 74, 0.5, 105, 80, 95, 50, 80, 87, 71, 50, 95, 0, 80, 75, 50, 70, 80, 100, 65, 80, 61, 50, 68, 60, 90, 67, 50, 60, 51]
prog30 = [71, 90, 80, 75, 100, 0, 90, 102, 84, 78, 105, 77, 73, 78, 0, 99, 80, 66, 46, 93, 40, 83, prog30 = [71, 90, 80, 75, 100, 0, 90, 102, 84, 78, 105, 77, 73, 78, 0, 99, 80, 66, 46, 93, 40, 83,
80, 90, 93, 50, 96, 88, 99, 108, 75, 80, 50, 64, 55, 100, 100, 110, 80, 50, 74, 90, 80, 80, 56, 80, 100, 55, 65, 59, 90, 50, 90, 90, 75] 80, 90, 93, 50, 96, 88, 99, 108, 75, 80, 50, 64, 55, 100, 100, 110, 80, 50, 74, 90, 80, 80, 56, 80, 79, 55, 65, 59, 90, 50, 90, 90, 75]
overdrive30 = [71, 90, 57, 75, 80, 0, 95, 79, 65, 31, 50, 69, 100, 68, 0, 78, 50, 70, 62, 59, 64, overdrive30 = [71, 90, 57, 75, 80, 0, 95, 79, 65, 31, 50, 69, 100, 68, 0, 78, 50, 70, 62, 59, 64,
56, 73, 95, 67, 84, 80, 88, 79, 80, 50, 80, 80, 63, 25, 50, 82, 55, 50, 95, 55, 70, 100, 80, 99, 80, 100, 40, 69, 62, 51, 90, 67, 60, 100] 56, 73, 95, 67, 84, 80, 88, 79, 80, 50, 80, 80, 63, 25, 50, 82, 55, 50, 95, 55, 70, 100, 80, 99, 80, 61, 40, 69, 62, 51, 90, 67, 60, 100]
char_type = [1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2, 0, 0, 0, 2, 3, 1, 0, 0, 0, 1, char_type = [1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2, 0, 0, 0, 2, 3, 1, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2] 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2]
char_core = { char_core = {
0: [{'core_id': 'core_hollow', 'amount': 25}, {'core_id': 'core_desolate', 'amount': 5}], 0: [{'core_id': 'core_hollow', 'amount': 25}, {'core_id': 'core_desolate', 'amount': 5}],
@@ -367,7 +368,7 @@ def main(path='./'):
c.execute(sql, (i, char[i], frag1[i], prog1[i], overdrive1[i], frag20[i], prog20[i], overdrive20[i], c.execute(sql, (i, char[i], frag1[i], prog1[i], overdrive1[i], frag20[i], prog20[i], overdrive20[i],
frag30[i], prog30[i], overdrive30[i], skill_id[i], skill_unlock_level[i], skill_requires_uncap, skill_id_uncap[i], char_type[i])) frag30[i], prog30[i], overdrive30[i], skill_id[i], skill_unlock_level[i], skill_requires_uncap, skill_id_uncap[i], char_type[i]))
else: else:
if i != 5 and i != 46: if i != 5:
sql = '''insert into character values(?,?,20,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0)''' sql = '''insert into character values(?,?,20,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0)'''
c.execute(sql, (i, char[i], frag1[i], prog1[i], overdrive1[i], frag20[i], prog20[i], overdrive20[i], c.execute(sql, (i, char[i], frag1[i], prog1[i], overdrive1[i], frag20[i], prog20[i], overdrive20[i],
frag30[i], prog30[i], overdrive30[i], skill_id[i], skill_unlock_level[i], skill_requires_uncap, skill_id_uncap[i], char_type[i])) frag30[i], prog30[i], overdrive30[i], skill_id[i], skill_unlock_level[i], skill_requires_uncap, skill_id_uncap[i], char_type[i]))
@@ -386,7 +387,7 @@ def main(path='./'):
c.execute('''insert into item values(?,"core",1,'')''', (i,)) c.execute('''insert into item values(?,"core",1,'')''', (i,))
world_songs = ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster", world_songs = ["babaroque", "shadesoflight", "kanagawa", "lucifer", "anokumene", "ignotus", "rabbitintheblackroom", "qualia", "redandblue", "bookmaker", "darakunosono", "espebranch", "blacklotus", "givemeanightmare", "vividtheory", "onefr", "gekka", "vexaria3", "infinityheaven3", "fairytale3", "goodtek3", "suomi", "rugie", "faintlight", "harutopia", "goodtek", "dreaminattraction", "syro", "diode", "freefall", "grimheart", "blaster",
"cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3", "glow", "enchantedlove", "take", "lifeispiano", "vandalism", "nexttoyou3", "lostcivilization3", "turbocharger", "bookmaker3", "laqryma3", "kyogenkigo", "hivemind", "seclusion", "quonwacca3", "bluecomet", "energysynergymatrix", "gengaozo", "lastendconductor3", "antithese3", "qualia3", "kanagawa3", "heavensdoor3", "pragmatism3", "nulctrl", "avril"] "cyberneciacatharsis", "monochromeprincess", "revixy", "vector", "supernova", "nhelv", "purgatorium3", "dement3", "crossover", "guardina", "axiumcrisis", "worldvanquisher", "sheriruth", "pragmatism", "gloryroad", "etherstrike", "corpssansorganes", "lostdesire", "blrink", "essenceoftwilight", "lapis", "solitarydream", "lumia3", "purpleverse", "moonheart3", "glow", "enchantedlove", "take", "lifeispiano", "vandalism", "nexttoyou3", "lostcivilization3", "turbocharger", "bookmaker3", "laqryma3", "kyogenkigo", "hivemind", "seclusion", "quonwacca3", "bluecomet", "energysynergymatrix", "gengaozo", "lastendconductor3", "antithese3", "qualia3", "kanagawa3", "heavensdoor3", "pragmatism3", "nulctrl", "avril", "ddd", "merlin3", "omakeno3"]
for i in world_songs: for i in world_songs:
c.execute('''insert into item values(?,"world_song",1,'')''', (i,)) c.execute('''insert into item values(?,"world_song",1,'')''', (i,))
@@ -399,6 +400,8 @@ def main(path='./'):
('fragment', 'fragment', 1, '')) ('fragment', 'fragment', 1, ''))
c.execute('''insert into item values(?,?,?,?)''', c.execute('''insert into item values(?,?,?,?)''',
('memory', 'memory', 1, '')) ('memory', 'memory', 1, ''))
c.execute('''insert into item values(?,?,?,?)''',
('anni5tix', 'anni5tix', 1, ''))
def insert_items(c, items): def insert_items(c, items):
# 物品数据导入 # 物品数据导入
@@ -411,8 +414,12 @@ def main(path='./'):
discount_to = -1 discount_to = -1
else: else:
discount_to = i['discount_to'] discount_to = i['discount_to']
c.execute('''insert into purchase values(?,?,?,?,?)''', if 'discount_reason' not in i:
(i['name'], i['price'], i['orig_price'], discount_from, discount_to)) discount_reason = ''
else:
discount_reason = i['discount_reason']
c.execute('''insert into purchase values(?,?,?,?,?,?)''',
(i['name'], i['price'], i['orig_price'], discount_from, discount_to, discount_reason))
for j in i['items']: for j in i['items']:
if "_id" not in j: if "_id" not in j:
_id = '' _id = ''

View File

@@ -1126,5 +1126,41 @@
], ],
"orig_price": 100, "orig_price": 100,
"price": 100 "price": 100
},
{
"name": "headbonkache",
"items": [
{
"type": "single",
"id": "headbonkache",
"is_available": true
},
{
"type": "core",
"amount": 1,
"id": "core_generic",
"is_available": true
}
],
"orig_price": 100,
"price": 100
},
{
"name": "aurgelmir",
"items": [
{
"type": "single",
"id": "aurgelmir",
"is_available": true
},
{
"type": "core",
"amount": 1,
"id": "core_generic",
"is_available": true
}
],
"orig_price": 100,
"price": 100
} }
] ]

View File

@@ -632,10 +632,11 @@ def pack(user_id):
# 单曲购买信息获取 # 单曲购买信息获取
@app.route(add_url_prefix('/purchase/bundle/single'), methods=['GET']) @app.route(add_url_prefix('/purchase/bundle/single'), methods=['GET'])
def single(): @server.auth.auth_required(request)
def single(user_id):
return jsonify({ return jsonify({
"success": True, "success": True,
"value": server.arcpurchase.get_single_purchase() "value": server.arcpurchase.get_single_purchase(user_id)
}) })

View File

@@ -2,7 +2,6 @@ from server.sql import Connect
import server.item import server.item
import server.character import server.character
import time import time
import json
def int2b(x): def int2b(x):
@@ -13,7 +12,7 @@ def int2b(x):
return True return True
def get_purchase(c, type='pack'): def get_purchase(c, user_id, type='pack'):
# 读取packs内容返回字典列表 # 读取packs内容返回字典列表
c.execute( c.execute(
'''select * from purchase where purchase_name in (select purchase_name from purchase_item where type = :a)''', {'a': type}) '''select * from purchase where purchase_name in (select purchase_name from purchase_item where type = :a)''', {'a': type})
@@ -50,7 +49,6 @@ def get_purchase(c, type='pack'):
"amount": amount "amount": amount
}) })
if t is not None: if t is not None:
# 放到列表头 # 放到列表头
items = [t, items] items = [t, items]
@@ -65,16 +63,24 @@ def get_purchase(c, type='pack'):
if i[4] > 0: if i[4] > 0:
r['discount_to'] = i[4] r['discount_to'] = i[4]
if i[5] == 'anni5tix' and i[3] <= int(time.time() * 1000) <= i[4]:
c.execute(
'''select amount from user_item where user_id=? and item_id="anni5tix"''', (user_id,))
z = c.fetchone()
if z and z[0] >= 1:
r['discount_reason'] = 'anni5tix'
r['price'] = 0
re.append(r) re.append(r)
return re return re
def get_single_purchase(): def get_single_purchase(user_id):
# main里面没开数据库这里写一下代替 # main里面没开数据库这里写一下代替
re = [] re = []
with Connect() as c: with Connect() as c:
re = get_purchase(c, type='single') re = get_purchase(c, user_id, 'single')
return re return re
@@ -98,6 +104,25 @@ def buy_item(c, user_id, price):
return True, ticket - price return True, ticket - price
def buy_item_with_anni5tix(c, user_id):
# 兑换券购买接口,返回成功与否标志
c.execute('''select amount from user_item where user_id = :a and item_id = "anni5tix"''',
{'a': user_id})
amount = c.fetchone()
if amount:
amount = amount[0]
else:
return False
if amount <= 0:
return False
c.execute('''update user_item set amount = :b where user_id = :a and item_id = "anni5tix"''',
{'a': user_id, 'b': amount-1})
return True
def buy_thing(user_id, purchase_id): def buy_thing(user_id, purchase_id):
# 购买物品接口,返回字典 # 购买物品接口,返回字典
success_flag = False success_flag = False
@@ -107,7 +132,7 @@ def buy_thing(user_id, purchase_id):
characters = [] characters = []
with Connect() as c: with Connect() as c:
c.execute('''select price, orig_price, discount_from, discount_to from purchase where purchase_name=:a''', c.execute('''select price, orig_price, discount_from, discount_to, discount_reason from purchase where purchase_name=:a''',
{'a': purchase_id}) {'a': purchase_id})
x = c.fetchone() x = c.fetchone()
price = 0 price = 0
@@ -117,6 +142,7 @@ def buy_thing(user_id, purchase_id):
orig_price = x[1] orig_price = x[1]
discount_from = x[2] discount_from = x[2]
discount_to = x[3] discount_to = x[3]
discount_reason = x[4]
else: else:
return { return {
"success": False, "success": False,
@@ -130,6 +156,8 @@ def buy_thing(user_id, purchase_id):
now = int(time.time() * 1000) now = int(time.time() * 1000)
if not(discount_from <= now <= discount_to): if not(discount_from <= now <= discount_to):
price = orig_price price = orig_price
elif discount_reason == 'anni5tix' and buy_item_with_anni5tix(c, user_id):
price = 0
flag, ticket = buy_item(c, user_id, price) flag, ticket = buy_item(c, user_id, price)

View File

@@ -155,7 +155,7 @@ def get_one_character(c, user_id, character_id):
"name": x[7], "name": x[7],
"character_id": x[1] "character_id": x[1]
} }
if x[1] == 21: if x[1] == 21 or x[1] == 46:
r["voice"] = [0, 1, 2, 3, 100, 1000, 1001] r["voice"] = [0, 1, 2, 3, 100, 1000, 1001]
return r return r

View File

@@ -590,7 +590,7 @@ class Constant:
"complete": 1 "complete": 1
}, { }, {
"unlock_key": "saikyostronger|2|3|laqryma|2", "unlock_key": "saikyostronger|2|3|laqryma|2",
"complete": 1 "complete": 3
}, { }, {
"unlock_key": "purgatorium|1|0", "unlock_key": "purgatorium|1|0",
"complete": 1 "complete": 1

View File

@@ -208,7 +208,7 @@ def get_user_me_c(user_id):
def get_purchase_pack(user_id): def get_purchase_pack(user_id):
# 返回曲包数据 # 返回曲包数据
with Connect() as c: with Connect() as c:
return server.arcpurchase.get_purchase(c, 'pack') return server.arcpurchase.get_purchase(c, user_id)
def get_game_info(): def get_game_info():
@@ -261,7 +261,7 @@ def arc_aggregate_big(user_id):
"value": get_user_me(c, user_id) "value": get_user_me(c, user_id)
}, { }, {
"id": 1, "id": 1,
"value": server.arcpurchase.get_purchase(c, 'pack') "value": server.arcpurchase.get_purchase(c, user_id)
}, { }, {
"id": 2, "id": 2,
"value": id_2 "value": id_2

View File

@@ -55,20 +55,20 @@ def claim_user_item(c, user_id, item_id, item_type, amount=1):
else: else:
return False return False
if item_type == 'core': if item_type in ['core', 'anni5tix']:
c.execute( c.execute(
'''select amount from user_item where user_id=? and item_id=? and type="core"''', (user_id, item_id)) '''select amount from user_item where user_id=? and item_id=? and type=?''', (user_id, item_id, item_type))
x = c.fetchone() x = c.fetchone()
if x: if x:
if x[0] + amount < 0: # 数量不足 if x[0] + amount < 0: # 数量不足
return False return False
c.execute('''update user_item set amount=? where user_id=? and item_id=? and type="core"''', c.execute('''update user_item set amount=? where user_id=? and item_id=? and type=?''',
(x[0]+amount, user_id, item_id)) (x[0]+amount, user_id, item_id, item_type))
else: else:
if amount < 0: # 添加数量错误 if amount < 0: # 添加数量错误
return False return False
c.execute('''insert into user_item values(?,?,"core",?)''', c.execute('''insert into user_item values(?,?,?,?)''',
(user_id, item_id, amount)) (user_id, item_id, item_type, amount))
elif item_type == 'memory': elif item_type == 'memory':
c.execute('''select ticket from user where user_id=?''', (user_id,)) c.execute('''select ticket from user where user_id=?''', (user_id,))

View File

@@ -19,7 +19,7 @@ class Config():
游戏API地址前缀 游戏API地址前缀
Game API's URL prefix Game API's URL prefix
''' '''
GAME_API_PREFIX = '/bridge/18' GAME_API_PREFIX = '/years/19'
''' '''
-------------------- --------------------
''' '''
@@ -30,7 +30,7 @@ class Config():
Allowed game versions Allowed game versions
If it is blank, all are allowed. If it is blank, all are allowed.
''' '''
ALLOW_APPVERSION = ['3.5.3', '3.5.3c', '3.12.0', '3.12.0c'] ALLOW_APPVERSION = ['3.5.3', '3.5.3c', '3.12.6', '3.12.6c']
''' '''
-------------------- --------------------
''' '''

View File

@@ -27,6 +27,10 @@
<span>Discount to: </span> <span>Discount to: </span>
<span class="char-num">{{item['discount_to']}}</span> <span class="char-num">{{item['discount_to']}}</span>
<br /> <br />
<span>Whether it is allowed to purchase with exchange certificate: </span>
<span class="char-num">{{item['discount_reason']}}</span>
<br />
{% if item['items'] %}<br /> {% if item['items'] %}<br />
{% for x in item['items'] %} {% for x in item['items'] %}
<span>Item id: </span> <span>Item id: </span>

View File

@@ -27,6 +27,7 @@
<option value='core'>Character core</option> <option value='core'>Character core</option>
<option value='fragment'>Fragment</option> <option value='fragment'>Fragment</option>
<option value='memory'>Memory</option> <option value='memory'>Memory</option>
<option value='anni5tix'>Anniversary 5 ticket</option>
</select> </select>
</div> </div>
<label for="amount">Amount</label> <label for="amount">Amount</label>

View File

@@ -16,6 +16,10 @@
<input type="datetime-local" name="discount_from" id="discount_from"> <input type="datetime-local" name="discount_from" id="discount_from">
<label for="discount_to">Discount to</label> <label for="discount_to">Discount to</label>
<input type="datetime-local" name="discount_to" id="discount_to"> <input type="datetime-local" name="discount_to" id="discount_to">
<div>是否允许使用兑换券购买 Whether it is allowed to purchase with Anniversary 5 ticket:
<label><input type="radio" name="discount_reason" value="0">No</label>
<label><input type="radio" name="discount_reason" value="anni5tix">Yes</label>
</div>
<div class="content">时间填写是一个HTML5控件</div> <div class="content">时间填写是一个HTML5控件</div>
<div class="content">Time filling is an HTML5 control.</div> <div class="content">Time filling is an HTML5 control.</div>
<br /> <br />

View File

@@ -38,6 +38,7 @@
<option value='core'>Character core</option> <option value='core'>Character core</option>
<option value='fragment'>Fragment</option> <option value='fragment'>Fragment</option>
<option value='memory'>Memory</option> <option value='memory'>Memory</option>
<option value='anni5tix'>Anniversary 5 ticket</option>
</select> </select>
</div> </div>
<label for="amount">Amount</label> <label for="amount">Amount</label>

View File

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

View File

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