SMSHandle.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef _SMS_HANDLE_HEADER_
  2. #define _SMS_HANDLE_HEADER_
  3. #include "CritSection.h"
  4. #include "CurlClient.h"
  5. typedef struct _SEND_RESPONEINFO_
  6. {
  7. CString strSendStatus; //发送状态
  8. CString strSendCount; //
  9. CString strBalance; //
  10. CString strErPhone;
  11. CString strSid;
  12. }ResponebySend, *pResponebySend;
  13. typedef struct _QUERYACCOUNTINFO_
  14. {
  15. CString strSendStatus;
  16. CString strAccount;
  17. CString strBalance;
  18. CString strSMSCharacterCount;
  19. CString strSignatures;
  20. CString strOwnedOperators; //平台服务器商
  21. }QuerAccountInfo, *pQuerAccountInfo;
  22. // 记录表sendreg
  23. typedef struct _SSendReg
  24. {
  25. CString account;
  26. CString phones;
  27. CString content;
  28. CString timestamp;
  29. CString msgcount;
  30. CString log;
  31. CString status;
  32. CString Sid;
  33. CString autoid;
  34. }SSendReg, *pSSendReg;
  35. #pragma once
  36. class CSMSHandle
  37. {
  38. public:
  39. CSMSHandle();
  40. ~CSMSHandle();
  41. INT AnalyzeSendStatus(LPBYTE lpRespone, ResponebySend &lRespone);
  42. //获取帐户信息
  43. int GetSMSBlance(const TCHAR* pSMSServer, const DWORD& dwPort, CString& strAccount, CString& strPwd, QuerAccountInfo& tAccountInfo);
  44. //发送短信
  45. int SendSMToSever(const TCHAR* pSMSServer, const DWORD& dwPort, const CString& strAccount, const CString& strPwd, const CString& strPhones, const CString& strContent, const CString& strStampTime, const CString& strAutoID);
  46. //获取短信状态
  47. int GetSMState(const TCHAR* pSMSServer, const DWORD& dwPort, const CString& strAccount, const CString& strPwd, const SSendReg* pSR);
  48. void UrlUTF8Decode(LPBYTE lpRespone, CString& strRespone);
  49. void UTF8ToWideChar(LPBYTE lpRespone, CString& strRespone);
  50. private:
  51. ThreadSection *ReturnSection(){return &s_critSection;}
  52. int UpdateSMLog(const int nRet, const ResponebySend* lRespone, const CString& strAutoID);
  53. private:
  54. ThreadSection s_critSection;
  55. utilitySdk::CCurlClient m_url;
  56. };
  57. #endif