Commit 14b85320 by NitefullWind

1. 修复日志重新打印Bug。2. 修改支付时的等待语。 3. 取消支付后,三次冲正的超时时间设置为19秒,总时间接近60秒。

parent a2f3213e
......@@ -598,7 +598,7 @@ void Control::Request(ReqType type, QStringList list)
while(i < 3)
{
if(_posType == SPCC) {
if((tmpflag = SendMessageToSBKAPI(tmpjson, tmparray, tmperror, 15, true)) == true) {
if((tmpflag = SendMessageToSBKAPI(tmpjson, tmparray, tmperror, 19, true)) == true) {
break;
}
} else {
......
......@@ -146,7 +146,7 @@ void HostWidget::ShowPayWidget()
if(_type == pay)
{
ui->label_pay_title->setText(QString::fromLocal8Bit("支付宝支付中..."));
ui->label_pay_title->setText(QString::fromLocal8Bit("支付中/等待用户输入密码"));
_intertime.start(2*1000);
emit RequestWithType(pay, list);
}
......
......@@ -21,46 +21,41 @@
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
static bool CopyApiDll(QString &errorString)
static void InitLogger()
{
// char path[MAX_PATH] = {0};
// ToolS::GetProcPath(path);
QString localDllPath = QString::fromLocal8Bit("%1/StarbucksAPI.dll").arg(qApp->applicationDirPath());
QFileInfo localFileInfo(localDllPath);
char path[MAX_PATH] = {0};
ToolS::GetProcPath(path);
FMPSettings setting;
QString configDllPath = setting.GetValue(CONFIG_OLTP_PATH, "C:\\OLTP\\").toString();
QFileInfo configFileInfo(configDllPath);
if(!configFileInfo.isFile()) {
configFileInfo = QFileInfo(configDllPath+"/StarbucksAPI.dll");
QString logPath = setting.GetValue(CONFIG_LOG_PATH, QString(path)+"/log").toString();
QString logName = setting.GetValue(CONFIG_LOG_NAME, "sbuxpay.txt").toString();
QsLogging::Level logLevel = (QsLogging::Level)setting.GetValue(CONFIG_LOG_LEVEL, 0).toInt();
if(logLevel < QsLogging::TraceLevel || logLevel > QsLogging::OffLevel) {
logLevel = QsLogging::TraceLevel;
}
int logSize = setting.GetValue(CONFIG_LOG_SIZE, 1).toInt();
int logCount = setting.GetValue(CONFIG_LOG_COUNT, 5).toInt();
if(!configFileInfo.exists()) {
errorString = "Config dll path: " + configDllPath + " does not exist.";
QLOG_ERROR() << errorString;
return false;
QDir logDir(logPath);
if(!logDir.exists()) {
logDir.mkpath(logDir.absolutePath());
}
QString logFilePath = logDir.absolutePath()+'/'+logName;
QsLogging::Logger& logger = QsLogging::Logger::instance();
logger.setLoggingLevel(logLevel);
if(!localFileInfo.exists() || localFileInfo.lastModified() < configFileInfo.lastModified()) {
QFile localDllFile(localFileInfo.absoluteFilePath());
if(localDllFile.exists()) {
localDllFile.remove();
}
QFile configDllFile(configFileInfo.absoluteFilePath());
if(!configDllFile.copy(localDllPath)) {
errorString = "Can't copy StarbucksAPI.dll: " + configDllFile.errorString();
QLOG_ERROR() << errorString;
return false;
}
}
/* 配置输出定向器 */
QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(
logFilePath,
QsLogging::EnableLogRotation, QsLogging::MaxSizeBytes(1024*1024*logSize),
QsLogging::MaxOldLogCount(logCount)));
logger.addDestination(fileDestination);
return true;
QsLogging::DestinationPtr consleDest(QsLogging::DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(consleDest);
}
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/ )
{
static bool ownApplication = FALSE;
......@@ -85,6 +80,9 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
QApplication::addLibraryPath(configPath);
qDebug() << "Library paths: " << QApplication::libraryPaths() << configPath;
InitLogger();
ownApplication = QMfcApp::pluginInstance( hInstance );
}
if ( dwReason == DLL_PROCESS_DETACH && ownApplication )
......@@ -98,48 +96,10 @@ extern "C" __declspec(dllexport) void Start(const char *indata, char *outdata)
HWND parent = GetDesktopWindow();
QWinWidget win( parent );
char path[MAX_PATH] = {0};
ToolS::GetProcPath(path);
FMPSettings setting;
QString logPath = setting.GetValue(CONFIG_LOG_PATH, QString(path)+"/log").toString();
QString logName = setting.GetValue(CONFIG_LOG_NAME, "sbuxpay.txt").toString();
QsLogging::Level logLevel = (QsLogging::Level)setting.GetValue(CONFIG_LOG_LEVEL, 0).toInt();
if(logLevel < QsLogging::TraceLevel || logLevel > QsLogging::OffLevel) {
logLevel = QsLogging::TraceLevel;
}
int logSize = setting.GetValue(CONFIG_LOG_SIZE, 1).toInt();
int logCount = setting.GetValue(CONFIG_LOG_COUNT, 5).toInt();
QDir logDir(logPath);
if(!logDir.exists()) {
logDir.mkpath(logDir.absolutePath());
}
QString logFilePath = logDir.absolutePath()+'/'+logName;
QsLogging::Logger& logger = QsLogging::Logger::instance();
logger.setLoggingLevel(logLevel);
/* 配置输出定向器 */
QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(
logFilePath,
QsLogging::EnableLogRotation, QsLogging::MaxSizeBytes(1024*1024*logSize),
QsLogging::MaxOldLogCount(logCount)));
logger.addDestination(fileDestination);
QsLogging::DestinationPtr consleDest(QsLogging::DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(consleDest);
// QString errorString;
// if(!CopyApiDll(errorString)) {
// errorString = QString::fromLocal8Bit("{\"statusCode\":23, \"message\":\"%1\"}").arg(errorString);
// strcpy(outdata, errorString.toLocal8Bit());
// return;
// }
static RollBack rollback;
Control control(&win);
control.Start(indata, outdata);
static RollBack rollback;
if(!rollback.isRunning())
rollback.start();
}
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 38
#define VER_BUILD 40
//! Convert version numbers to string
#define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment