@@ -80,6 +80,7 @@ XHTHREAD AuthClient_Thread()
8080 if (0 == st_ProtocolHdr.wReserve )
8181 {
8282 printf (_X (" 登录成功\n " ));
83+ xhToken = st_ProtocolHdr.xhToken ;
8384 }
8485 else
8586 {
@@ -182,7 +183,7 @@ int AuthClient_Pay()
182183}
183184int AuthClient_DynamicCode ()
184185{
185- LPCXSTR lpszUrl = _X (" http://127.0.0.1:5302/api?function=dcode&user=get " );
186+ LPCXSTR lpszUrl = _X (" http://127.0.0.1:5302/api?function=dcode" );
186187
187188 int nMsgLen = 0 ;
188189 XCHAR* ptszMsgBuffer = NULL ;
@@ -284,7 +285,8 @@ int AuthClient_Login()
284285}
285286int AuthClient_Notice ()
286287{
287- LPCXSTR lpszUrl = _X (" http://127.0.0.1:5302/api?function=notice" );
288+ XCHAR tszURLStr[MAX_PATH] = {};
289+ _xstprintf (tszURLStr, _T (" http://127.0.0.1:5302/api?function=notice&token=%lld" ), xhToken);
288290
289291 int nMsgLen = 0 ;
290292 XCHAR* ptszMsgBuffer = NULL ;
@@ -294,7 +296,7 @@ int AuthClient_Notice()
294296 Json::CharReaderBuilder st_ReaderBuilder;
295297 std::unique_ptr<Json::CharReader> const pSt_JsonReader (st_ReaderBuilder.newCharReader ());
296298
297- APIClient_Http_Request (_X (" GET" ), lpszUrl , NULL , NULL , &ptszMsgBuffer, &nMsgLen);
299+ APIClient_Http_Request (_X (" GET" ), tszURLStr , NULL , NULL , &ptszMsgBuffer, &nMsgLen);
298300 if (bEncrypto)
299301 {
300302 XCHAR tszDEBuffer[2048 ] = {};
@@ -373,7 +375,8 @@ int AuthClient_GetTime()
373375{
374376 Json::Value st_JsonRoot;
375377 Json::Value st_JsonObject;
376- LPCXSTR lpszUrl = _X (" http://127.0.0.1:5302/auth/user/time" );
378+ XCHAR tszURLStr[MAX_PATH] = {};
379+ _xstprintf (tszURLStr, _T (" http://127.0.0.1:5302/api?function=time&token=%lld" ),xhToken);
377380
378381 st_JsonObject[" tszUserName" ] = lpszUser;
379382 st_JsonObject[" tszUserPass" ] = lpszPass;
@@ -389,15 +392,15 @@ int AuthClient_GetTime()
389392
390393 nMsgLen = st_JsonRoot.toStyledString ().length ();
391394 OPenSsl_XCrypto_Encoder (st_JsonRoot.toStyledString ().c_str (), &nMsgLen, (XBYTE*)tszENBuffer, lpszPass);
392- APIClient_Http_Request (_X (" POST " ), lpszUrl , tszENBuffer, NULL , &ptszMsgBuffer, &nMsgLen);
395+ APIClient_Http_Request (_X (" GET " ), tszURLStr , tszENBuffer, NULL , &ptszMsgBuffer, &nMsgLen);
393396
394397 OPenSsl_XCrypto_Decoder (ptszMsgBuffer, &nMsgLen, tszDEBuffer, lpszPass);
395398 printf (" AuthClient_GetTime:\n %s\n " , tszDEBuffer);
396399 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
397400 }
398401 else
399402 {
400- APIClient_Http_Request (_X (" POST " ), lpszUrl , st_JsonRoot.toStyledString ().c_str (), NULL , &ptszMsgBuffer, &nMsgLen);
403+ APIClient_Http_Request (_X (" GET " ), tszURLStr , st_JsonRoot.toStyledString ().c_str (), NULL , &ptszMsgBuffer, &nMsgLen);
401404 printf (" AuthClient_GetTime:\n %s\n " , ptszMsgBuffer);
402405 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
403406 }
@@ -449,8 +452,8 @@ int AuthClient_Try()
449452 LPCXSTR lpszSerialNet = _X (" cpuid:112233" ); // 通过此可以做临时网络验证,安全性比本地临时验证高
450453 LPCXSTR lpszUrl = _X (" http://127.0.0.1:5302/auth/user/try" );
451454
452- st_JsonObject[" tszSerial " ] = lpszSerialNet;
453- st_JsonRoot[" st_UserTry " ] = st_JsonObject;
455+ st_JsonObject[" tszVSerial " ] = lpszSerialNet;
456+ st_JsonRoot[" st_VERTemp " ] = st_JsonObject;
454457
455458 int nMsgLen = 0 ;
456459 XCHAR* ptszMsgBuffer = NULL ;
@@ -502,7 +505,7 @@ int main()
502505 AuthClient_GetPass ();
503506 AuthClient_GetTime ();
504507
505- std::this_thread::sleep_for (std::chrono::seconds (600 ));
508+ std::this_thread::sleep_for (std::chrono::seconds (10 ));
506509 AuthClient_Delete ();
507510 AuthClient_Try ();
508511
0 commit comments