forked from erp-dev/erp
feat: big
This commit is contained in:
@@ -157,3 +157,24 @@ def create_sales_return_order_stock_entries(
|
||||
payload['task_id'] = self.request.id
|
||||
return payload
|
||||
|
||||
|
||||
@shared_task(bind=True)
|
||||
def notify_business_order_speech(self, *, text: str) -> Dict[str, Any]:
|
||||
try:
|
||||
from flower.utils import play_speech
|
||||
|
||||
response = play_speech(text=text, timeout_seconds=3.0)
|
||||
return {
|
||||
'status': 'sent',
|
||||
'task_id': self.request.id,
|
||||
'status_code': response.status_code,
|
||||
'raw': response.raw,
|
||||
}
|
||||
except Exception as exc:
|
||||
logger.exception('[business.tasks] 业务单据语音播报失败(已忽略)')
|
||||
return {
|
||||
'status': 'error',
|
||||
'task_id': self.request.id,
|
||||
'error': str(exc),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user