Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915
  1. import concurrent.futures
  2. import requests
  3. from concurrent.futures import ThreadPoolExecutor, as_completed
  4. from sqlalchemy import Column,String,create_engine
  5. #,event
  6. from sqlalchemy.orm import sessionmaker
  7. from sqlalchemy.ext.declarative import declarative_base
  8. import pyodbc
  9. import pandas as pd
  10. import numpy as np
  11. import csv
  12. import requests
  13. import json
  14. import rsa
  15. import binascii
  16. import json
  17. import csv
  18. import pandas as pd
  19. import datetime
  20. import random
  21. import sys
  22. import time
  23. from bs4 import BeautifulSoup
  24. import re
  25. from PyQt5.QtCore import QThread, pyqtSignal
  26. from PyQt5.QtWidgets import (QApplication, QDialog,
  27. QProgressBar, QPushButton,QLabel)
  28. from PyQt5 import QtWidgets
  29. from PyQt5.QtCore import *
  30. from sqlalchemy import Column,String,create_engine
  31. from sqlalchemy.orm import sessionmaker
  32. from sqlalchemy.ext.declarative import declarative_base
  33. import pyodbc
  34. import os
  35. import logging
  36. import traceback
  37. import atexit
  38. FORMAT = '%(asctime)s %(levelname)s: %(message)s'
  39. logging.basicConfig(level=logging.INFO, filename='myLog.log', filemode='w', format=FORMAT)
  40. Base = declarative_base()
  41. class Logdata(Base):
  42. __tablename__ = 'LOGDB'
  43. 資料庫 = Column(String(20), primary_key=True)
  44. IP位置 = Column(String(20))
  45. 帳號 = Column(String(20))
  46. 密碼 = Column(String(20))
  47. class User(Base):
  48. __tablename__ = '客戶資料表'
  49. 客戶 = Column(String(20), primary_key=True)
  50. 資料庫 = Column(String(20))
  51. IP位置 = Column(String(20))
  52. 帳號 = Column(String(20))
  53. 密碼 = Column(String(20))
  54. class DateF(Base):
  55. __tablename__ = '查詢時間'
  56. 開始=Column(String(20), primary_key=True)
  57. 結束=Column(String(20))
  58. 是否全導=Column(String(20))
  59. class Someoneupdate(Base):
  60. __tablename__ = '自動導入判斷'
  61. 正在自動導入中= Column(String(20), primary_key=True)
  62. def loadCSV():
  63. try:
  64. with open('000.csv', newline='') as csvfile:
  65. rows = csv.reader(csvfile)
  66. csvvrow=[]
  67. for row in rows:
  68. csvvrow.append(row)
  69. coustomtxt=(csvvrow[1][0])
  70. bdtxtcrypto=(csvvrow[2][0])
  71. #====================================解密==========================
  72. PRIVATTTTT=693199020841184529005187339596013597950466957598599888793608033530271219415853952414609432155441426597962873618644988823224505129033188472492232565627111731743840442387622658441932249274048207290194890312931801018119336565101207159089093817844379836520246765598761731093447853178093855957965143730121353938159096214435813116478583463281838568325696377260624492699103838269489173425735163766515881745838239102851526971498900537039965925229366981233886305256752613857576375123305107336285923247046744901857058559811348110224118414002814652550587381981742663420856507553321403129123387307759852585845583253705194423896104474967966535066409675943348475929657759428664521337873475544406762447015072876289975051669953965932555224693025757002523361150649200905802416556626834350633483715061798581642291839762255979334372982156774414505811030453728205541010293992016524698689810201483053731487961892768615175941360043106707261541518852778287823654935902238415934276399863697899069150965902889645358960710613979521286008786269668237598187906056491031301559442316212834296436205439154886053776090316790598915161638161668892006476380622662058436463540372859165165728327478177043147902958378365406901451035507793539047616182219516942468776336379
  73. #PrivateKey
  74. A1=435136098972877768874748645248339158125703956065257805897130489515873898645785064137580564100320503666838498219287367368030775233887671705599248600291953393231454780648861079171195672717473628632853618453449217420455794237632155291175461656351373149436294485404694429947256530385791280349340495413483412113186857182441596591220416636342090069157129915377951859333634936029548424638926391232291634636038258059603109206715187896810765799441703590963590776385210580000409455669280693512175818186066741512695081131148497030784289903926969375944559780083722346620544362180693184053719440253987062360057770451705216722616373945761278697477867656454308042535057052004210508850990364826097246310462235289453838547367442863138161099765610183693493835956264409463595891562624222255540841617618186384919177648960630843478742501992844305124096538648231123014949030890404247398161443680124720970242595119682693770042136274011065565273819531541118246115073819134261046370918950429149073365625538812772489582690787721407799409054150416184648077711942774002489730938839028835996373562349388498470086161265863994312489374464512279091382150353090705188164569282723516063722137626802108564462453248942121100848000690940344201632450119420978307322308945
  75. A2=9627714051932950193134188501742994592784042206914443459734438308841410040354738469881718445461422881776007294906803790685427277699734850787185938262102876531473114260174800542552232307443022494368143100728406826855674366796656059054215802558213346170105688323652674928367680251460924362233864869984871966783909100785712414620921144535418728448391075664442600744983428543175164409720230286595771434578391588137898216407341812591598354427012529961000712417819821596260309468611766323842906019082923549785615976305556417630687246871293866806059225782724368215141401076633953519395967986211659258251543120569378038365122086876706827618666557619122782700896147
  76. A3=72000374865933143340744306653169834428832683081115110740204100237805467875781399111076588189449270231784547205065314993551385284482420372845976820023615822918370850049018336485262561074750111640775157594829249815372287322731748252778906894672575675394415480712584447066603079224388770970172603768779881242086210954654794512868330782099170594476257989194451530266257956383540560124814995186866139904562390161487741092810396910518052928540664299189962055810713116703112503213279177866017925218355080344908808970420740591501342146164000394175136511345019472809580649061686926648057
  77. bdtxtcrypto=bdtxtcrypto.encode('utf8')
  78. print(bdtxtcrypto)
  79. print(type(bdtxtcrypto))
  80. bdtxtcrypto=binascii.a2b_hex(bdtxtcrypto)
  81. mmmmm=rsa.decrypt(bdtxtcrypto,rsa.PrivateKey(PRIVATTTTT,65537,A1,A2,A3))
  82. bdtxt=(mmmmm.decode('utf8'))
  83. #====================================解密==========================
  84. return coustomtxt,bdtxt
  85. except:
  86. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  87. traceback.print_exc(file=open('log.txt', 'a'))
  88. logging.debug('debug message',exc_info=True)
  89. logging.info('info message',exc_info=True)
  90. logging.warning('warning message',exc_info=True)
  91. logging.error('error message',exc_info=True)
  92. logging.critical('critical message',exc_info=True)
  93. app1 = QtWidgets.QApplication([])
  94. error_dialog = QtWidgets.QErrorMessage()
  95. error_dialog.setWindowTitle('ERROR')
  96. error_dialog.showMessage('無法取得000.csv')
  97. app1.exec_()
  98. def connectEngine(coustomtxt,engine):
  99. try:
  100. DB_session = sessionmaker(engine)
  101. db_session = DB_session()
  102. comDbUserData=db_session.query(User).filter(User.客戶.like(coustomtxt)).all()
  103. UserDbName=comDbUserData[0].資料庫
  104. UserIPName=comDbUserData[0].IP位置
  105. UserAdName=comDbUserData[0].帳號
  106. UserPdName=comDbUserData[0].密碼
  107. engine3 = create_engine('mssql+pyodbc://'+UserAdName+':'+UserPdName+'@'+UserIPName+'/'+UserDbName+'?driver=SQL+Server+Native+Client+11.0',fast_executemany=True)
  108. # engine3 = create_engine('mssql+pyodbc://'+UserAdName+':'+UserPdName+'@'+UserIPName+'/'+UserDbName+'?driver=SQL+Server+Native+Client+11.0')
  109. return engine3
  110. except:
  111. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  112. traceback.print_exc(file=open('log.txt', 'a'))
  113. logging.debug('debug message',exc_info=True)
  114. logging.info('info message',exc_info=True)
  115. logging.warning('warning message',exc_info=True)
  116. logging.error('error message',exc_info=True)
  117. logging.critical('critical message',exc_info=True)
  118. app1 = QtWidgets.QApplication([])
  119. error_dialog = QtWidgets.QErrorMessage()
  120. error_dialog.setWindowTitle('ERROR')
  121. error_dialog.showMessage('資料連線失敗')
  122. app1.exec_()
  123. def DateDataLoad(engine3,db_session2):
  124. try:
  125. #engine3=connectEngine()
  126. Datefind=db_session2.query(DateF).all()
  127. startdatekey=Datefind[0].開始
  128. enddatekey=Datefind[0].結束
  129. allpart=Datefind[0].是否全導
  130. return startdatekey,enddatekey,allpart
  131. except:
  132. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  133. traceback.print_exc(file=open('log.txt', 'a'))
  134. logging.debug('debug message',exc_info=True)
  135. logging.info('info message',exc_info=True)
  136. logging.warning('warning message',exc_info=True)
  137. logging.error('error message',exc_info=True)
  138. logging.critical('critical message',exc_info=True)
  139. app1 = QtWidgets.QApplication([])
  140. error_dialog = QtWidgets.QErrorMessage()
  141. error_dialog.setWindowTitle('ERROR')
  142. error_dialog.showMessage('導入日期資料失敗')
  143. app1.exec_()
  144. def LoadCustomData(engine3,allpart):
  145. try:
  146. #editim = "CC1,CC2,CC3,CC4,CC5,CC6,CC7,CC8,CC9,CC10,CC11,CC12,CC13,CC14,CC15,CC16,CC17,CC18,CC19,CC20,CC21,CC22,CC23,CC24,CC25,CC26,CC27,CC28,CC29,CC30,CC31,CC32,CC33,CC34,CC35,CC36,CC37,CC38"
  147. if thisfile=="A1.txt":
  148. if (allpart=="0"):
  149. #有外埔 ca5-mfr7.cm589.net 28ss
  150. #無外補 c39-4gb93.cw8889.net top009
  151. #ca1-k92xt.cm589.net
  152. #kk155
  153. #pos1.2b598.net
  154. #)"#
  155. #www.bb5858.net
  156. #ku01
  157. #aa8888
  158. #www.fpk357.com
  159. #wa.jar199.com
  160. #168aq
  161. text3="SELECT TOP(1000) 網址, 帳號, 密碼 ,備用網址 FROM 商客基本資料表 WHERE (上一層='0')"# and 網址='mm.3g688.net' and 帳號='kg06')"
  162. #text4="SELECT TOP(1000) "+editim+" FROM 商客基本資料表 WHERE (上一層='0')"# and 網址='w3a.fuu588.com' and 帳號='s013')"
  163. CA_SQL="SELECT TOP(1000) 網址, 帳號, 主帳號 ,備用網址 FROM 商客基本資料表 WHERE (上一層='1')"# and 網址='mm.3g688.net' and 帳號='kg06')"
  164. else:
  165. text3="SELECT TOP(1000) 網址, 帳號, 密碼 ,備用網址 FROM 商客資料暫存檔 WHERE (上一層='0')"# and 網址='c56-gdmc.ck9998.net' and 帳號='kk98')"
  166. #text4="SELECT TOP(1000) "+editim+" FROM 商客基本資料表 WHERE (上一層='0')"# and 網址='c56-gdmc.ck9998.net' and 帳號='kk98')"
  167. CA_SQL="SELECT TOP(1000) 網址, 帳號, 主帳號 ,備用網址 FROM 商客資料暫存檔 WHERE (上一層='1')"# and 網址='c56-gdmc.ck9998.net' and 帳號='kk98')"
  168. elif thisfile=="A2.txt":
  169. if (allpart=="0"):
  170. text3="SELECT TOP(1000) 網址, 帳號, 密碼 ,備用網址 FROM 後台商客基本資料表 WHERE (上一層='0')"# and 網址='w1a.85vvip.com' and 帳號='vv09')"
  171. #text4="SELECT TOP(1000) "+editim+" FROM 商客基本資料表 WHERE (上一層='0')"# and 網址='www.jjj539.com' and 帳號='28ss')"
  172. CA_SQL="SELECT TOP(1000) 網址, 帳號, 主帳號 ,備用網址 FROM 後台商客基本資料表 WHERE (上一層='1')"# and 網址='w1a.85vvip.com' and 帳號='vv09')"
  173. else:
  174. text3="SELECT TOP(1000) 網址, 帳號, 密碼 ,備用網址 FROM 後台商客資料暫存檔 WHERE (上一層='0')"# and 網址='w1a.85vvip.com' and 帳號='vv09')"
  175. #text4="SELECT TOP(1000) "+editim+" FROM 商客基本資料表 WHERE (上一層='0')"# and 網址='www.jjj539.com' and 帳號='28ss')"
  176. CA_SQL="SELECT TOP(1000) 網址, 帳號, 主帳號 ,備用網址 FROM 後台商客資料暫存檔 WHERE (上一層='1')"# and 網址='w1a.85vvip.com' and 帳號='vv09')"
  177. loopper2=pd.read_sql(text3,engine3)
  178. childAdminLs=pd.read_sql(CA_SQL,engine3)
  179. asd = np.ones((1, 38), dtype=bool)
  180. loopper3=pd.DataFrame(asd)
  181. print(loopper3)
  182. contforloop=len(loopper2)
  183. loopper2=loopper2.values
  184. loopper3=loopper3.values
  185. print(loopper3)
  186. childAdminLs=childAdminLs.values
  187. print(loopper2)
  188. print(len(loopper3[0]))
  189. if thisfile=="A2.txt":
  190. x=0
  191. while x != len(loopper3[0]):
  192. loopper3[0][x] = True
  193. x+=1
  194. print(loopper3)
  195. return contforloop,loopper2,childAdminLs,loopper3
  196. except:
  197. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  198. traceback.print_exc(file=open('log.txt', 'a'))
  199. logging.debug('debug message',exc_info=True)
  200. logging.info('info message',exc_info=True)
  201. logging.warning('warning message',exc_info=True)
  202. logging.error('error message',exc_info=True)
  203. logging.critical('critical message',exc_info=True)
  204. app1 = QtWidgets.QApplication([])
  205. error_dialog = QtWidgets.QErrorMessage()
  206. error_dialog.setWindowTitle('ERROR')
  207. error_dialog.showMessage('無基本資料')
  208. app1.exec_()
  209. def CreateLogEngine():
  210. try:
  211. DB_session_log = sessionmaker(engine)
  212. db_session_log= DB_session_log()
  213. Log_database=db_session_log.query(Logdata).all()
  214. LogDbName=Log_database[0].資料庫
  215. LogIPName=Log_database[0].IP位置
  216. LogAdName=Log_database[0].帳號
  217. LogPdName=Log_database[0].密碼
  218. log_Engine=create_engine('mssql+pyodbc://'+LogAdName+':'+LogPdName+'@'+LogIPName+'/'+LogDbName+'?driver=SQL+Server+Native+Client+11.0')
  219. return log_Engine
  220. except:
  221. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  222. traceback.print_exc(file=open('log.txt', 'a'))
  223. logging.debug('debug message',exc_info=True)
  224. logging.info('info message',exc_info=True)
  225. logging.warning('warning message',exc_info=True)
  226. logging.error('error message',exc_info=True)
  227. logging.critical('critical message',exc_info=True)
  228. app1 = QtWidgets.QApplication([])
  229. error_dialog = QtWidgets.QErrorMessage()
  230. error_dialog.setWindowTitle('ERROR')
  231. error_dialog.showMessage('記錄連線失敗')
  232. app1.exec_()
  233. def LongFirstLogin(urlkey,adminkey,passkey):
  234. try:
  235. #===========================================================網站需要的加密
  236. print(urlkey)
  237. pubkey="B0C1D0E12B47DA93A24C7422D433170A4D5B126A27CED6F3087652723562889803E2280041F02E6B24A251C928EBE5BA12501D466D63A43AD5D88A5809A09271F14FD220C0DAE272CAAF9F1CF09DAF52005272529071723C0CB87B5A6392860CA2E72B23A4652910DB87BAC31D89E4DD23B3C56AAE685D9A14C4CC89862AAA27"
  238. rsaPublickey = int(pubkey,16)
  239. key = rsa.PublicKey(rsaPublickey,65537)
  240. message='{\"Account\":\"'+adminkey+'\",\"Password\":\"'+passkey+'\"}'
  241. message=message.encode('utf8')
  242. #passwd = rsa.encrypt(message,key)
  243. passwd = binascii.b2a_hex(rsa.encrypt(message,key)).decode()
  244. #=========================================================================
  245. Loginurl="http://"+urlkey+"/api/shared/login"
  246. headers1 = {
  247. 'Content-Length': '256',
  248. 'Content-Type': 'application/x-www-form-urlencoded'
  249. }
  250. print(passwd)
  251. response = requests.request("POST", Loginurl, headers=headers1, data=passwd, timeout=12,verify=False)
  252. return response
  253. except Exception as e:
  254. print("发生异常:", e)
  255. response="無法取得資料"
  256. return response
  257. def LongSecondLogin(LFLresponse):
  258. try:
  259. LFLresponseJson=json.loads(LFLresponse.text)
  260. print("LFLresponseJson:"+str(LFLresponseJson))
  261. SecondLoginUrl=LFLresponseJson['Redirect']
  262. SecondLoginData=LFLresponseJson['Data']
  263. headers2 = {
  264. 'Content-Length': '514',
  265. 'Content-Type': 'application/x-www-form-urlencoded'
  266. }
  267. print(SecondLoginUrl)#debug
  268. GatewayUrl="http:"+SecondLoginUrl
  269. print("GatewayUrl"+GatewayUrl)
  270. LoginGatewayPostData="+="+SecondLoginData
  271. response2 = requests.request("POST", GatewayUrl, headers=headers2, data=LoginGatewayPostData, timeout=12,verify=False)
  272. return SecondLoginUrl,SecondLoginData,response2
  273. except:
  274. SecondLoginUrl=""
  275. SecondLoginData=""
  276. response2=""
  277. return SecondLoginUrl,SecondLoginData,response2
  278. def LongGetData(urlkey, adminkey, passkey, startDatekey, endDatekey,backupUrl,childAdminLs):
  279. print("URLLLLLLLLLLLLLL:"+str(urlkey))
  280. try:
  281. LFLresponse=LongFirstLogin(urlkey,adminkey,passkey)#第一層登入
  282. if LFLresponse=="無法取得資料":
  283. urlkey=backupUrl#使用備用網址
  284. LFLresponse=LongFirstLogin(urlkey,adminkey,passkey)
  285. if LFLresponse=="無法取得資料":
  286. fordebugger="無法取得資料"
  287. allll=pd.DataFrame()
  288. return allll,fordebugger,urlkey,adminkey
  289. print("LFLresponsestatus_code"+str(LFLresponse.status_code))
  290. if LFLresponse.status_code==200:
  291. SecondLoginUrl,SecondLoginData,LSLresponse=LongSecondLogin(LFLresponse)#第一層登入成功 登入第2層
  292. if LSLresponse=="":
  293. print('我從這邊出去的')
  294. allll,fordebugger,urlkey,adminkey=ShortGetData(urlkey, adminkey, passkey, startDatekey, endDatekey,childAdminLs)
  295. #fordebugger="無法取得資料"
  296. #allll=pd.DataFrame()
  297. return allll,fordebugger,urlkey,adminkey
  298. else:
  299. getnameurl = "http:"+SecondLoginUrl[:-21]+"/Admin/D/D02"
  300. cookie=LSLresponse.cookies
  301. cookie=dict(cookie)['ASP.NET_SessionId']
  302. #print("cookie:"+str(cookie))
  303. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/AdminD02Report1/MainQuery"#-21=-(/Command/LoginGateway)
  304. cookstring="ASP.NET_SessionId="+cookie
  305. headers88 = {
  306. 'X-Requested-With': 'XMLHttpRequest',
  307. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36',
  308. 'Content-Type': 'application/x-www-form-urlencoded',
  309. 'Cookie': cookstring,
  310. }
  311. response4 = requests.request("GET", getnameurl, headers=headers88, timeout=12,verify=False)
  312. print("response4status_code"+str(response4.status_code))
  313. if response4.status_code != 200:
  314. getnameurl = "http:"+SecondLoginUrl[:-21]+"/Front/A/A08"
  315. response4 = requests.request("GET", getnameurl, headers=headers88, timeout=12,verify=False)
  316. print(response4.status_code)
  317. #print("respons4444444"+response4.text)
  318. soup3=BeautifulSoup(response4.text,"lxml")
  319. pattern = re.compile(r'Name:"(.*?)"',re.MULTILINE|re.DOTALL)
  320. #print(pattern)
  321. script = soup3.find("script", text=pattern)
  322. #print("SCRIPTTTTT:::::"+str(script))
  323. matches = re.finditer(r'Name:"(.*?)"', script.string, re.MULTILINE)
  324. matchend=[]
  325. badmatchend= ["單碰","配比包牌","雙面包牌","連碰","柱碰","一比四","套餐","連柱碰","雙星連碰柱","三星連碰柱","雙連碰"]
  326. for matchNum, match in enumerate(matches, start=1):
  327. #print ("在{start}-{end}找到匹配{matchNum}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  328. for groupNum in range(0, len(match.groups())):
  329. groupNum = groupNum + 1
  330. if match.group(groupNum) not in matchend and match.group(groupNum) not in badmatchend:
  331. matchend.append(match.group(groupNum))
  332. #print ("在{start}-{end}找到组{groupNum}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
  333. print(matchend)
  334. print(loopper3)
  335. getData3 = ""
  336. if len(loopper3) > 0:
  337. if '迦納彩' in matchend and loopper3[0][37] == True:
  338. getData3 += "&GameType%5B%5D=35"
  339. #if '加州彩' in matchend and loopper3[0][34] == True:
  340. # getData3 += "&GameType%5B%5D=35"
  341. if '天天樂' in matchend and loopper3[0][6] == True:
  342. getData3 += "&GameType%5B%5D=22"
  343. if '威力' in matchend and loopper3[0][5] == True:
  344. getData3 += "&GameType%5B%5D=14"
  345. if '539' in matchend and loopper3[0][4] == True:
  346. getData3 += "&GameType%5B%5D=13"
  347. if '大樂' in matchend and loopper3[0][3] == True:
  348. getData3 += "&GameType%5B%5D=12"
  349. if '六合' in matchend and loopper3[0][2] == True:
  350. getData3 += "&GameType%5B%5D=11"
  351. if '三星彩' in matchend and loopper3[0][1] == True:
  352. getData3 += "&GameType%5B%5D=3"
  353. if '四星彩' in matchend and loopper3[0][0] == True:
  354. getData3 += "&GameType%5B%5D=2"
  355. if '十二不中' in matchend and loopper3[0][24] == True:
  356. getData3 += "&GroupType%5B%5D=160"
  357. if '十一不中' in matchend and loopper3[0][23] == True:
  358. getData3 += "&GroupType%5B%5D=159"
  359. if '十不中' in matchend and loopper3[0][22] == True:
  360. getData3 += "&GroupType%5B%5D=158"
  361. if '九不中' in matchend and loopper3[0][21] == True:
  362. getData3 += "&GroupType%5B%5D=157"
  363. if '八不中' in matchend and loopper3[0][20] == True:
  364. getData3 += "&GroupType%5B%5D=156"
  365. if '七不中' in matchend and loopper3[0][19] == True:
  366. getData3 += "&GroupType%5B%5D=155"
  367. if '六不中' in matchend and loopper3[0][18] == True:
  368. getData3 += "&GroupType%5B%5D=154"
  369. if '五不中' in matchend and loopper3[0][17] == True:
  370. getData3 += "&GroupType%5B%5D=153"
  371. if '五星' in matchend and loopper3[0][16] == True:
  372. getData3 += "&GroupType%5B%5D=118"
  373. if '天碰三' in matchend and loopper3[0][15] == True:
  374. getData3 += "&GroupType%5B%5D=109"
  375. if '天碰二' in matchend and loopper3[0][14] == True:
  376. getData3 += "&GroupType%5B%5D=108"
  377. if '四星' in matchend and loopper3[0][13] == True:
  378. getData3 += "&GroupType%5B%5D=107"
  379. if '三星' in matchend and loopper3[0][12] == True:
  380. getData3 += "&GroupType%5B%5D=106"
  381. if '二星' in matchend and loopper3[0][11] == True:
  382. getData3 += "&GroupType%5B%5D=105"
  383. if '特尾三' in matchend and loopper3[0][10] == True:
  384. getData3 += "&GroupType%5B%5D=104"
  385. if '台號' in matchend and loopper3[0][9] == True:
  386. getData3 += "&GroupType%5B%5D=103"
  387. if '特碼' in matchend and loopper3[0][8] == True:
  388. getData3 += "&GroupType%5B%5D=102"
  389. if '全車' in matchend and loopper3[0][7] == True:
  390. getData3 += "&GroupType%5B%5D=101"
  391. if '合單雙' in matchend and loopper3[0][33] == True:
  392. getData3 += "&GroupType%5B%5D=9"
  393. if '四字現' in matchend and loopper3[0][32] == True:
  394. getData3 += "&GroupType%5B%5D=8"
  395. if '三字現' in matchend and loopper3[0][31] == True:
  396. getData3 += "&GroupType%5B%5D=7"
  397. if '二字現' in matchend and loopper3[0][30] == True:
  398. getData3 += "&GroupType%5B%5D=6"
  399. if '一字現' in matchend and loopper3[0][29] == True:
  400. getData3 += "&GroupType%5B%5D=5"
  401. if '四定位' in matchend and loopper3[0][28] == True:
  402. getData3 += "&GroupType%5B%5D=4"
  403. if '三定位' in matchend and loopper3[0][27] == True:
  404. getData3 += "&GroupType%5B%5D=3"
  405. if '二定位' in matchend and loopper3[0][26] == True:
  406. getData3 += "&GroupType%5B%5D=2"
  407. if '一定位' in matchend and loopper3[0][25] == True:
  408. getData3 += "&GroupType%5B%5D=1"
  409. print(getData3)
  410. print(getData3.find("GameType"))
  411. getData= "Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  412. #====================================種類=================================
  413. #getData="Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  414. #getData= "Account=&GameType%5B%5D=35&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  415. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  416. if response3.status_code!=200:
  417. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/FrontA08Report1/MainQuery"#-21=-(/Command/LoginGateway)
  418. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  419. #print(response3)
  420. print("AAAAA0")
  421. if response3.status_code==200:
  422. jsondata=json.loads(response3.text)
  423. print("AAAAA1")
  424. #print(jsondata)
  425. if response3.text=="null":
  426. getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  427. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  428. print("AAAAA7")
  429. if response3.text=="null":
  430. #getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  431. getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  432. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  433. print("AAAAA2")
  434. if response3.text=="null":
  435. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  436. getData= "Account=&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  437. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  438. #responsetxt=response3.text
  439. #print(responsetxt)
  440. print("AAAAA3")
  441. if response3.text=="null":
  442. getData="Account=&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  443. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  444. print("AAAAA4")
  445. if response3.text=="null":
  446. getData="Account=&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  447. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  448. print("AAAAA5")
  449. if response3.text=="null":
  450. #getData="Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  451. getData="Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  452. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  453. print("AAAAA8")
  454. jsondata=json.loads(response3.text)
  455. print(jsondata)
  456. print("AAAAA6")
  457. #====================================種類=========================================
  458. #====================================解析資料=====================================
  459. allll=[]
  460. if len(jsondata['DataList'])>0:
  461. #print(len(jsondata['DataList']))
  462. #print(jsondata['DataList'])
  463. #print(jsondata['DataList'][0]['NickName'])
  464. for i in range(len(jsondata['DataList'])):
  465. allll.append([])
  466. allll[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  467. allll[i].append(jsondata['DataList'][i]['TotBet'])
  468. allll[i].append(jsondata['DataList'][i]['TotBetRebate'])
  469. allll[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  470. allll[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  471. if len(jsondata['DataList'][i]['ContributionPaid']) >7:
  472. for j in range(7):
  473. allll[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  474. else:
  475. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  476. allll[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  477. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  478. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  479. for z in range(ReAdd):
  480. allll[i].append(None)
  481. allll[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  482. allll[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  483. allll[i].append(jsondata['DataList'][i]['TotPaid'])
  484. allll[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  485. try:
  486. allll[i].append(jsondata['DataList'][i]['PaidContributor'])
  487. except:
  488. allll[i].append(None)
  489. allll[i].append(jsondata['DataList'][i]['TotContribution'])
  490. allll[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  491. try:
  492. allll[i].append(jsondata['DataList'][i]['TotControl'])
  493. except:
  494. allll[i].append(None)
  495. try:
  496. allll[i].append(jsondata['DataList'][i]['TotControlDuty'])
  497. except:
  498. allll[i].append(None)
  499. try:
  500. allll[i].append(jsondata['DataList'][i]['SystemDuty'])
  501. except:
  502. allll[i].append(None)
  503. print(allll)
  504. allll=pd.DataFrame(allll)
  505. allll.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  506. fordebugger="OK"
  507. else:
  508. allll=pd.DataFrame()
  509. fordebugger="查詢期間無資料"
  510. #=================================解析資料=============================================
  511. #================================插入資訊==============================================
  512. WEBURLTXT=[]
  513. ADMINTXT=[]
  514. StartDATETXT=[]
  515. EndDATETXT=[]
  516. TIMERAND=[]
  517. nowTime=datetime.datetime.now().strftime("%m%d%H%M%S")
  518. randomNum=random.randint(0,10000)
  519. if randomNum<10:
  520. randomNum=str(0)+str(0)+str(0)+str(randomNum)
  521. elif randomNum>10 and randomNum<100:
  522. randomNum=str(0)+str(0)+str(randomNum)
  523. elif randomNum>100 and randomNum<1000:
  524. randomNum=str(0)+str(randomNum)
  525. uniqueNum=str(nowTime)+str(randomNum)
  526. for i in range(len(allll)):
  527. WEBURLTXT.append(urlkey)
  528. ADMINTXT.append(adminkey)
  529. StartDATETXT.append(startDatekey)
  530. EndDATETXT.append(endDatekey)
  531. TIMERAND.append("全")
  532. allll.insert(0,"開始日期",StartDATETXT)
  533. allll.insert(1,"結束日期",EndDATETXT)
  534. allll.insert(2,"網址",WEBURLTXT)
  535. allll.insert(3,"帳戶",ADMINTXT)
  536. allll.insert(4,"隨機碼",TIMERAND)
  537. print(allll)
  538. #=====================================================================================
  539. refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  540. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  541. allll=pd.concat([refind,allll],ignore_index = True)
  542. end = time.time()
  543. print("執行時間:%f 秒" % (end - start))
  544. """
  545. if thisfile=="A2.txt":
  546. getData3 = ""
  547. if '大樂' in matchend :
  548. getData3 += "&GameType%5B%5D=12"
  549. if '十二不中' in matchend :
  550. getData3 += "&GroupType%5B%5D=160"
  551. if '十一不中' in matchend :
  552. getData3 += "&GroupType%5B%5D=159"
  553. if '十不中' in matchend :
  554. getData3 += "&GroupType%5B%5D=158"
  555. if '九不中' in matchend :
  556. getData3 += "&GroupType%5B%5D=157"
  557. if '八不中' in matchend :
  558. getData3 += "&GroupType%5B%5D=156"
  559. if '七不中' in matchend :
  560. getData3 += "&GroupType%5B%5D=155"
  561. if '六不中' in matchend :
  562. getData3 += "&GroupType%5B%5D=154"
  563. if '五不中' in matchend :
  564. getData3 += "&GroupType%5B%5D=153"
  565. if '五星' in matchend :
  566. getData3 += "&GroupType%5B%5D=118"
  567. if '天碰三' in matchend :
  568. getData3 += "&GroupType%5B%5D=109"
  569. if '天碰二' in matchend :
  570. getData3 += "&GroupType%5B%5D=108"
  571. if '四星' in matchend :
  572. getData3 += "&GroupType%5B%5D=107"
  573. if '三星' in matchend :
  574. getData3 += "&GroupType%5B%5D=106"
  575. if '二星' in matchend :
  576. getData3 += "&GroupType%5B%5D=105"
  577. if '特尾三' in matchend :
  578. getData3 += "&GroupType%5B%5D=104"
  579. if '台號' in matchend :
  580. getData3 += "&GroupType%5B%5D=103"
  581. if '特碼' in matchend :
  582. getData3 += "&GroupType%5B%5D=102"
  583. if '全車' in matchend :
  584. getData3 += "&GroupType%5B%5D=101"
  585. if '合單雙' in matchend:
  586. getData3 += "&GroupType%5B%5D=9"
  587. if '四字現' in matchend :
  588. getData3 += "&GroupType%5B%5D=8"
  589. if '三字現' in matchend :
  590. getData3 += "&GroupType%5B%5D=7"
  591. if '二字現' in matchend :
  592. getData3 += "&GroupType%5B%5D=6"
  593. if '一字現' in matchend :
  594. getData3 += "&GroupType%5B%5D=5"
  595. if '四定位' in matchend :
  596. getData3 += "&GroupType%5B%5D=4"
  597. if '三定位' in matchend :
  598. getData3 += "&GroupType%5B%5D=3"
  599. if '二定位' in matchend :
  600. getData3 += "&GroupType%5B%5D=2"
  601. if '一定位' in matchend :
  602. getData3 += "&GroupType%5B%5D=1"
  603. getData= "Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  604. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  605. if response3.status_code!=200:
  606. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/FrontA08Report1/MainQuery"#-21=-(/Command/LoginGateway)
  607. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  608. #print(response3)
  609. print("AAAAA0")
  610. if response3.status_code==200:
  611. jsondata=json.loads(response3.text)
  612. print("AAAAA1")
  613. #print(jsondata)
  614. if response3.text=="null":
  615. getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  616. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  617. print("AAAAA7")
  618. if response3.text=="null":
  619. #getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  620. getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  621. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  622. print("AAAAA2")
  623. if response3.text=="null":
  624. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  625. getData= "Account=&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  626. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  627. #responsetxt=response3.text
  628. #print(responsetxt)
  629. print("AAAAA3")
  630. if response3.text=="null":
  631. getData="Account=&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  632. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  633. print("AAAAA4")
  634. if response3.text=="null":
  635. getData="Account=&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  636. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  637. print("AAAAA5")
  638. if response3.text=="null":
  639. #getData="Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  640. getData="Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  641. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  642. print("AAAAA8")
  643. jsondata=json.loads(response3.text)
  644. #print(jsondata)
  645. print("AAAAA6")
  646. #====================================種類=========================================
  647. #====================================解析資料=====================================
  648. allll2=[]
  649. if len(jsondata['DataList'])>0:
  650. #print(len(jsondata['DataList']))
  651. #print(jsondata['DataList'])
  652. #print(jsondata['DataList'][0]['NickName'])
  653. for i in range(len(jsondata['DataList'])):
  654. allll2.append([])
  655. allll2[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  656. allll2[i].append(jsondata['DataList'][i]['TotBet'])
  657. allll2[i].append(jsondata['DataList'][i]['TotBetRebate'])
  658. allll2[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  659. allll2[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  660. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  661. allll2[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  662. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  663. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  664. for z in range(ReAdd):
  665. allll2[i].append(None)
  666. allll2[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  667. allll2[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  668. allll2[i].append(jsondata['DataList'][i]['TotPaid'])
  669. allll2[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  670. try:
  671. allll2[i].append(jsondata['DataList'][i]['PaidContributor'])
  672. except:
  673. allll2[i].append(None)
  674. allll2[i].append(jsondata['DataList'][i]['TotContribution'])
  675. allll2[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  676. try:
  677. allll2[i].append(jsondata['DataList'][i]['TotControl'])
  678. except:
  679. allll2[i].append(None)
  680. try:
  681. allll2[i].append(jsondata['DataList'][i]['TotControlDuty'])
  682. except:
  683. allll2[i].append(None)
  684. try:
  685. allll2[i].append(jsondata['DataList'][i]['SystemDuty'])
  686. except:
  687. allll2[i].append(None)
  688. print(allll2)
  689. allll2=pd.DataFrame(allll2)
  690. allll2.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  691. fordebugger="OK"
  692. else:
  693. allll2=pd.DataFrame()
  694. fordebugger="查詢期間無資料"
  695. WEBURLTXT=[]
  696. ADMINTXT=[]
  697. StartDATETXT=[]
  698. EndDATETXT=[]
  699. TIMERAND=[]
  700. nowTime=datetime.datetime.now().strftime("%m%d%H%M%S")
  701. randomNum=random.randint(0,10000)
  702. if randomNum<10:
  703. randomNum=str(0)+str(0)+str(0)+str(randomNum)
  704. elif randomNum>10 and randomNum<100:
  705. randomNum=str(0)+str(0)+str(randomNum)
  706. elif randomNum>100 and randomNum<1000:
  707. randomNum=str(0)+str(randomNum)
  708. uniqueNum=str(nowTime)+str(randomNum)
  709. for i in range(len(allll2)):
  710. WEBURLTXT.append(urlkey)
  711. ADMINTXT.append(adminkey)
  712. StartDATETXT.append(startDatekey)
  713. EndDATETXT.append(endDatekey)
  714. TIMERAND.append("大")
  715. allll2.insert(0,"開始日期",StartDATETXT)
  716. allll2.insert(1,"結束日期",EndDATETXT)
  717. allll2.insert(2,"網址",WEBURLTXT)
  718. allll2.insert(3,"帳戶",ADMINTXT)
  719. allll2.insert(4,"隨機碼",TIMERAND)
  720. print(allll2)
  721. #=====================================================================================
  722. refind2=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  723. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  724. allll2=pd.concat([refind2,allll2],ignore_index = True)
  725. allll=pd.concat([allll,allll2],ignore_index = True)
  726. if thisfile=="A2.txt":
  727. getData3 = ""
  728. if '六合' in matchend:
  729. getData3 += "&GameType%5B%5D=11"
  730. if '十二不中' in matchend :
  731. getData3 += "&GroupType%5B%5D=160"
  732. if '十一不中' in matchend :
  733. getData3 += "&GroupType%5B%5D=159"
  734. if '十不中' in matchend :
  735. getData3 += "&GroupType%5B%5D=158"
  736. if '九不中' in matchend :
  737. getData3 += "&GroupType%5B%5D=157"
  738. if '八不中' in matchend :
  739. getData3 += "&GroupType%5B%5D=156"
  740. if '七不中' in matchend :
  741. getData3 += "&GroupType%5B%5D=155"
  742. if '六不中' in matchend :
  743. getData3 += "&GroupType%5B%5D=154"
  744. if '五不中' in matchend :
  745. getData3 += "&GroupType%5B%5D=153"
  746. if '五星' in matchend :
  747. getData3 += "&GroupType%5B%5D=118"
  748. if '天碰三' in matchend :
  749. getData3 += "&GroupType%5B%5D=109"
  750. if '天碰二' in matchend :
  751. getData3 += "&GroupType%5B%5D=108"
  752. if '四星' in matchend :
  753. getData3 += "&GroupType%5B%5D=107"
  754. if '三星' in matchend :
  755. getData3 += "&GroupType%5B%5D=106"
  756. if '二星' in matchend :
  757. getData3 += "&GroupType%5B%5D=105"
  758. if '特尾三' in matchend :
  759. getData3 += "&GroupType%5B%5D=104"
  760. if '台號' in matchend :
  761. getData3 += "&GroupType%5B%5D=103"
  762. if '特碼' in matchend :
  763. getData3 += "&GroupType%5B%5D=102"
  764. if '全車' in matchend :
  765. getData3 += "&GroupType%5B%5D=101"
  766. if '合單雙' in matchend:
  767. getData3 += "&GroupType%5B%5D=9"
  768. if '四字現' in matchend :
  769. getData3 += "&GroupType%5B%5D=8"
  770. if '三字現' in matchend :
  771. getData3 += "&GroupType%5B%5D=7"
  772. if '二字現' in matchend :
  773. getData3 += "&GroupType%5B%5D=6"
  774. if '一字現' in matchend :
  775. getData3 += "&GroupType%5B%5D=5"
  776. if '四定位' in matchend :
  777. getData3 += "&GroupType%5B%5D=4"
  778. if '三定位' in matchend :
  779. getData3 += "&GroupType%5B%5D=3"
  780. if '二定位' in matchend :
  781. getData3 += "&GroupType%5B%5D=2"
  782. if '一定位' in matchend :
  783. getData3 += "&GroupType%5B%5D=1"
  784. getData= "Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  785. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  786. if response3.status_code!=200:
  787. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/FrontA08Report1/MainQuery"#-21=-(/Command/LoginGateway)
  788. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  789. #print(response3)
  790. print("AAAAA0")
  791. if response3.status_code==200:
  792. jsondata=json.loads(response3.text)
  793. print("AAAAA1")
  794. #print(jsondata)
  795. if response3.text=="null":
  796. getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  797. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  798. print("AAAAA7")
  799. if response3.text=="null":
  800. #getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  801. getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  802. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  803. print("AAAAA2")
  804. if response3.text=="null":
  805. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  806. getData= "Account=&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  807. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  808. #responsetxt=response3.text
  809. #print(responsetxt)
  810. print("AAAAA3")
  811. if response3.text=="null":
  812. getData="Account=&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  813. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  814. print("AAAAA4")
  815. if response3.text=="null":
  816. getData="Account=&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  817. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  818. print("AAAAA5")
  819. if response3.text=="null":
  820. #getData="Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  821. getData="Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  822. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  823. print("AAAAA8")
  824. jsondata=json.loads(response3.text)
  825. #print(jsondata)
  826. print("AAAAA6")
  827. #====================================種類=========================================
  828. #====================================解析資料=====================================
  829. allll3=[]
  830. if len(jsondata['DataList'])>0:
  831. #print(len(jsondata['DataList']))
  832. #print(jsondata['DataList'])
  833. #print(jsondata['DataList'][0]['NickName'])
  834. for i in range(len(jsondata['DataList'])):
  835. allll3.append([])
  836. allll3[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  837. allll3[i].append(jsondata['DataList'][i]['TotBet'])
  838. allll3[i].append(jsondata['DataList'][i]['TotBetRebate'])
  839. allll3[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  840. allll3[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  841. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  842. allll3[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  843. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  844. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  845. for z in range(ReAdd):
  846. allll3[i].append(None)
  847. allll3[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  848. allll3[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  849. allll3[i].append(jsondata['DataList'][i]['TotPaid'])
  850. allll3[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  851. try:
  852. allll3[i].append(jsondata['DataList'][i]['PaidContributor'])
  853. except:
  854. allll3[i].append(None)
  855. allll3[i].append(jsondata['DataList'][i]['TotContribution'])
  856. allll3[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  857. try:
  858. allll3[i].append(jsondata['DataList'][i]['TotControl'])
  859. except:
  860. allll3[i].append(None)
  861. try:
  862. allll3[i].append(jsondata['DataList'][i]['TotControlDuty'])
  863. except:
  864. allll3[i].append(None)
  865. try:
  866. allll3[i].append(jsondata['DataList'][i]['SystemDuty'])
  867. except:
  868. allll3[i].append(None)
  869. print(allll3)
  870. allll3=pd.DataFrame(allll3)
  871. allll3.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  872. fordebugger="OK"
  873. else:
  874. allll3=pd.DataFrame()
  875. fordebugger="查詢期間無資料"
  876. WEBURLTXT=[]
  877. ADMINTXT=[]
  878. StartDATETXT=[]
  879. EndDATETXT=[]
  880. TIMERAND=[]
  881. for i in range(len(allll3)):
  882. WEBURLTXT.append(urlkey)
  883. ADMINTXT.append(adminkey)
  884. StartDATETXT.append(startDatekey)
  885. EndDATETXT.append(endDatekey)
  886. TIMERAND.append("六")
  887. allll3.insert(0,"開始日期",StartDATETXT)
  888. allll3.insert(1,"結束日期",EndDATETXT)
  889. allll3.insert(2,"網址",WEBURLTXT)
  890. allll3.insert(3,"帳戶",ADMINTXT)
  891. allll3.insert(4,"隨機碼",TIMERAND)
  892. print(allll3)
  893. #=====================================================================================
  894. refind3=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  895. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  896. allll3=pd.concat([refind3,allll3],ignore_index = True)
  897. allll=pd.concat([allll,allll3],ignore_index = True)
  898. if thisfile=="A2.txt":
  899. getData3 = ""
  900. if '539' in matchend:
  901. getData3 += "&GameType%5B%5D=13"
  902. if '十二不中' in matchend :
  903. getData3 += "&GroupType%5B%5D=160"
  904. if '十一不中' in matchend :
  905. getData3 += "&GroupType%5B%5D=159"
  906. if '十不中' in matchend :
  907. getData3 += "&GroupType%5B%5D=158"
  908. if '九不中' in matchend :
  909. getData3 += "&GroupType%5B%5D=157"
  910. if '八不中' in matchend :
  911. getData3 += "&GroupType%5B%5D=156"
  912. if '七不中' in matchend :
  913. getData3 += "&GroupType%5B%5D=155"
  914. if '六不中' in matchend :
  915. getData3 += "&GroupType%5B%5D=154"
  916. if '五不中' in matchend :
  917. getData3 += "&GroupType%5B%5D=153"
  918. if '五星' in matchend :
  919. getData3 += "&GroupType%5B%5D=118"
  920. if '天碰三' in matchend :
  921. getData3 += "&GroupType%5B%5D=109"
  922. if '天碰二' in matchend :
  923. getData3 += "&GroupType%5B%5D=108"
  924. if '四星' in matchend :
  925. getData3 += "&GroupType%5B%5D=107"
  926. if '三星' in matchend :
  927. getData3 += "&GroupType%5B%5D=106"
  928. if '二星' in matchend :
  929. getData3 += "&GroupType%5B%5D=105"
  930. if '特尾三' in matchend :
  931. getData3 += "&GroupType%5B%5D=104"
  932. if '台號' in matchend :
  933. getData3 += "&GroupType%5B%5D=103"
  934. if '特碼' in matchend :
  935. getData3 += "&GroupType%5B%5D=102"
  936. if '全車' in matchend :
  937. getData3 += "&GroupType%5B%5D=101"
  938. if '合單雙' in matchend:
  939. getData3 += "&GroupType%5B%5D=9"
  940. if '四字現' in matchend :
  941. getData3 += "&GroupType%5B%5D=8"
  942. if '三字現' in matchend :
  943. getData3 += "&GroupType%5B%5D=7"
  944. if '二字現' in matchend :
  945. getData3 += "&GroupType%5B%5D=6"
  946. if '一字現' in matchend :
  947. getData3 += "&GroupType%5B%5D=5"
  948. if '四定位' in matchend :
  949. getData3 += "&GroupType%5B%5D=4"
  950. if '三定位' in matchend :
  951. getData3 += "&GroupType%5B%5D=3"
  952. if '二定位' in matchend :
  953. getData3 += "&GroupType%5B%5D=2"
  954. if '一定位' in matchend :
  955. getData3 += "&GroupType%5B%5D=1"
  956. getData= "Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  957. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  958. if response3.status_code!=200:
  959. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/FrontA08Report1/MainQuery"#-21=-(/Command/LoginGateway)
  960. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  961. #print(response3)
  962. print("AAAAA0")
  963. if response3.status_code==200:
  964. jsondata=json.loads(response3.text)
  965. print("AAAAA1")
  966. #print(jsondata)
  967. if response3.text=="null":
  968. getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  969. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  970. print("AAAAA7")
  971. if response3.text=="null":
  972. #getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  973. getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  974. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  975. print("AAAAA2")
  976. if response3.text=="null":
  977. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  978. getData= "Account=&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  979. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  980. #responsetxt=response3.text
  981. #print(responsetxt)
  982. print("AAAAA3")
  983. if response3.text=="null":
  984. getData="Account=&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  985. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  986. print("AAAAA4")
  987. if response3.text=="null":
  988. getData="Account=&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  989. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  990. print("AAAAA5")
  991. if response3.text=="null":
  992. #getData="Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  993. getData="Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  994. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  995. print("AAAAA8")
  996. jsondata=json.loads(response3.text)
  997. #print(jsondata)
  998. print("AAAAA6")
  999. #====================================種類=========================================
  1000. #====================================解析資料=====================================
  1001. allll4=[]
  1002. if len(jsondata['DataList'])>0:
  1003. #print(len(jsondata['DataList']))
  1004. #print(jsondata['DataList'])
  1005. #print(jsondata['DataList'][0]['NickName'])
  1006. for i in range(len(jsondata['DataList'])):
  1007. allll4.append([])
  1008. allll4[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  1009. allll4[i].append(jsondata['DataList'][i]['TotBet'])
  1010. allll4[i].append(jsondata['DataList'][i]['TotBetRebate'])
  1011. allll4[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  1012. allll4[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  1013. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  1014. allll4[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  1015. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  1016. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  1017. for z in range(ReAdd):
  1018. allll4[i].append(None)
  1019. allll4[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  1020. allll4[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  1021. allll4[i].append(jsondata['DataList'][i]['TotPaid'])
  1022. allll4[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  1023. try:
  1024. allll4[i].append(jsondata['DataList'][i]['PaidContributor'])
  1025. except:
  1026. allll4[i].append(None)
  1027. allll4[i].append(jsondata['DataList'][i]['TotContribution'])
  1028. allll4[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  1029. try:
  1030. allll4[i].append(jsondata['DataList'][i]['TotControl'])
  1031. except:
  1032. allll4[i].append(None)
  1033. try:
  1034. allll4[i].append(jsondata['DataList'][i]['TotControlDuty'])
  1035. except:
  1036. allll4[i].append(None)
  1037. try:
  1038. allll4[i].append(jsondata['DataList'][i]['SystemDuty'])
  1039. except:
  1040. allll4[i].append(None)
  1041. print(allll4)
  1042. allll4=pd.DataFrame(allll4)
  1043. allll4.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  1044. fordebugger="OK"
  1045. else:
  1046. allll4=pd.DataFrame()
  1047. fordebugger="查詢期間無資料"
  1048. WEBURLTXT=[]
  1049. ADMINTXT=[]
  1050. StartDATETXT=[]
  1051. EndDATETXT=[]
  1052. TIMERAND=[]
  1053. for i in range(len(allll4)):
  1054. WEBURLTXT.append(urlkey)
  1055. ADMINTXT.append(adminkey)
  1056. StartDATETXT.append(startDatekey)
  1057. EndDATETXT.append(endDatekey)
  1058. TIMERAND.append("五")
  1059. allll4.insert(0,"開始日期",StartDATETXT)
  1060. allll4.insert(1,"結束日期",EndDATETXT)
  1061. allll4.insert(2,"網址",WEBURLTXT)
  1062. allll4.insert(3,"帳戶",ADMINTXT)
  1063. allll4.insert(4,"隨機碼",TIMERAND)
  1064. print(allll4)
  1065. #=====================================================================================
  1066. refind4=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  1067. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  1068. allll4=pd.concat([refind4,allll4],ignore_index = True)
  1069. allll=pd.concat([allll,allll4],ignore_index = True)
  1070. if thisfile=="A2.txt":
  1071. getData3 = ""
  1072. if '天天樂' in matchend:
  1073. getData3 += "&GameType%5B%5D=22"
  1074. if '十二不中' in matchend :
  1075. getData3 += "&GroupType%5B%5D=160"
  1076. if '十一不中' in matchend :
  1077. getData3 += "&GroupType%5B%5D=159"
  1078. if '十不中' in matchend :
  1079. getData3 += "&GroupType%5B%5D=158"
  1080. if '九不中' in matchend :
  1081. getData3 += "&GroupType%5B%5D=157"
  1082. if '八不中' in matchend :
  1083. getData3 += "&GroupType%5B%5D=156"
  1084. if '七不中' in matchend :
  1085. getData3 += "&GroupType%5B%5D=155"
  1086. if '六不中' in matchend :
  1087. getData3 += "&GroupType%5B%5D=154"
  1088. if '五不中' in matchend :
  1089. getData3 += "&GroupType%5B%5D=153"
  1090. if '五星' in matchend :
  1091. getData3 += "&GroupType%5B%5D=118"
  1092. if '天碰三' in matchend :
  1093. getData3 += "&GroupType%5B%5D=109"
  1094. if '天碰二' in matchend :
  1095. getData3 += "&GroupType%5B%5D=108"
  1096. if '四星' in matchend :
  1097. getData3 += "&GroupType%5B%5D=107"
  1098. if '三星' in matchend :
  1099. getData3 += "&GroupType%5B%5D=106"
  1100. if '二星' in matchend :
  1101. getData3 += "&GroupType%5B%5D=105"
  1102. if '特尾三' in matchend :
  1103. getData3 += "&GroupType%5B%5D=104"
  1104. if '台號' in matchend :
  1105. getData3 += "&GroupType%5B%5D=103"
  1106. if '特碼' in matchend :
  1107. getData3 += "&GroupType%5B%5D=102"
  1108. if '全車' in matchend :
  1109. getData3 += "&GroupType%5B%5D=101"
  1110. if '合單雙' in matchend:
  1111. getData3 += "&GroupType%5B%5D=9"
  1112. if '四字現' in matchend :
  1113. getData3 += "&GroupType%5B%5D=8"
  1114. if '三字現' in matchend :
  1115. getData3 += "&GroupType%5B%5D=7"
  1116. if '二字現' in matchend :
  1117. getData3 += "&GroupType%5B%5D=6"
  1118. if '一字現' in matchend :
  1119. getData3 += "&GroupType%5B%5D=5"
  1120. if '四定位' in matchend :
  1121. getData3 += "&GroupType%5B%5D=4"
  1122. if '三定位' in matchend :
  1123. getData3 += "&GroupType%5B%5D=3"
  1124. if '二定位' in matchend :
  1125. getData3 += "&GroupType%5B%5D=2"
  1126. if '一定位' in matchend :
  1127. getData3 += "&GroupType%5B%5D=1"
  1128. getData= "Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  1129. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1130. if response3.status_code!=200:
  1131. GetDataUrl="http:"+SecondLoginUrl[:-21]+"/api/FrontA08Report1/MainQuery"#-21=-(/Command/LoginGateway)
  1132. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1133. print(response3)
  1134. print("AAAAA0")
  1135. if response3.status_code==200:
  1136. jsondata=json.loads(response3.text)
  1137. print("AAAAA1")
  1138. #print(jsondata)
  1139. if response3.text=="null":
  1140. getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1141. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1142. print("AAAAA7")
  1143. if response3.text=="null":
  1144. #getData= "Account=&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate"+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"
  1145. getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1146. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1147. print("AAAAA2")
  1148. if response3.text=="null":
  1149. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1150. getData= "Account=&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1151. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1152. #responsetxt=response3.text
  1153. #print(responsetxt)
  1154. print("AAAAA3")
  1155. if response3.text=="null":
  1156. getData="Account=&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  1157. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1158. print("AAAAA4")
  1159. if response3.text=="null":
  1160. getData="Account=&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  1161. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1162. print("AAAAA5")
  1163. if response3.text=="null":
  1164. #getData="Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  1165. getData="Account="+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  1166. response3 = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=10,verify=False)
  1167. print("AAAAA8")
  1168. jsondata=json.loads(response3.text)
  1169. #print(jsondata)
  1170. print("AAAAA6")
  1171. #====================================種類=========================================
  1172. #====================================解析資料=====================================
  1173. allll5=[]
  1174. if len(jsondata['DataList'])>0:
  1175. #print(len(jsondata['DataList']))
  1176. #print(jsondata['DataList'])
  1177. #print(jsondata['DataList'][0]['NickName'])
  1178. for i in range(len(jsondata['DataList'])):
  1179. allll5.append([])
  1180. allll5[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  1181. allll5[i].append(jsondata['DataList'][i]['TotBet'])
  1182. allll5[i].append(jsondata['DataList'][i]['TotBetRebate'])
  1183. allll5[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  1184. allll5[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  1185. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  1186. allll5[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  1187. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  1188. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  1189. for z in range(ReAdd):
  1190. allll5[i].append(None)
  1191. allll5[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  1192. allll5[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  1193. allll5[i].append(jsondata['DataList'][i]['TotPaid'])
  1194. allll5[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  1195. try:
  1196. allll5[i].append(jsondata['DataList'][i]['PaidContributor'])
  1197. except:
  1198. allll5[i].append(None)
  1199. allll5[i].append(jsondata['DataList'][i]['TotContribution'])
  1200. allll5[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  1201. try:
  1202. allll5[i].append(jsondata['DataList'][i]['TotControl'])
  1203. except:
  1204. allll5[i].append(None)
  1205. try:
  1206. allll5[i].append(jsondata['DataList'][i]['TotControlDuty'])
  1207. except:
  1208. allll5[i].append(None)
  1209. try:
  1210. allll5[i].append(jsondata['DataList'][i]['SystemDuty'])
  1211. except:
  1212. allll5[i].append(None)
  1213. print(allll5)
  1214. allll5=pd.DataFrame(allll5)
  1215. allll5.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  1216. fordebugger="OK"
  1217. else:
  1218. allll5=pd.DataFrame()
  1219. fordebugger="查詢期間無資料"
  1220. WEBURLTXT=[]
  1221. ADMINTXT=[]
  1222. StartDATETXT=[]
  1223. EndDATETXT=[]
  1224. TIMERAND=[]
  1225. for i in range(len(allll5)):
  1226. WEBURLTXT.append(urlkey)
  1227. ADMINTXT.append(adminkey)
  1228. StartDATETXT.append(startDatekey)
  1229. EndDATETXT.append(endDatekey)
  1230. TIMERAND.append("加")
  1231. allll5.insert(0,"開始日期",StartDATETXT)
  1232. allll5.insert(1,"結束日期",EndDATETXT)
  1233. allll5.insert(2,"網址",WEBURLTXT)
  1234. allll5.insert(3,"帳戶",ADMINTXT)
  1235. allll5.insert(4,"隨機碼",TIMERAND)
  1236. print(allll5)
  1237. #=====================================================================================
  1238. refind5=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  1239. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  1240. allll5=pd.concat([refind5,allll5],ignore_index = True)
  1241. allll=pd.concat([allll,allll5],ignore_index = True)
  1242. """
  1243. #子帳號 #========================================================================================
  1244. doneChild=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  1245. print("childAdminLschildAdminLs:"+str(len(childAdminLs)))
  1246. for i in range(len(childAdminLs)):
  1247. childallll=pd.DataFrame()
  1248. if (urlkey==childAdminLs[i][0] or urlkey==childAdminLs[i][3]) and adminkey== childAdminLs[i][2]:
  1249. childAdmin=childAdminLs[i][1]
  1250. print(childAdmin)
  1251. getData= "Account="+childAdminLs[i][1]+getData3+"&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1252. #getData= "Account="+childAdminLs[i][1]+"&GameType%5B%5D=35&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1253. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1254. jsondata=json.loads(response3child.text)
  1255. print("chiAAAAA12")
  1256. #print(jsondata)
  1257. if response3child.text=="null":
  1258. getData= "Account="+childAdmin+"&GameType%5B%5D=14&GameType%5B%5D=22&GameType%5B%5D=13&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1259. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1260. print("chiAAAAA13")
  1261. if response3child.text=="null":
  1262. getData= "Account="+childAdmin+"&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1263. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1264. print("chiAAAAA8")
  1265. if response3child.text=="null":
  1266. #getData= "Account=&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1267. getData= "Account="+childAdmin+"&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#FPK375#jnn688
  1268. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1269. print("chiAAAAA9")
  1270. if response3child.text=="null":
  1271. getData="Account="+childAdmin+"&GameType%5B%5D=22&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=118&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true"#KPC365
  1272. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1273. print("chiAAAAA10")
  1274. if response3child.text=="null":
  1275. getData="Account="+childAdmin+"&GameType%5B%5D=13&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  1276. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1277. print("chiAAAAA11")
  1278. if response3child.text=="null":
  1279. getData="Account="+childAdmin+"&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=110&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=102&GroupType%5B%5D=101&StartDate="+startDatekey+"&EndDate="+endDatekey+"&IsNotShowNow=true" #UJK555
  1280. response3child = requests.request("POST", GetDataUrl, headers=headers88, data=getData, timeout=12,verify=False)
  1281. print("chiAAAAA14")
  1282. jsondata=json.loads(response3child.text)
  1283. print(jsondata)
  1284. childallll=[]
  1285. if len(jsondata['DataList'])>0:
  1286. for i in range(len(jsondata['DataList'])):
  1287. childallll.append([])
  1288. childallll[i].append(jsondata['DataList'][i]['NickName']+"("+jsondata['DataList'][i]['Account']+")")
  1289. #
  1290. childallll[i].append(jsondata['DataList'][i]['TotBet'])
  1291. childallll[i].append(jsondata['DataList'][i]['TotBetRebate'])
  1292. childallll[i].append(jsondata['DataList'][i]['TotBetWinLose'])
  1293. childallll[i].append(jsondata['DataList'][i]['SubtotalTotWinLose'])
  1294. if len(jsondata['DataList'][i]['ContributionPaid']) > 7:
  1295. for j in range(7):
  1296. childallll[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  1297. else:
  1298. for j in range(len(jsondata['DataList'][i]['ContributionPaid'])):
  1299. childallll[i].append(jsondata['DataList'][i]['ContributionPaid'][j]['TotPaid'])
  1300. if len(jsondata['DataList'][i]['ContributionPaid'])<7:
  1301. ReAdd=7-len(jsondata['DataList'][i]['ContributionPaid'])
  1302. for z in range(ReAdd):
  1303. childallll[i].append(None)
  1304. childallll[i].append(jsondata['DataList'][i]['SubtotalTotDutyWinLose'])
  1305. childallll[i].append(jsondata['DataList'][i]['SubtotalRebateWinLoseDifference'])
  1306. childallll[i].append(jsondata['DataList'][i]['TotPaid'])
  1307. childallll[i].append(jsondata['DataList'][i]['SubtotalSelfTotWinLose'])
  1308. childallll[i].append(jsondata['DataList'][i]['PaidContributor'])
  1309. childallll[i].append(jsondata['DataList'][i]['TotContribution'])
  1310. childallll[i].append(jsondata['DataList'][i]['SubtotalContribution'])
  1311. childallll[i].append(jsondata['DataList'][i]['TotControl'])
  1312. childallll[i].append(jsondata['DataList'][i]['TotControlDuty'])
  1313. childallll[i].append(jsondata['DataList'][i]['SystemDuty'])
  1314. print(childallll)
  1315. childallll=pd.DataFrame(childallll)
  1316. childallll.columns =["名稱","總量","退水","中獎","輸贏","會員","代理","總代理","股東","大股東","總監","大總監","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","調盤退水","調退實佔","系統商"]
  1317. fordebugger="OK"
  1318. else:
  1319. childallll=pd.DataFrame()
  1320. fordebugger="查詢期間無資料"
  1321. print("FA:SSSAEL")
  1322. WEBURLTXT=[]
  1323. ADMINTXT=[]
  1324. StartDATETXT=[]
  1325. EndDATETXT=[]
  1326. TIMERAND=[]
  1327. nowTime=datetime.datetime.now().strftime("%m%d%H%M%S")
  1328. randomNum=random.randint(0,10000)
  1329. if randomNum<10:
  1330. randomNum=str(0)+str(0)+str(0)+str(randomNum)
  1331. elif randomNum>10 and randomNum<100:
  1332. randomNum=str(0)+str(0)+str(randomNum)
  1333. elif randomNum>100 and randomNum<1000:
  1334. randomNum=str(0)+str(randomNum)
  1335. uniqueNum=str(nowTime)+str(randomNum)
  1336. for i in range(len(childallll)):
  1337. WEBURLTXT.append(urlkey)
  1338. ADMINTXT.append(childAdmin)
  1339. StartDATETXT.append(startDatekey)
  1340. EndDATETXT.append(endDatekey)
  1341. TIMERAND.append(None)
  1342. childallll.insert(0,"開始日期",StartDATETXT)
  1343. childallll.insert(1,"結束日期",EndDATETXT)
  1344. childallll.insert(2,"網址",WEBURLTXT)
  1345. childallll.insert(3,"帳戶",ADMINTXT)
  1346. childallll.insert(4,"隨機碼",TIMERAND)
  1347. print(childallll)
  1348. #=====================================================================================
  1349. refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","大總監","系統商","隨機碼"])
  1350. #refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監","隨機碼"])
  1351. childallll=pd.concat([refind,childallll],ignore_index = True)
  1352. doneChild=pd.concat([refind,doneChild,childallll],ignore_index = True)
  1353. #子帳號========================================================================================
  1354. allll=pd.concat([refind,allll,doneChild],ignore_index = True)
  1355. return allll,fordebugger,urlkey,adminkey
  1356. print(getData3.find("GameType"))
  1357. if response3.status_code!=200 and getData3.find("GameType") != -1:
  1358. fordebugger="無法取得資料"
  1359. allll=pd.DataFrame()
  1360. return allll,fordebugger,urlkey,adminkey
  1361. elif response3.status_code!=200 and getData3.find("GameType") == -1:
  1362. fordebugger="查詢期間無資料"
  1363. allll=pd.DataFrame()
  1364. return allll,fordebugger,urlkey,adminkey
  1365. else:
  1366. fordebugger="查詢期間無資料"
  1367. allll=pd.DataFrame()
  1368. return allll,fordebugger,urlkey,adminkey
  1369. if LFLresponse.status_code!=200 :
  1370. allll,fordebugger,urlkey,adminkey=ShortGetData(urlkey, adminkey, passkey, startDatekey, endDatekey,childAdminLs)
  1371. #print(allll)
  1372. return allll,fordebugger,urlkey,adminkey
  1373. except Exception as e:
  1374. fordebugger="無法取得資料"
  1375. print("errorcode4")
  1376. print(e)
  1377. allll=pd.DataFrame()
  1378. return allll,fordebugger,urlkey,adminkey
  1379. def ShortGetData(urlkey, adminkey, passkey, startDatekey, endDatekey,childAdminLs):
  1380. print("我有進ShortGetData")
  1381. badmatchend= ["單碰","配比包牌","雙面包牌","連碰","柱碰","一比四","套餐","連柱碰","雙星連碰柱","三星連碰柱","雙連碰","全選"]
  1382. try:
  1383. sloginUrl = "https://"+urlkey+"/pub/SuperGateway.php?c=900%2C"+adminkey+"%2C"+passkey
  1384. response = requests.request("POST", sloginUrl, timeout=12,verify=False)
  1385. #jsondata=json.loads(response.text)
  1386. #SIDKey=rrr[2]
  1387. print(response.status_code)
  1388. if response.status_code==200:#如果網站有正常回應
  1389. if len(response.text)>3:#回應的是正確值
  1390. SIDKey=response.text.split(',')[2]#拆分SIDKey
  1391. if len(SIDKey)<5:#如果SIDKey<拆分SIDKey
  1392. SIDKey=response.text.split(',')[3]
  1393. print(SIDKey)
  1394. AMKey=SIDKey.split('_')[0]
  1395. print(AMKey)
  1396. if urlkey == "c56-gdmc.ck9998.net":
  1397. LevelUrl="https://"+urlkey+"/hp/headmenu2.php?si="+SIDKey
  1398. else:
  1399. LevelUrl="https://"+urlkey+"/hp/headmenu.php?si="+SIDKey
  1400. LevelUrlresponse = requests.request("GET", LevelUrl, timeout=12,verify=False)
  1401. print(LevelUrlresponse.status_code)
  1402. print(LevelUrlresponse.text)
  1403. soup=BeautifulSoup(LevelUrlresponse.text,"lxml")
  1404. print(len(LevelUrlresponse.text))
  1405. print("1.RESPONE:"+LevelUrlresponse.text)
  1406. print(soup)
  1407. if len(LevelUrlresponse.text)>1:#一般種類
  1408. #---------------------尋找level-------------------------
  1409. try:
  1410. pattern = re.compile(r'var lv(.*?)=(.*?);',re.MULTILINE|re.DOTALL )
  1411. #print(pattern)
  1412. script = soup.find("script", text=pattern)
  1413. #print(script)
  1414. #print((len(pattern.search(script.string).group())))
  1415. if len(pattern.search(script.string).group())==11:
  1416. Level=pattern.search(script.string).group(2)[1:]
  1417. elif len(pattern.search(script.string).group())==9:
  1418. Level=pattern.search(script.string).group(2)
  1419. #print(pattern.search(script.string).group())
  1420. #print("LEVELLLLL::::::::"+str(Level))
  1421. geeetURL="https://"+urlkey+"/func/report/rpt_plus.php?sid="+SIDKey+"&am="+AMKey+"$l="+Level
  1422. #print(geeetURL)
  1423. editUrlresponse = requests.request("GET", geeetURL, timeout=12,verify=False)
  1424. soup4=BeautifulSoup(editUrlresponse.text,"lxml")
  1425. #print(type(str(soup4)))
  1426. matches = re.finditer(r'/>(.+\w)\s', str(soup4), re.MULTILINE)
  1427. matchend=[]
  1428. for matchNum, match in enumerate(matches, start=1):
  1429. #print ("在{start}-{end}找到匹配{matchNum}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  1430. for groupNum in range(0, len(match.groups())):
  1431. groupNum = groupNum + 1
  1432. matchtext = match.group(groupNum).strip()
  1433. #print("mat111"+matchtext)
  1434. if matchtext == '加州彩':
  1435. matchtext = '加洲彩'
  1436. #print("mat222"+matchtext)
  1437. if matchtext not in matchend and matchtext not in badmatchend:
  1438. matchend.append(matchtext)
  1439. #print ("在{start}-{end}找到组{groupNum}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
  1440. #print(matchend)
  1441. #print(loopper3)
  1442. #print(len(matchend))
  1443. getData3=Getdata(matchend)
  1444. #print(matchend[1])
  1445. #print(cclist.index(matchend[1]))
  1446. #print(loopper3[0][cclist.index(matchend[1])])
  1447. print("GERDATAAAAA3:"+getData3)
  1448. #print(pattern.search(script.string).group(1))
  1449. #Level=pattern.search(script.string).group(1)
  1450. #---------------------尋找level-------------------------
  1451. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1452. iscommon=1
  1453. except Exception as e:
  1454. print(e)
  1455. #一般商品種類
  1456. else:
  1457. geeetURL="https://"+urlkey+"/func/report/rpt_plus.php?sid="+SIDKey
  1458. print(geeetURL)
  1459. editUrlresponse = requests.request("GET", geeetURL, timeout=12,verify=False)
  1460. soup4=BeautifulSoup(editUrlresponse.text,"lxml")
  1461. #print(soup4)
  1462. matches = re.finditer(r'/>(.+\w)\s', str(soup4), re.MULTILINE)
  1463. matchend=[]
  1464. for matchNum, match in enumerate(matches, start=1):
  1465. #print ("在{start}-{end}找到匹配{matchNum}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  1466. for groupNum in range(0, len(match.groups())):
  1467. groupNum = groupNum + 1
  1468. matchtext = match.group(groupNum).strip()
  1469. #print("mat11"+matchtext)
  1470. if matchtext == "加州彩":
  1471. matchtext = "加洲彩"
  1472. #print("mat22"+matchtext)
  1473. if matchtext not in matchend and matchtext not in badmatchend:
  1474. matchend.append(matchtext)
  1475. #print ("在{start}-{end}找到组{groupNum}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
  1476. print(matchend)
  1477. print(loopper3)
  1478. print(len(matchend))
  1479. getData3=Getdata(matchend)
  1480. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1481. print(payload)
  1482. iscommon=0
  1483. #後台用商品種類
  1484. GetUrl="https://"+urlkey+"/func/report/rpt_allplus.php"
  1485. GetHeaders = {
  1486. 'Content-Type': 'application/x-www-form-urlencoded'
  1487. }
  1488. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=12,verify=False)
  1489. #print(GetResponse.status_code)
  1490. #print(GetResponse.text)
  1491. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" or GetResponse.text == "您所搜尋的日期範圍並無任何期數喔":
  1492. val=pd.DataFrame()
  1493. fordebugger="查詢期間無資料"
  1494. else:
  1495. #向網站取得資料
  1496. val=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1497. print(len(val))
  1498. if len(val)>0:#是否有資料
  1499. val.columns = val.loc[0].values.tolist()
  1500. val=val.drop([0])
  1501. print(val)
  1502. #================將資訊插入資料=================================
  1503. WEBURLTXT=[]
  1504. ADMINTXT=[]
  1505. StartDATETXT=[]
  1506. EndDATETXT=[]
  1507. TIMERAND=[]
  1508. for i in range(len(val)):
  1509. WEBURLTXT.append(urlkey)
  1510. ADMINTXT.append(adminkey)
  1511. StartDATETXT.append(startDatekey)
  1512. EndDATETXT.append(endDatekey)
  1513. if thisfile=="A2.txt":
  1514. TIMERAND.append("全")
  1515. else:
  1516. TIMERAND.append(None)
  1517. val.insert(0,"開始日期",StartDATETXT)
  1518. val.insert(1,"結束日期",EndDATETXT)
  1519. val.insert(2,"網址",WEBURLTXT)
  1520. val.insert(3,"帳戶",ADMINTXT)
  1521. val.insert(4,"隨機碼",TIMERAND)
  1522. #======================================================
  1523. # refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","隨機碼"])
  1524. refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1525. #重整資料用
  1526. val=pd.concat([refind,val],ignore_index = True)
  1527. #=========================================================
  1528. if len(val)>0:#如果有資料
  1529. val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1530. # val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"]
  1531. fordebugger="OK"
  1532. else:
  1533. val=pd.DataFrame()
  1534. fordebugger="查詢期間無資料"
  1535. """
  1536. if thisfile == "A2.txt":
  1537. if matchend[12] == '六合' or matchend[12] =='大樂' or matchend[12] =='539'or matchend[12] =='加洲彩':
  1538. getData3 = "&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas1=yes"
  1539. if iscommon==1:
  1540. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1541. elif iscommon==0:
  1542. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1543. print(payload)
  1544. GetUrl="https://"+urlkey+"/func/report/rpt_allplus.php"
  1545. GetHeaders = {
  1546. 'Content-Type': 'application/x-www-form-urlencoded'
  1547. }
  1548. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=10,verify=False)
  1549. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" or GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" :
  1550. val2=pd.DataFrame()
  1551. print("2無資料")
  1552. fordebugger="ok"
  1553. else:
  1554. val2=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1555. if len(val2)>0:#是否有資料
  1556. val2.columns = val2.loc[0].values.tolist()
  1557. val2=val2.drop([0])
  1558. #================將資訊插入資料=================================
  1559. WEBURLTXT=[]
  1560. ADMINTXT=[]
  1561. StartDATETXT=[]
  1562. EndDATETXT=[]
  1563. TIMERAND=[]
  1564. for i in range(len(val2)):
  1565. WEBURLTXT.append(urlkey)
  1566. ADMINTXT.append(adminkey)
  1567. StartDATETXT.append(startDatekey)
  1568. EndDATETXT.append(endDatekey)
  1569. if matchend[12] == '六合':
  1570. TIMERAND.append("六")
  1571. elif matchend[12] == '539':
  1572. TIMERAND.append("五")
  1573. elif matchend[12] == '大樂':
  1574. TIMERAND.append("大")
  1575. elif matchend[12] == '加洲彩':
  1576. TIMERAND.append("加")
  1577. val2.insert(0,"開始日期",StartDATETXT)
  1578. val2.insert(1,"結束日期",EndDATETXT)
  1579. val2.insert(2,"網址",WEBURLTXT)
  1580. val2.insert(3,"帳戶",ADMINTXT)
  1581. val2.insert(4,"隨機碼",TIMERAND)
  1582. #======================================================
  1583. # refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","隨機碼"])
  1584. refind2=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1585. val2 =pd.concat([refind2,val2],ignore_index = True)
  1586. if len(val2)>0:#如果有資料
  1587. val2.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1588. # val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"]
  1589. fordebugger="OK"
  1590. else:
  1591. val2=pd.DataFrame()
  1592. fordebugger="OK"
  1593. val = pd.concat([val,val2],ignore_index = True)
  1594. else:
  1595. val2=pd.DataFrame()
  1596. fordebugger="OK"
  1597. if thisfile == "A2.txt":
  1598. if matchend[13] == '六合' or matchend[13] =='大樂' or matchend[13] =='539' or matchend[13] =='加洲彩':
  1599. getData3 = "&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas2=yes"
  1600. if iscommon==1:
  1601. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1602. elif iscommon==0:
  1603. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1604. GetUrl="https://"+urlkey+"/func/report/rpt_allplus.php"
  1605. GetHeaders = {
  1606. 'Content-Type': 'application/x-www-form-urlencoded'
  1607. }
  1608. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=10,verify=False)
  1609. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" or GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" :
  1610. val3=pd.DataFrame()
  1611. print("3無資料")
  1612. fordebugger="ok"
  1613. else:
  1614. val3=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1615. if len(val3)>0:#是否有資料
  1616. val3.columns = val3.loc[0].values.tolist()
  1617. val3=val3.drop([0])
  1618. #================將資訊插入資料=================================
  1619. WEBURLTXT=[]
  1620. ADMINTXT=[]
  1621. StartDATETXT=[]
  1622. EndDATETXT=[]
  1623. TIMERAND=[]
  1624. for i in range(len(val3)):
  1625. WEBURLTXT.append(urlkey)
  1626. ADMINTXT.append(adminkey)
  1627. StartDATETXT.append(startDatekey)
  1628. EndDATETXT.append(endDatekey)
  1629. if matchend[13] == '六合':
  1630. TIMERAND.append("六")
  1631. elif matchend[13] == '539':
  1632. TIMERAND.append("五")
  1633. elif matchend[13] == '大樂':
  1634. TIMERAND.append("大")
  1635. elif matchend[13] == '加洲彩':
  1636. TIMERAND.append("加")
  1637. val3.insert(0,"開始日期",StartDATETXT)
  1638. val3.insert(1,"結束日期",EndDATETXT)
  1639. val3.insert(2,"網址",WEBURLTXT)
  1640. val3.insert(3,"帳戶",ADMINTXT)
  1641. val3.insert(4,"隨機碼",TIMERAND)
  1642. #======================================================
  1643. # refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","隨機碼"])
  1644. refind3=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1645. val3 =pd.concat([refind3,val3],ignore_index = True)
  1646. if len(val3)>0:#如果有資料
  1647. val3.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1648. # val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"]
  1649. fordebugger="OK"
  1650. else:
  1651. val3=pd.DataFrame()
  1652. fordebugger="OK"
  1653. val = pd.concat([val,val3],ignore_index = True)
  1654. else:
  1655. val3=pd.DataFrame()
  1656. fordebugger="OK"
  1657. if thisfile == "A2.txt":
  1658. if matchend[14] == '六合' or matchend[14] =='大樂' or matchend[14] =='539' or matchend[14] =='加洲彩':
  1659. getData3 = "&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas3=yes"
  1660. if iscommon==1:
  1661. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1662. elif iscommon==0:
  1663. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1664. GetUrl="https://"+urlkey+"/func/report/rpt_allplus.php"
  1665. GetHeaders = {
  1666. 'Content-Type': 'application/x-www-form-urlencoded'
  1667. }
  1668. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=10,verify=False)
  1669. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" or GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" :
  1670. val4=pd.DataFrame()
  1671. print("4無資料")
  1672. fordebugger="ok"
  1673. else:
  1674. val4=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1675. if len(val4)>0:#是否有資料
  1676. val4.columns = val4.loc[0].values.tolist()
  1677. val4=val4.drop([0])
  1678. #================將資訊插入資料=================================
  1679. WEBURLTXT=[]
  1680. ADMINTXT=[]
  1681. StartDATETXT=[]
  1682. EndDATETXT=[]
  1683. TIMERAND=[]
  1684. for i in range(len(val4)):
  1685. WEBURLTXT.append(urlkey)
  1686. ADMINTXT.append(adminkey)
  1687. StartDATETXT.append(startDatekey)
  1688. EndDATETXT.append(endDatekey)
  1689. if matchend[14] == '六合':
  1690. TIMERAND.append("六")
  1691. elif matchend[14] == '539':
  1692. TIMERAND.append("五")
  1693. elif matchend[14] == '大樂':
  1694. TIMERAND.append("大")
  1695. elif matchend[15] == '加洲彩':
  1696. TIMERAND.append("加")
  1697. val4.insert(0,"開始日期",StartDATETXT)
  1698. val4.insert(1,"結束日期",EndDATETXT)
  1699. val4.insert(2,"網址",WEBURLTXT)
  1700. val4.insert(3,"帳戶",ADMINTXT)
  1701. val4.insert(4,"隨機碼",TIMERAND)
  1702. #======================================================
  1703. # refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","隨機碼"])
  1704. refind4=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1705. val4 =pd.concat([refind4,val4],ignore_index = True)
  1706. if len(val4)>0:#如果有資料
  1707. val4.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1708. # val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"]
  1709. fordebugger="OK"
  1710. else:
  1711. val4=pd.DataFrame()
  1712. fordebugger="OK"
  1713. val = pd.concat([val,val4],ignore_index = True)
  1714. else:
  1715. val4=pd.DataFrame()
  1716. fordebugger="OK"
  1717. if thisfile == "A2.txt" and len(matchend) ==16:
  1718. if matchend[15] == '六合' or matchend[15] =='大樂' or matchend[15] =='539' or matchend[15] =='加洲彩':
  1719. getData3 = "&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas4=yes"
  1720. if iscommon==1:
  1721. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1722. elif iscommon==0:
  1723. payload='sacco=&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1724. GetUrl="https://"+urlkey+"/func/report/rpt_allplus.php"
  1725. GetHeaders = {
  1726. 'Content-Type': 'application/x-www-form-urlencoded'
  1727. }
  1728. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=10,verify=False)
  1729. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" or GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" :
  1730. val5=pd.DataFrame()
  1731. print("5無資料")
  1732. fordebugger="ok"
  1733. else:
  1734. val5=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1735. if len(val5)>0:#是否有資料
  1736. val5.columns = val5.loc[0].values.tolist()
  1737. val5=val5.drop([0])
  1738. #================將資訊插入資料=================================
  1739. WEBURLTXT=[]
  1740. ADMINTXT=[]
  1741. StartDATETXT=[]
  1742. EndDATETXT=[]
  1743. TIMERAND=[]
  1744. for i in range(len(val5)):
  1745. WEBURLTXT.append(urlkey)
  1746. ADMINTXT.append(adminkey)
  1747. StartDATETXT.append(startDatekey)
  1748. EndDATETXT.append(endDatekey)
  1749. if matchend[15] == '六合':
  1750. TIMERAND.append("六")
  1751. elif matchend[15] == '539':
  1752. TIMERAND.append("五")
  1753. elif matchend[15] == '大樂':
  1754. TIMERAND.append("大")
  1755. elif matchend[15] == '加洲彩':
  1756. TIMERAND.append("加")
  1757. val5.insert(0,"開始日期",StartDATETXT)
  1758. val5.insert(1,"結束日期",EndDATETXT)
  1759. val5.insert(2,"網址",WEBURLTXT)
  1760. val5.insert(3,"帳戶",ADMINTXT)
  1761. val5.insert(4,"隨機碼",TIMERAND)
  1762. #======================================================
  1763. # refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","隨機碼"])
  1764. refind5=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1765. val5 =pd.concat([refind5,val5],ignore_index = True)
  1766. if len(val5)>0:#如果有資料
  1767. val5.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1768. # val.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"]
  1769. fordebugger="OK"
  1770. else:
  1771. val5=pd.DataFrame()
  1772. fordebugger="OK"
  1773. val = pd.concat([val,val5],ignore_index = True)
  1774. else:
  1775. val5=pd.DataFrame()
  1776. fordebugger="OK"
  1777. """
  1778. #========================================================
  1779. #=================子帳號=======================================
  1780. doneChildval=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"])
  1781. for i in range(len(childAdminLs)):
  1782. childval=pd.DataFrame()
  1783. if (urlkey==childAdminLs[i][0]or urlkey==childAdminLs[i][3])and adminkey== childAdminLs[i][2]:
  1784. childAdmin=childAdminLs[i][1]
  1785. if iscommon==1:
  1786. payload='sacco='+childAdmin+'&data1='+startDatekey+'&data2='+endDatekey+getData3+'&am='+AMKey+'&l='+Level+'&sid='+SIDKey+'&master=%20&Submit=%25E7%25A2%25BA%25E5%25AE%259A'
  1787. elif iscommon==0:
  1788. payload='sacco='+childAdmin+'&data1='+startDatekey+'&data2='+endDatekey+getData3+'&l=&sid='+SIDKey+'&master=yes&am='
  1789. GetResponse = requests.request("POST", GetUrl, headers=GetHeaders, data=payload, timeout=12,verify=False)
  1790. childval=pd.DataFrame(pd.read_html(GetResponse.text)[2])[:-1]
  1791. if len(childval)>0:#是否有資料
  1792. childval.columns = childval.loc[0].values.tolist()
  1793. childval=childval.drop([0])
  1794. #print(childval)
  1795. #================將資訊插入資料=================================
  1796. WEBURLTXT=[]
  1797. ADMINTXT=[]
  1798. StartDATETXT=[]
  1799. EndDATETXT=[]
  1800. TIMERAND=[]
  1801. nowTime=datetime.datetime.now().strftime("%m%d%H%M%S")
  1802. randomNum=random.randint(0,10000);
  1803. if randomNum<10:
  1804. randomNum=str(0)+str(0)+str(0)+str(randomNum)
  1805. elif randomNum>10 and randomNum<100:
  1806. randomNum=str(0)+str(0)+str(randomNum)
  1807. elif randomNum>100 and randomNum<1000:
  1808. randomNum=str(0)+str(randomNum)
  1809. uniqueNum=str(nowTime)+str(randomNum)
  1810. for i in range(len(childval)):
  1811. WEBURLTXT.append(urlkey)
  1812. ADMINTXT.append(childAdmin)
  1813. StartDATETXT.append(startDatekey)
  1814. EndDATETXT.append(endDatekey)
  1815. TIMERAND.append(None)
  1816. childval.insert(0,"開始日期",StartDATETXT)
  1817. childval.insert(1,"結束日期",EndDATETXT)
  1818. childval.insert(2,"網址",WEBURLTXT)
  1819. childval.insert(3,"帳戶",ADMINTXT)
  1820. childval.insert(4,"隨機碼",TIMERAND)
  1821. refind=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶","總量","中獎","輸贏","客戶小計","代理小計","總代理小計","股東小計","大股東小計","總監小計","個人所得","水差","下注明細","查看對帳","貢獻額","貢獻度","調盤退水","調退實佔","隨機碼"])
  1822. #重整資料用
  1823. childval=pd.concat([refind,childval],ignore_index = True)
  1824. if len(childval)>0:#如果有資料
  1825. childval.columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","隨機碼"]
  1826. fordebugger="OK"
  1827. else:
  1828. childval=pd.DataFrame()
  1829. fordebugger="查詢期間無資料"
  1830. if GetResponse.text == "您所搜尋的日期範圍並無任何期數喔" :
  1831. childval=pd.DataFrame()
  1832. fordebugger="查詢期間無資料"
  1833. doneChildval=pd.concat([doneChildval,childval],ignore_index = True)
  1834. #========================================================
  1835. val=pd.concat([val,doneChildval],ignore_index = True)
  1836. return val,fordebugger,urlkey,adminkey
  1837. else:
  1838. val=pd.DataFrame()
  1839. print("error 1")
  1840. fordebugger="無法取得資料"
  1841. return val,fordebugger,urlkey,adminkey
  1842. if response.status_code!=200:
  1843. val=pd.DataFrame()
  1844. print("error 2")
  1845. fordebugger="無法取得資料"
  1846. return val,fordebugger,urlkey,adminkey
  1847. except:
  1848. val=pd.DataFrame()
  1849. print("error 3")
  1850. fordebugger="無法取得資料"
  1851. return val,fordebugger,urlkey,adminkey
  1852. def Getdata(matchend):
  1853. cclist=["四星彩","三星彩","六合","大樂","539","威力","天天樂","全車","特碼","台號","特尾三","二星","三星","四星","天碰二","天碰三","五星","五不中","六不中","七不中","八不中","九不中",
  1854. "十不中","十一不中","十二不中","一定位","二定位","三定位","四定位","一字現","二字現","三字現","四字現","合單雙","加洲彩","雙面","反轉樂","迦納彩"]
  1855. getData3=""
  1856. if len(matchend) == 15 :
  1857. if matchend[0] in cclist and loopper3[0][cclist.index(matchend[0])] == True:
  1858. getData3 += "&check0=yes"
  1859. if matchend[1] in cclist and loopper3[0][cclist.index(matchend[1])] == True:
  1860. getData3 += "&check1=yes"
  1861. if matchend[2] in cclist and loopper3[0][cclist.index(matchend[2])] == True:
  1862. getData3 += "&check2=yes"
  1863. if matchend[3] in cclist and loopper3[0][cclist.index(matchend[3])] == True:
  1864. getData3 += "&check3=yes"
  1865. if matchend[4] in cclist and loopper3[0][cclist.index(matchend[4])] == True:
  1866. getData3 += "&check4=yes"
  1867. if matchend[5] in cclist and loopper3[0][cclist.index(matchend[5])] == True:
  1868. getData3 += "&check5=yes"
  1869. if matchend[6] in cclist and loopper3[0][cclist.index(matchend[6])] == True:
  1870. getData3 += "&check6=yes"
  1871. if matchend[7] in cclist and loopper3[0][cclist.index(matchend[7])] == True:
  1872. getData3 += "&check7=yes"
  1873. if matchend[8] in cclist and loopper3[0][cclist.index(matchend[8])] == True:
  1874. getData3 += "&check8=yes"
  1875. if matchend[9] in cclist and loopper3[0][cclist.index(matchend[9])] == True:
  1876. getData3 += "&check9=yes"
  1877. if matchend[10] in cclist and loopper3[0][cclist.index(matchend[10])] == True:
  1878. getData3 += "&check10=yes"
  1879. if matchend[11] in cclist and loopper3[0][cclist.index(matchend[11])] == True:
  1880. getData3 += "&check11=yes"
  1881. if matchend[12] in cclist and loopper3[0][cclist.index(matchend[12])] == True:
  1882. getData3 += "&cas1=yes"
  1883. if matchend[13] in cclist and loopper3[0][cclist.index(matchend[13])] == True:
  1884. getData3 += "&cas2=yes"
  1885. if matchend[14] in cclist and loopper3[0][cclist.index(matchend[14])] == True:
  1886. getData3 += "&cas3=yes"
  1887. elif len(matchend) == 16:
  1888. print(matchend[0])
  1889. print(loopper3[0][cclist.index(matchend[0])])
  1890. if matchend[0] in cclist and loopper3[0][cclist.index(matchend[0])] == True:
  1891. getData3 += "&check0=yes"
  1892. if matchend[1] in cclist and loopper3[0][cclist.index(matchend[1])] == True:
  1893. getData3 += "&check1=yes"
  1894. if matchend[2] in cclist and loopper3[0][cclist.index(matchend[2])] == True:
  1895. getData3 += "&check2=yes"
  1896. if matchend[3] in cclist and loopper3[0][cclist.index(matchend[3])] == True:
  1897. getData3 += "&check3=yes"
  1898. if matchend[4] in cclist and loopper3[0][cclist.index(matchend[4])] == True:
  1899. getData3 += "&check4=yes"
  1900. if matchend[5] in cclist and loopper3[0][cclist.index(matchend[5])] == True:
  1901. getData3 += "&check5=yes"
  1902. if matchend[6] in cclist and loopper3[0][cclist.index(matchend[6])] == True:
  1903. getData3 += "&check6=yes"
  1904. if matchend[7] in cclist and loopper3[0][cclist.index(matchend[7])] == True:
  1905. getData3 += "&check7=yes"
  1906. if matchend[8] in cclist and loopper3[0][cclist.index(matchend[8])] == True:
  1907. getData3 += "&check8=yes"
  1908. if matchend[9] in cclist and loopper3[0][cclist.index(matchend[9])] == True:
  1909. getData3 += "&check9=yes"
  1910. if matchend[10] in cclist and loopper3[0][cclist.index(matchend[10])] == True:
  1911. getData3 += "&check10=yes"
  1912. if matchend[11] in cclist and loopper3[0][cclist.index(matchend[11])] == True:
  1913. getData3 += "&check11=yes"
  1914. if matchend[12] in cclist and loopper3[0][cclist.index(matchend[12])] == True:
  1915. getData3 += "&cas1=yes"
  1916. if matchend[13] in cclist and loopper3[0][cclist.index(matchend[13])] == True:
  1917. getData3 += "&cas2=yes"
  1918. if matchend[14] in cclist and loopper3[0][cclist.index(matchend[14])] == True:
  1919. getData3 += "&cas3=yes"
  1920. print(matchend[15])
  1921. print(cclist.index(matchend[15]))
  1922. if matchend[15] in cclist and loopper3[0][cclist.index(matchend[15])] == True:
  1923. getData3 += "&cas4=yes"
  1924. print(getData3)
  1925. return getData3
  1926. def OutbetGetData(urlkey,adminkey,passkey, startDatekey, endDatekey):
  1927. print("OutbetGetData")
  1928. badmatchend= ["單碰","配比包牌","雙面包牌","連碰","柱碰","一比四","套餐","連柱碰","雙星連碰柱","三星連碰柱","雙連碰","全選"]
  1929. try:
  1930. sloginUrl = "https://"+urlkey+"/pub/SuperGateway.php?c=900%2C"+adminkey+"%2C"+passkey
  1931. response = requests.request("POST", sloginUrl, timeout=12,verify=False)
  1932. #jsondata=json.loads(response.text)
  1933. #SIDKey=rrr[2]
  1934. #print(response.status_code)
  1935. if response.status_code==200:#如果網站有正常回應
  1936. if len(response.text)>3:#回應的是正確值
  1937. SIDKey=response.text.split(',')[2]#拆分SIDKey
  1938. if len(SIDKey)<5:#如果SIDKey<拆分SIDKey
  1939. SIDKey=response.text.split(',')[3]
  1940. print(SIDKey)
  1941. AMKey=SIDKey.split('_')[0]
  1942. print(AMKey)
  1943. LevelUrl="https://"+urlkey+"/hp/headmenu.php?si="+SIDKey
  1944. LevelUrlresponse = requests.request("GET", LevelUrl, timeout=12,verify=False)
  1945. #print(LevelUrlresponse.status_code)
  1946. #print(LevelUrlresponse.text)
  1947. soup=BeautifulSoup(LevelUrlresponse.text,"lxml")
  1948. #print(len(LevelUrlresponse.text))
  1949. #print("RESPONE:"+LevelUrlresponse.text)
  1950. #print(soup)
  1951. if len(LevelUrlresponse.text)>1:#一般種類
  1952. #---------------------尋找level-------------------------
  1953. try:
  1954. pattern = re.compile(r'var lv(.*?)=(.*?);',re.MULTILINE|re.DOTALL )
  1955. #print(pattern)
  1956. script = soup.find("script", text=pattern)
  1957. #print(script)
  1958. #print((len(pattern.search(script.string).group())))
  1959. if len(pattern.search(script.string).group())==11:
  1960. Level=pattern.search(script.string).group(2)[1:]
  1961. elif len(pattern.search(script.string).group())==9:
  1962. Level=pattern.search(script.string).group(2)
  1963. #print(pattern.search(script.string).group())
  1964. #print("LEVELLLLL::::::::"+str(Level))
  1965. geeetURL="https://"+urlkey+"/func/report/rpt_plus.php?sid="+SIDKey+"&am="+AMKey+"$l="+Level
  1966. print(geeetURL)
  1967. editUrlresponse = requests.request("GET", geeetURL, timeout=12,verify=False)
  1968. soup4=BeautifulSoup(editUrlresponse.text,"lxml")
  1969. #print(type(str(soup4)))
  1970. matches = re.finditer(r'/>(.+\w)\s', str(soup4), re.MULTILINE)
  1971. matchend=[]
  1972. for matchNum, match in enumerate(matches, start=1):
  1973. #print ("在{start}-{end}找到匹配{matchNum}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  1974. for groupNum in range(0, len(match.groups())):
  1975. groupNum = groupNum + 1
  1976. matchtext = match.group(groupNum).strip()
  1977. if matchtext == '加州彩':
  1978. matchtext = '加洲彩'
  1979. if matchtext not in matchend and matchtext not in badmatchend:
  1980. matchend.append(matchtext)
  1981. #print ("在{start}-{end}找到组{groupNum}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
  1982. #---------------------尋找level-------------------------
  1983. iscommon=1
  1984. except Exception as e:
  1985. print(e)
  1986. else:
  1987. geeetURL="https://"+urlkey+"/func/report/rpt_plus.php?sid="+SIDKey
  1988. editUrlresponse = requests.request("GET", geeetURL, timeout=12,verify=False)
  1989. soup4=BeautifulSoup(editUrlresponse.text,"lxml")
  1990. matches = re.finditer(r'/>(.+\w)\s', str(soup4), re.MULTILINE)
  1991. matchend=[]
  1992. for matchNum, match in enumerate(matches, start=1):
  1993. #print ("在{start}-{end}找到匹配{matchNum}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  1994. for groupNum in range(0, len(match.groups())):
  1995. groupNum = groupNum + 1
  1996. matchtext = match.group(groupNum).strip()
  1997. if matchtext == "加州彩":
  1998. matchtext = "加洲彩"
  1999. if matchtext not in matchend and matchtext not in badmatchend:
  2000. matchend.append(matchtext)
  2001. #print ("在{start}-{end}找到组{groupNum}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
  2002. iscommon=0
  2003. print(matchend)
  2004. print(len(matchend))
  2005. #==================外埔==================================
  2006. if len(matchend) == 16 :
  2007. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas1=yes&cas2=yes&cas3=yes&cas4=yes'
  2008. else:
  2009. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas1=yes&cas2=yes&cas3=yes'
  2010. GetUrlo="https://"+urlkey+"/func/supply/page/report/outbet_all.php"
  2011. GetHeaderso = {
  2012. 'Content-Type': 'application/x-www-form-urlencoded'
  2013. }
  2014. GetResponseo = requests.request("POST", GetUrlo, headers=GetHeaderso, data=payloado, timeout=12,verify=False)
  2015. if len(GetResponseo.text)>5:
  2016. print("有外埔")
  2017. try:
  2018. val=pd.DataFrame(pd.read_html(GetResponseo.text)[0])[:-2]
  2019. val = val.drop(val.columns[0:3],axis=1)
  2020. print(len(val))
  2021. WEBURLTXT=[]
  2022. ADMINTXT=[]
  2023. StartDATETXT=[]
  2024. EndDATETXT=[]
  2025. for i in range(len(val)):
  2026. WEBURLTXT.append(urlkey)
  2027. ADMINTXT.append(adminkey)
  2028. StartDATETXT.append(startDatekey)
  2029. EndDATETXT.append(endDatekey)
  2030. val.insert(0,"開始日期",StartDATETXT)
  2031. val.insert(1,"結束日期",EndDATETXT)
  2032. val.insert(2,"網址",WEBURLTXT)
  2033. val.insert(3,"帳戶",ADMINTXT)
  2034. val.insert(4,"狀態","全")
  2035. val.columns =["開始日期","結束日期","網址","帳戶","狀態","總量","退水","中獎","小計"]
  2036. print(val)
  2037. fordebugger="OK"
  2038. except Exception as e:
  2039. print(e)
  2040. if matchend[12] == '六合' or matchend[12] == '大樂' or matchend[12] == '539' or matchend[12] == '加洲彩':
  2041. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas1=yes'
  2042. GetUrlo="https://"+urlkey+"/func/supply/page/report/outbet_all.php"
  2043. GetHeaderso = {
  2044. 'Content-Type': 'application/x-www-form-urlencoded'
  2045. }
  2046. GetResponseo = requests.request("POST", GetUrlo, headers=GetHeaderso, data=payloado, timeout=12,verify=False)
  2047. if len(GetResponseo.text)>5:
  2048. print("有外埔2")
  2049. try:
  2050. val2=pd.DataFrame(pd.read_html(GetResponseo.text)[0])[:-2]
  2051. val2 = val2.drop(val2.columns[0:3],axis=1)
  2052. print(len(val2))
  2053. WEBURLTXT=[]
  2054. ADMINTXT=[]
  2055. StartDATETXT=[]
  2056. EndDATETXT=[]
  2057. for i in range(len(val2)):
  2058. WEBURLTXT.append(urlkey)
  2059. ADMINTXT.append(adminkey)
  2060. StartDATETXT.append(startDatekey)
  2061. EndDATETXT.append(endDatekey)
  2062. val2.insert(0,"開始日期",StartDATETXT)
  2063. val2.insert(1,"結束日期",EndDATETXT)
  2064. val2.insert(2,"網址",WEBURLTXT)
  2065. val2.insert(3,"帳戶",ADMINTXT)
  2066. if matchend[12] == '六合':
  2067. val2.insert(4,"狀態","六")
  2068. elif matchend[12] == '539':
  2069. val2.insert(4,"狀態","五")
  2070. elif matchend[12] == '大樂':
  2071. val2.insert(4,"狀態","大")
  2072. elif matchend[12] == '加洲彩':
  2073. val2.insert(4,"狀態","加")
  2074. else:
  2075. val2.insert(4,"狀態","E")
  2076. val2.columns =["開始日期","結束日期","網址","帳戶","狀態","總量","退水","中獎","小計"]
  2077. print(val2)
  2078. val=pd.concat([val,val2],ignore_index = True)
  2079. fordebugger="OK"
  2080. print(val)
  2081. except Exception as e:
  2082. print(e)
  2083. else:
  2084. val2=pd.DataFrame()
  2085. fordebugger="OK"
  2086. print("無外埔2")
  2087. else:
  2088. val2=pd.DataFrame()
  2089. fordebugger="OK"
  2090. print("無外埔2")
  2091. if matchend[13] == '六合' or matchend[13] =='大樂' or matchend[13] =='539' or matchend[13] =='加洲彩':
  2092. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas2=yes'
  2093. GetUrlo="https://"+urlkey+"/func/supply/page/report/outbet_all.php"
  2094. GetHeaderso = {
  2095. 'Content-Type': 'application/x-www-form-urlencoded'
  2096. }
  2097. GetResponseo = requests.request("POST", GetUrlo, headers=GetHeaderso, data=payloado, timeout=12,verify=False)
  2098. if len(GetResponseo.text)>5:
  2099. print("有外埔3")
  2100. try:
  2101. val2=pd.DataFrame(pd.read_html(GetResponseo.text)[0])[:-2]
  2102. val2 = val2.drop(val2.columns[0:3],axis=1)
  2103. print(len(val2))
  2104. WEBURLTXT=[]
  2105. ADMINTXT=[]
  2106. StartDATETXT=[]
  2107. EndDATETXT=[]
  2108. for i in range(len(val2)):
  2109. WEBURLTXT.append(urlkey)
  2110. ADMINTXT.append(adminkey)
  2111. StartDATETXT.append(startDatekey)
  2112. EndDATETXT.append(endDatekey)
  2113. val2.insert(0,"開始日期",StartDATETXT)
  2114. val2.insert(1,"結束日期",EndDATETXT)
  2115. val2.insert(2,"網址",WEBURLTXT)
  2116. val2.insert(3,"帳戶",ADMINTXT)
  2117. if matchend[13] == '六合':
  2118. val2.insert(4,"狀態","六")
  2119. elif matchend[13] == '539':
  2120. val2.insert(4,"狀態","五")
  2121. elif matchend[13] == '大樂':
  2122. val2.insert(4,"狀態","大")
  2123. elif matchend[13] == '加洲彩':
  2124. val2.insert(4,"狀態","加")
  2125. else:
  2126. val2.insert(4,"狀態","E")
  2127. val2.columns =["開始日期","結束日期","網址","帳戶","狀態","總量","退水","中獎","小計"]
  2128. print(val2)
  2129. val=pd.concat([val,val2],ignore_index = True)
  2130. fordebugger="OK"
  2131. print(val)
  2132. except Exception as e:
  2133. print(e)
  2134. else:
  2135. val2=pd.DataFrame()
  2136. fordebugger="OK"
  2137. print("無外埔3")
  2138. else:
  2139. val2=pd.DataFrame()
  2140. fordebugger="OK"
  2141. print("無外埔3")
  2142. if matchend[14] == '六合' or matchend[14] =='大樂' or matchend[14] =='539' or matchend[14] =='加洲彩':
  2143. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas3=yes'
  2144. GetUrlo="https://"+urlkey+"/func/supply/page/report/outbet_all.php"
  2145. GetHeaderso = {
  2146. 'Content-Type': 'application/x-www-form-urlencoded'
  2147. }
  2148. GetResponseo = requests.request("POST", GetUrlo, headers=GetHeaderso, data=payloado, timeout=12,verify=False)
  2149. if len(GetResponseo.text)>5:
  2150. print("有外埔4")
  2151. try:
  2152. val2=pd.DataFrame(pd.read_html(GetResponseo.text)[0])[:-2]
  2153. val2 = val2.drop(val2.columns[0:3],axis=1)
  2154. print(len(val2))
  2155. WEBURLTXT=[]
  2156. ADMINTXT=[]
  2157. StartDATETXT=[]
  2158. EndDATETXT=[]
  2159. for i in range(len(val2)):
  2160. WEBURLTXT.append(urlkey)
  2161. ADMINTXT.append(adminkey)
  2162. StartDATETXT.append(startDatekey)
  2163. EndDATETXT.append(endDatekey)
  2164. val2.insert(0,"開始日期",StartDATETXT)
  2165. val2.insert(1,"結束日期",EndDATETXT)
  2166. val2.insert(2,"網址",WEBURLTXT)
  2167. val2.insert(3,"帳戶",ADMINTXT)
  2168. if matchend[14] == '六合':
  2169. val2.insert(4,"狀態","六")
  2170. elif matchend[14] == '539':
  2171. val2.insert(4,"狀態","五")
  2172. elif matchend[14] == '大樂':
  2173. val2.insert(4,"狀態","大")
  2174. elif matchend[14] == '加洲彩':
  2175. val2.insert(4,"狀態","加")
  2176. else:
  2177. val2.insert(4,"狀態","E")
  2178. val2.columns =["開始日期","結束日期","網址","帳戶","狀態","總量","退水","中獎","小計"]
  2179. print(val2)
  2180. val=pd.concat([val,val2],ignore_index = True)
  2181. fordebugger="OK"
  2182. print(val)
  2183. except Exception as e:
  2184. print(e)
  2185. else:
  2186. val2=pd.DataFrame()
  2187. fordebugger="OK"
  2188. print("無外埔4")
  2189. else:
  2190. val2=pd.DataFrame()
  2191. fordebugger="OK"
  2192. print("無外埔4")
  2193. if len(matchend) ==16 :
  2194. if matchend[15] == '六合' or matchend[15] =='大樂' or matchend[15] =='539' or matchend[15] =='加洲彩':
  2195. payloado='data1='+startDatekey+'&data2='+endDatekey+'&checka=yes&check0=yes&check1=yes&check2=yes&check3=yes&check4=yes&check5=yes&check6=yes&check7=yes&check8=yes&check9=yes&check10=yes&check11=yes&cas4=yes'
  2196. GetUrlo="https://"+urlkey+"/func/supply/page/report/outbet_all.php"
  2197. GetHeaderso = {
  2198. 'Content-Type': 'application/x-www-form-urlencoded'
  2199. }
  2200. GetResponseo = requests.request("POST", GetUrlo, headers=GetHeaderso, data=payloado, timeout=12,verify=False)
  2201. if len(GetResponseo.text)>5:
  2202. print("有外埔5")
  2203. try:
  2204. val2=pd.DataFrame(pd.read_html(GetResponseo.text)[0])[:-2]
  2205. val2 = val2.drop(val2.columns[0:3],axis=1)
  2206. print(len(val2))
  2207. WEBURLTXT=[]
  2208. ADMINTXT=[]
  2209. StartDATETXT=[]
  2210. EndDATETXT=[]
  2211. for i in range(len(val2)):
  2212. WEBURLTXT.append(urlkey)
  2213. ADMINTXT.append(adminkey)
  2214. StartDATETXT.append(startDatekey)
  2215. EndDATETXT.append(endDatekey)
  2216. val2.insert(0,"開始日期",StartDATETXT)
  2217. val2.insert(1,"結束日期",EndDATETXT)
  2218. val2.insert(2,"網址",WEBURLTXT)
  2219. val2.insert(3,"帳戶",ADMINTXT)
  2220. if matchend[15] == '六合':
  2221. val2.insert(4,"狀態","六")
  2222. elif matchend[15] == '539':
  2223. val2.insert(4,"狀態","五")
  2224. elif matchend[15] == '大樂':
  2225. val2.insert(4,"狀態","大")
  2226. elif matchend[15] == '加洲彩':
  2227. val2.insert(4,"狀態","加")
  2228. else:
  2229. val2.insert(4,"狀態","E")
  2230. val2.columns =["開始日期","結束日期","網址","帳戶","狀態","總量","退水","中獎","小計"]
  2231. print(val2)
  2232. val=pd.concat([val,val2],ignore_index = True)
  2233. fordebugger="OK"
  2234. print(val)
  2235. except Exception as e:
  2236. print(e)
  2237. else:
  2238. val2=pd.DataFrame()
  2239. fordebugger="OK"
  2240. print("無外埔5")
  2241. else:
  2242. val2=pd.DataFrame()
  2243. fordebugger="OK"
  2244. print("無外埔5")
  2245. else:
  2246. val=pd.DataFrame()
  2247. fordebugger="OK"
  2248. print("無外埔")
  2249. return val,fordebugger,urlkey,adminkey
  2250. else:
  2251. val=pd.DataFrame()
  2252. print("error 1")
  2253. fordebugger="無法取得資料"
  2254. return val,fordebugger,urlkey,adminkey
  2255. if response.status_code!=200:
  2256. val=pd.DataFrame()
  2257. print("error 2")
  2258. fordebugger="無法取得資料"
  2259. return val,fordebugger,urlkey,adminkey
  2260. except:
  2261. val=pd.DataFrame()
  2262. print("error 3")
  2263. fordebugger="無法取得資料"
  2264. return val,fordebugger,urlkey,adminkey
  2265. def BallGetData(urlkey,adminkey,passkey, startDatekey, endDatekey):
  2266. print("BallGetData")
  2267. val=pd.DataFrame()
  2268. print("error 3")
  2269. fordebugger="無法取得資料"
  2270. return val,fordebugger,urlkey,adminkey
  2271. class External(QThread):
  2272. """
  2273. Runs a counter thread.
  2274. """
  2275. countChanged = pyqtSignal(int)#介面用進度條
  2276. urlChanged=pyqtSignal(str)#介面用網址資訊
  2277. def run(self):
  2278. try:
  2279. ALLDataFrameList=[]
  2280. DebugCodeList=[]
  2281. ALLDataFrameList.append(refindlong)
  2282. ALLDataFrameList.append(refindshort)
  2283. ALLDataFrameList=pd.concat(ALLDataFrameList)
  2284. #-----------------------------------------------------------------------------------------------
  2285. #多執行續
  2286. with ThreadPoolExecutor(max_workers=10) as executor:
  2287. futures = []
  2288. test=[]
  2289. z=0
  2290. x=len(UrlList)
  2291. y=len(AdminList)
  2292. for urlkey,adminkey,passkey,backupUrl in zip(UrlList,AdminList,PasswordList,backupUrlList):
  2293. future=executor.submit(LongGetData,urlkey,adminkey,passkey, startDatekey, endDatekey,backupUrl,childAdminLs)
  2294. futures.append(future)#已完成的
  2295. for future in as_completed(futures):
  2296. test.append(list(future.result()))
  2297. MDF,MDC,MURL,ADMINNNNNN=list(future.result())
  2298. #MDF=pd.concat([ALLDataFrameList,MDF])
  2299. #MDF.to_sql('流水帳', con=engine3, if_exists='append')
  2300. if MURL in UrlList :
  2301. f1=UrlList.index(MURL)
  2302. if ADMINNNNNN in AdminList:
  2303. f2=AdminList.index(ADMINNNNNN,f1)
  2304. try:
  2305. MURL2=str(UrlList[f2+1])
  2306. except:
  2307. MURL2="最後一個"
  2308. elif MURL in backupUrlList:
  2309. f1=backupUrlList.index(MURL)
  2310. if ADMINNNNNN in AdminList:
  2311. f2=AdminList.index(ADMINNNNNN,f1)
  2312. try:
  2313. MURL2=str(UrlList[f2+1])
  2314. except:
  2315. MURL2="最後一個"
  2316. MDCURL=MURL+"=>"+MDC+"\n等待中=>"+MURL2
  2317. percentvalues=((z+1)/x)*100
  2318. self.countChanged.emit(percentvalues)
  2319. self.urlChanged.emit(MDCURL)
  2320. z=z+1
  2321. #-----------------------------------------------------------------------------------------------
  2322. ALLDataFrameList0,DebugCodeList,UrlDebugList,ADMINKEYLIST=zip(*test)
  2323. ALLDataFrameList0=pd.concat(ALLDataFrameList0)
  2324. neewDataFrmoe=pd.concat([ALLDataFrameList,ALLDataFrameList0])
  2325. print(neewDataFrmoe)
  2326. #-------------------------------------------------------------------------
  2327. #=============================LOGER======================================
  2328. LOGGER=[]
  2329. y=0
  2330. for UrlDebugListlog,DebugCodeListlog,ADMINKEYLISTlog in zip(UrlDebugList,DebugCodeList,ADMINKEYLIST):
  2331. if DebugCodeListlog=="OK":
  2332. print("OK")
  2333. else:
  2334. LOGGER.append([])
  2335. randomNum=random.randint(0,9)
  2336. nowTime=datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
  2337. nowTime=str(nowTime)+"---"+str(randomNum)
  2338. LOGGER[y].append(coustomtxt)
  2339. LOGGER[y].append(startDatekey+"-"+endDatekey)
  2340. LOGGER[y].append(UrlDebugListlog)
  2341. LOGGER[y].append(DebugCodeListlog)
  2342. LOGGER[y].append(nowTime)
  2343. LOGGER[y].append(ADMINKEYLISTlog)
  2344. y=y+1
  2345. LOGGER=pd.DataFrame(LOGGER)
  2346. if len(LOGGER)>0:
  2347. LOGGER.columns =["客戶","查詢區間","網址","狀態","查詢時間","帳號"]
  2348. else:
  2349. print("NO LOG")
  2350. print(LOGGER)
  2351. #===================================================================================
  2352. end = time.time()
  2353. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理中...")
  2354. #------------------------------------------------------------------------
  2355. #neewDataFrmoe.to_csv("M126UI.csv",encoding="utf_8_sig")#for debug
  2356. print("FILE明子...asdasdasd:"+thisfile)
  2357. if thisfile=="A1.txt":
  2358. neewDataFrmoe.to_sql('流水帳', con=engine3, if_exists='append')
  2359. elif thisfile=="A2.txt" :
  2360. neewDataFrmoe.to_sql('後台流水帳', con=engine3, if_exists='append')
  2361. LOGGER.to_sql('LOG', con=engine3, if_exists='append')
  2362. if thisfile=="A1.txt":
  2363. closedatalodibg=LoadingYesorNo()
  2364. end = time.time()
  2365. print("執行時間:%f 秒" % (end - start))
  2366. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理完成")
  2367. print("DONE.....................100%")
  2368. #window.close()
  2369. app.quit()
  2370. except Exception:
  2371. logging.debug('debug message',exc_info=True)
  2372. logging.info('info message',exc_info=True)
  2373. logging.warning('warning message',exc_info=True)
  2374. logging.error('error message',exc_info=True)
  2375. logging.critical('critical message',exc_info=True)
  2376. app1 = QtWidgets.QApplication([])
  2377. error_dialog = QtWidgets.QErrorMessage()
  2378. error_dialog.setWindowTitle('ERROR')
  2379. error_dialog.showMessage('連線資料錯誤')
  2380. app1.exec_()
  2381. finally:
  2382. if thisfile=="A1.txt":
  2383. closedatalodibg=LoadingYesorNo()
  2384. class External2(QThread):
  2385. """
  2386. Runs a counter thread.
  2387. """
  2388. countChanged = pyqtSignal(int)#介面用進度條
  2389. urlChanged=pyqtSignal(str)#介面用網址資訊
  2390. def run(self):
  2391. try:
  2392. ALLDataFrameList=[]
  2393. DebugCodeList=[]
  2394. ALLDataFrameList.append(refindoutbet)
  2395. ALLDataFrameList=pd.concat(ALLDataFrameList)
  2396. #-----------------------------------------------------------------------------------------------
  2397. #多執行續
  2398. with ThreadPoolExecutor(max_workers=10) as executor:
  2399. futures = []
  2400. test=[]
  2401. z=0
  2402. x=len(UrlList)
  2403. for urlkey,adminkey,passkey,backupUrl in zip(UrlList,AdminList,PasswordList,backupUrlList):
  2404. future=executor.submit(OutbetGetData,urlkey,adminkey,passkey, startDatekey, endDatekey)
  2405. futures.append(future)#已完成的
  2406. for future in as_completed(futures):
  2407. test.append(list(future.result()))
  2408. MDF,MDC,MURL,ADMINNNNNN=list(future.result())
  2409. #MDF=pd.concat([ALLDataFrameList,MDF])
  2410. #MDF.to_sql('流水帳', con=engine3, if_exists='append')
  2411. MDCURL=MURL+"=>"+MDC
  2412. percentvalues=((z+1)/x)*100
  2413. self.countChanged.emit(percentvalues)
  2414. self.urlChanged.emit(MDCURL)
  2415. z=z+1
  2416. #-----------------------------------------------------------------------------------------------
  2417. ALLDataFrameList0,DebugCodeList,UrlDebugList,ADMINKEYLIST=zip(*test)
  2418. ALLDataFrameList0=pd.concat(ALLDataFrameList0)
  2419. neewDataFrmoe=pd.concat([ALLDataFrameList,ALLDataFrameList0])
  2420. print("newwwwww"+str(neewDataFrmoe))
  2421. #-------------------------------------------------------------------------
  2422. #=============================LOGER======================================
  2423. LOGGER=[]
  2424. y=0
  2425. for UrlDebugListlog,DebugCodeListlog,ADMINKEYLISTlog in zip(UrlDebugList,DebugCodeList,ADMINKEYLIST):
  2426. if DebugCodeListlog=="OK":
  2427. print("OK")
  2428. else:
  2429. LOGGER.append([])
  2430. randomNum=random.randint(0,9)
  2431. nowTime=datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
  2432. nowTime=str(nowTime)+"---"+str(randomNum)
  2433. LOGGER[y].append(coustomtxt)
  2434. LOGGER[y].append(startDatekey+"-"+endDatekey)
  2435. LOGGER[y].append(UrlDebugListlog)
  2436. LOGGER[y].append(DebugCodeListlog)
  2437. LOGGER[y].append(nowTime)
  2438. LOGGER[y].append(ADMINKEYLISTlog)
  2439. y=y+1
  2440. LOGGER=pd.DataFrame(LOGGER)
  2441. if len(LOGGER)>0:
  2442. LOGGER.columns =["客戶","查詢區間","網址","狀態","查詢時間","帳號"]
  2443. else:
  2444. print("NO LOG")
  2445. print(LOGGER)
  2446. #===================================================================================
  2447. end = time.time()
  2448. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理中...")
  2449. #------------------------------------------------------------------------
  2450. #neewDataFrmoe.to_csv("M126UI.csv",encoding="utf_8_sig")#for debug
  2451. print("FILE明子...asdasdasd:"+thisfile)
  2452. neewDataFrmoe.to_sql('後台外埔報表', con=engine3, if_exists='append')
  2453. LOGGER.to_sql('LOG', con=engine3, if_exists='append')
  2454. closedatalodibg=LoadingYesorNo()
  2455. end = time.time()
  2456. print("執行時間:%f 秒" % (end - start))
  2457. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理完成")
  2458. print("DONE.....................100%")
  2459. #window.close()
  2460. app.quit()
  2461. except Exception:
  2462. logging.debug('debug message',exc_info=True)
  2463. logging.info('info message',exc_info=True)
  2464. logging.warning('warning message',exc_info=True)
  2465. logging.error('error message',exc_info=True)
  2466. logging.critical('critical message',exc_info=True)
  2467. app1 = QtWidgets.QApplication([])
  2468. error_dialog = QtWidgets.QErrorMessage()
  2469. error_dialog.setWindowTitle('ERROR')
  2470. error_dialog.showMessage('連線資料錯誤')
  2471. app1.exec_()
  2472. finally:
  2473. closedatalodibg=LoadingYesorNo()
  2474. class External3(QThread):
  2475. """
  2476. Runs a counter thread.
  2477. """
  2478. countChanged = pyqtSignal(int)#介面用進度條
  2479. urlChanged=pyqtSignal(str)#介面用網址資訊
  2480. def run(self):
  2481. try:
  2482. ALLDataFrameList=[]
  2483. DebugCodeList=[]
  2484. ALLDataFrameList.append(refindoutbet)
  2485. ALLDataFrameList=pd.concat(ALLDataFrameList)
  2486. #-----------------------------------------------------------------------------------------------
  2487. #多執行續
  2488. with ThreadPoolExecutor(max_workers=10) as executor:
  2489. futures = []
  2490. test=[]
  2491. z=0
  2492. x=len(UrlList)
  2493. for urlkey,adminkey,passkey,backupUrl in zip(UrlList,AdminList,PasswordList,backupUrlList):
  2494. future=executor.submit(BallGetData,urlkey,adminkey,passkey, startDatekey, endDatekey)
  2495. futures.append(future)#已完成的
  2496. for future in as_completed(futures):
  2497. test.append(list(future.result()))
  2498. MDF,MDC,MURL,ADMINNNNNN=list(future.result())
  2499. #MDF=pd.concat([ALLDataFrameList,MDF])
  2500. #MDF.to_sql('流水帳', con=engine3, if_exists='append')
  2501. MDCURL=MURL+"=>"+MDC
  2502. percentvalues=((z+1)/x)*100
  2503. self.countChanged.emit(percentvalues)
  2504. self.urlChanged.emit(MDCURL)
  2505. z=z+1
  2506. #-----------------------------------------------------------------------------------------------
  2507. ALLDataFrameList0,DebugCodeList,UrlDebugList,ADMINKEYLIST=zip(*test)
  2508. ALLDataFrameList0=pd.concat(ALLDataFrameList0)
  2509. neewDataFrmoe=pd.concat([ALLDataFrameList,ALLDataFrameList0])
  2510. print("newwwwww"+str(neewDataFrmoe))
  2511. #-------------------------------------------------------------------------
  2512. #=============================LOGER======================================
  2513. LOGGER=[]
  2514. y=0
  2515. for UrlDebugListlog,DebugCodeListlog,ADMINKEYLISTlog in zip(UrlDebugList,DebugCodeList,ADMINKEYLIST):
  2516. if DebugCodeListlog=="OK":
  2517. print("OK")
  2518. else:
  2519. LOGGER.append([])
  2520. randomNum=random.randint(0,9)
  2521. nowTime=datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
  2522. nowTime=str(nowTime)+"---"+str(randomNum)
  2523. LOGGER[y].append(coustomtxt)
  2524. LOGGER[y].append(startDatekey+"-"+endDatekey)
  2525. LOGGER[y].append(UrlDebugListlog)
  2526. LOGGER[y].append(DebugCodeListlog)
  2527. LOGGER[y].append(nowTime)
  2528. LOGGER[y].append(ADMINKEYLISTlog)
  2529. y=y+1
  2530. LOGGER=pd.DataFrame(LOGGER)
  2531. if len(LOGGER)>0:
  2532. LOGGER.columns =["客戶","查詢區間","網址","狀態","查詢時間","帳號"]
  2533. else:
  2534. print("NO LOG")
  2535. print(LOGGER)
  2536. #===================================================================================
  2537. end = time.time()
  2538. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理中...")
  2539. #------------------------------------------------------------------------
  2540. #neewDataFrmoe.to_csv("M126UI.csv",encoding="utf_8_sig")#for debug
  2541. print("FILE明子...asdasdasd:"+thisfile)
  2542. neewDataFrmoe.to_sql('流水帳', con=engine3, if_exists='append')
  2543. LOGGER.to_sql('LOG', con=engine3, if_exists='append')
  2544. closedatalodibg=LoadingYesorNo()
  2545. end = time.time()
  2546. print("執行時間:%f 秒" % (end - start))
  2547. self.urlChanged.emit("已執行"+str(end - start)+"秒 處理完成")
  2548. print("DONE.....................100%")
  2549. #window.close()
  2550. app.quit()
  2551. except Exception:
  2552. logging.debug('debug message',exc_info=True)
  2553. logging.info('info message',exc_info=True)
  2554. logging.warning('warning message',exc_info=True)
  2555. logging.error('error message',exc_info=True)
  2556. logging.critical('critical message',exc_info=True)
  2557. app1 = QtWidgets.QApplication([])
  2558. error_dialog = QtWidgets.QErrorMessage()
  2559. error_dialog.setWindowTitle('ERROR')
  2560. error_dialog.showMessage('連線資料錯誤')
  2561. app1.exec_()
  2562. finally:
  2563. closedatalodibg=LoadingYesorNo()
  2564. class Actions(QDialog):
  2565. """
  2566. Simple dialog that consists of a Progress Bar and a Button.
  2567. Clicking on the button results in the start of a timer and
  2568. updates the progress bar..
  2569. """
  2570. def __init__(self):
  2571. super().__init__()
  2572. self.initUI()
  2573. def initUI(self):
  2574. self.setWindowTitle('D0128')
  2575. self.setWindowFlags(Qt.WindowStaysOnTopHint)
  2576. self.progress = QProgressBar(self)
  2577. self.progress.setGeometry(20, 20, 300, 25)
  2578. self.progress.setMaximum(100)
  2579. self.label=QLabel(self)
  2580. self.label.setGeometry(20, 50, 211, 31)
  2581. self.label.setText("- 自動導入中請勿關閉視窗 - ")
  2582. self.label2=QLabel(self)
  2583. self.label2.setGeometry(20, 70, 211, 31)
  2584. self.show()
  2585. self.calc = External()
  2586. self.calc.countChanged.connect(self.onCountChanged)
  2587. self.calc.urlChanged.connect(self.onUrlChanged)
  2588. self.calc.start()
  2589. def onCountChanged(self, value):
  2590. self.progress.setValue(value)
  2591. def onUrlChanged(self, urlstr):
  2592. self.label2.setText(urlstr)
  2593. class Actions2(QDialog):
  2594. """
  2595. Simple dialog that consists of a Progress Bar and a Button.
  2596. Clicking on the button results in the start of a timer and
  2597. updates the progress bar.
  2598. """
  2599. def __init__(self):
  2600. super().__init__()
  2601. self.initUI()
  2602. def initUI(self):
  2603. self.setWindowTitle('連線中...')
  2604. self.label=QLabel(self)
  2605. #self.label.setFont(QtGui.QFont('Arial', 12))
  2606. self.label.setGeometry(20, 20,120,30)
  2607. #self.label.setTextFormat(QtCore.Qt.AutoText)
  2608. self.label.setText("- 取得連線 請按開始 -")
  2609. self.button = QPushButton('開始', self)
  2610. self.button.move(50, 80)
  2611. self.show()
  2612. self.button.clicked.connect(self.onButtonClick)
  2613. def onButtonClick(self):
  2614. self.close()
  2615. class Actions3(QDialog):
  2616. """
  2617. Simple dialog that consists of a Progress Bar and a Button.
  2618. Clicking on the button results in the start of a timer and
  2619. updates the progress bar..
  2620. """
  2621. def __init__(self):
  2622. super().__init__()
  2623. self.initUI()
  2624. def initUI(self):
  2625. self.setWindowTitle('D0150')
  2626. self.setWindowFlags(Qt.WindowStaysOnTopHint)
  2627. self.progress = QProgressBar(self)
  2628. self.progress.setGeometry(20, 20, 300, 25)
  2629. self.progress.setMaximum(100)
  2630. self.label=QLabel(self)
  2631. self.label.setGeometry(20, 50, 211, 31)
  2632. self.label.setText("- 自動導入中請勿關閉視窗 - ")
  2633. self.label2=QLabel(self)
  2634. self.label2.setGeometry(20, 70, 211, 31)
  2635. self.show()
  2636. self.calc = External2()
  2637. self.calc.countChanged.connect(self.onCountChanged)
  2638. self.calc.urlChanged.connect(self.onUrlChanged)
  2639. self.calc.start()
  2640. def onCountChanged(self, value):
  2641. self.progress.setValue(value)
  2642. def onUrlChanged(self, urlstr):
  2643. self.label2.setText(urlstr)
  2644. class Actions4(QDialog):
  2645. """
  2646. Simple dialog that consists of a Progress Bar and a Button.
  2647. Clicking on the button results in the start of a timer and
  2648. updates the progress bar..
  2649. """
  2650. def __init__(self):
  2651. super().__init__()
  2652. self.initUI()
  2653. def initUI(self):
  2654. self.setWindowTitle('D0230')
  2655. self.setWindowFlags(Qt.WindowStaysOnTopHint)
  2656. self.progress = QProgressBar(self)
  2657. self.progress.setGeometry(20, 20, 300, 25)
  2658. self.progress.setMaximum(100)
  2659. self.label=QLabel(self)
  2660. self.label.setGeometry(20, 50, 211, 31)
  2661. self.label.setText("- 自動導入中請勿關閉視窗 - ")
  2662. self.label2=QLabel(self)
  2663. self.label2.setGeometry(20, 70, 211, 31)
  2664. self.show()
  2665. self.calc = External3()
  2666. self.calc.countChanged.connect(self.onCountChanged)
  2667. self.calc.urlChanged.connect(self.onUrlChanged)
  2668. self.calc.start()
  2669. def onCountChanged(self, value):
  2670. self.progress.setValue(value)
  2671. def onUrlChanged(self, urlstr):
  2672. self.label2.setText(urlstr)
  2673. try:
  2674. #app1 = QApplication(sys.argv)
  2675. #window2 = Actions2()
  2676. FIle="A1.txt"
  2677. FIle2="B.txt"
  2678. FIle3="A2.txt"
  2679. def LoadingYesorNo():
  2680. SUPDA=db_session2.query(Someoneupdate).filter_by(正在自動導入中='YES').first()
  2681. SUPDAc=db_session2.query(Someoneupdate).filter_by(正在自動導入中='YES').count()
  2682. print(SUPDAc)
  2683. if (SUPDAc==1):
  2684. SUPDA.正在自動導入中='NO'
  2685. db_session2.commit()
  2686. coustomtxt,bdtxt=loadCSV()
  2687. engine = create_engine('mssql+pyodbc://'+bdtxt+'?driver=SQL+Server+Native+Client+11.0')
  2688. print (coustomtxt)
  2689. engine3=connectEngine(coustomtxt,engine)
  2690. '''
  2691. @event.listens_for(engine3, 'before_cursor_execute')
  2692. def receive_before_cursor_execute(conn, cursor, statement, params, context, executemany):
  2693. if executemany:
  2694. cursor.fast_executemany = True
  2695. cursor.commit()
  2696. '''
  2697. DB_session2 = sessionmaker(engine3)
  2698. db_session2= DB_session2()
  2699. log_Engine=CreateLogEngine()
  2700. while True:
  2701. if os.path.isfile(FIle)==True:
  2702. thisfile="A1.txt"
  2703. os.remove(FIle)
  2704. startDatekey,endDatekey,allpart=DateDataLoad(engine3,db_session2)
  2705. contforloop,loopper2,childAdminLs,loopper3=LoadCustomData(engine3,allpart)
  2706. UrlList,AdminList,PasswordList,backupUrlList=zip(*loopper2)
  2707. #webselect="GameType%5B%5D=35&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101"
  2708. print(UrlList,AdminList,PasswordList)#,webselect)
  2709. start = time.time()
  2710. # refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2711. # refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"])
  2712. refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2713. refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","大總監","系統商","隨機碼"])
  2714. #refindoutbet=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","總量","退水","中獎","小計"])
  2715. #window2.close()
  2716. #app1.quit()
  2717. #app1.exec_()
  2718. app = QtWidgets.QApplication(sys.argv)
  2719. window = Actions()
  2720. app.exec_()
  2721. del app
  2722. del window
  2723. #sys.exit(app.exec_())
  2724. continue
  2725. if os.path.isfile(FIle3)==True:
  2726. thisfile="A2.txt"
  2727. os.remove(FIle3)
  2728. startDatekey,endDatekey,allpart=DateDataLoad(engine3,db_session2)
  2729. contforloop,loopper2,childAdminLs,loopper3=LoadCustomData(engine3,allpart)
  2730. UrlList,AdminList,PasswordList,backupUrlList=zip(*loopper2)
  2731. print(UrlList,AdminList,PasswordList)
  2732. start = time.time()
  2733. # refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2734. # refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"])
  2735. refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2736. refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","大總監","系統商","隨機碼"])
  2737. refindoutbet=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","總量","退水","中獎","小計","狀態"])
  2738. #window2.close()
  2739. #app1.quit()
  2740. #app1.exec_()
  2741. app = QtWidgets.QApplication(sys.argv)
  2742. window = Actions()
  2743. app.exec_()
  2744. del app
  2745. del window
  2746. #sys.exit(app.exec_())
  2747. app = QtWidgets.QApplication(sys.argv)
  2748. window = Actions3()
  2749. app.exec_()
  2750. del app
  2751. del window
  2752. continue
  2753. if os.path.isfile(FIle)==True:
  2754. thisfile="A1.txt"
  2755. os.remove(FIle)
  2756. startDatekey,endDatekey,allpart=DateDataLoad(engine3,db_session2)
  2757. contforloop,loopper2,childAdminLs,loopper3=LoadCustomData(engine3,allpart)
  2758. UrlList,AdminList,PasswordList,backupUrlList=zip(*loopper2)
  2759. #webselect="GameType%5B%5D=35&GameType%5B%5D=22&GameType%5B%5D=11&GameType%5B%5D=12&GameType%5B%5D=13&GroupType%5B%5D=118&GroupType%5B%5D=109&GroupType%5B%5D=108&GroupType%5B%5D=102&GroupType%5B%5D=160&GroupType%5B%5D=159&GroupType%5B%5D=158&GroupType%5B%5D=157&GroupType%5B%5D=156&GroupType%5B%5D=155&GroupType%5B%5D=154&GroupType%5B%5D=153&GroupType%5B%5D=107&GroupType%5B%5D=106&GroupType%5B%5D=105&GroupType%5B%5D=104&GroupType%5B%5D=103&GroupType%5B%5D=101"
  2760. print(UrlList,AdminList,PasswordList)#,webselect)
  2761. start = time.time()
  2762. # refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2763. # refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","隨機碼"])
  2764. refindlong=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","名稱","總量","退水","中獎","輸贏","佔成輸贏","水倍差","上繳金額","自已總輸贏","上繳貢獻額","貢獻額","貢獻度","下注明細","玩法明細","調盤退水","調退實佔","上繳","會員","代理","總代理","股東","大股東","總監"])
  2765. refindshort=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","客戶s","總量s","中獎s","輸贏s","客戶小計s","代理小計s","總代理小計s","股東小計s","大股東小計s","總監小計s","個人所得s","水差s","下注明細s","查看對帳s","貢獻額s","貢獻度s","調盤退水s","調退實佔s","大總監","系統商","隨機碼"])
  2766. #refindoutbet=pd.DataFrame(columns =["開始日期","結束日期","網址","帳戶","總量","退水","中獎","小計"])
  2767. del app
  2768. del window
  2769. #window2.close()
  2770. #app1.quit()
  2771. #app1.exec_()
  2772. app = QtWidgets.QApplication(sys.argv)
  2773. window = Actions4()
  2774. app.exec_()
  2775. del app
  2776. del window
  2777. #sys.exit(app.exec_())
  2778. continue
  2779. if os.path.isfile(FIle2)==True:
  2780. os.remove(FIle2)
  2781. break
  2782. time.sleep(1)
  2783. #sys.exit()
  2784. except:
  2785. traceback.print_exc() # 捕捉異常,並將異常傳播資訊輸出控制檯
  2786. traceback.print_exc(file=open('log.txt', 'a'))
  2787. logging.debug('debug message',exc_info=True)
  2788. logging.info('info message',exc_info=True)
  2789. logging.warning('warning message',exc_info=True)
  2790. logging.error('error message',exc_info=True)
  2791. logging.critical('critical message',exc_info=True)
  2792. app2 = QtWidgets.QApplication([])
  2793. error_dialog = QtWidgets.QErrorMessage()
  2794. error_dialog.setWindowTitle('ERROR')
  2795. error_dialog.showMessage('網路DRIVER錯誤')
  2796. app2.exec_()
  2797. finally:
  2798. closedatalodibg=LoadingYesorNo()