mod_CustMngrAuth.cpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. DbgToBeidou(ctx->link, __FUNCTION__)();
  76. if (m_fsm.m_ctx == NULL) m_fsm.m_ctx = ctx;
  77. AuthorizeStartEvent* e = new AuthorizeStartEvent();
  78. e->ctx = ctx;
  79. m_fsm.PostEventFIFO(e);
  80. }
  81. //废弃
  82. void CCustMngrAuthEntity::StopAuthorize(SpReqAnsContext<CustMngrAuthService_StopAuthorize_Req, CustMngrAuthService_StopAuthorize_Ans>::Pointer ctx)
  83. {
  84. LOG_FUNCTION();
  85. DbgToBeidou(ctx->link, __FUNCTION__)();
  86. AuthorizeCancelEvent* e = new AuthorizeCancelEvent();
  87. m_fsm.PostEventFIFO(e);
  88. }
  89. //使用
  90. void CCustMngrAuthEntity::QueryAuthorInfo(SpReqAnsContext<CustMngrAuthService_QueryAuthorInfo_Req, CustMngrAuthService_QueryAuthorInfo_Ans>::Pointer ctx)
  91. {
  92. LOG_FUNCTION();
  93. DbgToBeidou(ctx->link, __FUNCTION__)();
  94. if (m_fsm.qaInfoCtx == NULL) m_fsm.qaInfoCtx = ctx;
  95. QueryAuthorInfoEvent* e = new QueryAuthorInfoEvent();
  96. e->ctx = ctx;
  97. m_fsm.PostEventFIFO(e);
  98. }
  99. //使用
  100. void CCustMngrAuthEntity::StopAuthorizeEx(SpReqAnsContext<CustMngrAuthService_StopAuthorizeEx_Req, CustMngrAuthService_StopAuthorizeEx_Ans>::Pointer ctx)
  101. {
  102. LOG_FUNCTION();
  103. DbgToBeidou(ctx->link, __FUNCTION__)();
  104. AuthorizeCancelExEvent* e = new AuthorizeCancelExEvent();
  105. m_fsm.PostEventFIFO(e);
  106. }
  107. //废弃
  108. void CCustMngrAuthEntity::CollectFingerPrint(SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx)
  109. {
  110. LOG_FUNCTION();
  111. DbgToBeidou(ctx->link, __FUNCTION__)();
  112. CollectFingerPrintStartEvent *pEvt = new CollectFingerPrintStartEvent();
  113. pEvt->ctx = ctx;
  114. m_fsm.PostEventFIFO(pEvt);
  115. }
  116. //使用
  117. void CCustMngrAuthEntity::StopCollect(SpReqAnsContext<CustMngrAuthService_StopCollect_Req, CustMngrAuthService_StopCollect_Ans>::Pointer ctx)
  118. {
  119. LOG_FUNCTION();
  120. DbgToBeidou(ctx->link, __FUNCTION__)();
  121. CancelCollectFingerPrintEvent* pEvt = new CancelCollectFingerPrintEvent();
  122. m_fsm.PostEventFIFO(pEvt);
  123. }
  124. //废弃
  125. void CCustMngrAuthEntity::CollectFingerPrintEx(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintEx_Req, CustMngrAuthService_CollectFingerPrintEx_Ans>::Pointer ctx)
  126. {
  127. LOG_FUNCTION();
  128. DbgToBeidou(ctx->link, __FUNCTION__)();
  129. CollectFingerPrintExStartEvent* pEvt = new CollectFingerPrintExStartEvent();
  130. pEvt->ctx = ctx;
  131. m_fsm.PostEventFIFO(pEvt);
  132. }
  133. //使用
  134. void CCustMngrAuthEntity::CollectFingerPrintInfo(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintInfo_Req, CustMngrAuthService_CollectFingerPrintInfo_Ans>::Pointer ctx)
  135. {
  136. LOG_FUNCTION();
  137. DbgToBeidou(ctx->link, __FUNCTION__)();
  138. CollectFingerPrintInfoEvent *pEvt = new CollectFingerPrintInfoEvent();
  139. pEvt->ctx = ctx;
  140. m_fsm.PostEventFIFO(pEvt);
  141. }
  142. //使用
  143. void CCustMngrAuthEntity::GenerateTemplate(SpReqAnsContext<CustMngrAuthService_GenerateTemplate_Req, CustMngrAuthService_GenerateTemplate_Ans>::Pointer ctx)
  144. {
  145. LOG_FUNCTION();
  146. DbgToBeidou(ctx->link, __FUNCTION__)();
  147. GenerateTemplateEvent* gtEvt = new GenerateTemplateEvent();
  148. gtEvt->ctx = ctx;
  149. m_fsm.PostEventFIFO(gtEvt);
  150. }
  151. //废弃
  152. void CCustMngrAuthEntity::SaveFingerPrint(SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx)
  153. {
  154. LOG_FUNCTION();
  155. DbgToBeidou(ctx->link, __FUNCTION__)();
  156. SaveFingerPrintStartEvent *pEvt = new SaveFingerPrintStartEvent();
  157. pEvt->ctx = ctx;
  158. m_fsm.PostEventFIFO(pEvt);
  159. }
  160. //废弃
  161. void CCustMngrAuthEntity::CheckUkey(SpReqAnsContext<CustMngrAuthService_CheckUkey_Req, CustMngrAuthService_CheckUkey_Ans>::Pointer ctx)
  162. {
  163. LOG_FUNCTION();
  164. DbgToBeidou(ctx->link, __FUNCTION__)();
  165. CheckUkeyEvent *pEvt = new CheckUkeyEvent();
  166. m_fsm.PostEventFIFO(pEvt);
  167. }
  168. //废弃
  169. void CCustMngrAuthEntity::HoldOn(SpReqAnsContext<CustMngrAuthService_HoldOn_Req, CustMngrAuthService_HoldOn_Ans>::Pointer ctx)
  170. {
  171. LOG_FUNCTION();
  172. DbgToBeidou(ctx->link, __FUNCTION__)();
  173. HoldOnEvent *pEvt = new HoldOnEvent();
  174. pEvt->ctx = ctx;
  175. m_fsm.PostEventFIFO(pEvt);
  176. }
  177. //废弃
  178. void CustMngrAuthServerSession::Handle_StartAuthorize(SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx)
  179. {
  180. LOG_FUNCTION();
  181. DbgToBeidou(ctx->link, __FUNCTION__)();
  182. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StartAuthorize");
  183. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke StartAuthorize request refuse");
  184. ctx->Answer(Error_Exception);
  185. //m_pEntity->StartAuthorize(ctx);
  186. }
  187. //使用
  188. void CustMngrAuthServerSession::Handle_QueryAuthorInfo(SpReqAnsContext<CustMngrAuthService_QueryAuthorInfo_Req, CustMngrAuthService_QueryAuthorInfo_Ans>::Pointer ctx)
  189. {
  190. LOG_FUNCTION();
  191. DbgToBeidou(ctx->link, __FUNCTION__)();
  192. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke QueryAuthorInfo TimeLimit:%d, WayofFinger:%d, WayofKey:%d",
  193. ctx->Req.TimeLimit, ctx->Req.WayofFinger, ctx->Req.WayofKey);
  194. if (ctx->Req.WayofFinger != 1) {
  195. ctx->Answer(Error_Param);//uos中只通过指纹授权
  196. return;
  197. }
  198. m_pEntity->QueryAuthorInfo(ctx);
  199. }
  200. //废弃
  201. void CustMngrAuthServerSession::Handle_StopAuthorize(SpReqAnsContext<CustMngrAuthService_StopAuthorize_Req, CustMngrAuthService_StopAuthorize_Ans>::Pointer ctx)
  202. {
  203. LOG_FUNCTION();
  204. DbgToBeidou(ctx->link, __FUNCTION__)();
  205. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopAuthorize");
  206. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke StopAuthorize request refuse");
  207. ctx->Answer(Error_Exception);
  208. //m_pEntity->StopAuthorize(ctx);
  209. }
  210. //使用
  211. void CustMngrAuthServerSession::Handle_StopAuthorizeEx(SpReqAnsContext<CustMngrAuthService_StopAuthorizeEx_Req, CustMngrAuthService_StopAuthorizeEx_Ans>::Pointer ctx)
  212. {
  213. LOG_FUNCTION();
  214. DbgToBeidou(ctx->link, __FUNCTION__)();
  215. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopAuthorizeEx");
  216. m_pEntity->StopAuthorizeEx(ctx);
  217. }
  218. //废弃
  219. void CustMngrAuthServerSession::Handle_CollectFingerPrint(SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx)
  220. {
  221. LOG_FUNCTION();
  222. DbgToBeidou(ctx->link, __FUNCTION__)();
  223. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrint");
  224. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke CollectFingerPrint request refuse");
  225. ctx->Answer(Error_Exception);
  226. //m_pEntity->CollectFingerPrint(ctx);
  227. }
  228. //使用
  229. void CustMngrAuthServerSession::Handle_StopCollect(SpReqAnsContext<CustMngrAuthService_StopCollect_Req, CustMngrAuthService_StopCollect_Ans>::Pointer ctx)
  230. {
  231. LOG_FUNCTION();
  232. DbgToBeidou(ctx->link, __FUNCTION__)();
  233. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke StopCollect");
  234. m_pEntity->StopCollect(ctx);
  235. }
  236. //废弃
  237. void CustMngrAuthServerSession::Handle_CollectFingerPrintEx(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintEx_Req, CustMngrAuthService_CollectFingerPrintEx_Ans>::Pointer ctx)
  238. {
  239. LOG_FUNCTION();
  240. DbgToBeidou(ctx->link, __FUNCTION__)();
  241. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrintEx");
  242. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke CollectFingerPrintEx request refuse");
  243. ctx->Answer(Error_Exception);
  244. //m_pEntity->CollectFingerPrintEx(ctx);
  245. }
  246. //使用
  247. void CustMngrAuthServerSession::Handle_CollectFingerPrintInfo(SpReqAnsContext<CustMngrAuthService_CollectFingerPrintInfo_Req, CustMngrAuthService_CollectFingerPrintInfo_Ans>::Pointer ctx)
  248. {
  249. LOG_FUNCTION();
  250. DbgToBeidou(ctx->link, __FUNCTION__)();
  251. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CollectFingerPrintInfo");
  252. m_pEntity->CollectFingerPrintInfo(ctx);
  253. }
  254. //使用
  255. void CustMngrAuthServerSession::Handle_GenerateTemplate(SpReqAnsContext<CustMngrAuthService_GenerateTemplate_Req, CustMngrAuthService_GenerateTemplate_Ans>::Pointer ctx)
  256. {
  257. LOG_FUNCTION();
  258. DbgToBeidou(ctx->link, __FUNCTION__)();
  259. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke GenerateTemplate");
  260. m_pEntity->GenerateTemplate(ctx);
  261. }
  262. //废弃
  263. void CustMngrAuthServerSession::Handle_SaveFingerPrint(SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx)
  264. {
  265. LOG_FUNCTION();
  266. DbgToBeidou(ctx->link, __FUNCTION__)();
  267. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke SaveFingerPrint");
  268. LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_REQUEST_REFUSE, "web invoke SaveFingerPrint request refuse");
  269. ctx->Answer(Error_Exception);
  270. //m_pEntity->SaveFingerPrint(ctx);
  271. }
  272. //废弃
  273. void CustMngrAuthServerSession::Handle_CheckUkey(SpReqAnsContext<CustMngrAuthService_CheckUkey_Req, CustMngrAuthService_CheckUkey_Ans>::Pointer ctx)
  274. {
  275. LOG_FUNCTION();
  276. DbgToBeidou(ctx->link, __FUNCTION__)();
  277. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CheckUkey");
  278. m_pEntity->CheckUkey(ctx);
  279. }
  280. //废弃
  281. void CustMngrAuthServerSession::Handle_HoldOn(SpReqAnsContext<CustMngrAuthService_HoldOn_Req, CustMngrAuthService_HoldOn_Ans>::Pointer ctx)
  282. {
  283. LOG_FUNCTION();
  284. DbgToBeidou(ctx->link, __FUNCTION__)();
  285. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke HoldOn");
  286. m_pEntity->HoldOn(ctx);
  287. }
  288. SP_BEGIN_ENTITY_MAP()
  289. SP_ENTITY(CCustMngrAuthEntity)
  290. SP_END_ENTITY_MAP()