update
This commit is contained in:
parent
fc0abccd1c
commit
4fe679acc5
@ -16,6 +16,7 @@ from typing import List, Optional
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
|
from app.core.qcloud import qcloud_manager
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@ -65,6 +66,9 @@ async def create_additional_fee_request(
|
|||||||
db.refresh(db_fee_request)
|
db.refresh(db_fee_request)
|
||||||
|
|
||||||
# TODO: 发送通知给用户
|
# TODO: 发送通知给用户
|
||||||
|
user = db.query(UserDB).filter(UserDB.userid == order.userid).first()
|
||||||
|
if user:
|
||||||
|
await qcloud_manager.send_sms_code_additional_fee(user.phone)
|
||||||
|
|
||||||
return success_response(data=OrderAdditionalFeeInfo.model_validate(db_fee_request))
|
return success_response(data=OrderAdditionalFeeInfo.model_validate(db_fee_request))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -56,6 +56,7 @@ class Settings(BaseSettings):
|
|||||||
SMS_SDK_APP_ID: str = "1400961527"
|
SMS_SDK_APP_ID: str = "1400961527"
|
||||||
SMS_SIGN_NAME: str = "蜂快到家公众号"
|
SMS_SIGN_NAME: str = "蜂快到家公众号"
|
||||||
SMS_TEMPLATE_ID: str = "2353143" # 验证码短信模板ID
|
SMS_TEMPLATE_ID: str = "2353143" # 验证码短信模板ID
|
||||||
|
SMS_TEMPLATE_ID_ADDITIONAL_FEE: str = "2375181" # 加价短信模板ID
|
||||||
|
|
||||||
# 腾讯云 COS 配置
|
# 腾讯云 COS 配置
|
||||||
COS_REGION: str = "ap-chengdu"
|
COS_REGION: str = "ap-chengdu"
|
||||||
|
|||||||
@ -108,6 +108,31 @@ class QCloudManager:
|
|||||||
except TencentCloudSDKException as e:
|
except TencentCloudSDKException as e:
|
||||||
raise Exception(f"发送短信失败: {str(e)}")
|
raise Exception(f"发送短信失败: {str(e)}")
|
||||||
|
|
||||||
|
async def send_sms_code_additional_fee(self, phone: str) -> tuple[str, str]:
|
||||||
|
"""
|
||||||
|
发送加价短信验证码
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self._init_sms_client()
|
||||||
|
|
||||||
|
# 构建请求
|
||||||
|
req = sms_models.SendSmsRequest()
|
||||||
|
req.SmsSdkAppId = settings.SMS_SDK_APP_ID
|
||||||
|
req.SignName = settings.SMS_SIGN_NAME
|
||||||
|
req.TemplateId = settings.SMS_TEMPLATE_ID_ADDITIONAL_FEE
|
||||||
|
|
||||||
|
# 发送短信
|
||||||
|
response = self.sms_client.SendSms(req)
|
||||||
|
|
||||||
|
# 检查发送结果
|
||||||
|
if response.SendStatusSet[0].Code != "Ok":
|
||||||
|
raise Exception(response.SendStatusSet[0].Message)
|
||||||
|
|
||||||
|
return response.RequestId
|
||||||
|
|
||||||
|
except TencentCloudSDKException as e:
|
||||||
|
raise Exception(f"发送加价短信验证码失败: {str(e)}")
|
||||||
|
|
||||||
async def verify_id_card(self, id_card: str, name: str) -> dict:
|
async def verify_id_card(self, id_card: str, name: str) -> dict:
|
||||||
"""
|
"""
|
||||||
身份证实名认证
|
身份证实名认证
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user