Discuz 论坛 版主回复后在帖子列表后加版主回复字样

 找到 存储过程 dnt_gettopiclist

ALTER PROCEDURE [dbo].[dnt_gettopiclist]   
@fid int,
@pagesize int, 
@startnum int, 
@pageindex int 
AS
DECLARE @strSQL varchar(5000)
if object_id('tempdb..#a') is not null drop table #a --创建临时表
select distinct a.tid,'<font color=red>版主回复</font>' tailtitle into #a
 from dnt_posts1 a,dnt_users b where a.posterid=b.uid
and a.fid=@fid and b.groupid<=3--用户组别<=3的

--之后topics 与临时表#a 再做左连接就可以实现了

IF @pageindex = 1  BEGIN   SET @strSQL = 'SELECT TOP ' + STR(@pagesize) +' [rate],a.[tid],[iconid],[typeid],[title],b.tailtitle,[price],[hide],[readperm],

[special],[poster],[posterid],[replies],[views],[postdatetime],[lastpost],[lastposter],

[lastpostid],[lastposterid],[replies],[highlight],[digest],[displayorder],[attachment],[closed],[magic],[special] FROM

[dnt_topics] a left join #a b on a.tid=b.tid WHERE [fid]=' +STR(@fid) + ' AND [displayorder]=0  ORDER BY [lastpostid] DESC'  END ELSE  BEGIN   SET @strSQL = 'SELECT TOP ' + STR(@pagesize) +'[rate], a.[tid],[iconid],[typeid],[title],b.tailtitle,[price],[hide],[readperm],

[special],[poster],[posterid],[replies],[views],[postdatetime],[lastpost],[lastposter],

[lastpostid],[lastposterid],[replies],[highlight],[digest],[displayorder],[attachment],[closed],[magic],[special] FROM

[dnt_topics] a left join #a b on a.tid=b.tid WHERE [lastpostid] < (SELECT min([lastpostid])  FROM (SELECT TOP ' + STR

((@pageindex-1)*@pagesize-@startnum) + ' [lastpostid] FROM [dnt_topics] WHERE [fid]=' +STR

(@fid) + ' AND [displayorder]=0 ORDER BY [lastpostid] DESC) AS tblTmp )

AND [fid]=' +STR(@fid) + ' AND [displayorder]=0 ORDER BY [lastpostid] DESC'  END  print @strSQL EXEC(@strSQL)


 
展开阅读全文

没有更多推荐了,返回首页