|
|
@ -134,7 +134,7 @@ class Coins_add(BaseModel):
|
|
|
|
amount: str
|
|
|
|
amount: str
|
|
|
|
@app.post('/api/coins_add/')
|
|
|
|
@app.post('/api/coins_add/')
|
|
|
|
def coins_add(it: Coins_add):
|
|
|
|
def coins_add(it: Coins_add):
|
|
|
|
token, id, amount = it.token, it.id, float(it.amount)
|
|
|
|
token, id, amount = it.token, it.id, abs(float(it.amount))
|
|
|
|
if token_check(token):
|
|
|
|
if token_check(token):
|
|
|
|
db = read()
|
|
|
|
db = read()
|
|
|
|
db['id'][id]['bal'] = fix_add(db['id'][id]['bal'], amount)
|
|
|
|
db['id'][id]['bal'] = fix_add(db['id'][id]['bal'], amount)
|
|
|
@ -150,13 +150,16 @@ class Coins_del(BaseModel):
|
|
|
|
amount: str
|
|
|
|
amount: str
|
|
|
|
@app.post('/api/coins_del/')
|
|
|
|
@app.post('/api/coins_del/')
|
|
|
|
def coins_del(it: Coins_del):
|
|
|
|
def coins_del(it: Coins_del):
|
|
|
|
token, id, amount = it.token, it.id, float(it.amount)
|
|
|
|
token, id, amount = it.token, it.id, abs(float(it.amount))
|
|
|
|
if token_check(token):
|
|
|
|
if token_check(token):
|
|
|
|
db = read()
|
|
|
|
db = read()
|
|
|
|
db['id'][id]['bal'] = fix_sub(db['id'][id]['bal'], amount)
|
|
|
|
if db['id'][id]['bal'] >= amount:
|
|
|
|
write(db)
|
|
|
|
db['id'][id]['bal'] = fix_sub(db['id'][id]['bal'], amount)
|
|
|
|
stat_run(amount*-1)
|
|
|
|
write(db)
|
|
|
|
return 'OK'
|
|
|
|
stat_run(amount*-1)
|
|
|
|
|
|
|
|
return 'OK'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return 'Error'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return 'Error'
|
|
|
|
return 'Error'
|
|
|
|
|
|
|
|
|
|
|
|