From 8b0fab87b550b65a1a02aa7afb062300909c7ead Mon Sep 17 00:00:00 2001 From: youngS Date: Thu, 27 May 2021 14:46:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/app/shellcmds.py | 54 ------------------- fir_ser/api/utils/pay/ali.py | 5 +- .../api/utils/{ => pay}/alipay/__init__.py | 0 fir_ser/api/utils/{ => pay}/alipay/compat.py | 0 .../api/utils/{ => pay}/alipay/exceptions.py | 0 fir_ser/api/utils/{ => pay}/alipay/loggers.py | 0 fir_ser/api/utils/{ => pay}/alipay/utils.py | 0 fir_ser/api/utils/pay/wx.py | 2 +- fir_ser/api/utils/{ => pay}/wxpay/__init__.py | 0 fir_ser/api/utils/{ => pay}/wxpay/core.py | 0 fir_ser/api/utils/storage/caches.py | 12 ----- 11 files changed, 3 insertions(+), 70 deletions(-) rename fir_ser/api/utils/{ => pay}/alipay/__init__.py (100%) rename fir_ser/api/utils/{ => pay}/alipay/compat.py (100%) rename fir_ser/api/utils/{ => pay}/alipay/exceptions.py (100%) rename fir_ser/api/utils/{ => pay}/alipay/loggers.py (100%) rename fir_ser/api/utils/{ => pay}/alipay/utils.py (100%) rename fir_ser/api/utils/{ => pay}/wxpay/__init__.py (100%) rename fir_ser/api/utils/{ => pay}/wxpay/core.py (100%) diff --git a/fir_ser/api/utils/app/shellcmds.py b/fir_ser/api/utils/app/shellcmds.py index f56dd3e..33c0a19 100644 --- a/fir_ser/api/utils/app/shellcmds.py +++ b/fir_ser/api/utils/app/shellcmds.py @@ -9,9 +9,6 @@ import logging import paramiko, json import socket -# import pexpect -# from api.utils.storage.caches import developer_auth_code - logger = logging.getLogger(__file__) @@ -89,57 +86,6 @@ class SSHConnection(object): self._client.close() -# def pshell_command(cmdstrs, user_obj, developer_email, timeout=60 * 10): -# result = default_result() -# run = pexpect.spawn(cmdstrs, encoding='utf-8') -# try: -# index = run.expect( -# ["Two-factor Authentication", "Invalid username and password combination", pexpect.EOF, pexpect.TIMEOUT], -# timeout=timeout) -# if index == 0: -# count = 1 -# if timeout == -1: -# timeout = 60 * 60 * 24 -# while True and count < timeout / 3: -# code = developer_auth_code("get", user_obj, developer_email) -# if code: -# run.sendline(code) -# try: -# err = run.expect(["Unauthorized Access", pexpect.EOF, pexpect.TIMEOUT]) -# if err == 0: -# result['exit_code'] = 2 -# result['return_info'] = 'Unauthorized Access 【验证码有误】' -# elif err == 1: -# result['exit_code'] = 0 -# result['return_info'] = 'Verify Code Success' -# else: -# result['exit_code'] = 3 -# result['return_info'] = 'Verify Code TimeOut or UnKnown Error 【双重验证未知错误】' -# developer_auth_code("del", user_obj, developer_email) -# return result -# except Exception as e: -# logger.error("cmdstrs:%s developer_email:%s user_obj:%s Exception:%s" % ( -# cmdstrs, developer_email, user_obj, e)) -# developer_auth_code("del", user_obj, developer_email) -# result['exit_code'] = 0 -# result['return_info'] = 'Success' -# return result -# count += 1 -# time.sleep(3) -# elif index == 1: -# result['exit_code'] = 1 -# result['return_info'] = 'Invalid username and password combination 【密码或者账号有误】' -# elif index == 2: -# result['exit_code'] = 0 -# result['return_info'] = 'Alreay Success' -# else: -# result['exit_code'] = 4 -# result['return_info'] = 'Code TimeOut or UnKnown Error 【验证超时】' -# except Exception as e: -# logger.error("cmdstrs:%s developer_email:%s user_obj:%s Exception:%s" % (cmdstrs, developer_email, user_obj, e)) -# return result - - def shell_command(cmdstrs, timeout): result = default_result() result['return_info'] = '' diff --git a/fir_ser/api/utils/pay/ali.py b/fir_ser/api/utils/pay/ali.py index fa419b5..46a8a57 100644 --- a/fir_ser/api/utils/pay/ali.py +++ b/fir_ser/api/utils/pay/ali.py @@ -6,9 +6,8 @@ # pip install alipay-sdk-python==3.3.398 -from api.utils.alipay import AliPay -from api.utils.alipay.utils import AliPayConfig -from fir_ser.settings import PAY_CONFIG +from api.utils.pay.alipay import AliPay +from api.utils.pay.alipay.utils import AliPayConfig from datetime import datetime, timedelta from api.utils.storage.caches import update_order_info, update_order_status import json diff --git a/fir_ser/api/utils/alipay/__init__.py b/fir_ser/api/utils/pay/alipay/__init__.py similarity index 100% rename from fir_ser/api/utils/alipay/__init__.py rename to fir_ser/api/utils/pay/alipay/__init__.py diff --git a/fir_ser/api/utils/alipay/compat.py b/fir_ser/api/utils/pay/alipay/compat.py similarity index 100% rename from fir_ser/api/utils/alipay/compat.py rename to fir_ser/api/utils/pay/alipay/compat.py diff --git a/fir_ser/api/utils/alipay/exceptions.py b/fir_ser/api/utils/pay/alipay/exceptions.py similarity index 100% rename from fir_ser/api/utils/alipay/exceptions.py rename to fir_ser/api/utils/pay/alipay/exceptions.py diff --git a/fir_ser/api/utils/alipay/loggers.py b/fir_ser/api/utils/pay/alipay/loggers.py similarity index 100% rename from fir_ser/api/utils/alipay/loggers.py rename to fir_ser/api/utils/pay/alipay/loggers.py diff --git a/fir_ser/api/utils/alipay/utils.py b/fir_ser/api/utils/pay/alipay/utils.py similarity index 100% rename from fir_ser/api/utils/alipay/utils.py rename to fir_ser/api/utils/pay/alipay/utils.py diff --git a/fir_ser/api/utils/pay/wx.py b/fir_ser/api/utils/pay/wx.py index 6026831..ffd6ce0 100644 --- a/fir_ser/api/utils/pay/wx.py +++ b/fir_ser/api/utils/pay/wx.py @@ -4,7 +4,7 @@ # author: NinEveN # date: 2021/3/18 -from api.utils.wxpay import WeChatPay, WeChatPayType +from api.utils.pay.wxpay import WeChatPay, WeChatPayType from datetime import datetime, timedelta from api.utils.storage.caches import update_order_info, update_order_status import json diff --git a/fir_ser/api/utils/wxpay/__init__.py b/fir_ser/api/utils/pay/wxpay/__init__.py similarity index 100% rename from fir_ser/api/utils/wxpay/__init__.py rename to fir_ser/api/utils/pay/wxpay/__init__.py diff --git a/fir_ser/api/utils/wxpay/core.py b/fir_ser/api/utils/pay/wxpay/core.py similarity index 100% rename from fir_ser/api/utils/wxpay/core.py rename to fir_ser/api/utils/pay/wxpay/core.py diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 7e63c8e..85c6528 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -229,18 +229,6 @@ def get_app_today_download_times(app_ids): return download_times_count -# def developer_auth_code(act, user_obj, developer_issuer_id, code=None): -# auth_key = file_format_path(user_obj, email=developer_issuer_id) -# key = "_".join([CACHE_KEY_TEMPLATE.get("developer_auth_code_key"), auth_key]) -# if act == "set": -# cache.delete(key) -# cache.set(key, code, 60 * 10) -# elif act == "get": -# return cache.get(key) -# elif act == "del": -# cache.delete(key) - - def upload_file_tmp_name(act, filename, user_obj_id): tmp_key = "_".join([CACHE_KEY_TEMPLATE.get("upload_file_tmp_name_key"), filename]) if act == "set":