BO 1.34+4 trial sync
This commit is contained in:
parent
a4a6a5ef36
commit
67ac1e1ddd
@ -29,7 +29,7 @@ class Mautic:
|
||||
"&mauticform[database_id]=" + str(customer.customer_id) + \
|
||||
"&mauticform[lang]=" + str(customer.lang) + \
|
||||
"&mauticform[formId]=7" + \
|
||||
"&mauticform[formName]=appdatachange"
|
||||
"&mauticform[formName]=appdatasync"
|
||||
|
||||
print(data)
|
||||
|
||||
@ -49,7 +49,7 @@ class Mautic:
|
||||
return True
|
||||
|
||||
def syncTrial(self):
|
||||
qs = Customer.objects.raw('SELECT * from customer WHERE trial_date is not null and trial_date != "1900-01-01 00:00:00 00:00" and trial_date_sync is null')
|
||||
qs = Customer.objects.raw('select * FROM customer WHERE trial_date <= NOW() - INTERVAL 10 DAY and trial_date_sync is null')
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info("Syncronising trial date...")
|
||||
|
||||
@ -61,9 +61,9 @@ class Mautic:
|
||||
for customer in qs:
|
||||
data = "mauticform[email]=" + customer.email + \
|
||||
"&mauticform[database_id]=" + str(customer.customer_id) + \
|
||||
"&mauticform[trialdate]=" + str(customer.trial_date) + \
|
||||
"&mauticform[trialdate]=1900-01-01" + \
|
||||
"&mauticform[formId]=7" + \
|
||||
"&mauticform[formName]=appdatachange"
|
||||
"&mauticform[formName]=appdatasync"
|
||||
|
||||
print(data)
|
||||
|
||||
|
@ -3,17 +3,6 @@ from ..automation.mautic import Mautic
|
||||
from django_cron import CronJobBase, Schedule
|
||||
import datetime
|
||||
|
||||
|
||||
class MyCronJob(CronJobBase):
|
||||
|
||||
RUN_EVERY_MINS = 60
|
||||
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
||||
code = 'aitrainer_backoffice.controlling.cron' # a unique code
|
||||
|
||||
def do(self):
|
||||
print(datetime.datetime.now(), " *** START sync customers ")
|
||||
|
||||
|
||||
class NotificationJob(CronJobBase):
|
||||
notif = NotificationExec()
|
||||
RUN_EVERY_MINS = 5
|
||||
|
Loading…
Reference in New Issue
Block a user