IndexAction::getUserAttachData PHP Method

getUserAttachData() private method

private getUserAttachData ( $uid, $limit = 4, $page = 1 )
    private function getUserAttachData($uid, $limit = 4, $page = 1)
    {
        $map['a.uid'] = $uid;
        $map['a.type'] = 'postimage';
        $map['is_del'] = 0;
        $limit_start = ($page - 1) * $limit;
        $list = D()->table('`' . C('DB_PREFIX') . 'feed` AS a LEFT JOIN `' . C('DB_PREFIX') . 'feed_data` AS b ON a.`feed_id` = b.`feed_id`')->field('a.`feed_id`, a.`publish_time`, b.`feed_data`')->where($map)->order('feed_id DESC')->limit($limit_start . ',' . $limit)->findAll();
        // 获取附件信息
        foreach ($list as &$value) {
            $tmp = unserialize($value['feed_data']);
            $attachId = is_array($tmp['attach_id']) ? intval($tmp['attach_id'][0]) : intval($tmp['attach_id']);
            $attachInfo = model('Attach')->getAttachById($attachId);
            $value['savepath'] = $attachInfo['save_path'] . $attachInfo['save_name'];
            $value['name'] = $attachInfo['name'];
            $value['body'] = parseForApi($tmp['body']);
        }
        return $list;
    }