forked from Fragrance/maquitous
feat: add process and remove functions in single file
This commit is contained in:
110
main.py
110
main.py
@@ -5,123 +5,17 @@ from datetime import datetime
|
||||
from flask import Flask,request,redirect,jsonify
|
||||
from flask_cors import CORS
|
||||
|
||||
from sdgb import qr_api
|
||||
from logout import logout
|
||||
from login import login
|
||||
from ticket import get_ticket
|
||||
from charge import charge
|
||||
from map import map
|
||||
from userdata import userdata
|
||||
from character import character
|
||||
from process import *
|
||||
|
||||
from sdgb import sdgb_api
|
||||
from sdgb import sdgb_api, qr_api
|
||||
from mapstock import music_with_retry as mapstock
|
||||
from music import music_with_retry as music
|
||||
from unlock_all import music_with_retry as unlock
|
||||
from map_clear import music_with_retry as map_clear
|
||||
from bonus9 import music_with_retry as login_bonus
|
||||
|
||||
def find_map(mapId, user_map_data):
|
||||
for single in user_map_data:
|
||||
if single["mapId"] == mapId:
|
||||
return single
|
||||
else:
|
||||
continue
|
||||
|
||||
def isNewMapList(mapId, user_map_data):
|
||||
if ('{"mapId": ' + str(mapId)) in user_map_data:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
def item(item_data, user_character_list):
|
||||
item_list = []
|
||||
character_list = []
|
||||
for single in item_data:
|
||||
if single['kind'] == 9:
|
||||
if ('{"characterId": ' + str(single['id'])) in user_character_list:
|
||||
pass
|
||||
else:
|
||||
data = ({
|
||||
"characterId":single['id'],
|
||||
"level":1,
|
||||
"awakening":0,
|
||||
"useCount": 0
|
||||
})
|
||||
character_list.append(data)
|
||||
else:
|
||||
data = ({
|
||||
"itemKind": single['kind'],
|
||||
"itemId": single['id'],
|
||||
"stock": 1,
|
||||
"isValid": True
|
||||
})
|
||||
item_list.append(data)
|
||||
return item_list, character_list, item_data[-1]['distance']
|
||||
|
||||
|
||||
def bonus_list_gen(userId):
|
||||
with open('login_bonus.json') as file:
|
||||
cache = json.load(file)
|
||||
bonus_data = []
|
||||
for item in cache:
|
||||
bonus_data.append(item['id'])
|
||||
cache = []
|
||||
data = json.dumps({
|
||||
"userId": int(userId),
|
||||
"nextIndex":0,
|
||||
"maxCount":2000
|
||||
})
|
||||
user_bonus = json.loads(sdgb_api(data, "GetUserLoginBonusApi", userId))['userLoginBonusList']
|
||||
for item in user_bonus:
|
||||
cache.append(item['bonusId'])
|
||||
bonus_list_unexist = list(set(bonus_data) - set(cache))
|
||||
bonus_list = []
|
||||
for item in user_bonus:
|
||||
if item['isComplete'] == False:
|
||||
if item['bonusId'] in [12, 29, 30, 38, 43, 604]:
|
||||
data = ({
|
||||
"bonusId": item['bonusId'],
|
||||
"point": 4,
|
||||
"isCurrent": item['isCurrent'],
|
||||
"isComplete": False
|
||||
})
|
||||
else:
|
||||
data = ({
|
||||
"bonusId": item['bonusId'],
|
||||
"point": 9,
|
||||
"isCurrent": item['isCurrent'],
|
||||
"isComplete": False
|
||||
})
|
||||
bonus_list.append(data)
|
||||
elif item['bonusId'] == 999:
|
||||
data = ({
|
||||
"bonusId": 999,
|
||||
"point": item['point'] // 10 * 10 + 9,
|
||||
"isCurrent": item['isCurrent'],
|
||||
"isComplete": False
|
||||
})
|
||||
bonus_list.append(data)
|
||||
else:
|
||||
pass
|
||||
for item in bonus_list_unexist:
|
||||
if item in [12, 29, 30, 38, 43, 604]:
|
||||
data = ({
|
||||
"bonusId": item,
|
||||
"point": 4,
|
||||
"isCurrent": False,
|
||||
"isComplete": False
|
||||
})
|
||||
else:
|
||||
data = ({
|
||||
"bonusId": item,
|
||||
"point": 9,
|
||||
"isCurrent": False,
|
||||
"isComplete": False
|
||||
})
|
||||
bonus_list.append(data)
|
||||
return bonus_list
|
||||
|
||||
app = Flask(__name__)
|
||||
app.json.sort_keys = False
|
||||
app.json.ensure_ascii = False
|
||||
|
||||
Reference in New Issue
Block a user