Example #1
0
 /**
  * Отправляем письма уведомления о заказе на базе ТУ заказчику и исполнителю.
  * 
  * @param array $order
  * @return boolean
  */
 public function _newOrder($order)
 {
     if (empty($order)) {
         return FALSE;
     }
     $employer = new employer();
     $employer->GetUserByUID(@$order['emp_id']);
     if (!$employer->uid) {
         return FALSE;
     }
     $freelancer = new freelancer();
     $freelancer->GetUserByUID(@$order['frl_id']);
     if (!$freelancer->uid) {
         return FALSE;
     }
     //Отправляем заказчику
     $this->recipient = $this->_formatFullname(&$employer, true);
     $template = $order['pay_type'] == 1 ? 'new_order_reserve_emp.tpl.php' : 'new_order_emp.tpl.php';
     $this->message = Template::render(TSERVICES_TPL_MAIL_PATH . $template, array('smail' => &$this, 'order' => $order, 'params' => $this->_addUrlParams('e'), 'frl_fullname' => $this->_formatFullname(&$freelancer)));
     $ret_e = $this->send('text/html');
     //Отправляем фрилансеру
     $this->recipient = $this->_formatFullname(&$freelancer, true);
     $template = $order['pay_type'] == 1 ? 'new_order_reserve_frl.tpl.php' : 'new_order_frl.tpl.php';
     $message = Template::render(TSERVICES_TPL_MAIL_PATH . $template, array('smail' => &$this, 'order' => $order, 'params' => $this->_addUrlParams('f'), 'emp_fullname' => $this->_formatFullname(&$employer)));
     $this->message = nl2br($message);
     $ret_f = $this->send('text/html');
     //Сообщение в ЛС
     messages_tservices::sendOrderStatus($freelancer->login, $message);
     //Сообщение СМС
     $status = $order['pay_type'] == 1 ? tservices_sms::STATUS_NEW_RESERVE : TServiceOrderModel::STATUS_NEW;
     tservices_sms::model($freelancer->uid)->sendOrderStatus($status, $order['id']);
     return $ret_e && $ret_f;
 }
Example #2
0
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '512M');
if (!isset($_SERVER['DOCUMENT_ROOT']) || !strlen($_SERVER['DOCUMENT_ROOT'])) {
    $_SERVER['DOCUMENT_ROOT'] = rtrim(realpath(pathinfo(__FILE__, PATHINFO_DIRNAME) . '/../../'), '/');
}
//define('IN_STDF',1);
//require_once $_SERVER['DOCUMENT_ROOT'].'/classes/memBuff.php';
//require_once($_SERVER['DOCUMENT_ROOT'] . '/classes/DB.php');
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
//require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/config.php");
//require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/profiler.php");
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages_tservices.php';
//------------------------------------------------------------------------------
$results = array();
//$profiler = new profiler();
//------------------------------------------------------------------------------
//$profiler->start('fill_frl_mem');
//------------------------------------------------------------------------------
messages_tservices::sendOrderStatus();
//------------------------------------------------------------------------------
//$profiler->stop('fill_frl_mem');
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
array_walk($results, function (&$value, $key) {
    $value = sprintf('%s = %s' . PHP_EOL, $key, $value);
});
print_r(implode('', $results));
exit;