Update to v2.3

This commit is contained in:
Lost-MSth
2021-03-09 13:46:49 +08:00
parent df181f104e
commit 4f66f492fc
18 changed files with 450 additions and 343 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.log

View File

@@ -36,6 +36,7 @@ This procedure is mainly used for study and research, and shall not be used for
- 后台自定义信息 Customize some things in the background - 后台自定义信息 Customize some things in the background
- 成绩校验 Score check - 成绩校验 Score check
- 下载校验 Download check - 下载校验 Download check
- 服务器日志 Server log
没有以下 We don't have 没有以下 We don't have
- 角色数值 Character characteristic value - 角色数值 Character characteristic value
@@ -63,24 +64,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. > Tips: When updating, please keep the original database in case of data loss.
### Version 2.2 ### Version 2.3
- 适用于Arcaea 3.5.1版本 For Arcaea 3.5.1 - 适用于Arcaea 3.5.2版本 For Arcaea 3.5.2
- 更新了歌曲数据库 Update the song database. - 更新了歌曲数据库 Update the song database.
- 新增多设备登录 Add multi device login. - 新增服务器日志 Add server log.
- 修改了配置文件结构 The configuration file structure has been modified.
- 优化了代码结构 Optimize the code structure. - 优化了代码结构 Optimize the code structure.
- 修复了一Bug Fix many bugs. - 修复了一Bug,提升服务器安全性 Fix some bugs and improve server security.
> 提醒:本次更新需重新登录
>
> Tip: You need to log in Arcaea again in this update.
## 运行环境与依赖 Running environment and requirements ## 运行环境与依赖 Running environment and requirements
- Windows操作系统 Windows operating system - Windows/Linux/Mac OS/Android
- Python 3 - Python 3
- Flask模块 Flask module - Flask module
- Charles - Charles (optional)
## 环境搭建 Environment construction ## 环境搭建 Environment construction
[中文](https://github.com/Lost-MSth/Arcaea-server/wiki/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA) [中文](https://github.com/Lost-MSth/Arcaea-server/wiki/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA)

Binary file not shown.

View File

@@ -236,15 +236,15 @@ primary key(user_id, code)
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', 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', 'Luna & Mia', 'Areus', 'Seele', 'Isabelle'] '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', 'Luna & Mia', 'Areus', 'Seele', 'Isabelle', 'Mir']
skill_id = ['gauge_easy', '', '', '', 'note_mirror', '', '', 'gauge_hard', 'frag_plus_10_pack_stellights', 'gauge_easy|frag_plus_15_pst&prs', 'gauge_hard|fail_frag_minus_100', 'frag_plus_5_side_light', 'visual_hide_hp', 'frag_plus_5_side_conflict', 'challenge_fullcombo_0gauge', 'gauge_overflow', 'gauge_easy|note_mirror', 'note_mirror', 'visual_tomato_pack_tonesphere', skill_id = ['gauge_easy', '', '', '', 'note_mirror', '', '', 'gauge_hard', 'frag_plus_10_pack_stellights', 'gauge_easy|frag_plus_15_pst&prs', 'gauge_hard|fail_frag_minus_100', 'frag_plus_5_side_light', 'visual_hide_hp', 'frag_plus_5_side_conflict', 'challenge_fullcombo_0gauge', 'gauge_overflow', 'gauge_easy|note_mirror', 'note_mirror', 'visual_tomato_pack_tonesphere',
'frag_rng_ayu', 'gaugestart_30|gaugegain_70', 'combo_100-frag_1', 'audio_gcemptyhit_pack_groovecoaster', 'gauge_saya', 'gauge_chuni', 'kantandeshou', 'gauge_haruna', 'frags_nono', 'gauge_pandora', 'gauge_regulus', 'omatsuri_daynight', '', '', 'sometimes(note_mirror|frag_plus_5)', 'scoreclear_aa|visual_scoregauge', 'gauge_tempest', 'gauge_hard', 'gauge_ilith_summer', '', 'note_mirror|visual_hide_far', 'frags_ongeki', 'gauge_areus', 'gauge_seele', 'gauge_isabelle'] 'frag_rng_ayu', 'gaugestart_30|gaugegain_70', 'combo_100-frag_1', 'audio_gcemptyhit_pack_groovecoaster', 'gauge_saya', 'gauge_chuni', 'kantandeshou', 'gauge_haruna', 'frags_nono', 'gauge_pandora', 'gauge_regulus', 'omatsuri_daynight', '', '', 'sometimes(note_mirror|frag_plus_5)', 'scoreclear_aa|visual_scoregauge', 'gauge_tempest', 'gauge_hard', 'gauge_ilith_summer', '', 'note_mirror|visual_hide_far', 'frags_ongeki', 'gauge_areus', 'gauge_seele', 'gauge_isabelle', 'gauge_exhaustion']
skill_id_uncap = ['', '', 'frags_kou', '', 'visual_ink', '', '', '', '', '', '', '', '', 'shirabe_entry_fee', skill_id_uncap = ['', '', 'frags_kou', '', 'visual_ink', '', '', '', '', '', '', '', '', 'shirabe_entry_fee',
'', '', '', '', '', '', '', 'frags_yume', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] '', '', '', '', '', '', '', 'frags_yume', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
for i in range(0, 44): for i in range(0, 45):
if i in [0, 1, 2, 4, 13, 26, 27, 28, 29, 36, 21, 42, 43]: if i in [0, 1, 2, 4, 13, 26, 27, 28, 29, 36, 21, 42, 43]:
sql = 'insert into character values('+str( sql = 'insert into character values('+str(
i)+',"'+char[i]+'''",30,25000,25000,90,90,90,"'''+skill_id[i]+'''",0,0,"'''+skill_id_uncap[i]+'''",0,'',1,1)''' i)+',"'+char[i]+'''",30,25000,25000,90,90,90,"'''+skill_id[i]+'''",0,0,"'''+skill_id_uncap[i]+'''",0,'',1,1)'''

View File

@@ -3,154 +3,154 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "core", "id": "core",
"_id": "6008c2ff36651a07ebc52ca9", "_id": "6046bab736651a07ebc537db",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 400,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "shiawase", "name": "shiawase",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "shiawase", "id": "shiawase",
"_id": "6008c2ff36651a07ebc52ce0", "_id": "6046bab736651a07ebc53823",
"is_available": true "is_available": true
}, { }, {
"type": "character", "type": "character",
"id": "kou", "id": "kou",
"_id": "6008c2ff36651a07ebc52cdf", "_id": "6046bab736651a07ebc53822",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1552089600000, "discount_from": 1615248000000,
"discount_to": 1552694399000 "discount_to": 1615852799000
}, { }, {
"name": "dynamix", "name": "dynamix",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "dynamix", "id": "dynamix",
"_id": "6008c2ff36651a07ebc52ce4", "_id": "6046bab736651a07ebc53827",
"is_available": true "is_available": true
}, { }, {
"type": "character", "type": "character",
"id": "sapphire", "id": "sapphire",
"_id": "6008c2ff36651a07ebc52ce3", "_id": "6046bab736651a07ebc53826",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "mirai", "name": "mirai",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "mirai", "id": "mirai",
"_id": "6008c2ff36651a07ebc52cdc", "_id": "6046bab736651a07ebc5381d",
"is_available": true "is_available": true
}, { }, {
"type": "character", "type": "character",
"id": "lethe", "id": "lethe",
"_id": "6008c2ff36651a07ebc52cdb", "_id": "6046bab736651a07ebc5381c",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1552089600000, "discount_from": 1615248000000,
"discount_to": 1552694399000 "discount_to": 1615852799000
}, { }, {
"name": "yugamu", "name": "yugamu",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "yugamu", "id": "yugamu",
"_id": "6008c2ff36651a07ebc52caa", "_id": "6046bab736651a07ebc537dc",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 400,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "lanota", "name": "lanota",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "lanota", "id": "lanota",
"_id": "6008c2ff36651a07ebc52cd0", "_id": "6046bab736651a07ebc537e8",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "nijuusei", "name": "nijuusei",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "nijuusei", "id": "nijuusei",
"_id": "6008c2ff36651a07ebc52cab", "_id": "6046bab736651a07ebc537dd",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "rei", "name": "rei",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "rei", "id": "rei",
"_id": "6008c2ff36651a07ebc52cc5", "_id": "6046bab736651a07ebc537f6",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 400,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "tonesphere", "name": "tonesphere",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "tonesphere", "id": "tonesphere",
"_id": "6008c2ff36651a07ebc52cd2", "_id": "6046bab736651a07ebc537ea",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "groovecoaster", "name": "groovecoaster",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "groovecoaster", "id": "groovecoaster",
"_id": "6008c2ff36651a07ebc52ca1", "_id": "6046bab736651a07ebc53812",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "zettai", "name": "zettai",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "zettai", "id": "zettai",
"_id": "6008c2ff36651a07ebc52cc7", "_id": "6046bab736651a07ebc537f8",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500, "orig_price": 500,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "chunithm", "name": "chunithm",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "chunithm", "id": "chunithm",
"_id": "6008c2ff36651a07ebc52cbb", "_id": "6046bab736651a07ebc53806",
"is_available": true "is_available": true
}], }],
"price": 300, "price": 300,
@@ -160,47 +160,55 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "prelude", "id": "prelude",
"_id": "6008c2ff36651a07ebc52ca2", "_id": "6046bab736651a07ebc53813",
"is_available": true "is_available": true
}], }],
"price": 400, "price": 250,
"orig_price": 400 "orig_price": 400,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "omatsuri", "name": "omatsuri",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "omatsuri", "id": "omatsuri",
"_id": "6008c2ff36651a07ebc52cc8", "_id": "6046bab736651a07ebc537f9",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 250,
"orig_price": 500 "orig_price": 500,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "vs", "name": "vs",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "vs", "id": "vs",
"_id": "6008c2ff36651a07ebc52cbe", "_id": "6046bab736651a07ebc53809",
"is_available": true "is_available": true
}], }],
"price": 500, "price": 400,
"orig_price": 500 "orig_price": 500,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "extend", "name": "extend",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "extend", "id": "extend",
"_id": "6008c2ff36651a07ebc52ca5", "_id": "6046bab736651a07ebc53816",
"is_available": true "is_available": true
}], }],
"price": 700, "price": 500,
"orig_price": 700 "orig_price": 700,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "alice", "name": "alice",
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "alice", "id": "alice",
"_id": "6008c2ff36651a07ebc52ccd", "_id": "6046bab736651a07ebc537fe",
"is_available": true "is_available": true
}], }],
"orig_price": 500, "orig_price": 500,
@@ -210,7 +218,7 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "alice_append_1", "id": "alice_append_1",
"_id": "6008c2ff36651a07ebc52cb4", "_id": "6046bab736651a07ebc537e6",
"is_available": true "is_available": true
}], }],
"orig_price": 300, "orig_price": 300,
@@ -220,7 +228,7 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "ongeki", "id": "ongeki",
"_id": "6008c2ff36651a07ebc52cc1", "_id": "6046bab736651a07ebc5380c",
"is_available": true "is_available": true
}], }],
"orig_price": 400, "orig_price": 400,
@@ -230,7 +238,7 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "maimai", "id": "maimai",
"_id": "6008c2ff36651a07ebc52ca8", "_id": "6046bab736651a07ebc53819",
"is_available": true "is_available": true
}], }],
"orig_price": 400, "orig_price": 400,
@@ -240,7 +248,7 @@
"items": [{ "items": [{
"type": "pack", "type": "pack",
"id": "chunithm_append_1", "id": "chunithm_append_1",
"_id": "6008c2ff36651a07ebc52cda", "_id": "6046bab736651a07ebc537f2",
"is_available": true "is_available": true
}], }],
"orig_price": 300, "orig_price": 300,

View File

@@ -12,55 +12,55 @@
"items": [{ "items": [{
"id": "dataerror", "id": "dataerror",
"type": "single", "type": "single",
"_id": "6008c2ff36651a07ebc52cb5", "_id": "6046bab736651a07ebc537f3",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "yourvoiceso", "name": "yourvoiceso",
"items": [{ "items": [{
"id": "yourvoiceso", "id": "yourvoiceso",
"type": "single", "type": "single",
"_id": "6008c2ff36651a07ebc52cc2", "_id": "6046bab736651a07ebc53800",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "crosssoul", "name": "crosssoul",
"items": [{ "items": [{
"id": "crosssoul", "id": "crosssoul",
"type": "single", "type": "single",
"_id": "6008c2ff36651a07ebc52ccf", "_id": "6046bab736651a07ebc5380d",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "impurebird", "name": "impurebird",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "impurebird", "id": "impurebird",
"_id": "6008c2ff36651a07ebc52cb6", "_id": "6046bab736651a07ebc53801",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "auxesia", "name": "auxesia",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "auxesia", "id": "auxesia",
"_id": "6008c2ff36651a07ebc52c9d", "_id": "6046bab736651a07ebc5380e",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -72,43 +72,43 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "modelista", "id": "modelista",
"_id": "6008c2ff36651a07ebc52cc3", "_id": "6046bab736651a07ebc537f4",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "yozakurafubuki", "name": "yozakurafubuki",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "yozakurafubuki", "id": "yozakurafubuki",
"_id": "6008c2ff36651a07ebc52cb7", "_id": "6046bab736651a07ebc53802",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "surrender", "name": "surrender",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "surrender", "id": "surrender",
"_id": "6008c2ff36651a07ebc52c9e", "_id": "6046bab736651a07ebc5380f",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "metallicpunisher", "name": "metallicpunisher",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "metallicpunisher", "id": "metallicpunisher",
"_id": "6008c2ff36651a07ebc52cc4", "_id": "6046bab736651a07ebc537f5",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -118,7 +118,7 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "carminescythe", "id": "carminescythe",
"_id": "6008c2ff36651a07ebc52cb8", "_id": "6046bab736651a07ebc53803",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -128,79 +128,79 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "bethere", "id": "bethere",
"_id": "6008c2ff36651a07ebc52c9f", "_id": "6046bab736651a07ebc53810",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "callmyname", "name": "callmyname",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "callmyname", "id": "callmyname",
"_id": "6008c2ff36651a07ebc52cd1", "_id": "6046bab736651a07ebc537e9",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "fallensquare", "name": "fallensquare",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "fallensquare", "id": "fallensquare",
"_id": "6008c2ff36651a07ebc52cac", "_id": "6046bab736651a07ebc537de",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "dropdead", "name": "dropdead",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "dropdead", "id": "dropdead",
"_id": "6008c2ff36651a07ebc52cb9", "_id": "6046bab736651a07ebc53804",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "alexandrite", "name": "alexandrite",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "alexandrite", "id": "alexandrite",
"_id": "6008c2ff36651a07ebc52ca0", "_id": "6046bab736651a07ebc53811",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "astraltale", "name": "astraltale",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "astraltale", "id": "astraltale",
"_id": "6008c2ff36651a07ebc52cc6", "_id": "6046bab736651a07ebc537f7",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "phantasia", "name": "phantasia",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "phantasia", "id": "phantasia",
"_id": "6008c2ff36651a07ebc52cad", "_id": "6046bab736651a07ebc537df",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -210,7 +210,7 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "empireofwinter", "id": "empireofwinter",
"_id": "6008c2ff36651a07ebc52cba", "_id": "6046bab736651a07ebc53805",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -220,75 +220,79 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "libertas", "id": "libertas",
"_id": "6008c2ff36651a07ebc52cd3", "_id": "6046bab736651a07ebc537eb",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "dottodot", "name": "dottodot",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "dottodot", "id": "dottodot",
"_id": "6008c2ff36651a07ebc52cae", "_id": "6046bab736651a07ebc537e0",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "dreadnought", "name": "dreadnought",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "dreadnought", "id": "dreadnought",
"_id": "6008c2ff36651a07ebc52cd4", "_id": "6046bab736651a07ebc537ec",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "mirzam", "name": "mirzam",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "mirzam", "id": "mirzam",
"_id": "6008c2ff36651a07ebc52caf", "_id": "6046bab736651a07ebc537e1",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100, "orig_price": 100,
"discount_from": 1583712000000, "discount_from": 1615248000000,
"discount_to": 1584316799000 "discount_to": 1615852799000
}, { }, {
"name": "heavenlycaress", "name": "heavenlycaress",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "heavenlycaress", "id": "heavenlycaress",
"_id": "6008c2ff36651a07ebc52cbc", "_id": "6046bab736651a07ebc53807",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "filament", "name": "filament",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "filament", "id": "filament",
"_id": "6008c2ff36651a07ebc52ca3", "_id": "6046bab736651a07ebc53814",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "avantraze", "name": "avantraze",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "avantraze", "id": "avantraze",
"_id": "6008c2ff36651a07ebc52cd5", "_id": "6046bab736651a07ebc537ed",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -298,17 +302,19 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "battlenoone", "id": "battlenoone",
"_id": "6008c2ff36651a07ebc52cc9", "_id": "6046bab736651a07ebc537fa",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "saikyostronger", "name": "saikyostronger",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "saikyostronger", "id": "saikyostronger",
"_id": "6008c2ff36651a07ebc52cb0", "_id": "6046bab736651a07ebc537e2",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -318,67 +324,79 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "izana", "id": "izana",
"_id": "6008c2ff36651a07ebc52cbd", "_id": "6046bab736651a07ebc53808",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "einherjar", "name": "einherjar",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "einherjar", "id": "einherjar",
"_id": "6008c2ff36651a07ebc52ca4", "_id": "6046bab736651a07ebc53815",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "laqryma", "name": "laqryma",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "laqryma", "id": "laqryma",
"_id": "6008c2ff36651a07ebc52cd6", "_id": "6046bab736651a07ebc537ee",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "amygdata", "name": "amygdata",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "amygdata", "id": "amygdata",
"_id": "6008c2ff36651a07ebc52cca", "_id": "6046bab736651a07ebc537fb",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "altale", "name": "altale",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "altale", "id": "altale",
"_id": "6008c2ff36651a07ebc52cb1", "_id": "6046bab736651a07ebc537e3",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "feelssoright", "name": "feelssoright",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "feelssoright", "id": "feelssoright",
"_id": "6008c2ff36651a07ebc52cd7", "_id": "6046bab736651a07ebc537ef",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "scarletcage", "name": "scarletcage",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "scarletcage", "id": "scarletcage",
"_id": "6008c2ff36651a07ebc52ccb", "_id": "6046bab736651a07ebc537fc",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -388,7 +406,7 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "teriqma", "id": "teriqma",
"_id": "6008c2ff36651a07ebc52cb2", "_id": "6046bab736651a07ebc537e4",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -398,27 +416,31 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "mahoroba", "id": "mahoroba",
"_id": "6008c2ff36651a07ebc52cbf", "_id": "6046bab736651a07ebc5380a",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "badtek", "name": "badtek",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "badtek", "id": "badtek",
"_id": "6008c2ff36651a07ebc52cd8", "_id": "6046bab736651a07ebc537f0",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "maliciousmischance", "name": "maliciousmischance",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "maliciousmischance", "id": "maliciousmischance",
"_id": "6008c2ff36651a07ebc52ccc", "_id": "6046bab736651a07ebc53817",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -428,7 +450,7 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "buchigireberserker", "id": "buchigireberserker",
"_id": "6008c2ff36651a07ebc52cb3", "_id": "6046bab736651a07ebc537e5",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -438,17 +460,19 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "galaxyfriends", "id": "galaxyfriends",
"_id": "6008c2ff36651a07ebc52cc0", "_id": "6046bab736651a07ebc5380b",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 50,
"orig_price": 100 "orig_price": 100,
"discount_from": 1615248000000,
"discount_to": 1615852799000
}, { }, {
"name": "xeraphinite", "name": "xeraphinite",
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "xeraphinite", "id": "xeraphinite",
"_id": "6008c2ff36651a07ebc52ca7", "_id": "6046bab736651a07ebc53818",
"is_available": true "is_available": true
}], }],
"orig_price": 100, "orig_price": 100,
@@ -458,7 +482,7 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "xanatos", "id": "xanatos",
"_id": "6008c2ff36651a07ebc52cd9", "_id": "6046bab736651a07ebc537f1",
"is_available": true "is_available": true
}], }],
"price": 100, "price": 100,
@@ -468,7 +492,17 @@
"items": [{ "items": [{
"type": "single", "type": "single",
"id": "attraqtia", "id": "attraqtia",
"_id": "6008c2ff36651a07ebc52cce", "_id": "6046bab736651a07ebc537ff",
"is_available": true
}],
"orig_price": 100,
"price": 100
}, {
"name": "gimmedablood",
"items": [{
"type": "single",
"id": "gimmedablood",
"_id": "6046bab736651a07ebc537e7",
"is_available": true "is_available": true
}], }],
"orig_price": 100, "orig_price": 100,

View File

@@ -514,18 +514,51 @@ def sys_set(user_id, path):
def main(): def main():
app.config.from_mapping(SECRET_KEY=Config.SECRET_KEY) app.config.from_mapping(SECRET_KEY=Config.SECRET_KEY)
app.config['SESSION_TYPE'] = 'filesystem'
app.register_blueprint(web.login.bp) app.register_blueprint(web.login.bp)
app.register_blueprint(web.index.bp) app.register_blueprint(web.index.bp)
dictConfig({ log_dict = {
'version': 1, 'version': 1,
'formatters': {'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
}},
'root': { 'root': {
'level': 'INFO' 'level': 'INFO',
'handlers': ['wsgi', 'error_file']
},
'handlers': {
'wsgi': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'default'
},
"error_file": {
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 1024 * 1024,
"backupCount": 1,
"encoding": "utf-8",
"level": "ERROR",
"formatter": "default",
"filename": "./log/error.log"
}
},
'formatters': {
'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s'
}
} }
}) }
if Config.ALLOW_LOG_INFO:
log_dict['root']['handlers'] = ['wsgi', 'info_file', 'error_file']
log_dict['handlers']['info_file'] = {
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 1024 * 1024,
"backupCount": 1,
"encoding": "utf-8",
"level": "INFO",
"formatter": "default",
"filename": "./log/info.log"
}
dictConfig(log_dict)
app.logger.info("Start to initialize data in 'songfile' table...") app.logger.info("Start to initialize data in 'songfile' table...")
try: try:

View File

@@ -242,8 +242,9 @@ def get_song_state(x):
return 0 return 0
def get_user_ptt(c, user_id) -> int: def get_user_ptt_float(c, user_id) -> float:
# 总ptt计算 # 总ptt计算,返回浮点数
sumr = 0 sumr = 0
c.execute('''select rating from best_score where user_id = :a order by rating DESC limit 30''', { c.execute('''select rating from best_score where user_id = :a order by rating DESC limit 30''', {
'a': user_id}) 'a': user_id})
@@ -272,8 +273,13 @@ def get_user_ptt(c, user_id) -> int:
sumr += r30[i] sumr += r30[i]
songs.append(s30[i]) songs.append(s30[i])
i += 1 i += 1
return sumr/40
return int(sumr/40*100)
def get_user_ptt(c, user_id) -> int:
# 总ptt计算返回4位整数向下取整
return int(get_user_ptt_float(c, user_id)*100)
def update_recent30(c, user_id, song_id, rating, is_protected): def update_recent30(c, user_id, song_id, rating, is_protected):
@@ -333,7 +339,7 @@ def update_recent30(c, user_id, song_id, rating, is_protected):
b.append(x[i+1]) b.append(x[i+1])
if is_protected: if is_protected:
ptt_pre = get_user_ptt(c, user_id) ptt_pre = get_user_ptt_float(c, user_id)
a_pre = [x for x in a] a_pre = [x for x in a]
b_pre = [x for x in b] b_pre = [x for x in b]
@@ -346,7 +352,7 @@ def update_recent30(c, user_id, song_id, rating, is_protected):
insert_r30table(c, user_id, a, b) insert_r30table(c, user_id, a, b)
if is_protected: if is_protected:
ptt = get_user_ptt(c, user_id) ptt = get_user_ptt_float(c, user_id)
if ptt < ptt_pre: if ptt < ptt_pre:
# 触发保护 # 触发保护
if song_id in b_pre: if song_id in b_pre:
@@ -898,7 +904,23 @@ def arc_all_get(user_id):
"mi": 6, "mi": 6,
"c": True, "c": True,
"r": True "r": True
}]}, }, {
"ma": 8,
"mi": 1,
"c": True,
"r": True
}, {
"ma": 8,
"mi": 2,
"c": True,
"r": True
}, {
"ma": 8,
"mi": 3,
"c": True,
"r": True
}]
},
"devicemodelname": { "devicemodelname": {
"val": devicemodelname_data "val": devicemodelname_data
}, },

View File

@@ -198,9 +198,8 @@ def get_value_0(c, user_id):
"stamina": 12, "stamina": 12,
"world_unlocks": ["scenery_chap1", "scenery_chap2", "scenery_chap3", "scenery_chap4", "scenery_chap5"], "world_unlocks": ["scenery_chap1", "scenery_chap2", "scenery_chap3", "scenery_chap4", "scenery_chap5"],
"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"], "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"],
"singles": get_user_singles(c, user_id), # ["dataerror", "yourvoiceso", "crosssoul", "impurebird", "auxesia", "modelista", "yozakurafubuki", "surrender", "metallicpunisher", "carminescythe", "bethere", "callmyname", "fallensquare", "dropdead", "alexandrite", "astraltale", "phantasia", "empireofwinter", "libertas", "dottodot", "dreadnought", "mirzam", "heavenlycaress", "filament", "avantraze", "battlenoone", "saikyostronger", "izana", "einherjar", "laqryma", "amygdata", "altale", "feelssoright", "scarletcage", "teriqma", "mahoroba", "badtek", "maliciousmischance", "buchigireberserker", "galaxyfriends", "xeraphinite", "xanatos"] "singles": get_user_singles(c, user_id),
"packs": get_user_packs(c, user_id), "packs": get_user_packs(c, user_id),
# ["vs", "extend", "dynamix", "prelude", "core", "yugamu", "omatsuri", "zettai", "mirai", "shiawase", "chunithm", "nijuusei", "groovecoaster", "rei", "tonesphere", "lanota"]
"characters": characters, "characters": characters,
"cores": [], "cores": [],
"recent_score": get_recent_score(c, user_id), "recent_score": get_recent_score(c, user_id),

View File

@@ -1,4 +1,6 @@
import sqlite3 import sqlite3
from flask import current_app
import traceback
class Connect(): class Connect():
@@ -22,4 +24,8 @@ class Connect():
self.conn.commit() self.conn.commit()
self.conn.close() self.conn.close()
if exc_type is not None:
current_app.logger.error(
traceback.format_exception(exc_type, exc_val, exc_tb))
return True return True

View File

@@ -8,7 +8,7 @@ class Config():
主机的地址和端口号 主机的地址和端口号
Host and port of your server Host and port of your server
''' '''
HOST = '192.168.1.101' HOST = '192.168.1.105'
PORT = '80' PORT = '80'
''' '''
-------------------- --------------------
@@ -38,8 +38,8 @@ class Config():
''' '''
-------------------- --------------------
玩家歌曲下载的24小时次数限制 玩家歌曲下载的24小时次数限制,每个文件算一次
Player's song download limit times in 24 hours Player's song download limit times in 24 hours, once per file
''' '''
DOWNLOAD_TIMES_LIMIT = 3000 DOWNLOAD_TIMES_LIMIT = 3000
''' '''
@@ -59,9 +59,19 @@ class Config():
LOGIN_DEVICE_NUMBER_LIMIT = 1 LOGIN_DEVICE_NUMBER_LIMIT = 1
''' '''
是否允许同设备多应用共存登录 是否允许同设备多应用共存登录
If multiple applications on the same device to log in is allowed If logging in from multiple applications on the same device is allowed
''' '''
ALLOW_LOGIN_SAME_DEVICE = False ALLOW_LOGIN_SAME_DEVICE = False
''' '''
-------------------- --------------------
''' '''
'''
--------------------
是否记录详细的服务器日志
If recording detailed server logs is enabled
'''
ALLOW_LOG_INFO = False
'''
--------------------
'''

View File

@@ -11,6 +11,9 @@
<div class="name">{{user['name']}} <div class="name">{{user['name']}}
<span class="rank">UID: {{user['user_id']}}</span> <span class="rank">UID: {{user['user_id']}}</span>
<span class="rank">User code: {{user['user_code']}}</span> <span class="rank">User code: {{user['user_code']}}</span>
{% if user['ban_flag'] %}
<span class="rank">Banned</span>
{% endif %}
</div> </div>
<div class="join-date">注册于 Registered in: {{user['join_date']}}</div> <div class="join-date">注册于 Registered in: {{user['join_date']}}</div>
<div class="ptt">PTT: {{'%0.2f'|format(user['rating_ptt']/100|float)}}</div> <div class="ptt">PTT: {{'%0.2f'|format(user['rating_ptt']/100|float)}}</div>

View File

@@ -22,6 +22,9 @@
<div class="name">{{user['name']}} <div class="name">{{user['name']}}
<span class="rank">UID: {{user['user_id']}}</span> <span class="rank">UID: {{user['user_id']}}</span>
<span class="rank">User code: {{user['user_code']}}</span> <span class="rank">User code: {{user['user_code']}}</span>
{% if user['ban_flag'] %}
<span class="rank">Banned</span>
{% endif %}
</div> </div>
<div class="join-date">注册于 Registered in: {{user['join_date']}}</div> <div class="join-date">注册于 Registered in: {{user['join_date']}}</div>
<div class="ptt">Memories: {{user['ticket']}}</div> <div class="ptt">Memories: {{user['ticket']}}</div>

View File

@@ -138,6 +138,11 @@ def all_player():
if i[20]: if i[20]:
time_played = time.strftime('%Y-%m-%d %H:%M:%S', time_played = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(i[20])//1000)) time.localtime(int(i[20])//1000))
if i[2] == '':
ban_flag = True
else:
ban_flag = False
posts.append({'name': i[1], posts.append({'name': i[1],
'user_id': i[0], 'user_id': i[0],
'join_date': join_date, 'join_date': join_date,
@@ -153,7 +158,8 @@ def all_player():
'time_played': time_played, 'time_played': time_played,
'clear_type': i[21], 'clear_type': i[21],
'rating': i[22], 'rating': i[22],
'ticket': i[26] 'ticket': i[26],
'ban_flag': ban_flag
}) })
else: else:
error = '没有玩家数据 No player data.' error = '没有玩家数据 No player data.'

View File

@@ -3,6 +3,7 @@ from flask import (Blueprint, flash, g, redirect,
render_template, request, session, url_for) render_template, request, session, url_for)
import functools import functools
from setting import Config from setting import Config
import hashlib
bp = Blueprint('login', __name__, url_prefix='/web') bp = Blueprint('login', __name__, url_prefix='/web')
@@ -20,7 +21,11 @@ def login():
if error is None: if error is None:
session.clear() session.clear()
session['user_id'] = Config.USERNAME + Config.PASSWORD hash_session = username + \
hashlib.sha256(password.encode("utf8")).hexdigest()
hash_session = hashlib.sha256(
hash_session.encode("utf8")).hexdigest()
session['user_id'] = hash_session
return redirect(url_for('index.index')) return redirect(url_for('index.index'))
flash(error) flash(error)
@@ -42,7 +47,11 @@ def login_required(view):
def wrapped_view(**kwargs): def wrapped_view(**kwargs):
x = session.get('user_id') x = session.get('user_id')
if x != Config.USERNAME + Config.PASSWORD: hash_session = Config.USERNAME + \
hashlib.sha256(Config.PASSWORD.encode("utf8")).hexdigest()
hash_session = hashlib.sha256(hash_session.encode("utf8")).hexdigest()
if x != hash_session:
return redirect(url_for('login.login')) return redirect(url_for('login.login'))
g.user = {'user_id': x, 'username': Config.USERNAME} g.user = {'user_id': x, 'username': Config.USERNAME}

View File

@@ -1,5 +1,5 @@
import os import os
import sqlite3 from server.sql import Connect
import time import time
import json import json
import server.arcscore import server.arcscore
@@ -179,46 +179,34 @@ def update_database():
# 对于arcaea_datebase.db更新一些表并用character数据更新user_char # 对于arcaea_datebase.db更新一些表并用character数据更新user_char
# 对于arcsong.db更新songs # 对于arcsong.db更新songs
if os.path.isfile("database/old_arcaea_database.db") and os.path.isfile("database/arcaea_database.db"): if os.path.isfile("database/old_arcaea_database.db") and os.path.isfile("database/arcaea_database.db"):
conn1 = sqlite3.connect('./database/old_arcaea_database.db') with Connect('./database/old_arcaea_database.db') as c1:
c1 = conn1.cursor() with Connect() as c2:
conn2 = sqlite3.connect('./database/arcaea_database.db')
c2 = conn2.cursor()
update_one_table(c1, c2, 'user') update_one_table(c1, c2, 'user')
update_one_table(c1, c2, 'friend') update_one_table(c1, c2, 'friend')
update_one_table(c1, c2, 'best_score') update_one_table(c1, c2, 'best_score')
update_one_table(c1, c2, 'recent30') update_one_table(c1, c2, 'recent30')
update_one_table(c1, c2, 'user_world') update_one_table(c1, c2, 'user_world')
update_one_table(c1, c2, 'item') update_one_table(c1, c2, 'item')
update_one_table(c1, c2, 'user_item') update_one_table(c1, c2, 'user_item')
update_one_table(c1, c2, 'user_save') update_one_table(c1, c2, 'user_save')
update_one_table(c1, c2, 'login') update_one_table(c1, c2, 'login')
update_one_table(c1, c2, 'present') update_one_table(c1, c2, 'present')
update_one_table(c1, c2, 'user_present') update_one_table(c1, c2, 'user_present')
update_one_table(c1, c2, 'redeem') update_one_table(c1, c2, 'redeem')
update_one_table(c1, c2, 'user_redeem') update_one_table(c1, c2, 'user_redeem')
update_user_char(c2) update_user_char(c2)
conn1.commit()
conn1.close()
conn2.commit()
conn2.close()
os.remove('database/old_arcaea_database.db') os.remove('database/old_arcaea_database.db')
# songs # songs
if os.path.isfile("database/old_arcsong.db") and os.path.isfile("database/arcsong.db"): if os.path.isfile("database/old_arcsong.db") and os.path.isfile("database/arcsong.db"):
conn1 = sqlite3.connect('./database/old_arcsong.db') with Connect('./database/old_arcsong.db') as c1:
c1 = conn1.cursor() with Connect('./database/arcsong.db') as c2:
conn2 = sqlite3.connect('./database/arcsong.db')
c2 = conn2.cursor()
update_one_table(c1, c2, 'songs') update_one_table(c1, c2, 'songs')
conn1.commit()
conn1.close()
conn2.commit()
conn2.close()
os.remove('database/old_arcsong.db') os.remove('database/old_arcsong.db')
@@ -257,34 +245,31 @@ def unlock_user_item(c, user_id):
def get_all_item(): def get_all_item():
# 所有购买数据查询 # 所有购买数据查询
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() c.execute('''select * from item''')
c.execute('''select * from item''') x = c.fetchall()
x = c.fetchall() re = []
re = [] if x:
if x: for i in x:
for i in x: discount_from = None
discount_from = None discount_to = None
discount_to = None
if i[5] and i[5] >= 0: if i[5] and i[5] >= 0:
discount_from = time.strftime( discount_from = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[5])/1000)) "%Y-%m-%d %H:%M:%S", time.localtime(int(i[5])/1000))
if i[6] and i[6] >= 0: if i[6] and i[6] >= 0:
discount_to = time.strftime( discount_to = time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(int(i[6])//1000)) "%Y-%m-%d %H:%M:%S", time.localtime(int(i[6])//1000))
re.append({'item_id': i[0], re.append({'item_id': i[0],
'type': i[1], 'type': i[1],
'is_available': int2b(i[2]), 'is_available': int2b(i[2]),
'price': i[3], 'price': i[3],
'orig_price': i[4], 'orig_price': i[4],
'discount_from': discount_from, 'discount_from': discount_from,
'discount_to': discount_to 'discount_to': discount_to
}) })
conn.commit()
conn.close()
return re return re
@@ -346,19 +331,16 @@ def add_one_present(present_id, expire_ts, description, items):
# 添加一个奖励 # 添加一个奖励
message = None message = None
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() c.execute(
c.execute( '''select exists(select * from present where present_id=:a)''', {'a': present_id})
'''select exists(select * from present where present_id=:a)''', {'a': present_id}) if c.fetchone() == (0,):
if c.fetchone() == (0,): c.execute('''insert into present values(:a,:b,:c,:d)''', {
c.execute('''insert into present values(:a,:b,:c,:d)''', { 'a': present_id, 'b': expire_ts, 'c': items, 'd': description})
'a': present_id, 'b': expire_ts, 'c': items, 'd': description}) message = '添加成功 Successfully add it.'
message = '添加成功 Successfully add it.' else:
else: message = '奖励已存在 The present exists.'
message = '奖励已存在 The present exists.'
conn.commit()
conn.close()
return message return message
@@ -366,21 +348,18 @@ def delete_one_present(present_id):
# 删除一个奖励 # 删除一个奖励
message = None message = None
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() c.execute(
c.execute( '''select exists(select * from present where present_id=:a)''', {'a': present_id})
'''select exists(select * from present where present_id=:a)''', {'a': present_id}) if c.fetchone() == (1,):
if c.fetchone() == (1,): c.execute('''delete from present where present_id = :a''',
c.execute('''delete from present where present_id = :a''', {'a': present_id})
{'a': present_id}) c.execute('''delete from user_present where present_id =:a''', {
c.execute('''delete from user_present where present_id =:a''', { 'a': present_id})
'a': present_id}) message = '删除成功 Successfully delete it.'
message = '删除成功 Successfully delete it.' else:
else: message = '奖励不存在 The present does not exist.'
message = '奖励不存在 The present does not exist.'
conn.commit()
conn.close()
return message return message
@@ -423,19 +402,16 @@ def add_one_redeem(code, redeem_type, items):
# 添加一个兑换码 # 添加一个兑换码
message = None message = None
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() c.execute(
c.execute( '''select exists(select * from redeem where code=:a)''', {'a': code})
'''select exists(select * from redeem where code=:a)''', {'a': code}) if c.fetchone() == (0,):
if c.fetchone() == (0,): c.execute('''insert into redeem values(:a,:b,:c)''', {
c.execute('''insert into redeem values(:a,:b,:c)''', { 'a': code, 'b': items, 'c': redeem_type})
'a': code, 'b': items, 'c': redeem_type}) message = '添加成功 Successfully add it.'
message = '添加成功 Successfully add it.' else:
else: message = '兑换码已存在 The redeem code exists.'
message = '兑换码已存在 The redeem code exists.'
conn.commit()
conn.close()
return message return message
@@ -443,21 +419,19 @@ def add_some_random_redeem(amount, redeem_type, items):
# 随机生成一堆10位的兑换码 # 随机生成一堆10位的兑换码
message = None message = None
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() i = 1
i = 1 while i <= amount:
while i <= amount: code = random_str()
code = random_str() c.execute(
c.execute( '''select exists(select * from redeem where code=:a)''', {'a': code})
'''select exists(select * from redeem where code=:a)''', {'a': code}) if c.fetchone() == (0,):
if c.fetchone() == (0,): c.execute('''insert into redeem values(:a,:b,:c)''',
c.execute('''insert into redeem values(:a,:b,:c)''', {'a': code, 'b': items, 'c': redeem_type})
{'a': code, 'b': items, 'c': redeem_type}) i += 1
i += 1
message = '添加成功 Successfully add it.'
message = '添加成功 Successfully add it.'
conn.commit()
conn.close()
return message return message
@@ -465,19 +439,17 @@ def delete_one_redeem(code):
# 删除一个兑换码 # 删除一个兑换码
message = None message = None
conn = sqlite3.connect('./database/arcaea_database.db') with Connect() as c:
c = conn.cursor() c.execute(
c.execute( '''select exists(select * from redeem where code=:a)''', {'a': code})
'''select exists(select * from redeem where code=:a)''', {'a': code}) if c.fetchone() == (1,):
if c.fetchone() == (1,): c.execute('''delete from redeem where code = :a''', {'a': code})
c.execute('''delete from redeem where code = :a''', {'a': code}) c.execute(
c.execute('''delete from user_redeem where code =:a''', {'a': code}) '''delete from user_redeem where code =:a''', {'a': code})
message = '删除成功 Successfully delete it.' message = '删除成功 Successfully delete it.'
else: else:
message = '兑换码不存在 The redeem code does not exist.' message = '兑换码不存在 The redeem code does not exist.'
conn.commit()
conn.close()
return message return message

View File

@@ -49,6 +49,10 @@ def get_user(c, user_id):
if x[20]: if x[20]:
time_played = time.strftime('%Y-%m-%d %H:%M:%S', time_played = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(int(x[20])//1000)) time.localtime(int(x[20])//1000))
if x[2] == '':
ban_flag = True
else:
ban_flag = False
r = {'name': x[1], r = {'name': x[1],
'user_id': user_id, 'user_id': user_id,
@@ -65,7 +69,8 @@ def get_user(c, user_id):
'time_played': time_played, 'time_played': time_played,
'clear_type': x[21], 'clear_type': x[21],
'rating': x[22], 'rating': x[22],
'ticket': x[26] 'ticket': x[26],
'ban_flag': ban_flag
} }
return r return r