mod_CustMngrAuth.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. #pragma once
  2. #include "stdafx.h"
  3. #include "SpBase.h"
  4. #include "mod_CustMngrAuth.h"
  5. #include "CustMngrAuth_UserErrorCode.h"
  6. CCustMngrAuthEntity::CCustMngrAuthEntity()
  7. {
  8. }
  9. const char* CCustMngrAuthEntity::GetEntityName() const
  10. {
  11. return "CustMngrAuth";
  12. }
  13. void CCustMngrAuthEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
  14. {
  15. LOG_FUNCTION();
  16. ErrorCodeEnum eErr = __OnStart(Error_Succeed);
  17. pTransactionContext->SendAnswer(eErr);
  18. }
  19. ErrorCodeEnum CCustMngrAuthEntity::__OnStart(ErrorCodeEnum preOperationError)
  20. {
  21. LOG_FUNCTION();
  22. if (preOperationError != Error_Succeed)
  23. return preOperationError;
  24. ErrorCodeEnum eStart = m_fsm.Init(this);
  25. if (eStart != Error_Succeed)
  26. {
  27. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_fsm.Init failed");
  28. }
  29. return eStart;
  30. }
  31. void CCustMngrAuthEntity::OnPreClose(EntityCloseCauseEnum eCloseCause, CSmartPointer<ITransactionContext> pTransactionContext)
  32. {
  33. LOG_FUNCTION();
  34. pTransactionContext->SendAnswer(Error_Succeed);
  35. }
  36. ErrorCodeEnum CCustMngrAuthEntity::__OnClose(ErrorCodeEnum preOperationError)
  37. {
  38. LOG_FUNCTION();
  39. return preOperationError;
  40. }
  41. void CCustMngrAuthEntity::OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
  42. {
  43. LOG_FUNCTION();
  44. pTransactionContext->SendAnswer(Error_Succeed);
  45. }
  46. void CCustMngrAuthEntity::OnContinued()
  47. {
  48. LOG_FUNCTION();
  49. }
  50. void CCustMngrAuthEntity::OnBroadcastEvent(CUUID SubID, const char *pszEntityName, DWORD dwMessageId, DWORD dwMessageSignature, CAutoBuffer Buffer)
  51. {
  52. }
  53. CServerSessionBase* CCustMngrAuthEntity::OnNewSession(const char*,const char*)
  54. {
  55. //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("A new connecting request arrived.");
  56. m_bNewSessionInit = true;
  57. return new CustMngrAuthServerSession(this);
  58. }
  59. void CCustMngrAuthEntity::OnTimeout(DWORD dwTimerID)
  60. {
  61. switch(dwTimerID)
  62. {
  63. case 1:
  64. {
  65. }
  66. break;
  67. default:
  68. break;
  69. }
  70. }
  71. //废弃
  72. void CCustMngrAuthEntity::StartAuthorize(SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx)
  73. {
  74. LOG_FUNCTION();
  75. if (m_fsm.m_ctx == NULL) m_fsm.m_ctx = ctx;
  76. AuthorizeStartEvent* e = new AuthorizeStartEvent();
  77. e->ctx = ctx;
  78. m_fsm.PostEventFIFO(e);
  79. }
  80. //废弃
  81. void CCustMngrAuthEntity::StopAuthorize(SpReqAnsContext<CustMngrAuthService_StopAuthorize_Req, CustMngrAuthService_StopAuthorize_Ans>::Pointer ctx)
  82. {
  83. LOG_FUNCTION();
  84. AuthorizeCancelEvent* e = new AuthorizeCancelEvent();
  85. m_fsm.PostEventFIFO(e);
  86. }
  87. //使用
  88. void CCustMngrAuthEntity::QueryAuthorInfo(SpReqAnsContext<CustMngrAuthService_QueryAuthorInfo_Req, CustMngrAuthService_QueryAuthorInfo_Ans>::Pointer ctx)
  89. {
  90. LOG_FUNCTION();
  91. if (m_fsm.qaInfoCtx == NULL) m_fsm.qaInfoCtx = ctx;
  92. QueryAuthorInfoEvent* e = new QueryAuthorInfoEvent();
  93. e->ctx = ctx;
  94. m_fsm.PostEventFIFO(e);
  95. }
  96. //使用
  97. void CCustMngrAuthEntity::StopAuthorizeEx(SpReqAnsContext<CustMngrAuthService_StopAuthorizeEx_Req, CustMngrAuthService_StopAuthorizeEx_Ans>::Pointer ctx)
  98. {
  99. LOG_FUNCTION();
  100. AuthorizeCancelExEvent* e = new AuthorizeCancelExEvent();
  101. m_fsm.PostEventFIFO(e);
  102. }
  103. //废弃
  104. void CCustMngrAuthEntity::CollectFingerPrint(SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx)
  105. {
  106. LOG_FUNCTION();
  107. CollectFingerPrintStartEvent *pEvt = new CollectFingerPrintStartEvent();
  108. pEvt->ctx = ctx;
  109. m_fsm.PostEventFIFO(pEvt);
  110. }
  111. //使用
  112. void CCustMngrAuthEntity::StopCollect(SpReqAnsContext<CustMngrAuthService_StopCollect_Req, CustMngrAuthService_StopCollect_Ans>::Pointer ctx)
  113. {
  114. LOG_FUNCTION();
  115. CancelCollectFingerPrintEvent* pEvt = new CancelCollectFingerPrintEvent();
  116. m_fsm.PostEventFIFO(pEvt);
  117. }
  118. //废弃
  119. void CCustMngrAuthEntity::CollectFingerPrintEx(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintEx_Req, CustMngrAuthService_CollectFingerPrintEx_Ans>::Pointer ctx)
  120. {
  121. LOG_FUNCTION();
  122. CollectFingerPrintExStartEvent* pEvt = new CollectFingerPrintExStartEvent();
  123. pEvt->ctx = ctx;
  124. m_fsm.PostEventFIFO(pEvt);
  125. }
  126. //使用
  127. void CCustMngrAuthEntity::CollectFingerPrintInfo(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintInfo_Req, CustMngrAuthService_CollectFingerPrintInfo_Ans>::Pointer ctx)
  128. {
  129. LOG_FUNCTION();
  130. CollectFingerPrintInfoEvent *pEvt = new CollectFingerPrintInfoEvent();
  131. pEvt->ctx = ctx;
  132. m_fsm.PostEventFIFO(pEvt);
  133. }
  134. //使用
  135. void CCustMngrAuthEntity::GenerateTemplate(SpReqAnsContext<CustMngrAuthService_GenerateTemplate_Req, CustMngrAuthService_GenerateTemplate_Ans>::Pointer ctx)
  136. {
  137. LOG_FUNCTION();
  138. GenerateTemplateEvent* gtEvt = new GenerateTemplateEvent();
  139. gtEvt->ctx = ctx;
  140. m_fsm.PostEventFIFO(gtEvt);
  141. }
  142. //废弃
  143. void CCustMngrAuthEntity::SaveFingerPrint(SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx)
  144. {
  145. LOG_FUNCTION();
  146. SaveFingerPrintStartEvent *pEvt = new SaveFingerPrintStartEvent();
  147. pEvt->ctx = ctx;
  148. m_fsm.PostEventFIFO(pEvt);
  149. }
  150. //废弃
  151. void CCustMngrAuthEntity::CheckUkey(SpReqAnsContext<CustMngrAuthService_CheckUkey_Req, CustMngrAuthService_CheckUkey_Ans>::Pointer ctx)
  152. {
  153. LOG_FUNCTION();
  154. CheckUkeyEvent *pEvt = new CheckUkeyEvent();
  155. m_fsm.PostEventFIFO(pEvt);
  156. }
  157. //废弃
  158. void CCustMngrAuthEntity::HoldOn(SpReqAnsContext<CustMngrAuthService_HoldOn_Req, CustMngrAuthService_HoldOn_Ans>::Pointer ctx)
  159. {
  160. LOG_FUNCTION();
  161. HoldOnEvent *pEvt = new HoldOnEvent();
  162. pEvt->ctx = ctx;
  163. m_fsm.PostEventFIFO(pEvt);
  164. }
  165. //废弃
  166. void CustMngrAuthServerSession::Handle_StartAuthorize(SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx)
  167. {
  168. LOG_FUNCTION();
  169. DbgToBeidou(ctx->link, __FUNCTION__)();
  170. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StartAuthorize");
  171. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke StartAuthorize request refuse");
  172. ctx->Answer(Error_Exception);
  173. //m_pEntity->StartAuthorize(ctx);
  174. }
  175. //使用
  176. void CustMngrAuthServerSession::Handle_QueryAuthorInfo(SpReqAnsContext<CustMngrAuthService_QueryAuthorInfo_Req, CustMngrAuthService_QueryAuthorInfo_Ans>::Pointer ctx)
  177. {
  178. LOG_FUNCTION();
  179. DbgToBeidou(ctx->link, __FUNCTION__)();
  180. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke QueryAuthorInfo TimeLimit:%d, WayofFinger:%d, WayofKey:%d",
  181. ctx->Req.TimeLimit, ctx->Req.WayofFinger, ctx->Req.WayofKey);
  182. if (ctx->Req.WayofFinger != 1) {
  183. ctx->Answer(Error_Param);//uos中只通过指纹授权
  184. return;
  185. }
  186. m_pEntity->QueryAuthorInfo(ctx);
  187. }
  188. //废弃
  189. void CustMngrAuthServerSession::Handle_StopAuthorize(SpReqAnsContext<CustMngrAuthService_StopAuthorize_Req, CustMngrAuthService_StopAuthorize_Ans>::Pointer ctx)
  190. {
  191. LOG_FUNCTION();
  192. DbgToBeidou(ctx->link, __FUNCTION__)();
  193. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopAuthorize");
  194. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke StopAuthorize request refuse");
  195. ctx->Answer(Error_Exception);
  196. //m_pEntity->StopAuthorize(ctx);
  197. }
  198. //使用
  199. void CustMngrAuthServerSession::Handle_StopAuthorizeEx(SpReqAnsContext<CustMngrAuthService_StopAuthorizeEx_Req, CustMngrAuthService_StopAuthorizeEx_Ans>::Pointer ctx)
  200. {
  201. LOG_FUNCTION();
  202. DbgToBeidou(ctx->link, __FUNCTION__)();
  203. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopAuthorizeEx");
  204. m_pEntity->StopAuthorizeEx(ctx);
  205. }
  206. //废弃
  207. void CustMngrAuthServerSession::Handle_CollectFingerPrint(SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx)
  208. {
  209. LOG_FUNCTION();
  210. DbgToBeidou(ctx->link, __FUNCTION__)();
  211. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrint");
  212. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke CollectFingerPrint request refuse");
  213. ctx->Answer(Error_Exception);
  214. //m_pEntity->CollectFingerPrint(ctx);
  215. }
  216. //使用
  217. void CustMngrAuthServerSession::Handle_StopCollect(SpReqAnsContext<CustMngrAuthService_StopCollect_Req, CustMngrAuthService_StopCollect_Ans>::Pointer ctx)
  218. {
  219. LOG_FUNCTION();
  220. DbgToBeidou(ctx->link, __FUNCTION__)();
  221. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopCollect");
  222. m_pEntity->StopCollect(ctx);
  223. }
  224. //废弃
  225. void CustMngrAuthServerSession::Handle_CollectFingerPrintEx(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintEx_Req, CustMngrAuthService_CollectFingerPrintEx_Ans>::Pointer ctx)
  226. {
  227. LOG_FUNCTION();
  228. DbgToBeidou(ctx->link, __FUNCTION__)();
  229. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrintEx");
  230. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke CollectFingerPrintEx request refuse");
  231. ctx->Answer(Error_Exception);
  232. //m_pEntity->CollectFingerPrintEx(ctx);
  233. }
  234. //使用
  235. void CustMngrAuthServerSession::Handle_CollectFingerPrintInfo(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintInfo_Req, CustMngrAuthService_CollectFingerPrintInfo_Ans>::Pointer ctx)
  236. {
  237. LOG_FUNCTION();
  238. DbgToBeidou(ctx->link, __FUNCTION__)();
  239. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrintInfo");
  240. m_pEntity->CollectFingerPrintInfo(ctx);
  241. }
  242. //使用
  243. void CustMngrAuthServerSession::Handle_GenerateTemplate(SpReqAnsContext<CustMngrAuthService_GenerateTemplate_Req, CustMngrAuthService_GenerateTemplate_Ans>::Pointer ctx)
  244. {
  245. LOG_FUNCTION();
  246. DbgToBeidou(ctx->link, __FUNCTION__)();
  247. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke GenerateTemplate");
  248. m_pEntity->GenerateTemplate(ctx);
  249. }
  250. //废弃
  251. void CustMngrAuthServerSession::Handle_SaveFingerPrint(SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx)
  252. {
  253. LOG_FUNCTION();
  254. DbgToBeidou(ctx->link, __FUNCTION__)();
  255. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke SaveFingerPrint");
  256. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke SaveFingerPrint request refuse");
  257. ctx->Answer(Error_Exception);
  258. //m_pEntity->SaveFingerPrint(ctx);
  259. }
  260. //废弃
  261. void CustMngrAuthServerSession::Handle_CheckUkey(SpReqAnsContext<CustMngrAuthService_CheckUkey_Req, CustMngrAuthService_CheckUkey_Ans>::Pointer ctx)
  262. {
  263. LOG_FUNCTION();
  264. DbgToBeidou(ctx->link, __FUNCTION__)();
  265. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CheckUkey");
  266. m_pEntity->CheckUkey(ctx);
  267. }
  268. //废弃
  269. void CustMngrAuthServerSession::Handle_HoldOn(SpReqAnsContext<CustMngrAuthService_HoldOn_Req, CustMngrAuthService_HoldOn_Ans>::Pointer ctx)
  270. {
  271. LOG_FUNCTION();
  272. DbgToBeidou(ctx->link, __FUNCTION__)();
  273. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke HoldOn");
  274. m_pEntity->HoldOn(ctx);
  275. }
  276. SP_BEGIN_ENTITY_MAP()
  277. SP_ENTITY(CCustMngrAuthEntity)
  278. SP_END_ENTITY_MAP()