portal/wwwroot/api/submit_lead.dspy

23 lines
663 B
Plaintext

config = getConfig('.')
DBPools(config.databases)
dbname = get_module_dbname('cms')
async with db.sqlorContext(dbname) as sor:
data = {
'id': getID(),
'source': 'website',
'status': 'new',
'org_id': '0'
}
for field in ['name', 'company', 'phone', 'email', 'industry', 'region',
'interest_products', 'message']:
v = params_kw.get(field, None)
if v is not None:
data[field] = v
await sor.C('cms_leads', data)
return {
'widgettype': 'Message',
'options': {'text': '感谢您的留言,我们会尽快联系您!', 'messagetype': 'success'}
}