本文整理汇总了PHP中FDB::talbe方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::talbe方法的具体用法?PHP FDB::talbe怎么用?PHP FDB::talbe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDB
的用法示例。
在下文中一共展示了FDB::talbe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserActivityLog
/**
* 会员最新动态日志获取
* by fishsword
* @param uid 会员ID num 取出指定数量
* @return array
* */
public function getUserActivityLog($uid, $num = 10)
{
if (!$uid) {
return;
}
$sql = 'select * from ' . FDB::table('user_activity_log') . ' where uid = ' . $uid . ' order by create_time desc limit ' . $num;
$res = FDB::query($sql);
$log_data = array();
while ($data = FDB::fetch($res)) {
$mes = array();
switch ($data['type']) {
case 1:
$f_name = FDB::resultFirst("select user_name from " . FDB::table("user") . " where uid = " . $data['object_id']);
$u_url = FU('u/index', array('uid' => $data['object_id']));
$user_info = '<a href="' . $u_url . '">' . $f_name . '</a>';
$mes['message'] = printf(lang('user', 'user_follow_log'), $user_info);
break;
case 2:
$c_uid = FDB::resultFirst("select c_uid from " . FDB::table("user_collect") . " where uid = " . $uid . " and share_id = " . $data['object_id']);
$share_name = FDB::resultFirst("select title from " . FDB::talbe("share") . " where share_id = " . $data['object_id']);
$user_name = FDB::resultFirst("select user_name from " . FDB::table("user") . " where uid = " . $c_uid);
$u_url = FU('u/index', array('uid' => $c_uid));
$user_info = '<a href="' . $u_url . '">' . $user_name . '</a>';
$share_url = FU('note/index', array('sid' => $data['object_id']));
$share_info = '<a href="' . $share_url . '">' . $share_name . '</a>';
$mes['message'] = printf(lang('user', 'user_collect_log'), $user_info, $share_info);
break;
case 3:
$comment_id = $data['object_id'];
$comment_data = FDB::fetchFirst("select * from " . FDB::table('share_comment') . " where comment_id = " . $comment_id);
$user_name = FDB::resultFirst("select user_name from " . FDB::table('user') . " where uid = " . $comment_data['uid']);
$share_name = FDB::resultFirst("select title from " . FDB::table('share') . " where share_id = " . $comment_data['share_id']);
$mes['uid'] = $comment_data['uid'];
$u_url = FU('u/index', array('uid' => $comment_data['uid']));
$user_info = '<a href="' . $u_url . '">' . $user_name . '</a>';
$share_url = FU('note/index', array('sid' => $comment_data['share_id']));
$share_info = '<a href="' . $share_url . '">' . $share_name . '</a>';
if ((int) $comment_data['parent_id'] > 0) {
$mes['message'] = printf(lang('user', 'user_repeate_comment_log'), $user_name, $share_info);
} else {
$mes['message'] = printf(lang('user', 'user_comment_log'), $user_name, $share_info);
}
break;
case 4:
//预留
break;
case 5:
//预留
break;
case 6:
$share_id = $data['object_id'];
$sql = 'select sp.img as img,al.id as album_id,al.title as album_name from ' . FDB::table("share") . ' as s
left join ' . FDB::table('album_share') . ' as als on als.share_id = s.share_id left join ' . FDB::table('album') . ' as al
on als.album_id = al.id where s.share_id = ' . $share_id;
$share_info = FDB::fetchFirst($share_info);
$img_url = getImgName($share_info['img'], 38, 38, 1, true);
$img_info = '<a href="' . FU('note/index', array('sid' => $share_id['share_id'])) . '" class="img"><img src="' . $img_url . '" width = 38 height = 38 /></a>';
$album_info = '<a href="' . FU("album/show", array('id' => $album['id'])) . '">' . $share_info['album_name'] . '</a>';
$mes['message'] = printf(lang('user', 'user_share_log'), $img_info, $album_info);
break;
case 7:
$album_follow_id = $data['object_id'];
$sql = 'select u.uid as uid, u.user_name as user_name,al.title as album_name,alf.album_id as album_id from ' . FDB::table('album_follow') . ' as alf
left join ' . FDB::table('album') . ' as al on alf.album_id = al.id left join ' . FDB::table('user') . ' as u on alf.uid = u.f_uid
where alf.id = ' . $album_follow_id;
$album_info = FDB::fetchFirst($sql);
$u_url = FU('u/index', array('uid' => $album_info['uid']));
$album_url = FU("album/show", array('id' => $album_info['album_id']));
$user_info = '<a href="' . $u_url . '">' . $album_info['user_name'] . '</a>';
$album_info = '<a href="' . $album_url . '">' . $album_info['album_name'] . '</a>';
$mes['message'] = printf(lang('user', 'user_album_log'), $user_info, $album_info);
break;
}
$log_data[] = $mes;
}
return $log_data;
}