unit CAOperator;interface uses SysUtils,Classes,XMLDoc,ActiveX,SqlExpr,DBXpress,Forms, {FMTBcd,} DB,SoapHTTPClient,Variants, uSMSInterface;type TCAFunction = class private { Private declarations } FDBConnect: TSQLConnection; soapPRIO: THTTPRIO; FSoapCAIntf:SMSInterface; public { Public declarations } constructor Create; destructor Destroy;override; function Call(strRequest: String;limit:integer = -1):string; end; function NextTransID(DBConnect:TSQLConnection):string;implementation uses tools,SysParam; function MD5( szData:string; wLength:WORD; // cdecl; stdcall szBuffer:PChar ) : Boolean; cdecl;external 'NTPWDENC.DLL' name 'MessageDigest5'; Resourcestring strXMLHead = '<?xml version="1.0" encoding="GB2312"?>';
const TransIDLengen:integer = 8; { TCAFunction }constructor TCAFunction.Create; begin CoInitialize(nil); FDBConnect:=nil; soapPRIO:= THTTPRIO.Create(nil); soapPRIO.URL:=SysParams.CAIntf.IntfUrl; FSoapCAIntf:=(soapPRIO as SMSInterface); end;destructor TCAFunction.Destroy; begin FSoapCAIntf:=nil; soapPRIO := nil; CoUnInitialize(); inherited; end; function TCAFunction.Call(strRequest: String;limit:integer = -1):string; type TBuffer = array[0..1024] of char; var strSRequest : string; strBuffer : TBuffer; sid : String; begin LogByDay(strRequest); if SysParams.CAIntf.IntfMode = 0 then begin strSRequest := strRequest+SysParams.CAIntf.SMSCode; FillChar(strBuffer,SizeOf(strBuffer),#0); if MD5(strSRequest,length(strSRequest),@strBuffer[0]) then begin strSRequest := LowerCase(strBuffer)+SysParams.CAIntf.SMSKey; MD5(strSRequest,length(strSRequest),@strBuffer[0]); result := FSoapCAIntf.SMSInterface( SysParams.CAIntf.IntfVersion, strRequest, SysParams.CAIntf.SMSCode, LowerCase(strBuffer) ); LogByDay(result); end; end else if SysParams.CAIntf.IntfMode = 3 then begin LogByDay('测试环境') end; end; end.
uSMSInterface;type
TCAFunction = class
private
{ Private declarations }
FDBConnect: TSQLConnection;
soapPRIO: THTTPRIO;
FSoapCAIntf:SMSInterface;
public
{ Public declarations }
constructor Create;
destructor Destroy;override;
function Call(strRequest: String;limit:integer = -1):string; end; function NextTransID(DBConnect:TSQLConnection):string;implementation
uses tools,SysParam; function MD5( szData:string;
wLength:WORD; // cdecl; stdcall
szBuffer:PChar )
: Boolean; cdecl;external 'NTPWDENC.DLL' name 'MessageDigest5'; Resourcestring strXMLHead = '<?xml version="1.0" encoding="GB2312"?>';
const TransIDLengen:integer = 8;
{ TCAFunction }constructor TCAFunction.Create;
begin
CoInitialize(nil);
FDBConnect:=nil;
soapPRIO:= THTTPRIO.Create(nil);
soapPRIO.URL:=SysParams.CAIntf.IntfUrl;
FSoapCAIntf:=(soapPRIO as SMSInterface);
end;destructor TCAFunction.Destroy;
begin
FSoapCAIntf:=nil;
soapPRIO := nil;
CoUnInitialize();
inherited;
end;
function TCAFunction.Call(strRequest: String;limit:integer = -1):string;
type
TBuffer = array[0..1024] of char;
var
strSRequest : string;
strBuffer : TBuffer;
sid : String;
begin
LogByDay(strRequest);
if SysParams.CAIntf.IntfMode = 0 then
begin
strSRequest := strRequest+SysParams.CAIntf.SMSCode;
FillChar(strBuffer,SizeOf(strBuffer),#0);
if MD5(strSRequest,length(strSRequest),@strBuffer[0]) then
begin
strSRequest := LowerCase(strBuffer)+SysParams.CAIntf.SMSKey;
MD5(strSRequest,length(strSRequest),@strBuffer[0]);
result := FSoapCAIntf.SMSInterface(
SysParams.CAIntf.IntfVersion,
strRequest,
SysParams.CAIntf.SMSCode,
LowerCase(strBuffer)
); LogByDay(result);
end;
end else
if SysParams.CAIntf.IntfMode = 3 then
begin
LogByDay('测试环境')
end;
end;
end.