找回密码
 快速注册
搜索
查看: 49|回复: 3

按赞数

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2023-11-5 01:23 |阅读模式
本帖最后由 hbghlyj 于 2023-11-5 14:50 编辑 Facebook帖文下方显示总按赞数,光标悬停时显示谁按过赞: Screenshot 2023-11-04 170050.png
Instagram帖文下方显示“某人、某人和其他人都说赞”: ig-hidden-likes-3[1].jpg
点击“其他人”显示谁按过赞: 183808jj3zfm6fiz39jy6h.jpg

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-11-5 01:26
本帖最后由 hbghlyj 于 2023-11-5 21:27 编辑 Discuz帖子下方显示总按赞数,光标悬停时还是显示总按赞数,有点重复: Screenshot 2023-11-04 175351.png
Discuz的1楼“哪些用户按过赞”存储在forum_memberrecommend表中
非1楼的帖子的“总按赞数”存储在forum_hotreply_number表中
“哪些用户按过赞”存储在forum_hotreply_member表中

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-11-5 03:02
本帖最后由 hbghlyj 于 2023-11-5 21:28 编辑 source/module/forum/forum_viewthread.php第822行
  1. $postlist[$pid]['postreview']['support'] = dintval($post['support'])
复制代码
改为
  1. if($postlist[$pid]['postreview']['support'] = dintval($post['support'])){
  2.         $postlist[$pid]['postreview']['support_member'] = '';
  3.         foreach(DB::fetch_all('SELECT uid FROM '.DB::table('forum_hotreply_member').' WHERE pid='.$pid) as $row){
  4.                 $postlist[$pid]['postreview']['support_member'] .= DB::fetch_first('SELECT username FROM '.DB::table('common_member').' WHERE uid='.$row['uid'])['username']."\n";
  5.         }
  6. }
复制代码

template/default/forum/viewthread_node.htm搜索<a class="replyadd"所在的行,改为:
  1. <a class="replyadd" href="forum.php?mod=misc&action=postreview&do=support&tid=$_G[tid]&pid=$post[pid]&hash={FORMHASH}" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', '');return false;"{else} onclick="showWindow('login', this.href)"{/if} title="$post[postreview]['support_member']"><!--$_G['setting']['recommendthread'][addtext]--> <span id="review_support_$post[pid]">$post[postreview][support]</span></a>
复制代码
再搜索fico-thumbup fc-l所在的行,改为
  1. <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$_G[tid]&hash={FORMHASH}" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} {if $_G['forum_thread']['recommend_add']}title="<!--{eval $supportmember='';foreach(DB::fetch_all('SELECT `recommenduid` FROM '.DB::table('forum_memberrecommend').' WHERE tid='.$_G['tid']) as $row)$supportmember .= DB::fetch_first('SELECT username FROM '.DB::table('common_member').' WHERE uid='.$row['recommenduid'])['username']."\n";}-->$supportmember"{/if}><i><em class="fico-thumbup fc-l"></em><!--$_G['setting']['recommendthread'][addtext]--><span id="recommendv_add"{if !$_G['forum_thread']['recommend_add']} style="display:none"{/if}>$_G[forum_thread][recommend_add]</span></i></a>
复制代码

修改后已经能显示谁按过赞: Screenshot 2023-11-04 190014.png

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-11-5 03:11
本帖最后由 hbghlyj 于 2023-11-5 23:59 编辑 其中
  1. DB::fetch_first('SELECT username FROM '.DB::table('common_member').' WHERE uid='.$row['uid'])['username']
复制代码
的作用是查询uid对应的用户名。每次都查询数据库太耗资源,不知有没有Discuz内建的函数?

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:37

Powered by Discuz!

× 快速回复 返回顶部 返回列表