카테고리 중간 수정버전

git-svn-id: svn://192.168.0.12/source@261 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
admin
2016-05-11 08:47:24 +00:00
parent d1adf4e8b4
commit bd8a037056
15 changed files with 712 additions and 226 deletions

View File

@@ -214,7 +214,8 @@ bool SInitializer::init(const QString& _strFilterProcessGroupID, const QString&
b_ok &= initFilterProcess();
b_ok &= initCompanyNum();
b_ok &= initPlatform();
b_ok &= initConsumerCategory();
//b_ok &= initConsumerCategory();
b_ok &= initCategory();
/*
if (!b_ok)
cout << "FALSE" << endl;
@@ -234,7 +235,7 @@ bool SInitializer::initInfluencer()
bool SInitializer::initFilterProcess()
{
QString strQuery = QString("select filterprocess_type,datagroup_id,filtergroup_id,company_num,category_num,filterprocess_order "
QString strQuery = QString("select filterprocess_type,datagroup_id,filtergroup_id,company_num,category_num,filterprocess_order,service_num "
"from filterprocess where filterprocessgroup_id = ") + QString::number(m_stFilterProcessGroup.m_nFilterProcessGroupID);
QSqlQuery query(m_sDBManager[SDBManager::E_DATABASE_DATA]);
@@ -255,6 +256,7 @@ bool SInitializer::initFilterProcess()
stfilterprocess.m_nCompanyNum = query.value(3).toInt();
stfilterprocess.m_nCategoryNum = query.value(4).toInt();
stfilterprocess.m_nFilterProcessOrder = query.value(5).toInt();
stfilterprocess.m_nServiceNum = query.value(6).toInt();
m_listFilterProcess.append(stfilterprocess);
}
@@ -288,7 +290,79 @@ bool SInitializer::initFilterProcess()
return true;
}
bool SInitializer::initCategory()
{
for (int i = 0; i < E_SERVICE_MAX; i++)
{
m_anAllCategory[i] = -1;
}
int company_num = -1;
foreach (const stFilterProcess& stfilterprocess, m_listFilterProcess)
{
if (stfilterprocess.m_nFilterProcessType == 2)
{
company_num = stfilterprocess.m_nCompanyNum;
}
}
if (company_num == -1)
return false;
QSqlQuery query(m_sDBManager[SDBManager::E_DATABASE_WEB]);
QString strQuery = "select num, servicenum from category where company_num = ";
strQuery += QString::number(company_num) + " order by servicenum asc, num asc";
if (query.exec(strQuery.toUtf8()) == false)
{
insertLog(query.lastQuery());
insertLog(query.lastError().text());
return false;
}
int nService[E_SERVICE_MAX] = {0,};
while(query.next())
{
switch(query.value(1).toInt())
{
case E_SERVICE_INFLUENCER:
{
if (0 == nService[E_SERVICE_INFLUENCER]++)
{
m_anAllCategory[E_SERVICE_INFLUENCER] = query.value(0).toInt();
}
break;
}
case E_SERVICE_CONSUMER:
{
if (0 == nService[E_SERVICE_CONSUMER]++)
{
m_anAllCategory[E_SERVICE_CONSUMER] = query.value(0).toInt();
}
break;
}
case E_SERVICE_SPAMMER:
{
if (0 == nService[E_SERVICE_SPAMMER]++)
{
m_anAllCategory[E_SERVICE_SPAMMER] = query.value(0).toInt();
}
break;
}
case E_SERVICE_POWERCAFE:
{
if (0 == nService[E_SERVICE_POWERCAFE]++)
{
m_anAllCategory[E_SERVICE_POWERCAFE] = query.value(0).toInt();
}
break;
}
}
}
return true;
}
/*
bool SInitializer::initConsumerCategory()
{
QSqlQuery query(m_sDBManager[SDBManager::E_DATABASE_WEB]);
@@ -330,6 +404,7 @@ bool SInitializer::initConsumerCategory()
}
return true;
}
*/
int SInitializer::getConsumerAllCategory()
{
@@ -525,3 +600,9 @@ bool SInitializer::openConnection(const QString& _str)
{
return m_sDBManager.open(_str);
}
int SInitializer::getAllCategoryNum(int _nService)
{
return m_anAllCategory[_nService];
}