V1.30.7 notification fix

This commit is contained in:
Tibor Bossanyi (Freelancer) 2021-10-02 14:33:12 +02:00
parent 52212fb949
commit 3ddddf906a
2 changed files with 6 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class FCM:
#notification_image_url = image_url #notification_image_url = image_url
#if image_url == None: #if image_url == None:
notification_image_url = self.logo_url notification_image_url = self.logo_url
registration_token = 'cOqNt8rzo074gbIkBSpCgW:APA91bEBuNi3iVzGKb4JhxqN2j80MoJbNptLHk2qsdeKBQz5grpHtrPPXvDqn5BJVVSaj1nwGPwgN7pi6FIApog_TTP3g1yobgmgpPN6udrYgzILlVPMvdGGFDSDh6gKlczhlTL9NEp0' #registration_token = 'cOqNt8rzo074gbIkBSpCgW:APA91bEBuNi3iVzGKb4JhxqN2j80MoJbNptLHk2qsdeKBQz5grpHtrPPXvDqn5BJVVSaj1nwGPwgN7pi6FIApog_TTP3g1yobgmgpPN6udrYgzILlVPMvdGGFDSDh6gKlczhlTL9NEp0'
print(f'image: {notification_image_url}' ) print(f'image: {notification_image_url}' )
@ -95,3 +95,5 @@ class FCM:
return rc return rc
def get_message():
pass

View File

@ -22,17 +22,18 @@ class Notification:
if hook_sql == None: if hook_sql == None:
customers = getattr(hook, hook_function)() customers = getattr(hook, hook_function)()
else: else:
print(f'execute {hook_function} with sql {hook_sql}')
customers = getattr(hook, hook_function)(hook_sql) customers = getattr(hook, hook_function)(hook_sql)
for customer in customers: for customer in customers:
if customer.firebase_reg_token != None: if customer.firebase_reg_token != None and customer.customer_id != None:
print(f'-- Notify Customer {customer.customer_id}') print(f'-- Notify Customer {customer.customer_id}')
rc= self.fcm.send_to_token(notification.message_title, notification.message_body, notification.image_url, customer.firebase_reg_token) rc= self.fcm.send_to_token(notification.message_title, notification.message_body, notification.image_url, customer.firebase_reg_token)
self.insert_history(notification=notification, customer=customer, rc=rc) self.insert_history(notification=notification, customer=customer, rc=rc)
except Exception as ex: except Exception as ex:
print(f'Notification Hook {notification.schedule_hook} has no callback function: {ex}') print(f'Error in execution of the notification {notification.internal_name}: {ex}')
def insert_history(self, notification, customer, rc): def insert_history(self, notification, customer, rc):
history = NotificationHistory() history = NotificationHistory()