#include "wool.h" WOOL::WOOL(QString host, QString port) { this->server_host = host; this->server_path = "/wsdl"; this->server_url = "http://"+this->server_host+this->server_path; QRegExp exp("\\d{1,4}"); if(exp.exactMatch(port)) { //this->server_port = port.toInt(); this->server_port = 86; } else { this->server_port = 80; } m_cancel = false; } void WOOL::onCanceled() { m_cancel = true; emit responseProcessed(); if(json.isEmpty()) json = "ABORT"; } void WOOL::getResponse() { // Get the response, check for error. const QtSoapMessage &message = http.getResponse(); if (message.isFault()) { qDebug()<json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetSysParamRequest(src, authCode); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //分包传送文件 QString WOOL::PackTran(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setPackTranRequest(fileName, packKey, packNo, packContent, packMD5, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //分包文件整合 QString WOOL::PackMerge(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setPackMergeRequest(fileName, packKey, packCount, fileMD5, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //用户服务验证 QString WOOL::UserServiceVerify(QString funcName, QString paraList, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setUserServiceVerifyRequest(funcName, paraList, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //提交防薅羊毛检测号码文件 QString WOOL::SubmitfhymFile(QString params, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setSubmitfhymFileRequest(params, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //下载防薅羊毛检测结果 QString WOOL::DlfhymResultFile(QString taskid, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setDlfhymResultFileRequest(taskid, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //查询防薅羊毛当前检测任务信息 QString WOOL::GetfhymTask(QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetfhymTaskRequest(userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //查询防薅羊毛历史检测任务信息 QString WOOL::GetfhymHt(QString params, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetfhymHtRequest(params, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //查询用户自己余额 QString WOOL::GetUserBalance(QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetUserBalanceRequest(userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //查询充值记录 QString WOOL::GetChargeInfo(QString params, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetChargeInfoRequest(params, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } //查询消费记录 QString WOOL::GetCostInfo(QString params, QString userHash) { this->json = ""; QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit())); setGetCostInfoRequest(params, userHash); loop.exec(); QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse())); return json; } void WOOL::setGetSysParamRequest(QString src, QString authCode) { QtSoapMessage request; request.setMethod("GetSysParam", this->server_url); request.addMethodArgument("src","",src); request.addMethodArgument("authCode","",authCode); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setPackTranRequest(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash) { QtSoapMessage request; request.setMethod("PackTran", this->server_url); request.addMethodArgument("fileName","",fileName); request.addMethodArgument("packKey","",packKey); request.addMethodArgument("packNo","",packNo); request.addMethodArgument("packContent","",packContent); request.addMethodArgument("packMD5","",packMD5); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setPackMergeRequest(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash) { QtSoapMessage request; request.setMethod("PackMerge", this->server_url); request.addMethodArgument("fileName","",fileName); request.addMethodArgument("packKey","",packKey); request.addMethodArgument("packCount","",packCount); request.addMethodArgument("fileMD5","",fileMD5); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setUserServiceVerifyRequest(QString funcName, QString paraList, QString userHash) { QtSoapMessage request; request.setMethod("UserServiceVerify", this->server_url); request.addMethodArgument("funcName","",funcName); request.addMethodArgument("paraList","",paraList); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setSubmitfhymFileRequest(QString params, QString userHash) { QtSoapMessage request; request.setMethod("SubmitfhymFile", this->server_url); request.addMethodArgument("params","",params); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setDlfhymResultFileRequest(QString taskid, QString userHash) { QtSoapMessage request; request.setMethod("DlfhymResultFile", this->server_url); request.addMethodArgument("taskid","",taskid); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setGetfhymTaskRequest(QString userHash) { QtSoapMessage request; request.setMethod("GetfhymTask", this->server_url); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setGetfhymHtRequest(QString params, QString userHash) { QtSoapMessage request; request.setMethod("GetfhymHt", this->server_url); request.addMethodArgument("params","",params); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setGetUserBalanceRequest(QString userHash) { QtSoapMessage request; request.setMethod("GetUserBalance", this->server_url); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setGetChargeInfoRequest(QString params, QString userHash) { QtSoapMessage request; request.setMethod("GetChargeInfo", this->server_url); request.addMethodArgument("params","",params); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); } void WOOL::setGetCostInfoRequest(QString params, QString userHash) { QtSoapMessage request; request.setMethod("GetCostInfo", this->server_url); request.addMethodArgument("params","",params); request.addMethodArgument("userHash","",userHash); http.setHost(this->server_host,this->server_port); http.submitRequest(request,this->server_path); }