mirror of
https://git.auk.su/Dinect/bonus-import-tools.git
synced 2025-12-29 02:20:02 +00:00
initial commit
This commit is contained in:
@@ -3,3 +3,5 @@
|
|||||||
bonus-import-tools
|
bonus-import-tools
|
||||||
|
|
||||||
приложение для импорта бонусных баллов
|
приложение для импорта бонусных баллов
|
||||||
|
|
||||||
|
python 3.11
|
||||||
46
app.py
Normal file
46
app.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# __author__ = 'szhdanoff@gmail.com'
|
||||||
|
import os
|
||||||
|
import csv
|
||||||
|
|
||||||
|
csv_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'csv')
|
||||||
|
|
||||||
|
files = []
|
||||||
|
# r=root, d=directories, f = files
|
||||||
|
for r, d, f in os.walk(csv_path):
|
||||||
|
for file in f:
|
||||||
|
filename, file_extension = os.path.splitext(file)
|
||||||
|
if file_extension == '.csv':
|
||||||
|
files.append(os.path.join(r, file))
|
||||||
|
|
||||||
|
for f in files:
|
||||||
|
with open(f + '.log', "w", encoding="utf-8") as log_file:
|
||||||
|
with open(f, "r", encoding="utf-8") as csv_file:
|
||||||
|
csv_reader = csv.reader(csv_file, delimiter=',')
|
||||||
|
line_count = 0
|
||||||
|
name, wallet, value = '', '', ''
|
||||||
|
for row in csv_reader:
|
||||||
|
if line_count == 0:
|
||||||
|
line_count += 1
|
||||||
|
else:
|
||||||
|
name, wallet, value = row[0].strip(), row[1].strip(), row[2].strip()
|
||||||
|
value = value.replace(',', '.')
|
||||||
|
value = value.replace(chr(160), '')
|
||||||
|
if value == '0':
|
||||||
|
value = ''
|
||||||
|
line_count += 1
|
||||||
|
|
||||||
|
ret = 'no tx'
|
||||||
|
if len(wallet) > 0 and len(value) > 0:
|
||||||
|
# wallet = w3.toChecksumAddress(wallet.lower())
|
||||||
|
# ret = send_joys(c.sender_wallet, _key, wallet, value)
|
||||||
|
|
||||||
|
print(name, wallet, value)
|
||||||
|
# log_file.write(f'{wallet}{chr9}{value}{chr9}{ret}\n')
|
||||||
|
log_file.write(f'{ret}\n')
|
||||||
|
|
||||||
|
csv_file.close()
|
||||||
|
log_file.close()
|
||||||
|
|
||||||
|
os.rename(f, f + '.old')
|
||||||
0
csv/.gitkeep
Normal file
0
csv/.gitkeep
Normal file
3
csv/example.csv.examples
Normal file
3
csv/example.csv.examples
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
org_id,user_id,date_time,balance_up, balance_down
|
||||||
|
8545,6548,"19920,53","19920,53",
|
||||||
|
,,,,
|
||||||
Reference in New Issue
Block a user