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[database_id]=" + str(customer.customer_id) + \
|
||||||
"&mauticform[lang]=" + str(customer.lang) + \
|
"&mauticform[lang]=" + str(customer.lang) + \
|
||||||
"&mauticform[formId]=7" + \
|
"&mauticform[formId]=7" + \
|
||||||
"&mauticform[formName]=appdatachange"
|
"&mauticform[formName]=appdatasync"
|
||||||
|
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class Mautic:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def syncTrial(self):
|
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 = logging.getLogger(__name__)
|
||||||
logger.info("Syncronising trial date...")
|
logger.info("Syncronising trial date...")
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ class Mautic:
|
|||||||
for customer in qs:
|
for customer in qs:
|
||||||
data = "mauticform[email]=" + customer.email + \
|
data = "mauticform[email]=" + customer.email + \
|
||||||
"&mauticform[database_id]=" + str(customer.customer_id) + \
|
"&mauticform[database_id]=" + str(customer.customer_id) + \
|
||||||
"&mauticform[trialdate]=" + str(customer.trial_date) + \
|
"&mauticform[trialdate]=1900-01-01" + \
|
||||||
"&mauticform[formId]=7" + \
|
"&mauticform[formId]=7" + \
|
||||||
"&mauticform[formName]=appdatachange"
|
"&mauticform[formName]=appdatasync"
|
||||||
|
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
|
@ -3,17 +3,6 @@ from ..automation.mautic import Mautic
|
|||||||
from django_cron import CronJobBase, Schedule
|
from django_cron import CronJobBase, Schedule
|
||||||
import datetime
|
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):
|
class NotificationJob(CronJobBase):
|
||||||
notif = NotificationExec()
|
notif = NotificationExec()
|
||||||
RUN_EVERY_MINS = 5
|
RUN_EVERY_MINS = 5
|
||||||
|
2
cron.sh
2
cron.sh
@ -1,2 +1,2 @@
|
|||||||
export $(cat /aitrainer_backoffice.env | xargs)
|
export $(cat /aitrainer_backoffice/.env | xargs)
|
||||||
/usr/local/bin/python /aitrainer_backoffice/aitrainer_backoffice/manage.py runcrons --settings aitrainer_backoffice.settings.deploy >> /var/log/cronjob.log 2>&1
|
/usr/local/bin/python /aitrainer_backoffice/aitrainer_backoffice/manage.py runcrons --settings aitrainer_backoffice.settings.deploy >> /var/log/cronjob.log 2>&1
|
Loading…
Reference in New Issue
Block a user