Backup/Discuz.Data.SqlServer/WebsiteManage.cs

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Data.Common;

using Discuz.Config;
using Discuz.Common;

namespace Discuz.Data.SqlServer
{
    public partial class DataProvider : IDataProvider
    {
        private DbParameter[] GetParms(string startDate, string endDate)
        {
            DbParameter[] parms = new DbParameter[2];
            if (startDate != "")
                parms[0] = DbHelper.MakeInParam("@startdate", (DbType)SqlDbType.DateTime, 8, DateTime.Parse(startDate));
  
            if (endDate != "")
                parms[1] = DbHelper.MakeInParam("@enddate", (DbType)SqlDbType.DateTime, 8, DateTime.Parse(endDate).AddDays(1));

            return parms;
        }

        public DataTable GetTopicListByCondition(string postName, int forumId, string posterList, string keyList, string startDate, string endDate, int pageSize, int currentPage)
        {
            string commandText = "";
            string condition = GetCondition(posterList, keyList, startDate, endDate);

            DbParameter[] parms = GetParms(startDate, endDate);

            int pageTop = (currentPage - 1) * pageSize;
            int minTid = DatabaseProvider.GetInstance().GetMinPostTableTid(postName);
            int maxTid = DatabaseProvider.GetInstance().GetMaxPostTableTid(postName);

            string fidCondition = forumId > 0 ? string.Format(" f.[fid]={0} OR CHARINDEX(',{0},',','+RTRIM(f.[parentidlist])+',')<>0 AND ", forumId) : "";

            if (currentPage == 1)
            {
                commandText = string.Format("SELECT TOP {0} {1},f.[name] FROM [{2}topics] t JOIN " + 
                    "(SELECT f.[fid],f.[name] FROM [{2}forums] f LEFT JOIN [{2}forumfields] ff " + 
                    "ON f.[fid]=ff.[fid] AND (ff.[viewperm] IS NULL OR CONVERT(NVARCHAR(1000),ff.[viewperm])='' " + 
                    "OR CHARINDEX(',7,',','+CONVERT(NVARCHAR(1000),ff.[viewperm])+',')<>0) WHERE {3} " +
                    "[password]='' AND [status]=1) AS f ON t.[fid]=f.[fid] " + 
                    "WHERE [tid]>={4} AND [tid]<={5} AND [closed]<>1 {6} ORDER BY [tid] DESC",
                                     pageSize, 
                                     DbFields.TOPICS_JOIN, 
                                     BaseConfigs.GetTablePrefix,
                                     fidCondition,
                                     minTid,
                                     maxTid,
                                     condition);
            }
            else
            {
                commandText = string.Format("SELECT TOP {0} {1},f.[name] FROM [{2}topics] t JOIN" + 
                    "(SELECT f.[fid],f.[name] FROM [{2}forums] f LEFT JOIN [{2}forumfields] ff ON f.[fid]=ff.[fid] AND" +  
                    "(ff.[viewperm] IS NULL OR CONVERT(NVARCHAR(1000),ff.[viewperm])='' OR CHARINDEX(',7,',','+CONVERT(NVARCHAR(1000),ff.[viewperm])+',')<>0) " +
                    "WHERE {3} [password]='' AND [status]=1) AS f ON t.[fid]=f.[fid] " +
                    "WHERE [tid]>={4} AND [tid]<(SELECT MIN([tid]) FROM (SELECT TOP {6} [tid] FROM [{2}topics] t JOIN " +
                    "(SELECT f.[fid],f.[name] FROM [{2}forums] f LEFT JOIN [{2}forumfields] ff ON f.[fid]=ff.[fid] AND" +
后面还有 153 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。