-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathservicemanager.cpp
257 lines (222 loc) · 6.51 KB
/
servicemanager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#include "StdAfx.h"
#include "servicemanager.h"
#include "utilitymanager.h"
#include "cryptmanager.h"
#include "GSoap\KadServiceSoap.nsmap"
#include "GSoap\soapKadServiceSoapProxy.h"
KadServiceSoapProxy g_soap;
ServiceManager::ServiceManager(QObject *parent)
: QObject(parent)
{
//GSoap生成方法
//wsdl2h -o service.h http://kadplayer.com:81/kadservice.asmx?wsdl
//soapcpp2 -C -L -x -i -I"E:\GSoap\gsoap\import" service.h
//soapC.cpp, soapClient.cpp, stdsoap2.cpp不使用头文件
//复制stdsoap2.h, stdsoap2.cpp到工程目录
g_soap.connect_timeout = 10;
g_soap.accept_timeout = 10;
g_soap.send_timeout = 10;
g_soap.recv_timeout = 10;
g_soap.mode = SOAP_C_UTFSTRING;
}
ServiceManager::~ServiceManager()
{
}
void ServiceManager::GetSystemMessage(QString version)
{
QString result;
std::string myVersion = UtilityManager::ws2s(version.toStdWString());
myVersion = CryptManager::EncodeDesString(myVersion, DES_KEY);
QString mac = UtilityManager::GetMacAddress();
std::string myMac = UtilityManager::ws2s(mac.toStdWString());
myMac = CryptManager::EncodeDesString(myMac, DES_KEY);
QString extension = tr("time=%1|utc=%2|mac=%3|os=%4|cpu=%5|memory=%6|language=%7|country=%8|screen=%9|bit=%10")
.arg(UtilityManager::GetHostTime().trimmed())
.arg(UtilityManager::GetHostZone().trimmed())
.arg(UtilityManager::GetMacAddress().trimmed())
.arg(UtilityManager::GetSysVersion().trimmed())
.arg(UtilityManager::GetCpuInfo().trimmed())
.arg(UtilityManager::GetMemoryInfo().trimmed())
.arg(UtilityManager::GeySysLanguage().trimmed())
.arg(UtilityManager::GeySysCountry().trimmed())
.arg(UtilityManager::GeySysMetrics().trimmed())
.arg(UtilityManager::GeySysPixel().trimmed())
;
std::string myExtension = UtilityManager::ws2s(extension.toStdWString());
myExtension = CryptManager::EncodeDesString(myExtension, DES_KEY);
try
{
_ns1__GetSystemMessage request;
request.mac = &myMac;
request.version = &myVersion;
request.extension = &myExtension;
_ns1__GetSystemMessageResponse response;
int gsoapResult = g_soap.GetSystemMessage(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
std::wstring notify = UtilityManager::s2ws(CryptManager::DecodeDesString(*response.GetSystemMessageResult, DES_KEY));
result = QString::fromStdWString(notify);
emit getSystemMessage(result);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::GetSensitiveWords()
{
QStringList result;
try
{
_ns1__GetSensitiveWords request;
_ns1__GetSensitiveWordsResponse response;
int gsoapResult = g_soap.GetSensitiveWords(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
std::wstring words = UtilityManager::s2ws(CryptManager::DecodeDesString(*response.GetSensitiveWordsResult, DES_KEY));
result = QString::fromStdWString(words).split(",", QString::SkipEmptyParts);
emit getSensitiveWords(result);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::GetHotEd2ks()
{
QStringList result;
try
{
_ns1__GetHotEd2ks request;
_ns1__GetHotEd2ksResponse response;
int gsoapResult = g_soap.GetHotEd2ks(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
std::wstring words = UtilityManager::s2ws(CryptManager::DecodeDesString(*response.GetHotEd2ksResult, DES_KEY));
result = QString::fromStdWString(words).split(",", QString::SkipEmptyParts);
emit getHotEd2ks(result);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::GetHotWords()
{
QStringList result;
try
{
_ns1__GetHotWords request;
_ns1__GetHotWordsResponse response;
int gsoapResult = g_soap.GetHotWords(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
std::wstring words = UtilityManager::s2ws(CryptManager::DecodeDesString(*response.GetHotWordsResult, DES_KEY));
result = QString::fromStdWString(words).split(",", QString::SkipEmptyParts);
emit getHotWords(result);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::GetRandomWord()
{
QString result;
try
{
_ns1__GetRandomWord request;
_ns1__GetRandomWordResponse response;
int gsoapResult = g_soap.GetRandomWord(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
std::wstring word = UtilityManager::s2ws(CryptManager::DecodeDesString(*response.GetRandomWordResult, DES_KEY));
result = QString::fromStdWString(word);
emit getRandomWord(result);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::SetSearchLog(QString key)
{
std::string myKey = UtilityManager::ws2s(key.toStdWString());
myKey = CryptManager::EncodeDesString(myKey, DES_KEY);
QString mac = UtilityManager::GetMacAddress();
std::string myMac = UtilityManager::ws2s(mac.toStdWString());
myMac = CryptManager::EncodeDesString(myMac, DES_KEY);
try
{
_ns1__SetSearchLog request;
request.keys = &myKey;
request.mac = &myMac;
_ns1__SetSearchLogResponse response;
int gsoapResult = g_soap.SetSearchLog(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
emit setSearchLog(key);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::SetFeedback(QString version, int type, QString content)
{
std::string myVersion = UtilityManager::ws2s(version.toStdWString());
myVersion = CryptManager::EncodeDesString(myVersion, DES_KEY);
std::string myContent = UtilityManager::ws2s(content.toStdWString());
myContent = CryptManager::EncodeDesString(myContent, DES_KEY);
QString mac = UtilityManager::GetMacAddress();
std::string myMac = UtilityManager::ws2s(mac.toStdWString());
myMac = CryptManager::EncodeDesString(myMac, DES_KEY);
try
{
_ns1__SetFeedback request;
request.mac = &myMac;
request.version = &myVersion;
request.type = type;
request.content = &myContent;
_ns1__SetFeedbackResponse response;
int gsoapResult = g_soap.SetFeedback(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
emit setFeedback(version, type, content);
}
}
catch(...)
{
int a = 0;
}
}
void ServiceManager::SetPlayLog(QString link)
{
std::string myLink = UtilityManager::ws2s(link.toStdWString());
myLink = CryptManager::EncodeDesString(myLink, DES_KEY);
QString mac = UtilityManager::GetMacAddress();
std::string myMac = UtilityManager::ws2s(mac.toStdWString());
myMac = CryptManager::EncodeDesString(myMac, DES_KEY);
try
{
_ns1__SetPlayLog request;
request.links = &myLink;
request.mac = &myMac;
_ns1__SetPlayLogResponse response;
int gsoapResult = g_soap.SetPlayLog(WEB_SERVICE_URL, NULL, &request, &response);
if(gsoapResult == SOAP_OK)
{
emit setPlayLog(link);
}
}
catch(...)
{
int a = 0;
}
}