Exemple #1
0
 function getUserThread($uid, $limit)
 {
     $data = $this->redis->get('User:getUserThread:uid' . $uid . ':limit' . $limit);
     if ($data == false) {
         $join['[>]thread_views'] = ['tid' => 'tid'];
         $join['[>]group'] = ['gid' => 'gid'];
         $where['AND'] = ['thread.authorid' => $uid, 'group.version' => '1.1', 'thread.closed' => 0, 'thread.status' => 0];
         $where['LIMIT'] = [$limit, 10];
         $data = $this->db->select('thread', $join, ['thread.tid', 'thread.gid', 'thread.subject', 'thread.dateline', 'thread_views.replies', 'thread_views.views'], $where);
         if (!empty($data)) {
             foreach ($data as $k => $v) {
                 $data[$k]['dateline'] = misc::tranTime($v['dateline']);
             }
         }
         $this->redis->set('User:getUserThread:uid' . $uid, $data, REDISTIME);
     }
     return $data;
 }