diff --git a/FilterProcess/sfilterprocess.cpp b/FilterProcess/sfilterprocess.cpp index 58194a0..6a6bd03 100644 --- a/FilterProcess/sfilterprocess.cpp +++ b/FilterProcess/sfilterprocess.cpp @@ -34,6 +34,12 @@ bool SFilterProcess::ReloadSetup() settings.beginGroup(QString("settings")); if (settings.childKeys().size() == 0) return false; m_nCutDays = settings.value("days").toInt(); + QString strFrom = settings.value("from").toString().trimmed(); + QString strTo = settings.value("to").toString().trimmed(); + if(!strFrom.isEmpty()) + m_strStartDay = "'" + strFrom + "'"; + if(!strTo.isEmpty()) + m_strEndDay = "'" + strTo + "'"; settings.endGroup(); settings.beginGroup(QString("spammers")); @@ -783,7 +789,7 @@ void SFilterProcess::DataMake(int _nCategory,QVector *_data, bool } } - foreach(QString strUrl , m_strlistOrder ) + foreach(QString strUrl , m_strlistOrder) { if (mapData.contains(strUrl)) { @@ -862,9 +868,26 @@ void SFilterProcess::DataLoad(QString _strDataNum) m_mapCommunity.insert(" ",stCom); QString astrWhere[E_ARTICLE_MAX] = {" where article_form = 'body'"," where article_form = 'reply'"}; - astrWhere[E_ARTICLE_BODY] += " and date(article_date) >= date(subdate(now(), INTERVAL "; - astrWhere[E_ARTICLE_BODY] += QString::number(abs(m_nCutDays)); - astrWhere[E_ARTICLE_BODY] += " DAY)) and date(article_date) <= date(now()) "; + astrWhere[E_ARTICLE_BODY] += " and date(article_date) >= "; + if(m_strStartDay.isEmpty()) + { + astrWhere[E_ARTICLE_BODY] += "date(subdate(now(), INTERVAL "; + astrWhere[E_ARTICLE_BODY] += QString::number(abs(m_nCutDays)); + astrWhere[E_ARTICLE_BODY] += " DAY))"; + } + else + { + astrWhere[E_ARTICLE_BODY] += "date(" + m_strStartDay + ") "; + } + if(m_strEndDay.isEmpty()) + { + astrWhere[E_ARTICLE_BODY] += " and date(article_date) <= date(now())"; + } + else + { + astrWhere[E_ARTICLE_BODY] += " and date(article_date) <= date(" + m_strEndDay + ")"; + } + astrWhere[E_ARTICLE_BODY] += " Order by article_date DESC"; for (int i = 0; i < E_ARTICLE_MAX ; i++) { diff --git a/FilterProcess/sfilterprocess.h b/FilterProcess/sfilterprocess.h index d26eb2c..a172382 100644 --- a/FilterProcess/sfilterprocess.h +++ b/FilterProcess/sfilterprocess.h @@ -257,6 +257,8 @@ private: double m_adSpammer[E_SPAMER_MAX]; int m_nCutDays; + QString m_strStartDay; + QString m_strEndDay; QVector m_vecKeyword; QMap m_mapReply;