Hi 您目前尚未登陆
请选择 进入手机版 | 继续访问电脑版

Admin

送给“上官雨伦”:做教师的人自己便当具有良好的教养,随人、随时、随地,都有适当的举止与礼貌。受过教育而无教养的人是一堆一文不值的垃圾。
演示站完全是自己仿的!所有帖子是胡乱发的,大家请无视!插件和模板都下载自垃圾的,没偷没抢!!!

Discuz! X 数据查询表 - 常用查询 heatlevel

2020-04-25 19:36:23 发布

Discuz /[教程] 55 0 0

adminWriter

来自中国,不是教师

47

主题

48

帖子

48

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
48
发表于 2020-4-25 19:36:23 | 显示全部楼层 |阅读模式
调用最新主题
  1. $new=DB::fetch_all("SELECT tid,subject FROM ".DB::table('forum_thread')." ORDER BY `dateline` desc LIMIT 0,1;");
复制代码

调用最新主题封面图
  1. $img=DB::fetch_all("SELECT a.subject,a.tid,b.attachment FROM ".DB::table("forum_thread")." a LEFT JOIN ".DB::table("forum_threadimage")." b on b.tid=a.tid WHERE a.`attachment`=2 ORDER BY a.`dateline` DESC LIMIT 0,5");
复制代码

调用当前登录用户阅读权限
  1. $read=DB::result(DB::query("SELECT b.readaccess FROM ".DB::table('common_member')." a left join ".DB::table('common_usergroup_field')." b on b.groupid=a.groupid WHERE a.`uid`= '$_G[uid]'"));
复制代码

调用常用统计数据
  1. //获取VERSION、RELEASE
  2. $version = unserialize($_G['setting']['cloudaddons_newversion']);

  3. //获取站长用户名
  4. $name = DB::result_first("select username from ".DB::table("common_member")." where uid = 1");

  5. //获取建站时间
  6. $time = DB::result_first("select regdate from ".DB::table("common_member")." where uid = 1");

  7. //获取模板个数
  8. $templates = DB::result_first("select count(styleid) from ".DB::table("common_style")."");

  9. //获取插件个数
  10. $plugins = DB::result_first("select count(pluginid) from ".DB::table("common_plugin")."");

  11. //获取会员人数
  12. $users = DB::result_first("select count(uid) from ".DB::table("common_member")."");

  13. //获取临时会员人数
  14. $guests = DB::result_first("select count(conopenid) from ".DB::table("common_connect_guest")."");

  15. //获取会员总人数
  16. $all_users = $users + $guests;

  17. //获取管理团队人数
  18. $admins = DB::result_first("select count(uid) from ".DB::table("common_member")." where groupid in (1,2)");

  19. //获取最新注册会员
  20. $newuser = DB::result_first("select username from ".DB::table("common_member")." order BY regdate desc");

  21. //获取发帖会员人数
  22. $post_posts = DB::result_first("select count(uid) from ".DB::table("common_member_count")." where posts > 0 ");

  23. //获取发表主题会员人数
  24. $post_threads = DB::result_first("select count(uid) from ".DB::table("common_member_count")." where threads > 0 ");

  25. //获取版块数
  26. $forums = DB::result_first("select count(fid) from ".DB::table("forum_forum")." where type = 'forum' and status in (0,1)");

  27. //获取总帖数
  28. $posts = DB::result_first("select count(pid) from ".DB::table("forum_post")."");

  29. //获取主题数
  30. $threads = DB::result_first("select count(tid) from ".DB::table("forum_thread")."");

  31. //获取精华主题数
  32. $digest = DB::result_first("select count(digest) from ".DB::table("forum_thread")." where digest > 0");

  33. //获取高亮主题数
  34. $highlight = DB::result_first("select count(highlight) from ".DB::table("forum_thread")." where highlight > 0");

  35. //获取置顶主题数
  36. $displayorder = DB::result_first("select count(displayorder) from ".DB::table("forum_thread")." where displayorder > 0");

  37. //获取附件主题数
  38. $attachment = DB::result_first("select count(tid) from ".DB::table("forum_thread")." where attachment > 0");

  39. //获取待审核主题数
  40. $moderate_threads = DB::result_first("select count(id) from ".DB::table("forum_thread_moderate")." where status = 0");

  41. //获取已忽略主题数
  42. $moderate_ignore_threads = DB::result_first("select count(id) from ".DB::table("forum_thread_moderate")." where status = 1");

  43. //获取待审核回复数
  44. $moderate_posts = DB::result_first("select count(id) from ".DB::table("forum_post_moderate")." where status = 0");

  45. //获取已忽略回复数
  46. $moderate_ignore_posts = DB::result_first("select count(id) from ".DB::table("forum_post_moderate")." where status = 1");

  47. //获取主题回收站数
  48. $recyclebin_threads = DB::result_first("select count(tid) from ".DB::table("forum_thread")." where displayorder = -1");

  49. //获取回复回收站数
  50. $recyclebin_posts = DB::result_first("select count(tid) from ".DB::table("forum_post")." where invisible = -5");

  51. //获取访问总数
  52. $views = DB::result_first("select sum(views) from ".DB::table("forum_thread")."");

  53. //获取回复总数
  54. $replies = DB::result_first("select sum(replies) from ".DB::table("forum_thread")."");

  55. //获取支持总数
  56. $recommend_add = DB::result_first("select sum(recommend_add) from ".DB::table("forum_thread")."");

  57. //获取反对总数
  58. $recommend_sub = DB::result_first("select sum(recommend_sub) from ".DB::table("forum_thread")."");

  59. //获取收藏总数
  60. $favtimes = DB::result_first("select sum(favtimes) from ".DB::table("forum_thread")."");

  61. //获取分享总数
  62. $sharetimes = DB::result_first("select sum(sharetimes) from ".DB::table("forum_thread")."");

  63. //获取会员:男性
  64. $users_man = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where gender = 1 ");

  65. //获取会员:女性
  66. $users_woman = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where gender = 2 ");

  67. //获取会员:80后
  68. $users_80 = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where birthyear > 1980 and birthyear < 1989 ");
复制代码

0 使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

当前话题还没有评论,来做第一个评论的人吧 ♪(^∇^*)