Skip to content

Commit

Permalink
Update to v1.8.1
Browse files Browse the repository at this point in the history
close #6
close #8
  • Loading branch information
Lost-MSth committed Dec 9, 2020
1 parent 5c02ecd commit 80122d7
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 79 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is a small local Arcaea server based on Python and Flask, which can simulat
- 角色数值 Character characteristic value
- 数据同步的时间记录 The record of time for data synchronization
- 服务器安全性保证 Server security assurance
- 登录奖励 Login present

可能有问题 There may be problems:
- Recent 30
Expand All @@ -54,15 +55,19 @@ 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.
### Version 1.8
- 适用于Arcaea 3.3.0版本 For Arcaea 3.3.0
### Version 1.8.1
- 适用于Arcaea 3.3.1版本 For Arcaea 3.3.1
- 更新了歌曲数据库 Update the song database.
- 新角色**Alice & Tenniel**已解锁 Unlock new character **Alice & Tenniel**.
- 数据同步机制修改 Modify data synchronization mechanism.
- Recent30增添简易的PTT保护机制 Add simple PTT protection mechanism to Recent30.
- 尝试解锁了一些东西 Try to unlock something.
- 修复了一些Bug Fix some bugs.

> 提醒:只是一次小更新,本次更新前后登录信息无法同步,需重新登录(我忘记给login表加主键了同步不了哈哈哈)
> 已发现的问题:设置Favorite角色可能并不有效
> 预告:登录奖励系统
>
> Tips: It is only a small update. The login information before and after this update can't be synchronized, so you need to log in again. (I forgot to add a primary key to the login table, so it can't be synchronized. lol)
> Problem found: Setting the favorite character may be useless.
> Preview: Login present system
## 运行环境与依赖 Running environment and requirements
- Windows操作系统 Windows operating system
- Python 3
Expand Down
Binary file modified latest version/database/arcaea_database.db
Binary file not shown.
Binary file modified latest version/database/arcsong.db
Binary file not shown.
10 changes: 10 additions & 0 deletions latest version/database/database_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@
devicemodelname_data text,
story_data text
);''')
c.execute('''create table if not exists present(present_id text primary key,
expire_ts int,
items text,
description text
);''')
c.execute('''create table if not exists user_present(user_id int,
present_id text,
primary key(user_id, present_id)
);''')


char = ['Hikari', 'Tairitsu', 'Kou', 'Sapphire', 'Lethe', '', 'Tairitsu(Axium)', 'Tairitsu(Grievous Lady)', 'Stella', 'Hikari & Fisica', 'Ilith', 'Eto', 'Luna', 'Shirabe', 'Hikari(Zero)', 'Hikari(Fracture)', 'Hikari(Summer)', 'Tairitsu(Summer)', 'Tairitsu & Trin',
'Ayu', 'Eto & Luna', 'Yume', 'Seine & Hikari', 'Saya', 'Tairitsu & Chuni Penguin', 'Chuni Penguin', 'Haruna', 'Nono', 'MTA-XXX', 'MDA-21', 'Kanae', 'Hikari(Fantasia)', 'Tairitsu(Sonata)', 'Sia', 'DORO*C', 'Tairitsu(Tempest)', 'Brillante', 'Ilith(Summer)', 'Etude', 'Alice & Tenniel']
Expand Down
50 changes: 30 additions & 20 deletions latest version/database/packs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"items": [{
"type": "pack",
"id": "core",
"_id": "5fc8306209787401bb857d1b",
"_id": "5fd01460a6e343038b057d28",
"is_available": true
}],
"price": 500,
Expand All @@ -15,12 +15,12 @@
"items": [{
"type": "pack",
"id": "shiawase",
"_id": "5fc8306209787401bb857d3b",
"_id": "5fd01461a6e343038b057d65",
"is_available": true
}, {
"type": "character",
"id": "kou",
"_id": "5fc8306209787401bb857d3a",
"_id": "5fd01461a6e343038b057d64",
"is_available": true
}],
"price": 500,
Expand All @@ -32,12 +32,12 @@
"items": [{
"type": "pack",
"id": "dynamix",
"_id": "5fc8306209787401bb857d33",
"_id": "5fd01461a6e343038b057d6f",
"is_available": true
}, {
"type": "character",
"id": "sapphire",
"_id": "5fc8306209787401bb857d32",
"_id": "5fd01461a6e343038b057d6e",
"is_available": true
}],
"price": 500,
Expand All @@ -49,12 +49,12 @@
"items": [{
"type": "pack",
"id": "mirai",
"_id": "5fc8306209787401bb857d37",
"_id": "5fd01461a6e343038b057d69",
"is_available": true
}, {
"type": "character",
"id": "lethe",
"_id": "5fc8306209787401bb857d36",
"_id": "5fd01461a6e343038b057d68",
"is_available": true
}],
"price": 500,
Expand All @@ -66,7 +66,7 @@
"items": [{
"type": "pack",
"id": "yugamu",
"_id": "5fc8306209787401bb857d1c",
"_id": "5fd01460a6e343038b057d29",
"is_available": true
}],
"price": 500,
Expand All @@ -78,7 +78,7 @@
"items": [{
"type": "pack",
"id": "lanota",
"_id": "5fc8306209787401bb857d26",
"_id": "5fd01460a6e343038b057d40",
"is_available": true
}],
"price": 500,
Expand All @@ -90,7 +90,7 @@
"items": [{
"type": "pack",
"id": "nijuusei",
"_id": "5fc8306209787401bb857d1d",
"_id": "5fd01460a6e343038b057d2a",
"is_available": true
}],
"price": 500,
Expand All @@ -102,7 +102,7 @@
"items": [{
"type": "pack",
"id": "rei",
"_id": "5fc8306209787401bb857cfa",
"_id": "5fd01460a6e343038b057d4d",
"is_available": true
}],
"price": 500,
Expand All @@ -114,7 +114,7 @@
"items": [{
"type": "pack",
"id": "tonesphere",
"_id": "5fc8306209787401bb857d28",
"_id": "5fd01460a6e343038b057d42",
"is_available": true
}],
"price": 500,
Expand All @@ -126,7 +126,7 @@
"items": [{
"type": "pack",
"id": "groovecoaster",
"_id": "5fc8306209787401bb857d14",
"_id": "5fd01460a6e343038b057d5b",
"is_available": true
}],
"price": 500,
Expand All @@ -138,7 +138,7 @@
"items": [{
"type": "pack",
"id": "zettai",
"_id": "5fc8306209787401bb857cfc",
"_id": "5fd01460a6e343038b057d4f",
"is_available": true
}],
"price": 500,
Expand All @@ -150,7 +150,7 @@
"items": [{
"type": "pack",
"id": "chunithm",
"_id": "5fc8306209787401bb857d09",
"_id": "5fd01460a6e343038b057d39",
"is_available": true
}],
"price": 300,
Expand All @@ -160,7 +160,7 @@
"items": [{
"type": "pack",
"id": "prelude",
"_id": "5fc8306209787401bb857d15",
"_id": "5fd01460a6e343038b057d5c",
"is_available": true
}],
"price": 400,
Expand All @@ -170,7 +170,7 @@
"items": [{
"type": "pack",
"id": "omatsuri",
"_id": "5fc8306209787401bb857cfd",
"_id": "5fd01460a6e343038b057d50",
"is_available": true
}],
"price": 500,
Expand All @@ -180,7 +180,7 @@
"items": [{
"type": "pack",
"id": "vs",
"_id": "5fc8306209787401bb857d0c",
"_id": "5fd01460a6e343038b057d3c",
"is_available": true
}],
"price": 500,
Expand All @@ -190,7 +190,7 @@
"items": [{
"type": "pack",
"id": "extend",
"_id": "5fc8306209787401bb857d18",
"_id": "5fd01460a6e343038b057d5f",
"is_available": true
}],
"price": 700,
Expand All @@ -200,9 +200,19 @@
"items": [{
"type": "pack",
"id": "alice",
"_id": "5fc8306209787401bb857d02",
"_id": "5fd01460a6e343038b057d55",
"is_available": true
}],
"orig_price": 500,
"price": 500
}, {
"name": "alice_append_1",
"items": [{
"type": "pack",
"id": "alice_append_1",
"_id": "5fd01460a6e343038b057d33",
"is_available": true
}],
"orig_price": 300,
"price": 300
}]
20 changes: 17 additions & 3 deletions latest version/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,23 @@ def redeem():
# 礼物确认
@app.route('/coffee/12/present/me/claim/<present_id>', methods=['POST'])
def claim_present(present_id):
return jsonify({
"success": True
})
headers = request.headers
token = headers['Authorization']
token = token[7:]
try:
user_id = server.auth.token_get_id(token)
if user_id is not None:
flag = server.arcpurchase.claim_user_present(user_id, present_id)
if flag:
return jsonify({
"success": True
})
else:
return error_return(108)
else:
return error_return(108)
except:
return error_return(108)


# 购买,为了world模式boost一下
Expand Down
35 changes: 35 additions & 0 deletions latest version/server/arcpurchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,38 @@ def buy_single(user_id, single_id):
return {
"success": True
}


def get_user_present(c, user_id):
# 获取用户奖励,返回字典列表
c.execute(
'''select * from present where present_id in (select present_id from user_present where user_id=:a)''', {'a': user_id})
x = c.fetchall()
re = []
if x:
for i in x:
re.append({'expire_ts': i[1],
'description': i[3],
'present_id': i[0],
'items': i[2]
})

return re


def claim_user_present(user_id, present_id):
# 确认并删除用户奖励,返回成功与否的布尔值
flag = False
conn = sqlite3.connect('./database/arcaea_database.db')
c = conn.cursor()

c.execute('''select exists(select * from user_present where user_id=:a and present_id=:b)''',
{'a': user_id, 'b': present_id})
if c.fetchone() == (1,):
flag = True
c.execute('''delete from user_present where user_id=:a and present_id=:b''',
{'a': user_id, 'b': present_id})

conn.commit()
conn.close()
return flag
Loading

0 comments on commit 80122d7

Please sign in to comment.