def catch():
j = json.loads(request.data)
data = j['data']
if mode == VARIABLE_MAX:
if data['is_load']:
# If you put money onto your account, save the amount of money as peak
r.set("peak", int(data['amount']))
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
else:
# If money is withdrawn OR in case of refunds or chargebacks the peak won't be set
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
if int(data['amount']) > int(getRedisValue("peak")):
# Only if the current balance is greater than the saved peak, save it as peak
r.set("peak", int(data['amount']))
else:
r.set("balance", int(getRedisValue("balance")) + int(data['amount']))
r.set("peak", max_bal)
notify_particle()
return "{} | {}".format(r.get("balance"), r.get("peak"))
评论列表
文章目录