Beispiel #1
0
 function send($type, $uid, $tid = 0, $event_id = 0)
 {
     $id = $this->put(array('ftype' => $type, 'uid' => $uid, 'tid' => $tid, 'eventid' => $event_id));
     $user = $this->swoole->model->UserInfo->getInfo($uid);
     $this->db->query("update {$this->table} set nickname='{$user['nickname']}' where id={$id}");
     if ($tid !== 0) {
         $feed_type = SiteDict::get('feed_type');
         $user['info'] = $feed_type[$type][0];
         $user['look'] = $feed_type[$type][1];
         $user['link'] = $feed_type[$type][2];
         $user['event'] = $event_id;
         //UserMsg::insertMsg($tid,'feeds',$user);
     }
 }
Beispiel #2
0
<?php

global $php;
SiteDict::$swoole = $php;
/**
 * 字典处理器,依赖于缓存系统
 * 读取/写入来自于文件系统的一个数据,并写入缓存
 * @author Tianfeng.Han
 * @package SwooleSystem
 * @subpackage dict
 */
class SiteDict
{
    static $swoole;
    static $cache_life = 600;
    static $data_dir = DICTPATH;
    public $table = 'site_dict';
    function __construct()
    {
        #import('app.SwooleDict');
    }
    /**
     * 读取字典内容
     * @param $dictname
     */
    static function get($dictname)
    {
        if (!self::$swoole->cache) {
            Error::info('SiteDict Cache Error', 'Please load Cache!');
        }
        $cache_key = 'sitedict_' . $dictname;
function smarty_function_sitedict($params, &$smarty)
{
    $var = SiteDict::get($params['from']);
    $smarty->assign($params['_name'], $var);
}