Added POST Create New EmailMessage API and text message and wechat message
parent
043c39b81a
commit
d66cdd54d0
|
@ -205,12 +205,24 @@ class EmailMessageCollection:
|
|||
except ValueError:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description="API.INVALID_SCHEDULED_DATETIME_FORMAT")
|
||||
print(created_datetime_utc)
|
||||
print(scheduled_datetime_utc)
|
||||
|
||||
status = 'new'
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
||||
if rule_id is not None:
|
||||
cursor.execute(" SELECT name "
|
||||
" FROM tbl_rules "
|
||||
" WHERE id = %s ",
|
||||
(new_values['data']['rule_id'],))
|
||||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
add_row = (" INSERT INTO tbl_email_messages "
|
||||
" (rule_id, recipient_name, recipient_email, subject, message, "
|
||||
" attachment_file_name, attachment_file_object, created_datetime_utc,"
|
||||
|
|
|
@ -185,6 +185,19 @@ class TextMessageCollection:
|
|||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
||||
if rule_id is not None:
|
||||
cursor.execute(" SELECT name "
|
||||
" FROM tbl_rules "
|
||||
" WHERE id = %s ",
|
||||
(new_values['data']['rule_id'],))
|
||||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
add_row = (" INSERT INTO tbl_text_messages_outbox"
|
||||
" (rule_id, recipient_name, recipient_mobile, message, "
|
||||
" acknowledge_code, created_datetime_utc,"
|
||||
|
|
|
@ -200,6 +200,19 @@ class WechatMessageCollection(object):
|
|||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
||||
if rule_id is not None:
|
||||
cursor.execute(" SELECT name "
|
||||
" FROM tbl_rules "
|
||||
" WHERE id = %s ",
|
||||
(new_values['data']['rule_id'],))
|
||||
row = cursor.fetchone()
|
||||
if row is None:
|
||||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||
description='API.RULE_NOT_FOUND')
|
||||
|
||||
add_row = (" INSERT INTO tbl_wechat_messages_outbox"
|
||||
" (rule_id, recipient_name, recipient_openid, message_template_id, message_data,"
|
||||
" acknowledge_code, created_datetime_utc, scheduled_datetime_utc, status) "
|
||||
|
|
Loading…
Reference in New Issue