public function send() { $to = $this->getString('to'); $title = $this->getString('title'); $content = $this->getString('content'); $taskId = $this->getString('taskId'); common\loadClass::getService('Mail')->send($to, $title, $content, $taskId); return null; }
protected function initUsedModel() { $pattern = "/(Model)\$/si"; $vars = get_class_vars(get_class($this)); $models = common\Utils::preg_grep_keys($pattern, $vars); if (!empty($models)) { foreach ($models as $model) { $this->{$model} = common\loadClass::getModel($model); } } }
public function online() { $olUids = common\Utils::online(); $idsArr = \array_keys($olUids); $where = "id in (" . implode(',', $idsArr) . ")"; $userInfo = common\loadClass::getService('User')->fetchWhere($where); $result = array(); foreach ($userInfo as $user) { $result[$user->id] = $user->hash(); } return $result; }
public function savereg() { $username = $this->getString($this->params, 'username'); $password = $this->getString($this->params, 'password'); $icon = $this->getString($this->params, 'icon', 'noface.jpg'); $service = common\loadClass::getService('User'); $result = $service->addUser($username, $password, $icon); if ($result) { return common\Utils::jump("main", "main", array("msg" => "注册成功")); } return common\Utils::showMsg("注册失败"); }
public function getOnlineList() { $olUids = common\Utils::online(); if (empty($olUids)) { return array(); } $idsArr = \array_keys($olUids); $where = "id in (" . implode(',', $idsArr) . ")"; $userInfo = common\loadClass::getService('User')->fetchWhere($where); $result = array(); foreach ($userInfo as $user) { $result[$user->id] = $user->hash(); } $this->sendOne(Request::getFd(), common\Cmd::OLLIST, $result); }
private function initUsedModel() { $pattern = "/(Model)\$/si"; $vars = get_class_vars(get_class($this)); $models = common\Utils::preg_grep_keys($pattern, $vars); if (!empty($models)) { foreach ($models as $model) { $this->{$model} = common\loadClass::getModel($model); } } //add Service $servicePattern = "/(Service)\$/si"; $services = common\Utils::preg_grep_keys($servicePattern, $vars); if (!empty($services)) { foreach ($services as $service) { $this->{$service} = common\loadClass::getService($service); } } }
public function send($to, $title, $content, $taskId) { $mail = common\loadClass::getPhpMail(); $mail->isSMTP(); $mail->Host = ZConfig::getField('mail', 'smtp_host'); $mail->Port = ZConfig::getField('mail', 'smtp_port', 25); $mail->SMTPAuth = true; $mail->Username = ZConfig::getField('mail', 'username'); $mail->Password = ZConfig::getField('mail', 'password'); $mail->setFrom(ZConfig::getField('mail', 'from', $mail->Username), ZConfig::getField('mail', 'sendname', 'zmail_server')); $mail->addAddress($to); $mail->Subject = $title; $mail->Body = $content; if (!$mail->send()) { common\Log::info([$taskId, $to, $title, $content, $mail->ErrorInfo], 'error'); return false; } common\Log::info([$taskId, $to, $title, $content, $mail->ErrorInfo], 'success'); return true; }
public function __construct() { $this->dao = common\loadClass::getDao('User'); }
public function _after() { common\loadClass::getDao('User')->closeDb(); }
public function offline() { common\loadClass::getService('Chat')->offline(); }
private static function getModel($name) { if (!isset(self::$model[$name])) { self::$model[$name] = common\loadClass::getModel($name); } return self::$model[$name]; }