219 lines
5.0 KiB
C++
219 lines
5.0 KiB
C++
#ifndef SUTILCLASS
|
|
#define SUTILCLASS
|
|
|
|
#include <QTableWidgetItem>
|
|
#include <QDate>
|
|
#include <QString>
|
|
#include <memory>
|
|
|
|
class STableWidgetItem : public QTableWidgetItem
|
|
{
|
|
public:
|
|
STableWidgetItem(int type = Type);
|
|
STableWidgetItem(const QString & text, int type = Type);
|
|
STableWidgetItem(const QIcon & icon, const QString & text, int type = Type);
|
|
STableWidgetItem(const QTableWidgetItem & other);
|
|
virtual bool operator<(const QTableWidgetItem & other) const override;
|
|
};
|
|
|
|
enum class E_RUN_MODE:unsigned short
|
|
{
|
|
MODE_WAIT = 0,
|
|
MODE_TERMINATING,
|
|
MODE_RUN
|
|
};
|
|
|
|
|
|
enum class E_CRAWL_STATE:unsigned short
|
|
{
|
|
OK = 0,
|
|
FAIL,
|
|
NO
|
|
};
|
|
|
|
enum class E_ERROR_CODE
|
|
{
|
|
DB_OPEN_ERROR = 0,
|
|
DB_FULL_ERROR,
|
|
DB_LONG_QUERY_ERROR,
|
|
DB_QUERY_ERROR,
|
|
DB_UNKNOWN_ERROR,
|
|
INTERNET_ERROR,
|
|
OUT_DATED_CRAWLER,
|
|
DELETED_URL_ERROR,
|
|
BLOCK_ERROR,
|
|
TIMEOUT,
|
|
NO_PROGRAM,
|
|
UNKNOWN_ERROR,
|
|
MAX
|
|
};
|
|
|
|
|
|
struct SReport
|
|
{
|
|
E_CRAWL_STATE state;
|
|
unsigned int company_num;
|
|
unsigned int platformname_num;
|
|
QString event_code;
|
|
QString url;
|
|
};
|
|
|
|
struct SReportSummary
|
|
{
|
|
unsigned int nOk;
|
|
unsigned int nError;
|
|
unsigned int nActiveEventCode;
|
|
unsigned int nAllGroupEvent;
|
|
unsigned int nTotal;
|
|
SReportSummary(unsigned int _ok = 0, unsigned int _error = 0,
|
|
unsigned int _active_event_code = 0, unsigned int _all_group_event = 0,
|
|
unsigned int _total = 0
|
|
):nOk(_ok), nError(_error), nActiveEventCode(_active_event_code),
|
|
nAllGroupEvent(_all_group_event), nTotal(_total) {}
|
|
};
|
|
|
|
struct SError
|
|
{
|
|
E_CRAWL_STATE state;
|
|
unsigned int company_num;
|
|
unsigned int platformname_num;
|
|
QString event_code;
|
|
QString url;
|
|
E_ERROR_CODE error_code;
|
|
QString str_error;
|
|
SError();
|
|
|
|
SError(E_ERROR_CODE _error_code): state(E_CRAWL_STATE::FAIL), company_num(-1), platformname_num(-1), error_code(_error_code)
|
|
{
|
|
|
|
}
|
|
|
|
template <typename T>
|
|
SError(E_ERROR_CODE _error_code, T&& _str_error): state(E_CRAWL_STATE::FAIL),
|
|
company_num(-1), platformname_num(-1),
|
|
error_code(_error_code), str_error(std::forward<T>(_str_error))
|
|
{
|
|
|
|
}
|
|
template <typename A, typename B, typename C>
|
|
SError(E_CRAWL_STATE _state, unsigned int _company_num, unsigned int _platformname_num,
|
|
A&& _event_code, B&& _url, E_ERROR_CODE _error_code, C&& _str_error):
|
|
state(_state), company_num(_company_num), platformname_num(_platformname_num),
|
|
event_code(std::forward<A>(_event_code)), url(std::forward<B>(_url)), error_code(_error_code),
|
|
str_error(std::forward<C>(_str_error))
|
|
{
|
|
|
|
}
|
|
};
|
|
|
|
struct SEffectRow
|
|
{
|
|
int company_num;
|
|
QString company_name;
|
|
QDate company_startdate;
|
|
QDate company_enddate;
|
|
int event_num;
|
|
QDate event_date;
|
|
QString url;
|
|
QString eventcode;
|
|
int platformname_num;
|
|
SEffectRow():company_num(-1), event_num(-1), platformname_num(-1){}
|
|
template <typename A, typename B, typename C, typename D, typename E, typename F>
|
|
SEffectRow(int _company_num, A&& _company_name, B&& _company_startdate, C&& _company_enddate, int _event_num,
|
|
D&& _event_date, E&& _url, F&& _eventcode, int _platformname_num):
|
|
company_num(_company_num), company_name(std::forward<A>(_company_name)), company_startdate(std::forward<B>(_company_startdate)),
|
|
company_enddate(std::forward<C>(_company_enddate)), event_num(_event_num), event_date(std::forward<D>(_event_date)),
|
|
url(std::forward<E>(_url)), eventcode(std::forward<F>(_eventcode)), platformname_num(_platformname_num)
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
enum class E_PLATFORM
|
|
{
|
|
NAVER_BLOG = 0,
|
|
NAVER_CAFE,
|
|
NAVER_NEWS,
|
|
DAUM_CAFE,
|
|
DAUM_BLOG,
|
|
DAUM_NEWS,
|
|
INSTAGRAM,
|
|
KAKAOSTORY,
|
|
FACEBOOK
|
|
};
|
|
|
|
enum class E_INFO
|
|
{
|
|
OK = 0,
|
|
ERROR,
|
|
ACTIVE_EVENT,
|
|
ALL_ACTIVE_GROUP,
|
|
TOTAL
|
|
};
|
|
|
|
enum E_LOG_COLUMN
|
|
{
|
|
STATUS = 0,
|
|
EVENT_CODE,
|
|
URL,
|
|
ERROR_CODE,
|
|
ERROR_MSG
|
|
};
|
|
|
|
enum E_COLUMN
|
|
{
|
|
PLATFORM_NAME = 0,
|
|
PLATFORM_FORM,
|
|
PLATFORM_TITLE,
|
|
ARTICLE_FORM,
|
|
ARTICLE_PARENT,
|
|
ARTICLE_ID,
|
|
ARTICLE_NICKNAME,
|
|
ARTICLE_TITLE,
|
|
ARTICLE_DATA,
|
|
ARTICLE_URL,
|
|
ARTICLE_HIT,
|
|
ARTICLE_DATE,
|
|
ARTICLE_ORDER,
|
|
ARTICLE_PROFILE,
|
|
ARTICLE_PROFILEURL,
|
|
PLATFORM_ID,
|
|
KEYWORD_ID,
|
|
REPLY_URL,
|
|
ETC,
|
|
TOTAL_COUNT,
|
|
};
|
|
|
|
struct DataForm
|
|
{
|
|
QString data[TOTAL_COUNT];
|
|
};
|
|
|
|
struct EffectData
|
|
{
|
|
DataForm body;
|
|
QVector<DataForm> reply;
|
|
};
|
|
|
|
struct State_s1_effect
|
|
{
|
|
int event_num;
|
|
QString view_buzz;
|
|
QString replybuzz;
|
|
int replycount;
|
|
int likecount;
|
|
int viewcount;
|
|
int interactioncount;
|
|
int reachcount;
|
|
int engagementcount;
|
|
State_s1_effect():event_num(0),replycount(0),likecount(0),viewcount(0),
|
|
interactioncount(0),reachcount(0),engagementcount(0)
|
|
{
|
|
}
|
|
};
|
|
|
|
|
|
#endif // SUTILCLASS
|
|
|