Contact retuen
This commit is contained in:
@@ -127,17 +127,33 @@ class ContactService(BaseService):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def process_save_contacts(data):
|
def process_save_contacts(data):
|
||||||
logger.info(f"Process_save_contacts IN -> : {data}", exc_info=True)
|
logger.info(f"Process_save_contacts IN -> : {data}", exc_info=True)
|
||||||
message = data.get('message', '')
|
try:
|
||||||
subscription_uid = data.get('subscription_uid', '')
|
|
||||||
title = data.get('title', '')
|
message = data.get('message', '')
|
||||||
email = data.get('email', '')
|
subscription_uid = data.get('subscription_uid', '')
|
||||||
sender = data.get('sender', '')
|
title = data.get('title', '')
|
||||||
memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid)
|
email = data.get('email', '')
|
||||||
if memSubb:
|
sender = data.get('sender', '')
|
||||||
member_id = memSubb.member_id,
|
contact_result = []
|
||||||
product_id = memSubb.product_id
|
memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid)
|
||||||
if message != '' and title != '' and email != '' and sender != '':
|
if memSubb:
|
||||||
logger.info(f"Ready to save data: {data}", exc_info=True)
|
member_id = memSubb.member_id,
|
||||||
ProductsContacts.add_product_contact(
|
product_id = memSubb.product_id
|
||||||
member_id, product_id, subscription_uid, title, email, sender, message
|
if message != '' and title != '' and email != '' and sender != '':
|
||||||
)
|
logger.info(f"Ready to save data: {data}", exc_info=True)
|
||||||
|
contact_result = ProductsContacts.add_product_contact(
|
||||||
|
member_id, product_id, subscription_uid, title, email, sender, message
|
||||||
|
)
|
||||||
|
|
||||||
|
response_data = {
|
||||||
|
"last_message": datetime.datetime.utcnow(),
|
||||||
|
"subscription_uid": subscription_uid,
|
||||||
|
"result": contact_result,
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseHelper.success(data=response_data)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
|
return ResponseHelper.internal_server_error()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user