足球彩票指數及比分數據採集系統

前言web

不少朋友喜歡足彩,面對網站每期大量對陣卻苦於沒法找到一種穩定下注的方法,其實開盤指數及臨場前指數的變化,各類蘊藏玄機,本系統採集新浪足彩每期指數,生成各類指數數據,並造成每期報表,便於下注者投注參考。經過本系統可生成球隊全部對陣比賽數據、及其贏盤指數規律數據,數據能夠導出excel表格,方便使用者二次提取。數據庫

運行程序連接:https://pan.baidu.com/s/1yETSldYwSv8kf5NIqGvasA%20
提取碼:ddxq
數組

界面多線程

 

 

 

功能實現app

1.網頁抓取函數

經過網頁抓取,提取每期開盤及最新變更指數、贏盤指數、比分數據網站

 

主要代碼:(貼代碼比寫文字簡單,有興趣的看註解吧)spa

  1 {/**
  2 
  3 Date:2014-3-20
  4 
  5 Author:吳chunyuan轉載請註明出處
  6 
  7 **/}
  8 
  9 procedure TFxlcj.Caiji_xl(OperNum:integer);   {本程序主要處理環節: 採集新浪數據 0-初始化 1-盤中  體球網採集:3-聯賽球隊 4-期數系列 }
 10 var Rp_Count,Get_Web,LineCount,c,i,j,backStart,Count_ws ,Count_qx:integer;
 11    ThreadId1:DWORD;
 12    Ret_Get_bszl:TArr;
 13   // Fmt   :TCharFormat2;
 14   begin
 15      Get_Web:=1;
 16      if Eqhao.Text='' then
 17        begin
 18          if OperNum<4 then
 19            begin
 20            SendtoMain('採集窗口提示:請輸入期號如130808');
 21             exit;
 22            end;
 23        end;
 24 
 25      Csh_qpfx(OperNum); {初始化期號}
 26      Edit2.CopyToClipboard;  //將剪切板初始化
 27      sleep(20);
 28      RichEdit1.PlainText := true;
 29      //WebBrowser1.SetFocus;
 30      
 31     { if WebBrowser1.ReadyState > READYSTATE_LOADING then
 32       begin
 33        WebBrowser1.stop;
 34        WebBrowser1.SetFocus;
 35       end else
 36        begin
 37        SendtoMain('取網頁異常,請重來1!');
 38        exit;
 39        end;
 40      }
 41         WebBrowser1.SetFocus;
 42 
 43          Rp_Count:=0;    {初始化重負複製網頁的次數,由於有時複製不成功 上限20次}
 44 
 45         Repeat   {複製網頁以提取數據}
 46 
 47                try
 48                 webbrowser1.ExecWB(OLECMDID_SELECTALL,0);
 49                 webbrowser1.ExecWB(OLECMDID_COPY,0);
 50               // WebBrowser1.ExecWB(OLECMDID_UNDO, 0);
 51                 Get_Web:=0;
 52                 except
 53                  SendtoMain('複製網頁異常,請重來!');
 54                  Get_Web:=1;
 55                end;
 56 
 57              if Get_Web=0 then
 58                 begin
 59                 richedit1.Lines.Clear;
 60                //richedit1.SetFocus;
 61                richedit1.PasteFromClipboard;
 62                WebBrowser1.ExecWB(OLECMDID_UNDO, OLECMDEXECOPT_DODEFAULT);    //取消全選
 63                c:=0;   {尋找選擇區域的起點位置}
 64                // backStart   :=   RichEdit1.SelStart;     //備份光標位置
 65                RichEdit1.SelStart   :=   c;   //尋找選擇區域的起點位置
 66                // initializeCriticalSection(CS); //沒初始化會 提示訪問ntdll.dll模塊出錯
 67                LineCount:=RichEdit1.Lines.Count;
 68                SendtoMain('採集失敗,請重來!');
 69                end;
 70             Rp_Count:=Rp_Count+1;
 71          until ((LineCount>100) or (Rp_Count>2) );   //重複不超2次
 72 
 73           {
 74 
 75        WebBrowser1.ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT);  //全選網頁
 76       WebBrowser1.ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT);     //複製網頁
 77       WordDocu.Range.Paste;            //word文檔粘貼
 78      WebBrowser1.ExecWB(OLECMDID_UNDO, OLECMDEXECOPT_DODEFAULT);    //取消全選
 79     }
 80 
 81       if Rp_Count>20 then exit;
 82 
 83          {採集期數序列}
 84 
 85          setlength(Ret_Get_bszl,18);  {初始化數組}
 86 
 87          if OperNum=4 then   //取期號序列
 88            begin
 89             for i:=10 to 50 do
 90              begin
 91                Ret_Get_bszl:=Get_bszl(2,i);
 92                if (Ret_Get_bszl[0]<>'1.0') and (length(Ret_Get_bszl[0])=6)  then
 93                  begin
 94                    Eqhao.Text:=Ret_Get_bszl[0];
 95                    ComboBox2.Items.Clear;
 96                     for j:=0 to 9 do
 97                     ComboBox2.Items.Add(Ret_Get_bszl[j]);
 98                     ComBobox2.ItemIndex:=0;
 99                     //Memo1.Lines.Clear;
100                      SendtoMain('取期號序列成功:');
101                      SendtoMain(Ret_Get_bszl[0]+' '+Ret_Get_bszl[1]+' '+Ret_Get_bszl[2]+' '+Ret_Get_bszl[3]+' '+Ret_Get_bszl[4]+' '+Ret_Get_bszl[5]+' '+Ret_Get_bszl[6]+' '+Ret_Get_bszl[7]+' '+Ret_Get_bszl[8]+' '+ Ret_Get_bszl[9]);
102                     exit;
103                   end;
104                end;
105            end;
106 
107     {開始採集數據}
108     if OperNum<4 then
109       begin
110          if OperNum=0 then
111           SendtoMain('初始化採集中....') else
112           SendtoMain('盤中採集中....');
113               Count_ws:=0; //未賽場數
114               Count_qx:=0;
115              for   i:=0   to   LineCount-1   do
116               begin
117 
118                j:=Caiji_xl_cjoneline(OperNum,i);
119                if j=0 then Count_ws:=Count_ws+1;
120                 if j=2 then Count_qx:=Count_qx+1;
121                sleep(5);
122                application.ProcessMessages;    //使用簡單多線程
123 
124              end;
125              if Count_ws>0 then
126             SendtoMain('採集完畢,未賽場數:'+inttostr(Count_ws-1)+',取消場數:'+inttostr(Count_qx)) else
127              SendtoMain('採集失敗!');
128 
129 
130            
131      end;
132      
133    RichEdit1.SelStart   :=   backStart   ;   //恢復光標位置
134         //webbrowser1.SetFocus;
135        // WebBrowser1.ExecWB(OLECMDID_UNDO,0);  // OLECMDEXECOPT_DODEFAULT
136    end;
137 
138 主要過程、函數:(貼兩個好了。。)
139 
140 function TFxlcj.Caiji_xl_cjoneline(OperNum:integer;Num:integer):integer;  //返回 0- 無比分 1-有比分    2-取消 3-其餘
141 var rs,i:integer;
142  Ret_Get_bszl,sparr:TArr;
143    fMainMessage,s,strpk,strbf,strypoz,strypsp:string;
144 begin
145    // EnterCriticalSection(CS);
146       rs:=3;
147     setlength(Ret_Get_bszl,18);
148      i:=Num;
149      Ret_Get_bszl:= Get_bszl(1,i);  {取每條比賽記錄,返回個字段值}
150 
151           {取期號,沒用到 if  ( i>=24) and (i<=24)  then
152             begin
153             strno:=GetFieldValue(' ',richedit1.Lines.Strings[i],1);
154             end;}
155 
156       if  i>=130 then   //從網頁131行開始取比賽資料 
157       begin
158           if length(Ret_Get_bszl[1])=1 then  {是比賽記錄 將進行:取數-插入bslsz }
159             begin
160             g_IfInsert:=IfInsert_bslsz(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5]);
161             if g_IfInsert<0 then exit;
162             
163             if Ret_Get_bszl[9]<>'' then  {無比分}
164                begin
165                 rs:=0;
166                //SendtoMain(strdate+','+str2+','+str3+','+str4+','+str5+','+str6+','+str7+','+str81+','+str82+','+str83+','+str10+','+str11+','+str12);
167                 try
168                  if  g_IfInsert=0 then
169                   s := Format('insert into bslsz (bsrq,xh,bssj,lsmc,zd,rangqiu,kd,sp1,sp2,sp3,xsp1,xsp2,xsp3,qhao)   values (%s,%d,%s,%s,%s,%d,%s,%f,%f,%f,%f,%f,%f,%s)',
170                  ['#'+Ret_Get_bszl[0]+'#',strtoint(Ret_Get_bszl[2]),quotedstr(Ret_Get_bszl[4]),quotedStr(Ret_Get_bszl[3]),quotedStr(Ret_Get_bszl[5]),strtoint(Ret_Get_bszl[6]),quotedStr(Ret_Get_bszl[7]),strtofloat(Ret_Get_bszl[8]),strtofloat(Ret_Get_bszl[9]),strtofloat(Ret_Get_bszl[10]),strtofloat(Ret_Get_bszl[14]),strtofloat(Ret_Get_bszl[15]),strtofloat(Ret_Get_bszl[16]),Quotedstr(Eqhao.Text)]);
171                  g_insertflag:=1;
172                 
173                  except
174                  //exit;
175                  g_insertflag:=0;
176                  SendtoMain('無SP');
177                  end;
178 
179                 if ( (g_IfInsert>0) and (OperNum=0)) or (OperNum=1) then  {無比分,更新最新xsp--從新初始化 }
180                  Update_sp(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5],Ret_Get_bszl[8],Ret_Get_bszl[9],Ret_Get_bszl[10],Ret_Get_bszl[14],Ret_Get_bszl[15],Ret_Get_bszl[16],OperNum); {修改xsp1,xsp2,xsp3}
181 
182                  {OperNum=1  無比分,更新最新xsp--盤中 }
183                  {修改xsp1,xsp2,xsp3}
184               end;
185 
186 
187            if Ret_Get_bszl[9]='' then  {有比分}
188               begin
189                  rs:=1;
190                 try
191                  strpk:= Return_pank(strtoint(Ret_Get_bszl[6]),strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]));
192                  strbf:= Return_bf(strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]));
193                  except
194                  SendtoMain('errcode:2,'+Ret_Get_bszl[5]);
195                  exit;
196                  end;
197 
198                  //SendtoMain(Ret_Get_bszl[0]+','+Ret_Get_bszl[2]+','+Ret_Get_bszl[3]+','+Ret_Get_bszl[4]+','+Ret_Get_bszl[5]+','+Ret_Get_bszl[6]+','+Ret_Get_bszl[7]+','+Ret_Get_bszl[8]+':'+Ret_Get_bszl[10]+','+Ret_Get_bszl[11]+','+Ret_Get_bszl[12]+','+Ret_Get_bszl[13]+','+Ret_Get_bszl[14]+','+Ret_Get_bszl[15]+','+Ret_Get_bszl[16]+strpk+','+strbf);
199                  fMainMessage:=Ret_Get_bszl[2]+' '+Ret_Get_bszl[3]+' '+Ret_Get_bszl[5]+'--'+Ret_Get_bszl[7]+' '+Ret_Get_bszl[8]+':'+Ret_Get_bszl[10]+' '+strpk+','+strbf;
200                  SendtoMain(fMainMessage);
201                  if  g_IfInsert=0 then
202                    try
203                     
204                     s := Format('insert into bslsz (bsrq,xh,bssj,lsmc,zd,rangqiu,kd,zdrq,kdrq,sp1,sp2,sp3,xsp1,xsp2,xsp3,pjg,bfjg,qhao)   values (%s,%d,%s,%s,%s,%d,%s,%d,%d,%f,%f,%f,%f,%f,%f,%s,%s,%s)',
205                     ['#'+Ret_Get_bszl[0]+'#',strtoint(Ret_Get_bszl[2]),quotedstr(Ret_Get_bszl[4]),quotedStr(Ret_Get_bszl[3]),quotedStr(Ret_Get_bszl[5]),strtoint(Ret_Get_bszl[6]),quotedStr(Ret_Get_bszl[7]),strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]),strtofloat(Ret_Get_bszl[11]),strtofloat(Ret_Get_bszl[12]),strtofloat(Ret_Get_bszl[13]),strtofloat(Ret_Get_bszl[14]),strtofloat(Ret_Get_bszl[15]),strtofloat(Ret_Get_bszl[16]),quotedStr(strpk),quotedStr(strbf),Quotedstr(Eqhao.Text)]);
206 
207                     except
208                     showmessage('e:'+s);
209                     exit;
210                    end;
211 
212                  if  g_IfInsert>0 then
213                    begin
214                    setlength(sparr,13);
215                    sparr:=Bslsz_sp(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5]); { sp1,nsp1,sp2,nsp2,sp3,nsp3,xsp1,nxsp1,xsp2,nxsp2,xsp3,nxsp3}
216                    //SendtoMain(sparr[0]);
217                     if strpk='' then  {取最新SP 若是數據庫最新 sp 或歐指爲-1.0 取網頁最新值 2013-7-30  }
218                        begin  strypoz:=Ret_Get_bszl[11]; strypsp:=Ret_Get_bszl[14];  end;
219 
220 
221                     if strpk='' then
222                        begin  strypoz:=Ret_Get_bszl[12]; strypsp:=Ret_Get_bszl[15]; end;
223 
224                     if strpk='' then
225                        begin  strypoz:=Ret_Get_bszl[13]; strypsp:=Ret_Get_bszl[16]; end;
226 
227                     if strpk='取消' then
228                        begin  rs:=2;strypoz:='-1.0'; strypsp:='-1.0'; end; {2013-11-4增長,不然Update_bslsz 無數據,出錯}
229 
230 
231                      try
232                       Update_bslsz(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5],strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]),strpk,strbf,strypsp,strypoz);
233                        except
234                       SendtoMain('errcode:update_bslsz'+strypsp+','+strypoz);
235                       exit;
236                       end;
237                   end;
238             end;
239 
240              if  g_IfInsert=0 then
241              Insert_bslsz(s);
242         end;{插入結束}
243        // RichEdit1.SelLength   :=   0;   //恢復選擇
244 
245        end;
246        result:=rs;
247      // LeaveCriticalSection(CS);
248 end;
249 
250 
251  
252 
253 Function TFxlcj.Get_bszl(Flag:Integer;Row:Integer):TArr; {取每行比賽資料,Flag=1比賽資料  2-取期序列}
254  var
255  str1,str2,str3,str4,str5,str6,str7,str8,str81,str82,str83,str9,str91,str92,str93,str10,str11,str12:string;
256   pos1:integer;
257  begin
258 
259       str82:='';
260       RichEdit1.SelLength   :=   length(richedit1.Lines.Strings[Row]);   //得到選擇當前行的長度
261       str1:= GetFieldValue(' ',richedit1.Lines.Strings[Row],1);
262       str2:= GetFieldValue(' ',richedit1.Lines.Strings[Row],2);
263       if Flag=2 then {取期數系列}
264         begin
265 
266           // SendtoMain(str1+','+str2);
267 
268            Result[0]:='1.0';
269            Result[1]:='1.0';
270            Result[2]:='1.0';
271            Result[3]:='1.0';
272            Result[4]:='1.0';
273            Result[5]:='1.0';
274            Result[6]:='1.0';
275            Result[7]:='1.0';
276            Result[8]:='1.0';
277            Result[9]:='1.0';
278            Result[10]:='1.0';
279            Result[11]:='1.0';
280            Result[12]:='1.0';
281            Result[13]:='1.0';
282            Result[14]:='1.0';
283            Result[15]:='1.0';
284            Result[16]:='1.0';
285            if copy(str2,1,4)='當前' then
286               begin
287               Result[0]:=str1;
288               Result[1]:=copy(str2,5,6);
289               Result[2]:=copy(str2,11,6);
290               Result[3]:=copy(str2,17,6);
291               Result[4]:=copy(str2,23,6);
292               Result[5]:=copy(str2,29,6);
293               Result[6]:=copy(str2,35,6);
294               Result[7]:=copy(str2,41,6);
295               Result[8]:=copy(str2,47,6);
296               Result[9]:=copy(str2,53,6);
297               
298              end;
299          exit;
300          end;
301          
302 
303       str3:= GetFieldValue(' ',richedit1.Lines.Strings[Row],3);
304       str4:= GetFieldValue(' ',richedit1.Lines.Strings[Row],4);
305       str5:= GetFieldValue(' ',richedit1.Lines.Strings[Row],5);
306       pos1:=pos('(',str5);     {去除主隊(中)}
307       if pos1>0 then str5:=copy(str5,1,pos1-1);
308       str6:= GetFieldValue(' ',richedit1.Lines.Strings[Row],6);
309       str7:= GetFieldValue(' ',richedit1.Lines.Strings[Row],7);
310       str8:= GetFieldValue(' ',richedit1.Lines.Strings[Row],8);
311       pos1:=pos('-',str8);
312 
313       if pos1>0 then    {未有比分,無歐指}
314        begin
315         str81:='-1.0';
316         str82:='-1.0';
317         str83:='-1.0';
318         end;
319  {begin 根據str8長度判斷 =12  ; >12 ; <12且 <>'---' ;   }
320 
321       if length(str8)=12 then    {有大於12的狀況 :1.192.1912.19}
322          begin
323           str81:=copy(str8,1,4);
324           str82:=copy(str8,5,4);
325           str83:=copy(str8,9,4);
326           end;
327 
328           if  str8='---' then
329            begin
330            str81:='-1.0';
331            str82:='-1.0';
332            str83:='-1.0';
333            end;
334 
335 
336       if (length(str8)>12) then    {有大於12的狀況 :1.19 2.19 12.19}
337        begin
338         if  (length(GetFieldValue('.',str8,1))=1) and  (length(GetFieldValue('.',str8,2))=3) and  (length(GetFieldValue('.',str8,3))=4) then
339           begin
340            str81:=copy(str8,1,4);
341            str82:=copy(str8,5,4);
342            str83:=copy(str8,9,5);
343            end;
344                                {12.11 1.23 3.23}
345         if  (length(GetFieldValue('.',str8,1))=2) and  (length(GetFieldValue('.',str8,2))=3) and  (length(GetFieldValue('.',str8,3))=3) then
346          begin
347           str81:=copy(str8,1,5);
348           str82:=copy(str8,6,4);
349           str83:=copy(str8,10,4);
350           end;
351 
352                                     {12.11 11.23 3.23}
353         if  (length(GetFieldValue('.',str8,1))=2) and  (length(GetFieldValue('.',str8,2))=4) and  (length(GetFieldValue('.',str8,3))=3) then
354          begin
355           str81:=copy(str8,1,5);
356           str82:=copy(str8,6,5);
357           str83:=copy(str8,11,4);
358           end;
359 
360 
361                                  {1.11 21.23 3.23}
362          if  (length(GetFieldValue('.',str8,1))=1) and  (length(GetFieldValue('.',str8,2))=4) and  (length(GetFieldValue('.',str8,3))=3) then
363           begin
364            str81:=copy(str8,1,4);
365            str82:=copy(str8,5,5);
366            str83:=copy(str8,10,4);
367            end;
368 
369                                    {1.11 21.23 13.23}
370          if  (length(GetFieldValue('.',str8,1))=1) and  (length(GetFieldValue('.',str8,2))=4) and  (length(GetFieldValue('.',str8,3))=4) then
371           begin
372            str81:=copy(str8,1,4);
373            str82:=copy(str8,5,5);
374            str83:=copy(str8,10,5);
375            end;
376 
377  
378 
379 
380       end;
381 
382 
383       if (length(str8)<12) and (trim(str8)<>'---')   then {有比分 若是* -腰斬不取}
384        begin
385         str81:= GetFieldValue(':',str8,1);
386         str82:=''; { str82='' 無比分的標誌}
387         str83:= GetFieldValue(':',str8,2);
388          if trim(str8)='*' then
389             begin
390              str81:='-1';
391              str83:='-1';
392             end;
393 
394       end;
395 
396   {end 根據str8長度判斷 =12  ; >12 ; <12且 <>'---' ;   }
397 
398    str9:= GetFieldValue(' ',richedit1.Lines.Strings[Row],9) ;  {SP}
399    {begin 根據str9長度判斷 =12  ; >12 }
400       if length(str9)=12 then
401        begin
402         str91:=copy(str9,1,4);
403         str92:=copy(str9,5,4);
404         str93:=copy(str9,9,4);
405         end;
406 
407        if length(str9)>12 then    {有大於12的狀況 :1.192.1912.19}
408         begin
409           if  (length(GetFieldValue('.',str9,1))=1) and   (length(GetFieldValue('.',str9,2))=3) and  (length(GetFieldValue('.',str9,3))=4) then
410              begin
411              str91:=copy(str9,1,4);
412              str92:=copy(str9,5,4);
413              str93:=copy(str9,9,5);
414              end;
415                                  {12.111.233.23}
416         if  (length(GetFieldValue('.',str9,1))=2) and  (length(GetFieldValue('.',str9,2))=3) and  (length(GetFieldValue('.',str9,3))=3) then
417             begin
418               str91:=copy(str9,1,5);
419                str92:=copy(str9,6,4);
420                str93:=copy(str9,10,4);
421             end;
422 
423                                   {1.1121.233.23}
424            if  (length(GetFieldValue('.',str9,1))=1) and  (length(GetFieldValue('.',str9,2))=4) and  (length(GetFieldValue('.',str9,3))=3) then
425               begin
426               str91:=copy(str9,1,4);
427               str92:=copy(str9,5,5);
428               str93:=copy(str9,10,4);
429               end;
430 
431      end;
432    {end根據str9長度判斷 =12  ; >12 }
433 
434    {begin 如下取 str10,str11,str12 ,str91,str,92,str93}
435       if length(str9)>=12 then   {有比分時的nsp}
436           begin
437            str10:= GetFieldValue(' ',richedit1.Lines.Strings[Row],11);
438            str11:= GetFieldValue(' ',richedit1.Lines.Strings[Row],12);
439            str12:= GetFieldValue(' ',richedit1.Lines.Strings[Row],13);
440            if length(str10)=1 then str10:='-1.0';
441            if length(str11)=1 then str11:='-1.0';
442            if length(str12)=1 then str12:='-1.0';
443           end;
444 
445 
446        if str9='---' then   {有比分時無oz-20130814}
447          begin
448           str91:='-1.0';
449           str92:='-1.0';
450           str93:='-1.0';
451            str10:= GetFieldValue(' ',richedit1.Lines.Strings[Row],11);
452            str11:= GetFieldValue(' ',richedit1.Lines.Strings[Row],12);
453            str12:= GetFieldValue(' ',richedit1.Lines.Strings[Row],13);
454            if length(str10)=1 then str10:='-1.0';
455            if length(str11)=1 then str11:='-1.0';
456            if length(str12)=1 then str12:='-1.0';
457           end;
458 
459         if length(str8)>=12 then  {無比分nsp}
460         begin
461         str10:= GetFieldValue(' ',richedit1.Lines.Strings[Row],10);
462         str11:= GetFieldValue(' ',richedit1.Lines.Strings[Row],11);
463         str12:= GetFieldValue(' ',richedit1.Lines.Strings[Row],12);
464         if trim(str10)='-' then str10:='-1.0' ;
465         if trim(str11)='-' then str11:='-1.0' ;
466         if trim(str12)='-' then str12:='-1.0' ;
467         end;
468   {end 取 str10,str11,str12 ,str91,str,92,str93}
469 
470    if length(str1)>4 then{取比賽日期}
471    g_strdate:=str1;
472 
473    {返回各字段到TArr }
474    Result[0]:=g_strdate;
475    Result[1]:=str1;
476    Result[2]:=str2;
477    Result[3]:=str3;
478    Result[4]:=str4;
479    Result[5]:=str5;
480    Result[6]:=str6;
481    Result[7]:=str7;
482    Result[8]:=str81;
483    Result[9]:=str82;
484    Result[10]:=str83;
485    Result[11]:=str91;
486    Result[12]:=str92;
487    Result[13]:=str93;
488    Result[14]:=str10;
489    Result[15]:=str11;
490    Result[16]:=str12;
491 
492    if Result[11]='' then   Result[11]:='1.0';
493     if Result[12]='' then Result[12]:='1.0';
494     if Result[13]='' then Result[13]:='1.0';
495    if Result[14]='' then  Result[14]:='1.0';
496     if Result[15]='' then Result[15]:='1.0';
497     if Result[16]='' then Result[16]:='1.0';
498 
499 end;
500 
501 function TFxlcj.Caiji_xl_cjoneline(OperNum:integer;Num:integer):integer;  //返回 0- 無比分 1-有比分    2-取消 3-其餘
502 var rs,i:integer;
503  Ret_Get_bszl,sparr:TArr;
504    fMainMessage,s,strpk,strbf,strypoz,strypsp:string;
505 begin
506    // EnterCriticalSection(CS);
507       rs:=3;
508     setlength(Ret_Get_bszl,18);
509      i:=Num;
510      Ret_Get_bszl:= Get_bszl(1,i);  {取每條比賽記錄,返回個字段值}
511 
512           {取期號,沒用到 if  ( i>=24) and (i<=24)  then
513             begin
514             strno:=GetFieldValue(' ',richedit1.Lines.Strings[i],1);
515             end;}
516 
517       if  i>=130 then   //從網頁131行開始取比賽資料 
518       begin
519           if length(Ret_Get_bszl[1])=1 then  {是比賽記錄 將進行:取數-插入bslsz }
520             begin
521             g_IfInsert:=IfInsert_bslsz(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5]);
522             if g_IfInsert<0 then exit;
523             
524             if Ret_Get_bszl[9]<>'' then  {無比分}
525                begin
526                 rs:=0;
527                //SendtoMain(strdate+','+str2+','+str3+','+str4+','+str5+','+str6+','+str7+','+str81+','+str82+','+str83+','+str10+','+str11+','+str12);
528                 try
529                  if  g_IfInsert=0 then
530                   s := Format('insert into bslsz (bsrq,xh,bssj,lsmc,zd,rangqiu,kd,sp1,sp2,sp3,xsp1,xsp2,xsp3,qhao)   values (%s,%d,%s,%s,%s,%d,%s,%f,%f,%f,%f,%f,%f,%s)',
531                  ['#'+Ret_Get_bszl[0]+'#',strtoint(Ret_Get_bszl[2]),quotedstr(Ret_Get_bszl[4]),quotedStr(Ret_Get_bszl[3]),quotedStr(Ret_Get_bszl[5]),strtoint(Ret_Get_bszl[6]),quotedStr(Ret_Get_bszl[7]),strtofloat(Ret_Get_bszl[8]),strtofloat(Ret_Get_bszl[9]),strtofloat(Ret_Get_bszl[10]),strtofloat(Ret_Get_bszl[14]),strtofloat(Ret_Get_bszl[15]),strtofloat(Ret_Get_bszl[16]),Quotedstr(Eqhao.Text)]);
532                  g_insertflag:=1;
533                 
534                  except
535                  //exit;
536                  g_insertflag:=0;
537                  SendtoMain('無SP');
538                  end;
539 
540                 if ( (g_IfInsert>0) and (OperNum=0)) or (OperNum=1) then  {無比分,更新最新xsp--從新初始化 }
541                  Update_sp(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5],Ret_Get_bszl[8],Ret_Get_bszl[9],Ret_Get_bszl[10],Ret_Get_bszl[14],Ret_Get_bszl[15],Ret_Get_bszl[16],OperNum); {修改xsp1,xsp2,xsp3}
542 
543                  {OperNum=1  無比分,更新最新xsp--盤中 }
544                  {修改xsp1,xsp2,xsp3}
545               end;
546 
547 
548            if Ret_Get_bszl[9]='' then  {有比分}
549               begin
550                  rs:=1;
551                 try
552                  strpk:= Return_pank(strtoint(Ret_Get_bszl[6]),strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]));
553                  strbf:= Return_bf(strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]));
554                  except
555                  SendtoMain('errcode:2,'+Ret_Get_bszl[5]);
556                  exit;
557                  end;
558 
559                  //SendtoMain(Ret_Get_bszl[0]+','+Ret_Get_bszl[2]+','+Ret_Get_bszl[3]+','+Ret_Get_bszl[4]+','+Ret_Get_bszl[5]+','+Ret_Get_bszl[6]+','+Ret_Get_bszl[7]+','+Ret_Get_bszl[8]+':'+Ret_Get_bszl[10]+','+Ret_Get_bszl[11]+','+Ret_Get_bszl[12]+','+Ret_Get_bszl[13]+','+Ret_Get_bszl[14]+','+Ret_Get_bszl[15]+','+Ret_Get_bszl[16]+strpk+','+strbf);
560                  fMainMessage:=Ret_Get_bszl[2]+' '+Ret_Get_bszl[3]+' '+Ret_Get_bszl[5]+'--'+Ret_Get_bszl[7]+' '+Ret_Get_bszl[8]+':'+Ret_Get_bszl[10]+' '+strpk+','+strbf;
561                  SendtoMain(fMainMessage);
562                  if  g_IfInsert=0 then
563                    try
564                     
565                     s := Format('insert into bslsz (bsrq,xh,bssj,lsmc,zd,rangqiu,kd,zdrq,kdrq,sp1,sp2,sp3,xsp1,xsp2,xsp3,pjg,bfjg,qhao)   values (%s,%d,%s,%s,%s,%d,%s,%d,%d,%f,%f,%f,%f,%f,%f,%s,%s,%s)',
566                     ['#'+Ret_Get_bszl[0]+'#',strtoint(Ret_Get_bszl[2]),quotedstr(Ret_Get_bszl[4]),quotedStr(Ret_Get_bszl[3]),quotedStr(Ret_Get_bszl[5]),strtoint(Ret_Get_bszl[6]),quotedStr(Ret_Get_bszl[7]),strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]),strtofloat(Ret_Get_bszl[11]),strtofloat(Ret_Get_bszl[12]),strtofloat(Ret_Get_bszl[13]),strtofloat(Ret_Get_bszl[14]),strtofloat(Ret_Get_bszl[15]),strtofloat(Ret_Get_bszl[16]),quotedStr(strpk),quotedStr(strbf),Quotedstr(Eqhao.Text)]);
567 
568                     except
569                     showmessage('e:'+s);
570                     exit;
571                    end;
572 
573                  if  g_IfInsert>0 then
574                    begin
575                    setlength(sparr,13);
576                    sparr:=Bslsz_sp(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5]); { sp1,nsp1,sp2,nsp2,sp3,nsp3,xsp1,nxsp1,xsp2,nxsp2,xsp3,nxsp3}
577                    //SendtoMain(sparr[0]);
578                     if strpk='' then  {取最新SP 若是數據庫最新 sp 或歐指爲-1.0 取網頁最新值 2013-7-30  }
579                        begin  strypoz:=Ret_Get_bszl[11]; strypsp:=Ret_Get_bszl[14];  end;
580 
581 
582                     if strpk='' then
583                        begin  strypoz:=Ret_Get_bszl[12]; strypsp:=Ret_Get_bszl[15]; end;
584 
585                     if strpk='' then
586                        begin  strypoz:=Ret_Get_bszl[13]; strypsp:=Ret_Get_bszl[16]; end;
587 
588                     if strpk='取消' then
589                        begin  rs:=2;strypoz:='-1.0'; strypsp:='-1.0'; end; {2013-11-4增長,不然Update_bslsz 無數據,出錯}
590 
591 
592                      try
593                       Update_bslsz(Ret_Get_bszl[0],Ret_Get_bszl[3],Ret_Get_bszl[5],strtoint(Ret_Get_bszl[8]),strtoint(Ret_Get_bszl[10]),strpk,strbf,strypsp,strypoz);
594                        except
595                       SendtoMain('errcode:update_bslsz'+strypsp+','+strypoz);
596                       exit;
597                       end;
598                   end;
599             end;
600 
601              if  g_IfInsert=0 then
602              Insert_bslsz(s);
603         end;{插入結束}
604        // RichEdit1.SelLength   :=   0;   //恢復選擇
605 
606        end;
607        result:=rs;
608      // LeaveCriticalSection(CS);
609 end;

 

2.數據分析線程

比賽結束,根據採集到的數據生成分析數據,包括:每期勝、負、平的場數,計算贏盤平均指數,數據展現每項指標提供排序,能夠得出每期贏盤規律性結果。excel