feat: 非必要包后续在函数中导入
This commit is contained in:
parent
a8477ce63e
commit
434002ba98
|
|
@ -1,5 +1,3 @@
|
||||||
from aliyunsdkcore.client import AcsClient
|
|
||||||
from aliyunsdkcore.request import CommonRequest
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from server.settings import get_sysconfig
|
from server.settings import get_sysconfig
|
||||||
|
|
@ -10,6 +8,8 @@ myLogger = logging.getLogger('log')
|
||||||
|
|
||||||
@auto_log(name='阿里云短信', raise_exception=True, send_mail=True)
|
@auto_log(name='阿里云短信', raise_exception=True, send_mail=True)
|
||||||
def send_sms(phone: str, template_code: int, template_param: dict):
|
def send_sms(phone: str, template_code: int, template_param: dict):
|
||||||
|
from aliyunsdkcore.client import AcsClient
|
||||||
|
from aliyunsdkcore.request import CommonRequest
|
||||||
config = get_sysconfig()
|
config = get_sysconfig()
|
||||||
if config.get("sms", {}).get('enabled', True) is False:
|
if config.get("sms", {}).get('enabled', True) is False:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import cv2
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from apps.utils.errors import SIGN_MAKE_FAIL
|
from apps.utils.errors import SIGN_MAKE_FAIL
|
||||||
from server.settings import BASE_DIR
|
from server.settings import BASE_DIR
|
||||||
import numpy as np
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
|
|
@ -29,6 +27,8 @@ class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
||||||
|
|
||||||
照片生成透明签名图片
|
照片生成透明签名图片
|
||||||
"""
|
"""
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
path = (BASE_DIR + request.data['path']).replace('\\', '/')
|
path = (BASE_DIR + request.data['path']).replace('\\', '/')
|
||||||
try:
|
try:
|
||||||
image = cv2.imread(path, cv2.IMREAD_UNCHANGED)
|
image = cv2.imread(path, cv2.IMREAD_UNCHANGED)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue