本文整理匯總了PHP中Mautic\CoreBundle\Factory\MauticFactory::getIpAddress方法的典型用法代碼示例。如果您正苦於以下問題:PHP MauticFactory::getIpAddress方法的具體用法?PHP MauticFactory::getIpAddress怎麽用?PHP MauticFactory::getIpAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getIpAddress方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: changePoints
/**
* @param $lead
* @param MauticFactory $factory
* @param $action
* @param $config
* @param $form
*/
public static function changePoints($lead, MauticFactory $factory, $action, $config, $form)
{
$model = $factory->getModel('lead');
//create a new points change event
$event = new PointsChangeLog();
$event->setType('form');
$event->setEventName($form->getId() . ":" . $form->getName());
$event->setActionName($action->getName());
$event->setIpAddress($factory->getIpAddress());
$event->setDateAdded(new \DateTime());
$event->setDelta($config['points']);
$event->setLead($lead);
$lead->addPointsChangeLog($event);
$lead->addToPoints($config['points']);
$model->saveEntity($lead, false);
}
示例2: changePoints
/**
* @param $event
* @param $lead
*
* @return bool
*/
public static function changePoints($event, $lead, MauticFactory $factory)
{
$points = $event['properties']['points'];
$somethingHappened = false;
if ($lead != null && !empty($points)) {
$lead->addToPoints($points);
//add a lead point change log
$log = new PointsChangeLog();
$log->setDelta($points);
$log->setLead($lead);
$log->setType('campaign');
$log->setEventName("{$event['campaign']['id']}: {$event['campaign']['name']}");
$log->setActionName("{$event['id']}: {$event['name']}");
$log->setIpAddress($factory->getIpAddress());
$log->setDateAdded(new \DateTime());
$lead->addPointsChangeLog($log);
$somethingHappened = true;
}
return $somethingHappened;
}