216 lines
10 KiB
C++
216 lines
10 KiB
C++
#pragma once
|
|
#include "..\MobsetApi\MobsetApiMobsetApiSoapService.h"
|
|
|
|
#include "spdlog/spdlog.h"
|
|
#include "spdlog/async.h"
|
|
namespace MobsetApi {
|
|
|
|
|
|
|
|
|
|
typedef struct _TaskItem
|
|
{
|
|
long lType;
|
|
long lMobileCount;
|
|
TCHAR szFileID[32];
|
|
TCHAR szName[64];
|
|
}TaskItem;
|
|
typedef struct _SQL_Pool
|
|
{
|
|
BOOL bUse;
|
|
long lRandID;
|
|
CAdoConnection adoConnection;
|
|
//CComPtr<IXMLDOMDocument2> spDoc;
|
|
DWORD dwBeginUse;
|
|
DWORD dwEndUse;
|
|
}SQL_Pool;
|
|
|
|
typedef struct _Req_Pool
|
|
{
|
|
DWORD dwTime;
|
|
unsigned long ip;
|
|
long lCorpID;
|
|
}Req_Pool;
|
|
|
|
class SQL_PoolEx
|
|
{
|
|
public:
|
|
SQL_Pool * m_pSQL_Pool;
|
|
|
|
CAdoConnection * GetAdoConnection(void)
|
|
{
|
|
if (m_pSQL_Pool)
|
|
{
|
|
return &m_pSQL_Pool->adoConnection;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
SQL_PoolEx(SQL_Pool * pPool)
|
|
{
|
|
m_pSQL_Pool = NULL;
|
|
try
|
|
{
|
|
if ( pPool )
|
|
{
|
|
m_pSQL_Pool = pPool;
|
|
|
|
m_pSQL_Pool->bUse = true;
|
|
m_pSQL_Pool->dwBeginUse = GetTickCount();
|
|
}
|
|
}
|
|
catch(...)
|
|
{
|
|
m_pSQL_Pool = NULL;
|
|
}
|
|
}
|
|
|
|
~SQL_PoolEx(void)
|
|
{
|
|
try
|
|
{
|
|
if ( m_pSQL_Pool )
|
|
{
|
|
m_pSQL_Pool->bUse = false;
|
|
m_pSQL_Pool->lRandID = 0;
|
|
m_pSQL_Pool->dwEndUse = GetTickCount();
|
|
m_pSQL_Pool = NULL;
|
|
}
|
|
}
|
|
catch(...)
|
|
{
|
|
m_pSQL_Pool = NULL;
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
class SOAP_CMAC MobsetApiServiceEx :
|
|
public MobsetApi::MobsetApiSoapService
|
|
{
|
|
|
|
public:
|
|
HANDLE m_hThread;
|
|
BOOL m_bStart;
|
|
BOOL m_bCopy; //是否复制的一部分
|
|
BOOL m_bHTTP; //是否HTTP接口一部分
|
|
|
|
LPVOID m_pParam;
|
|
TCHAR m_strSQL_Provider[32];
|
|
TCHAR m_strSQL_IP[32];
|
|
TCHAR m_strSQL_User[32];
|
|
TCHAR m_strSQL_Passwd[32];
|
|
TCHAR m_strSQL_DB[32];
|
|
|
|
SQL_Pool * m_pSQL;
|
|
long m_lSQLCount;
|
|
DWORD m_dwReqCount;
|
|
CRITICAL_SECTION * m_Critical;
|
|
|
|
Req_Pool * m_pReq;
|
|
long m_lReqCount;
|
|
long m_lReqIndex;
|
|
long * m_pReqIndex;
|
|
DWORD m_lReqAllCount;
|
|
DWORD * m_pReqAllCount;
|
|
CRITICAL_SECTION * m_Critical_Req;
|
|
|
|
BOOL m_bErrLog;
|
|
BOOL m_bHttpLog;
|
|
long m_lMaxIDReq;
|
|
long m_lMaxIPReq;
|
|
CSAStatusLog * m_pReqlog;
|
|
|
|
std::shared_ptr<spdlog::async_logger> m_loggerError;
|
|
std::shared_ptr<spdlog::async_logger> m_loggerInfo;
|
|
|
|
//用于记录请求日志
|
|
CStringA m_strReqTag;
|
|
long m_lReqCorpID;
|
|
CStringA m_strReqLoginName;
|
|
long m_lReqReturn;
|
|
|
|
public:
|
|
MobsetApiServiceEx(void);
|
|
~MobsetApiServiceEx(void);
|
|
MobsetApiServiceEx(const struct soap&);
|
|
|
|
virtual int dispatch();
|
|
|
|
static long GetSendCount(long lMobileCount, CString strMsg);
|
|
void Info_LogA(CStringA strLog);
|
|
void Info_Log(CString strLog);
|
|
void Error_Log(CString strLog);
|
|
void Error_LogA(CStringA strLog);
|
|
long isOverRequest(unsigned long ip,long lCorpID);
|
|
long Web_Exit();
|
|
void SetSQLParam(LPVOID pParam,CString strIP,CString strUser,CString strPasswd,CString strDB,CString strProvider);
|
|
BOOL ConnectSQLServer(SQL_Pool * pSql);
|
|
SQL_Pool * GetBankSQL();
|
|
long GetBankSQLCount(CString & strMsg);
|
|
static DWORD WINAPI Process_Req(LPVOID lpParam);
|
|
static UINT Process_AcceptT(LPVOID sParam);
|
|
long Web_Init(TCHAR * strIP,long lPort , long lSQLConnect, long lMaxIDReq, long lMaxIPReq);
|
|
virtual MobsetApiServiceEx *copy2();
|
|
static int Web_Get(struct soap* soap);
|
|
static int Web_post(struct soap *soap, const char *endpoint, const char *host, int port,const char *path, const char *action, size_t count);
|
|
static int HttpGetHandler(struct soap* soap);
|
|
static int HttpPostHandler(struct soap* soap);
|
|
|
|
static void GetCurrentPath(TCHAR *pPath);
|
|
int Sms_USCORESendEx(_ns1__Sms_USCORESend *ns1__Sms_USCORESend, _ns1__Sms_USCORESendResponse *ns1__Sms_USCORESendResponse, _ns1__Template_USCORESendSms *ns1__Template_USCORESendSms=nullptr);
|
|
virtual int Sms_USCORESend(_ns1__Sms_USCORESend *ns1__Sms_USCORESend, _ns1__Sms_USCORESendResponse *ns1__Sms_USCORESendResponse);
|
|
virtual int Sms_USCOREGetRecv(_ns1__Sms_USCOREGetRecv *ns1__Sms_USCOREGetRecv, _ns1__Sms_USCOREGetRecvResponse *ns1__Sms_USCOREGetRecvResponse);
|
|
virtual int Sms_USCOREGetReport(_ns1__Sms_USCOREGetReport *ns1__Sms_USCOREGetReport, _ns1__Sms_USCOREGetReportResponse *ns1__Sms_USCOREGetReportResponse);
|
|
virtual int Sms_USCOREGetSign(_ns1__Sms_USCOREGetSign *ns1__Sms_USCOREGetSign, _ns1__Sms_USCOREGetSignResponse *ns1__Sms_USCOREGetSignResponse);
|
|
virtual int Sms_USCOREGetBalance(_ns1__Sms_USCOREGetBalance *ns1__Sms_USCOREGetBalance, _ns1__Sms_USCOREGetBalanceResponse *ns1__Sms_USCOREGetBalanceResponse);
|
|
virtual int Sms_USCOREGetSentCount(_ns1__Sms_USCOREGetSentCount *ns1__Sms_USCOREGetSentCount, _ns1__Sms_USCOREGetSentCountResponse *ns1__Sms_USCOREGetSentCountResponse);
|
|
virtual int Sms_USCOREGetSentList(_ns1__Sms_USCOREGetSentList *ns1__Sms_USCOREGetSentList, _ns1__Sms_USCOREGetSentListResponse *ns1__Sms_USCOREGetSentListResponse);
|
|
virtual int Sms_USCORECancel(_ns1__Sms_USCORECancel* ns1__Sms_USCORECancel, _ns1__Sms_USCORECancelResponse* ns1__Sms_USCORECancelResponse);
|
|
|
|
int Sms_USCOREGetStatus(_ns1__Sms_USCOREGetBalance *ns1__Sms_USCOREGetBalance, _ns1__Sms_USCOREGetBalanceResponse *ns1__Sms_USCOREGetBalanceResponse);
|
|
int Sms_USCOREWxWork(_ns1__Sms_USCOREGetBalance *ns1__Sms_USCOREGetBalance, _ns1__Sms_USCOREGetBalanceResponse *ns1__Sms_USCOREGetBalanceResponse);
|
|
|
|
|
|
virtual int Mms_USCOREUpFile(_ns1__Mms_USCOREUpFile *ns1__Mms_USCOREUpFile, _ns1__Mms_USCOREUpFileResponse *ns1__Mms_USCOREUpFileResponse) ;
|
|
virtual int Mms_USCORESend(_ns1__Mms_USCORESend *ns1__Mms_USCORESend, _ns1__Mms_USCORESendResponse *ns1__Mms_USCORESendResponse) ;
|
|
virtual int Mms_USCOREGetReport(_ns1__Mms_USCOREGetReport *ns1__Mms_USCOREGetReport, _ns1__Mms_USCOREGetReportResponse *ns1__Mms_USCOREGetReportResponse) ;
|
|
virtual int Mms_USCOREGetRecv(_ns1__Mms_USCOREGetRecv *ns1__Mms_USCOREGetRecv, _ns1__Mms_USCOREGetRecvResponse *ns1__Mms_USCOREGetRecvResponse) ;
|
|
virtual int Task_USCOREUpFile(_ns1__Task_USCOREUpFile *ns1__Task_USCOREUpFile, _ns1__Task_USCOREUpFileResponse *ns1__Task_USCOREUpFileResponse);
|
|
virtual int Task_USCOREDelFile(_ns1__Task_USCOREDelFile *ns1__Task_USCOREDelFile, _ns1__Task_USCOREDelFileResponse *ns1__Task_USCOREDelFileResponse) ;
|
|
virtual int Task_USCORESmsSend(_ns1__Task_USCORESmsSend *ns1__Task_USCORESmsSend, _ns1__Task_USCORESmsSendResponse *ns1__Task_USCORESmsSendResponse) ;
|
|
virtual int Task_USCOREGetSmsStatus(_ns1__Task_USCOREGetSmsStatus *ns1__Task_USCOREGetSmsStatus, _ns1__Task_USCOREGetSmsStatusResponse *ns1__Task_USCOREGetSmsStatusResponse);
|
|
virtual int Task_USCORESmsStop(_ns1__Task_USCORESmsStop *ns1__Task_USCORESmsStop, _ns1__Task_USCORESmsStopResponse *ns1__Task_USCORESmsStopResponse);
|
|
virtual int Task_USCOREMmsSend(_ns1__Task_USCOREMmsSend *ns1__Task_USCOREMmsSend, _ns1__Task_USCOREMmsSendResponse *ns1__Task_USCOREMmsSendResponse) ;
|
|
virtual int Task_USCOREGetMmsStatus(_ns1__Task_USCOREGetMmsStatus *ns1__Task_USCOREGetMmsStatus, _ns1__Task_USCOREGetMmsStatusResponse *ns1__Task_USCOREGetMmsStatusResponse) ;
|
|
virtual int Task_USCOREMmsStop(_ns1__Task_USCOREMmsStop *ns1__Task_USCOREMmsStop, _ns1__Task_USCOREMmsStopResponse *ns1__Task_USCOREMmsStopResponse) ;
|
|
virtual int Mms_USCOREGetFileStatus(_ns1__Mms_USCOREGetFileStatus *ns1__Mms_USCOREGetFileStatus, _ns1__Mms_USCOREGetFileStatusResponse *ns1__Mms_USCOREGetFileStatusResponse);
|
|
virtual int Task_USCORESmsStart(_ns1__Task_USCORESmsStart *ns1__Task_USCORESmsStart, _ns1__Task_USCORESmsStartResponse *ns1__Task_USCORESmsStartResponse);
|
|
virtual int Task_USCOREMmsStart(_ns1__Task_USCOREMmsStart *ns1__Task_USCOREMmsStart, _ns1__Task_USCOREMmsStartResponse *ns1__Task_USCOREMmsStartResponse);
|
|
virtual int Agent_USCOREGetSmsBalance(_ns1__Agent_USCOREGetSmsBalance *ns1__Agent_USCOREGetSmsBalance, _ns1__Agent_USCOREGetSmsBalanceResponse *ns1__Agent_USCOREGetSmsBalanceResponse);
|
|
virtual int Agent_USCOREGetCorpSmsBalance(_ns1__Agent_USCOREGetCorpSmsBalance *ns1__Agent_USCOREGetCorpSmsBalance, _ns1__Agent_USCOREGetCorpSmsBalanceResponse *ns1__Agent_USCOREGetCorpSmsBalanceResponse);
|
|
virtual int Agent_USCORECorpSmsPay(_ns1__Agent_USCORECorpSmsPay *ns1__Agent_USCORECorpSmsPay, _ns1__Agent_USCORECorpSmsPayResponse *ns1__Agent_USCORECorpSmsPayResponse);
|
|
virtual int Agent_USCOREGetUserID(_ns1__Agent_USCOREGetUserID* ns1__Agent_USCOREGetUserID, _ns1__Agent_USCOREGetUserIDResponse* ns1__Agent_USCOREGetUserIDResponse);
|
|
virtual int Agent_USCOREGetUserSmsBalance(_ns1__Agent_USCOREGetUserSmsBalance* ns1__Agent_USCOREGetUserSmsBalance, _ns1__Agent_USCOREGetUserSmsBalanceResponse* ns1__Agent_USCOREGetUserSmsBalanceResponse);
|
|
virtual int Agent_USCORESetUserSmsBalance(_ns1__Agent_USCORESetUserSmsBalance* ns1__Agent_USCORESetUserSmsBalance, _ns1__Agent_USCORESetUserSmsBalanceResponse* ns1__Agent_USCORESetUserSmsBalanceResponse);
|
|
virtual int Agent_USCOREUserSmsPay(_ns1__Agent_USCOREUserSmsPay* ns1__Agent_USCOREUserSmsPay, _ns1__Agent_USCOREUserSmsPayResponse* ns1__Agent_USCOREUserSmsPayResponse);
|
|
virtual int Agent_USCORECorpAdd(_ns1__Agent_USCORECorpAdd* ns1__Agent_USCORECorpAdd, _ns1__Agent_USCORECorpAddResponse* ns1__Agent_USCORECorpAddResponse);
|
|
virtual int Agent_USCORECorpAddUser(_ns1__Agent_USCORECorpAddUser* ns1__Agent_USCORECorpAddUser, _ns1__Agent_USCORECorpAddUserResponse* ns1__Agent_USCORECorpAddUserResponse);
|
|
virtual int Agent_USCORECorpSignNameApply(_ns1__Agent_USCORECorpSignNameApply* ns1__Agent_USCORECorpSignNameApply, _ns1__Agent_USCORECorpSignNameApplyResponse* ns1__Agent_USCORECorpSignNameApplyResponse);
|
|
virtual int Agent_USCORECorpSignNameStatus(_ns1__Agent_USCORECorpSignNameStatus* ns1__Agent_USCORECorpSignNameStatus, _ns1__Agent_USCORECorpSignNameStatusResponse* ns1__Agent_USCORECorpSignNameStatusResponse);
|
|
|
|
|
|
virtual int Template_USCOREAdd(_ns1__Template_USCOREAdd *ns1__Template_USCOREAdd, _ns1__Template_USCOREAddResponse *ns1__Template_USCOREAddResponse);
|
|
virtual int Template_USCOREModify(_ns1__Template_USCOREModify *ns1__Template_USCOREModify, _ns1__Template_USCOREModifyResponse *ns1__Template_USCOREModifyResponse);
|
|
virtual int Template_USCOREDel(_ns1__Template_USCOREDel *ns1__Template_USCOREDel, _ns1__Template_USCOREDelResponse *ns1__Template_USCOREDelResponse);
|
|
virtual int Template_USCOREQuery(_ns1__Template_USCOREQuery *ns1__Template_USCOREQuery, _ns1__Template_USCOREQueryResponse *ns1__Template_USCOREQueryResponse);
|
|
virtual int Template_USCOREList(_ns1__Template_USCOREList *ns1__Template_USCOREList, _ns1__Template_USCOREListResponse *ns1__Template_USCOREListResponse);
|
|
virtual int Template_USCORESendSms(_ns1__Template_USCORESendSms *ns1__Template_USCORESendSms, _ns1__Template_USCORESendSmsResponse *ns1__Template_USCORESendSmsResponse);
|
|
|
|
virtual int SignName_USCOREApply(_ns1__SignName_USCOREApply *ns1__SignName_USCOREApply, _ns1__SignName_USCOREApplyResponse *ns1__SignName_USCOREApplyResponse);
|
|
virtual int SignName_USCOREStatus(_ns1__SignName_USCOREStatus *ns1__SignName_USCOREStatus, _ns1__SignName_USCOREStatusResponse *ns1__SignName_USCOREStatusResponse);
|
|
|
|
};
|
|
|
|
}
|