⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smg_sendthread.~pas

📁 SPIG1.1.rar SPIG接口协议
💻 ~PAS
字号:
unit SMG_SendThread;

interface

uses
  Windows, Forms, SysUtils, Classes, Registry, Math, Gauges, ComCtrls,
  SP_SMG_DLL, SMG_DB;

type
  Send_Thread = class(TThread)
  private
    procedure SendBuffer;
    { Private declarations }
  protected
    procedure Execute; override;
  public
    constructor Create(CreateSuspended: Boolean);
  end;

implementation

{ Important: Methods and properties of objects in VCL or CLX can only be used
  in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure SendThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ SendThread }
uses SPServer, DLL_Exports;
  
procedure Send_Thread.Execute;
begin
  { Place thread code here }
  FreeOnTerminate := True;
  SendBuffer;
end;

constructor Send_Thread.Create(CreateSuspended: Boolean);
begin
 FreeOnTerminate := True;
 inherited Create(CreateSuspended);
end;

procedure Send_Thread.SendBuffer;
var
 SendBuffer:PSendBuffer;
 Re,Count,Len:Integer;
 SeqNum1,SeqNum2,SeqNum3: LongInt;
 SPNum,ChargeNum,UserNum,CorpID,SvcType:PChar;
 FeeType:Char;
 FeeValue,GivenValue:PChar;
 AgentFlag,MoFlag,Priorit:Char;
 ExpireTime,ScheduleTime:PChar;
 ReportFlag,Pid,UDhi,MsgCoding,MsgType:Char;
 MsgContent,Reserve:PChar;
begin
 Inc(RI);
 New(SendBuffer);
 SendBuffer := BufferList[0];
   with SendBuffer^ do
      begin
        SPNum:=SPNumber;
        ChargeNum:=ChargeNumber;
        Count:=UserCount;
        UserNum:=UserPhone;
        CorpID:=CorpIDd;
        SvcType:=SvcType;
        FeeType:=FeeType;
        FeeValue:=FeeValue;
        GivenValue:=GivenValue;
        AgentFlag:=AgentFlag;
        MoFlag:=MoFlag;
        Priorit:=Priority;
        ExpireTime:=ExpireTime;
        ScheduleTime:=ScheduleTime;
        ReportFlag:=ReportFlag;
        Pid:=Tppid;
        Udhi:=Tpudhi;
        MsgCoding:=MsgCoding;
        MsgType:=MsgType;
        Len:=MsgLen;
        MsgContent:=MsgContent;
        Reserve:=Reserve;
      end;
  Re:=Submit(SPNum,ChargeNum,Count,UserNum,CorpID,SvcType,FeeType,
        FeeValue,GivenValue,AgentFlag,MoFlag,Priorit,ExpireTime,
        ScheduleTime,ReportFlag,Pid,Udhi,MsgCoding,MsgType,Len,
        MsgContent,#0,SeqNum1,SeqNum2,SeqNum3);
    case Re of
      1:begin
         with frmSGIP do
          begin
            CurLogMsg(TRE,'序列号1:'+IntToStr(SeqNum1));
            CurLogMsg(TRE,'序列号2:'+IntToStr(SeqNum2));
            CurLogMsg(TRE,'序列号3:'+IntToStr(SeqNum3));
            CurLogMsg(TRE,'手机号码:'+UserNum);
            CurLogMsg(TRE,'付费号码:'+ChargeNum);
            CurLogMsg(TRE,'服务类型:'+SvcType);
            CurLogMsg(TRE,'计费类型:'+FeeType);
            CurLogMsg(TRE,'收费值:'+FeeValue);
            CurLogMsg(TRE,'信息内容:'+MsgContent);
            CurLogMsg(TRE,'已成功加入服务器队列!');
          end;
          with frmSMGDB.tblSubmit do
            begin
              Open;
              Insert;
              Fields[1].Text:= SPNum;
              Fields[2].Text:= ChargeNum;
              Fields[3].Value:= Count;
              Fields[4].Text:= UserNum;
              Fields[5].Text:= SPCode;
              Fields[6].Text:= SvcType;
              Fields[7].Text:= FeeType;
              Fields[8].Text:= FeeValue;
              Fields[9].Text:= GivenValue;
              Fields[10].Text:= AgentFlag;
              Fields[11].Value:= MoFlag;
              Fields[12].Value:= Priorit;
              Fields[13].Text:= ExpireTime;
              Fields[14].Text:= ScheduleTime;
              Fields[15].Value:= ReportFlag;
              Fields[16].Text:= Pid;
              Fields[17].Value:= Udhi;
              Fields[18].Value:= MsgCoding;
              Fields[19].Value:= MsgType;
              Fields[20].Value:= Len;
              Fields[21].Text:= MsgContent;
              Fields[22].Text:= Reserve;
              Fields[23].Value:= SeqNum1;
              Fields[24].Value:= SeqNum2;
              Fields[25].Value:= SeqNum3;
              Post;
              Close;
            end;
         if BufferList.Count>0 then BufferList.Delete(0);
         Dec(RunCount);
        end;
      0:CurLogMsg(frmSGIP.TRE,'服务器队列已满!!');
     -1:CurLogMsg(frmSGIP.TRE,'插入服务器队列失败!');
   end;
 Dec(RI);
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -