+ Update transfer speed

+ Add error handler for getting credit
This commit is contained in:
yiekheng 2025-10-19 10:18:55 +08:00
parent d191821a6a
commit 3fb2786506
2 changed files with 19 additions and 17 deletions

View File

@ -178,6 +178,7 @@ class CM_BOT_HAL:
return float(cm_bot.get_user_credit())
def transfer_credit_api(self, f_username: str, f_password: str, t_username: str, t_password: str):
try:
cm_bot = CM_BOT()
if cm_bot.login(
username = f_username,
@ -191,7 +192,8 @@ class CM_BOT_HAL:
return(f'Successfully transfer amount: {amount} from {f_username} to {t_username}')
else:
return(f'Fail to transfer credit from {f_username} to {t_username}')
except:
return(f'Fail transfer credit for {f_username}')
if __name__ == '__main__':
bot = CM_BOT_HAL()

View File

@ -14,7 +14,7 @@ if not os.path.exists(logs_dir):
# api_url = 'https://api.luckytown888.net'
api_url = 'http://api-server:3000'
max_threading = 10
max_threading = 20
def transfer(data: dict, local_logger):
bot = CM_BOT_HAL()
@ -24,7 +24,7 @@ def transfer(data: dict, local_logger):
local_logger.info(f"[Thread-{thread_name}] {result}")
local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!")
del bot
time.sleep(10)
time.sleep(5)
while True:
weekday = int(datetime.now().strftime("%w"))