@@ -317,12 +317,17 @@ BOOL CProtocolModule_Packet::ProtocolModule_Packet_MQNumber(XENGINE_PROTOCOLHDR*
317317 类型:整数型指针
318318 可空:N
319319 意思:输出缓冲区大小
320+ 参数.四:nCode
321+ In/Out:In
322+ 类型:整数型
323+ 可空:N
324+ 意思:输入要操作的协议
320325返回值
321326 类型:逻辑型
322327 意思:是否成功
323328备注:
324329*********************************************************************/
325- BOOL CProtocolModule_Packet::ProtocolModule_Packet_PassAuth (XENGINE_PROTOCOL_USERAUTH* pSt_ProtocolAuth, TCHAR* ptszMsgBuffer, int * pInt_MsgLen)
330+ BOOL CProtocolModule_Packet::ProtocolModule_Packet_PassAuth (XENGINE_PROTOCOL_USERAUTH* pSt_ProtocolAuth, TCHAR* ptszMsgBuffer, int * pInt_MsgLen, int nCode )
326331{
327332 Protocol_IsErrorOccur = FALSE ;
328333
@@ -333,12 +338,84 @@ BOOL CProtocolModule_Packet::ProtocolModule_Packet_PassAuth(XENGINE_PROTOCOL_USE
333338 return FALSE ;
334339 }
335340 Json::Value st_JsonRoot;
341+ Json::Value st_JsonAuth;
336342 Json::StreamWriterBuilder st_JsonBuilder;
337343
338- st_JsonRoot[" tszUserName" ] = pSt_ProtocolAuth->tszUserName ;
339- st_JsonRoot[" tszUserPass" ] = pSt_ProtocolAuth->tszUserPass ;
340- st_JsonRoot[" enClientType" ] = pSt_ProtocolAuth->enClientType ;
341- st_JsonRoot[" enDeviceType" ] = pSt_ProtocolAuth->enDeviceType ;
344+ st_JsonAuth[" tszUserName" ] = pSt_ProtocolAuth->tszUserName ;
345+ st_JsonAuth[" tszUserPass" ] = pSt_ProtocolAuth->tszUserPass ;
346+ st_JsonAuth[" enClientType" ] = pSt_ProtocolAuth->enClientType ;
347+ st_JsonAuth[" enDeviceType" ] = pSt_ProtocolAuth->enDeviceType ;
348+
349+ st_JsonRoot[" unOperatorType" ] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
350+ st_JsonRoot[" unOperatorCode" ] = nCode;
351+ st_JsonRoot[" wReserve" ] = 0 ;
352+ st_JsonRoot[" byVersion" ] = 2 ;
353+ st_JsonRoot[" st_Auth" ] = st_JsonAuth;
354+
355+ st_JsonBuilder[" emitUTF8" ] = true ;
356+
357+ *pInt_MsgLen = Json::writeString (st_JsonBuilder, st_JsonRoot).length ();
358+ memcpy (ptszMsgBuffer, Json::writeString (st_JsonBuilder, st_JsonRoot).c_str (), *pInt_MsgLen);
359+ return TRUE ;
360+ }
361+ /* *******************************************************************
362+ 函数名称:ProtocolModule_Packet_PassUser
363+ 函数功能:HTTP用户信息打包函数
364+ 参数.一:pSt_ProtocolUser
365+ In/Out:In
366+ 类型:数据结构指针
367+ 可空:N
368+ 意思:输入要打包的内容
369+ 参数.二:ptszMsgBuffer
370+ In/Out:Out
371+ 类型:字符指针
372+ 可空:N
373+ 意思:输出打好包的缓冲区
374+ 参数.三:pInt_MsgLen
375+ In/Out:Out
376+ 类型:整数型指针
377+ 可空:N
378+ 意思:输出缓冲区大小
379+ 参数.四:nCode
380+ In/Out:In
381+ 类型:整数型
382+ 可空:N
383+ 意思:输入要操纵的协议
384+ 返回值
385+ 类型:逻辑型
386+ 意思:是否成功
387+ 备注:
388+ *********************************************************************/
389+ BOOL CProtocolModule_Packet::ProtocolModule_Packet_PassUser (XENGINE_PROTOCOL_USERINFO* pSt_ProtocolUser, TCHAR* ptszMsgBuffer, int * pInt_MsgLen, int nCode)
390+ {
391+ Protocol_IsErrorOccur = FALSE ;
392+
393+ if ((NULL == pSt_ProtocolUser) || (NULL == ptszMsgBuffer) || (NULL == pInt_MsgLen))
394+ {
395+ Protocol_IsErrorOccur = TRUE ;
396+ Protocol_dwErrorCode = ERROR_MQ_MODULE_PROTOCOL_PARAMENT;
397+ return FALSE ;
398+ }
399+ Json::Value st_JsonRoot;
400+ Json::Value st_JsonUser;
401+ Json::StreamWriterBuilder st_JsonBuilder;
402+
403+ st_JsonUser[" nIDNumber" ] = pSt_ProtocolUser->nIDNumber ;
404+ st_JsonUser[" nPhoneNumber" ] = pSt_ProtocolUser->nPhoneNumber ;
405+ st_JsonUser[" nUserLevel" ] = pSt_ProtocolUser->nUserLevel ;
406+ st_JsonUser[" nUserState" ] = pSt_ProtocolUser->nUserState ;
407+ st_JsonUser[" tszCreateTime" ] = pSt_ProtocolUser->tszCreateTime ;
408+ st_JsonUser[" tszEMailAddr" ] = pSt_ProtocolUser->tszEMailAddr ;
409+ st_JsonUser[" tszLoginTime" ] = pSt_ProtocolUser->tszLoginTime ;
410+ st_JsonUser[" tszUserName" ] = pSt_ProtocolUser->tszUserName ;
411+ st_JsonUser[" tszUserPass" ] = pSt_ProtocolUser->tszUserPass ;
412+
413+ st_JsonRoot[" unOperatorType" ] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ;
414+ st_JsonRoot[" unOperatorCode" ] = nCode;
415+ st_JsonRoot[" wReserve" ] = 0 ;
416+ st_JsonRoot[" byVersion" ] = 2 ;
417+ st_JsonRoot[" st_User" ] = st_JsonUser;
418+
342419 st_JsonBuilder[" emitUTF8" ] = true ;
343420
344421 *pInt_MsgLen = Json::writeString (st_JsonBuilder, st_JsonRoot).length ();
0 commit comments