setup.ini 기능추가

[days]
from=####-##-## (시작 날짜 설정)
to=####-##-## (종료 날짜 설정

git-svn-id: svn://192.168.0.12/source@242 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
admin
2016-01-19 06:53:10 +00:00
parent 21b11500bd
commit 7b9bddc989
2 changed files with 29 additions and 4 deletions

View File

@@ -34,6 +34,12 @@ bool SFilterProcess::ReloadSetup()
settings.beginGroup(QString("settings")); settings.beginGroup(QString("settings"));
if (settings.childKeys().size() == 0) return false; if (settings.childKeys().size() == 0) return false;
m_nCutDays = settings.value("days").toInt(); 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.endGroup();
settings.beginGroup(QString("spammers")); settings.beginGroup(QString("spammers"));
@@ -783,7 +789,7 @@ void SFilterProcess::DataMake(int _nCategory,QVector <QStringList> *_data, bool
} }
} }
foreach(QString strUrl , m_strlistOrder ) foreach(QString strUrl , m_strlistOrder)
{ {
if (mapData.contains(strUrl)) if (mapData.contains(strUrl))
{ {
@@ -862,9 +868,26 @@ void SFilterProcess::DataLoad(QString _strDataNum)
m_mapCommunity.insert(" ",stCom); m_mapCommunity.insert(" ",stCom);
QString astrWhere[E_ARTICLE_MAX] = {" where article_form = 'body'"," where article_form = 'reply'"}; 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] += " and date(article_date) >= ";
astrWhere[E_ARTICLE_BODY] += QString::number(abs(m_nCutDays)); if(m_strStartDay.isEmpty())
astrWhere[E_ARTICLE_BODY] += " DAY)) and date(article_date) <= date(now()) "; {
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"; astrWhere[E_ARTICLE_BODY] += " Order by article_date DESC";
for (int i = 0; i < E_ARTICLE_MAX ; i++) for (int i = 0; i < E_ARTICLE_MAX ; i++)
{ {

View File

@@ -257,6 +257,8 @@ private:
double m_adSpammer[E_SPAMER_MAX]; double m_adSpammer[E_SPAMER_MAX];
int m_nCutDays; int m_nCutDays;
QString m_strStartDay;
QString m_strEndDay;
QVector <SKeyword> m_vecKeyword; QVector <SKeyword> m_vecKeyword;
QMap <QString,int> m_mapReply; QMap <QString,int> m_mapReply;