📄 ufrmadd.pas
字号:
unit ufrmAdd;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, CheckLst, ExtCtrls, StrUtils;
type
TfrmAdd = class(TForm)
Label1: TLabel;
txtUser: TEdit;
Label2: TLabel;
Label8: TLabel;
txtThreads: TEdit;
Label9: TLabel;
txtMemo: TEdit;
cmdNew: TButton;
cmdClose: TButton;
cmbType: TComboBox;
txtCTR: TEdit;
Label11: TLabel;
lblAccount: TLabel;
Label12: TLabel;
pc: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Label3: TLabel;
txtADLink: TMemo;
Label5: TLabel;
Label6: TLabel;
Label4: TLabel;
Label7: TLabel;
txtImgsrc: TMemo;
txtAHref: TMemo;
lblTips: TLabel;
txtKeywords2: TMemo;
cmdDefault: TButton;
TabSheet3: TTabSheet;
txtDocument: TMemo;
chkSelected: TCheckBox;
Label13: TLabel;
txtRuntimes: TEdit;
TabSheet4: TTabSheet;
CheckListBoxCountry: TCheckListBox;
cmdSelectAll: TButton;
cmdSelectNot: TButton;
cmdSelectOM: TButton;
Panel1: TPanel;
rbShows: TRadioButton;
rbHits: TRadioButton;
txtReferer: TMemo;
cmdHelp: TButton;
Label14: TLabel;
txtZOrder: TEdit;
Label15: TLabel;
txtOwner: TComboBox;
Label10: TLabel;
txtAccount: TEdit;
TabSheet5: TTabSheet;
CheckListBoxUser: TCheckListBox;
cmdSelectAllUser: TButton;
cmdSelectUserNot: TButton;
txtUseIps: TEdit;
Label16: TLabel;
Label17: TLabel;
sheetIPs: TTabSheet;
chk6: TCheckBox;
chk7: TCheckBox;
chk8: TCheckBox;
chk9: TCheckBox;
chk10: TCheckBox;
chk11: TCheckBox;
chk12: TCheckBox;
chk13: TCheckBox;
chk14: TCheckBox;
chk15: TCheckBox;
chk16: TCheckBox;
chk17: TCheckBox;
chk18: TCheckBox;
chk19: TCheckBox;
chk20: TCheckBox;
chk21: TCheckBox;
chk22: TCheckBox;
chk23: TCheckBox;
chk24: TCheckBox;
chk25: TCheckBox;
chk26: TCheckBox;
chk27: TCheckBox;
chk28: TCheckBox;
chk29: TCheckBox;
chk30: TCheckBox;
chk31: TCheckBox;
chk32: TCheckBox;
chk33: TCheckBox;
chk34: TCheckBox;
chk35: TCheckBox;
chk36: TCheckBox;
chk37: TCheckBox;
chk38: TCheckBox;
chk39: TCheckBox;
chk40: TCheckBox;
chk101: TCheckBox;
chk1: TCheckBox;
chk2: TCheckBox;
chk3: TCheckBox;
chk4: TCheckBox;
chk5: TCheckBox;
chk106: TCheckBox;
chk111: TCheckBox;
chk116: TCheckBox;
chk121: TCheckBox;
chk126: TCheckBox;
chk131: TCheckBox;
chk136: TCheckBox;
Panel2: TPanel;
cmdAllIprange: TButton;
chkNeedLog: TCheckBox;
Label18: TLabel;
Label19: TLabel;
txtShows: TEdit;
txtHits: TEdit;
cmdAuto: TButton;
chk901: TCheckBox;
chk902: TCheckBox;
chk903: TCheckBox;
chk904: TCheckBox;
chk905: TCheckBox;
Panel3: TPanel;
procedure cmdCloseClick(Sender: TObject);
procedure cmdNewClick(Sender: TObject);
procedure cmbTypeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cmdDefaultClick(Sender: TObject);
procedure cmdSelectAllClick(Sender: TObject);
procedure cmdSelectNotClick(Sender: TObject);
procedure cmdSelectOMClick(Sender: TObject);
procedure cmdHelpClick(Sender: TObject);
procedure cmdSelectAllUserClick(Sender: TObject);
procedure cmdSelectUserNotClick(Sender: TObject);
procedure CheckListBoxUserClickCheck(Sender: TObject);
procedure chk101Click(Sender: TObject);
procedure chk106Click(Sender: TObject);
procedure chk111Click(Sender: TObject);
procedure chk116Click(Sender: TObject);
procedure chk121Click(Sender: TObject);
procedure chk126Click(Sender: TObject);
procedure chk131Click(Sender: TObject);
procedure chk136Click(Sender: TObject);
procedure cmdAllIprangeClick(Sender: TObject);
procedure cmdAutoClick(Sender: TObject);
procedure chk901Click(Sender: TObject);
procedure chk902Click(Sender: TObject);
procedure chk903Click(Sender: TObject);
procedure chk904Click(Sender: TObject);
procedure chk905Click(Sender: TObject);
private
function GetCountry: string;
procedure UpdateRecord;
procedure SelectCheckBox(Sender: TObject);
function GetCheckBoxToString: string;
procedure SelectCheckBoxByLine(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
m_bAdd: boolean;
m_fid: integer;
procedure SelectedCountry(strCountrys: string);
procedure SelectedUser(strUsers: string);
function GetUser: string;
procedure Selected_cmbType(ftype: string);
function SelectIpRangeCheckBox(strIPRange: string): string;
end;
var
frmAdd: TfrmAdd;
implementation
uses ufrmADClientMng, uMyTCPClient, ufrmSelectMRef, uGlobalVar;
{$R *.dfm}
procedure TfrmAdd.cmdCloseClick(Sender: TObject);
begin
close;
end;
function TfrmAdd.GetCountry(): string;
var
i: integer;
s: string;
begin
s := '';
for i := 0 to CheckListBoxCountry.Count - 1 do
begin
if CheckListBoxCountry.Checked[i] then
begin
s := s + CheckListBoxCountry.Items[i] + '_';
end;
end;
result := s;
end;
function TfrmAdd.GetUser(): string;
var
i: integer;
s: string;
begin
s := '';
for i := 0 to CheckListBoxUser.Count - 1 do
begin
if CheckListBoxUser.Checked[i] then
begin
s := s + CheckListBoxUser.Items[i] + '_';
end;
end;
result := s;
end;
procedure TfrmAdd.UpdateRecord();
begin
cmdNew.Enabled := false;
cmdNew.Enabled := true;
end;
procedure TfrmAdd.cmdNewClick(Sender: TObject);
var
strLine: string;
strResult: string;
strSQL: string;
bOk: boolean;
i: integer;
begin
cmdNew.Enabled := false;
if txtOwner.Text = '' then
begin
showmessage('txtOwner不能为空!');
cmdNew.Enabled := true;
exit;
end;
txtADLink.Text := trim(txtADLink.Text);
txtADLink.Text := ansireplacestr(txtADLink.Text,'"','''');
if length(txtADLink.Text)> 4000 then
begin
showmessage('广告代码不能超过4000个字符!' + inttostr(length(txtADLink.Text)));
cmdNew.Enabled := true;
exit;
end;
txtadlink.Text := trim(txtadlink.Text);
txtReferer.Text := trim(txtReferer.Text);
txtKeywords2.Text := trim(txtKeywords2.Text);
txtImgsrc.Text := trim(txtImgsrc.Text);
txtAHref.Text := trim(txtAHref.Text);
if cmbType.Text = 'park' then
begin
if txtAhref.Text = '' then
begin
showmessage('类型为park的时候,ahref代表第2次CTR,不能为空!');
cmdNew.Enabled := true;
exit;
end;
if txtImgsrc.Text = '' then
begin
showmessage('类型为park的时候,imgsrc代表流量,不能为空!');
cmdNew.Enabled := true;
exit;
end;
end;
if (cmbType.Text = 'search_get') or (cmbType.text = 'xmlfeed') then
begin
if (txtadlink.Text = '') or (txtReferer.Text = '') or (txtKeywords2.Text = '') then
begin
showmessage('adlink,referer,keywords2,任何一个都不能为空!');
cmdNew.Enabled := true;
exit;
end;
end;
if (cmbtype.Text = 'ie_cpc') then
begin
if txtKeywords2.Lines.Count > 1 then
begin
showmessage('ie_cpc类型的2次关键字只能设置1行');
cmdNew.Enabled := true;
exit;
end;
end;
if m_bAdd then
begin
strSQL := 'insert into account_tab(user,account,owner,useips,ftype,adlink,referer,keywords2,ahref,imgsrc,ctr,threads,memo,runtimes,country,iprange,needlog,isHits,shows,hits,zorder,isselected) values(';
strSQL := strSQL + '"' + txtUser.Text + '",';
strSQL := strSQL + '"' + txtAccount.Text + '",';
strSQL := strSQL + '"' + txtOwner.Text + '",';
strSQL := strSQL + '"' + txtUseIps.Text + '",';
strSQL := strSQL + '"' + cmbType.Text + '",';
strSQL := strSQL + '"' + txtadlink.Text + '",';
strSQL := strSQL + '"' + txtReferer.Text + '",';
strSQL := strSQL + '"' + txtKeywords2.Text + '",';
strSQL := strSQL + '"' + txtAHref.Text + '",';
strSQL := strSQL + '"' + txtImgsrc.Text + '",';
strSQL := strSQL + '"' + txtCtr.Text + '",';
strSQL := strSQL + '"' + txtThreads.Text + '",';
strSQL := strSQL + '"' + txtMemo.Text + '",';
strSQL := strSQL + '"' + txtRuntimes.Text + '",';
strSQL := strSQL + '"' + GetCountry() + '",';
strSQL := strSQL + '"' + GetCheckBoxToString() + '",';
strSQL := strSQL + '"'+MyBooleanToOneCharString( chkNeedLog.Checked) + '",';
strSQL := strSQL + '"'+MyBooleanToOneCharString(rbHits.Checked) + '",';
strSQL := strSQL + txtShows.Text + ',';
strSQL := strSQL + txtHits.text + ',';
strSQL := strSQL + '"' + txtZOrder.Text + '",'; //zorder
strSQL := strSQL + '"'+MyBooleanToOneCharString(chkSelected.Checked) + '")';
end;
if not m_bAdd then
begin
strSQL := 'update account_tab set ';
strSQL := strSQL + 'user="' + txtUser.Text + '",';
strSQL := strSQL + 'account="' + txtAccount.Text + '",';
strSQL := strSQL + 'owner="' + txtOwner.Text + '",';
strSQL := strSQL + 'useips="' + txtUseIps.Text + '",';
strSQL := strSQL + 'ftype="' + cmbType.Text + '",';
strSQL := strSQL + 'adlink="' + txtadlink.Text + '",';
strSQL := strSQL + 'referer="' + txtReferer.Text + '",';
strSQL := strSQL + 'keywords2="' + txtKeywords2.Text + '",';
strSQL := strSQL + 'ahref="' + txtAHref.Text + '",';
strSQL := strSQL + 'imgsrc="' + txtImgsrc.Text + '",';
strSQL := strSQL + 'ctr="' + txtCtr.Text + '",';
strSQL := strSQL + 'threads="' + txtThreads.Text + '",';
strSQL := strSQL + 'memo="' + txtMemo.Text + '",';
strSQL := strSQL + 'runtimes="' + txtRuntimes.Text + '",';
strSQL := strSQL + 'country="' + GetCountry() + '",';
strSQL := strSQL + 'iprange="' + GetCheckBoxToString() + '",';
strSQL := strSQL + 'shows=' + txtShows.Text +',';
strSQL := strSQL + 'hits=' + txtHits.Text +',';
strSQL := strSQL + 'zorder=' + txtZOrder.Text + ',';
if chkNeedLog.Checked then
strSQL := strSQL + 'needlog="1",'
else
strSQL := strSQL + 'needlog="0",';
if rbHits.Checked then
strSQL := strSQL + 'isHits="1",'
else
strSQL := strSQL + 'isHits="0",';
if chkSelected.Checked then
strSQL := strSQL + 'isselected="1"'
else
strSQL := strSQL + 'isselected="0"';
strSQL := strSQL + ' where fid=' + inttostr(m_fid);
end;
strResult := DoADServerCommand(ADSERVER_COMMAND_EXECUTE_SQL, strSQL);
frmADClientMng.txtLog.Lines.Add(strSQL);
if m_bAdd then
begin
txtadlink.Text := '';
txtReferer.Text := 'http://www.';
txtAHref.Text := '';
txtImgsrc.Text := '';
txtMemo.Text := '';
if strResult = 'OK' then
begin
lblTips.Caption := '已经成功增加!';
TfrmADClientMng(self.Parent).cmdGetAccountClick(sender);
end
else
lblTips.Caption := strResult;
end
else
begin
for i := 0 to 2 do
begin
bOK := GetRecord(CURRENT_USER);
if bOk then
begin
break;
end;
end;
close;
end;
cmdNew.Enabled := true;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -