feat: base 短信发送功能启动抛出异常2
This commit is contained in:
parent
1c8489a0b4
commit
ad1bbaa32e
|
@ -4,6 +4,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
from server.settings import get_sysconfig
|
from server.settings import get_sysconfig
|
||||||
from apps.utils.decorators import auto_log
|
from apps.utils.decorators import auto_log
|
||||||
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
||||||
# 实例化myLogger
|
# 实例化myLogger
|
||||||
myLogger = logging.getLogger('log')
|
myLogger = logging.getLogger('log')
|
||||||
|
@ -13,7 +14,7 @@ myLogger = logging.getLogger('log')
|
||||||
def send_sms(phone: str, template_code: int, template_param: dict):
|
def send_sms(phone: str, template_code: int, template_param: dict):
|
||||||
config = get_sysconfig()
|
config = get_sysconfig()
|
||||||
if config.get("sms", {}).get('enabled', False) is False:
|
if config.get("sms", {}).get('enabled', False) is False:
|
||||||
raise Exception("短信发送功能未启用")
|
raise ParseError("短信发送功能未启用")
|
||||||
try:
|
try:
|
||||||
client = AcsClient(config['sms']['xn_key'],
|
client = AcsClient(config['sms']['xn_key'],
|
||||||
config['sms']['xn_secret'], 'default')
|
config['sms']['xn_secret'], 'default')
|
||||||
|
|
Loading…
Reference in New Issue