fix: 增加数据模块
This commit is contained in:
parent
926c63fc7c
commit
5d45f7afa3
|
|
@ -164,3 +164,4 @@ cython_debug/
|
|||
#.idea/
|
||||
|
||||
>>>>>>> f8458cdff6d4b08b3ad0b33cb69a118e4b7a5c35
|
||||
nohup.out
|
||||
|
|
|
|||
128
auto.py
128
auto.py
|
|
@ -1,128 +0,0 @@
|
|||
import time
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
# chrome_options.add_argument('--headless')
|
||||
# mobile_emulation = {'deviceName': 'Apple iPhone XR'}
|
||||
# chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
# chrome_options.add_argument('user-agent="MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.29(0x18001d36) NetType/WIFI Language/zh_CN"')
|
||||
start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
|
||||
click(_close)
|
||||
|
||||
#店内账本
|
||||
click(Text("店内账本"))
|
||||
# moneynum = S('//*[@id="vue2_el"]/div[1]/section/div/div/div[3]/div[2]/span[1]')
|
||||
moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
wait_until(moneynum.exists)
|
||||
if moneynum is not None:
|
||||
balance = moneynum.web_element.text
|
||||
print(f"金额还剩:{balance}")
|
||||
else:
|
||||
print("元素未找到")
|
||||
# 回退
|
||||
back = S('#vue2_el > header > div.back > a')
|
||||
click(back)
|
||||
|
||||
# 点击排列三
|
||||
pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
click(pls)
|
||||
# click(Text('组选'))
|
||||
|
||||
|
||||
# 普通投注-> 取消组3
|
||||
# group3 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxmenu.topcenter > p:nth-child(1)')
|
||||
# group3 = Text("组3")
|
||||
# click(group3)
|
||||
ball_0 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(1) > p.ballline')
|
||||
ball_1 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(2) > p.ballline')
|
||||
ball_2 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(3) > p.ballline')
|
||||
ball_3 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(4) > p.ballline')
|
||||
ball_4 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(5) > p.ballline')
|
||||
ball_5 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(6) > p.ballline')
|
||||
ball_6 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(7) > p.ballline')
|
||||
ball_7 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(8) > p.ballline')
|
||||
ball_8 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(9) > p.ballline')
|
||||
ball_9 = S('#body > section > div.betmain.betmain_p3zx > div.betmain_p3zxball > ul > li:nth-child(10) > p.ballline')
|
||||
# click(ball_1)
|
||||
# click(ball_2)
|
||||
# click(ball_3)
|
||||
|
||||
# 和值投注
|
||||
# click(Text("和值投注"))
|
||||
sum_1 = Text("1")
|
||||
sum_2 = Text("2")
|
||||
sum_3 = Text("3")
|
||||
sum_4 = Text("4")
|
||||
sum_5 = Text("5")
|
||||
sum_6 = Text("6")
|
||||
sum_7 = Text("7")
|
||||
sum_8 = Text("8")
|
||||
sum_9 = Text("9")
|
||||
sum_10 = Text("10")
|
||||
sum_11 = Text("11")
|
||||
sum_12 = Text("12")
|
||||
sum_13 = Text("13")
|
||||
sum_14 = Text("14")
|
||||
sum_15 = Text("15")
|
||||
sum_16 = Text("16")
|
||||
sum_17 = Text("17")
|
||||
sum_18 = Text("18")
|
||||
sum_19 = Text("19")
|
||||
sum_20 = Text("20")
|
||||
sum_21 = Text("21")
|
||||
sum_22 = Text("22")
|
||||
sum_23 = Text("23")
|
||||
sum_24 = Text("24")
|
||||
sum_25 = Text("25")
|
||||
sum_26 = Text("26")
|
||||
# click(sum_9)
|
||||
|
||||
# click(Text("组3单式"))
|
||||
# 对子号码
|
||||
double_ball_0 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(1) > p')
|
||||
double_ball_1 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(2) > p')
|
||||
double_ball_2 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(3) > p')
|
||||
double_ball_3 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(4) > p')
|
||||
double_ball_4 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(5) > p')
|
||||
double_ball_5 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(6) > p')
|
||||
double_ball_6 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(7) > p')
|
||||
double_ball_7 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(8) > p')
|
||||
double_ball_8 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(9) > p')
|
||||
double_ball_9 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(1) > div.boxflex > ul > li:nth-child(10) > p')
|
||||
# 非对子号码
|
||||
single_ball_0 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(1) > p')
|
||||
single_ball_1 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(2) > p')
|
||||
single_ball_2 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(3) > p')
|
||||
single_ball_3 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(4) > p')
|
||||
single_ball_4 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(5) > p')
|
||||
single_ball_5 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(6) > p')
|
||||
single_ball_6 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(7) > p')
|
||||
single_ball_7 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(8) > p')
|
||||
single_ball_8 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(9) > p')
|
||||
single_ball_9 = S('#body > section > div.betmain.betmain_p3zxd > div:nth-child(2) > div.boxflex > ul > li:nth-child(10) > p')
|
||||
|
||||
# 点击一次下一步
|
||||
next_step = Text("下一步")
|
||||
# click(next_step)
|
||||
|
||||
# 设置倍数后,再点击一次下一步
|
||||
plus = Text("+")
|
||||
# click(plus)
|
||||
# click(Text("下一步"))
|
||||
|
||||
# 最后一步, 点击确认
|
||||
confirm = Text("确认")
|
||||
# click(confirm)
|
||||
# time.sleep(5)
|
||||
kill_browser()
|
||||
111
auto_v2.py
111
auto_v2.py
|
|
@ -1,111 +0,0 @@
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
mobile_emulation = {'deviceName': 'iPad Mini'}
|
||||
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
#chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
|
||||
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
driver = start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
try:
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
# _topclose = S('div.layerimg_topclose')
|
||||
# if _topclose.exists:
|
||||
# click(_topclose)
|
||||
_close = S('p.close')
|
||||
if _close.exists:
|
||||
click(_close)
|
||||
|
||||
#店内账本
|
||||
# click(Text("店内账本"))
|
||||
# moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
# wait_until(moneynum.exists)
|
||||
# if moneynum is not None:
|
||||
# balance = moneynum.web_element.text
|
||||
# print(f"金额还剩:{balance}")
|
||||
# else:
|
||||
# print("元素未找到")
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
#选号记录
|
||||
# click(Text("选号记录"))
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
|
||||
# 点击排列三
|
||||
# pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
pls = S('p.lottname.p3')
|
||||
wait_until(pls.exists)
|
||||
click(pls)
|
||||
# wait_until(Text('组选').exists)
|
||||
click(Text('组选'))
|
||||
# result = ['129', '156', '138', '237', '147']
|
||||
result = ['346', '139', '247', '256', '049']
|
||||
for index, item in enumerate(result):
|
||||
if len(set(item)) == 3:
|
||||
# 普通投注-> 取消组3
|
||||
click(Text('普通投注'))
|
||||
for i in item:
|
||||
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]')
|
||||
if ball_line.exists:
|
||||
click(ball_line)
|
||||
print(ball_line.web_element.text)
|
||||
else:
|
||||
print(f"{i}不存在")
|
||||
wait_until(Text("组3").exists)
|
||||
click(Text("组3"))
|
||||
else:
|
||||
click(Text('组3单式'))
|
||||
if item[0] == item[1]:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
else:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
click(double_ball)
|
||||
click(single_ball)
|
||||
print(f"对子号:{double_ball.web_element.text}")
|
||||
print(f"非对子号:{single_ball.web_element.text}")
|
||||
print(f"{index}: {item}")
|
||||
wait_until(Text("下一步").exists)
|
||||
click(Text("下一步"))
|
||||
if index + 1 != len(result):
|
||||
wait_until(Text("+继续添加").exists)
|
||||
click(Text("+继续添加"))
|
||||
# # 设置倍数后,再点击一次下一步
|
||||
plus = Text("+")
|
||||
for i in range(1):
|
||||
click(plus)
|
||||
save = Text("保存")
|
||||
wait_until(save.exists)
|
||||
click(Text("保存"))
|
||||
print(save.web_element.text)
|
||||
# # 设置倍数后,再点击一次下一步
|
||||
# plus = Text("+")
|
||||
# # click(plus)
|
||||
# wait_until(Text("下一步").exists)
|
||||
# click(Text("下一步"))
|
||||
|
||||
# # 最后一步, 点击确认
|
||||
# wait_until(Text("确认").exists)
|
||||
# click(Text("确认"))
|
||||
print("完成。。。")
|
||||
kill_browser()
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
kill_browser()
|
||||
88
auto_v3.py
88
auto_v3.py
|
|
@ -1,88 +0,0 @@
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
mobile_emulation = {'deviceName': 'iPhone XR'}
|
||||
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
#chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
|
||||
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
# chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
driver = start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
try:
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
|
||||
click(_close)
|
||||
|
||||
#店内账本
|
||||
# click(Text("店内账本"))
|
||||
# moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
# wait_until(moneynum.exists)
|
||||
# if moneynum is not None:
|
||||
# balance = moneynum.web_element.text
|
||||
# print(f"金额还剩:{balance}")
|
||||
# else:
|
||||
# print("元素未找到")
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
#选号记录
|
||||
# click(Text("选号记录"))
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
|
||||
# 点击排列三
|
||||
pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
wait_until(pls.exists)
|
||||
click(pls)
|
||||
wait_until(Text('组选').exists)
|
||||
click(Text('组选'))
|
||||
click(Text('普通投注'))
|
||||
# 普通投注-> 取消组3
|
||||
#
|
||||
result = ['168', '069', '348', '249', '078']
|
||||
for index, item in enumerate(result):
|
||||
for i in item:
|
||||
i = int(i) + 1
|
||||
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{i}]/p[1]')
|
||||
if ball_line.exists:
|
||||
click(ball_line)
|
||||
else:
|
||||
print(f"{i-1}不存在")
|
||||
print(f"{index}: {item}")
|
||||
wait_until(Text("组3").exists)
|
||||
click(Text("组3"))
|
||||
wait_until(Text("下一步").exists)
|
||||
click(Text("下一步"))
|
||||
if index + 1 != len(result):
|
||||
wait_until(Text("+继续添加").exists)
|
||||
click(Text("+继续添加"))
|
||||
wait_until(Text("保存").exists)
|
||||
click(Text("保存"))
|
||||
|
||||
# # 设置倍数后,再点击一次下一步
|
||||
# plus = Text("+")
|
||||
# # click(plus)
|
||||
# wait_until(Text("下一步").exists)
|
||||
# click(Text("下一步"))
|
||||
|
||||
# # 最后一步, 点击确认
|
||||
# wait_until(Text("确认").exists)
|
||||
# click(Text("确认"))
|
||||
print("完成。。。")
|
||||
kill_browser()
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
kill_browser()
|
||||
|
|
@ -15,6 +15,7 @@ def _get_data(url, lottery_type):
|
|||
draw_date = table_list.find("td.td_title01 span.span_right")[0].text
|
||||
draw_code = table_list.find("div.ball_box01")[0].text.replace('\n', '')
|
||||
print(draw_code)
|
||||
print(draw_date)
|
||||
last_id = lottery.insert(draw_issue, draw_date, draw_code)
|
||||
if last_id:
|
||||
print(f"issue:{draw_issue}数据写入完成。。。")
|
||||
|
|
@ -44,7 +45,7 @@ def main(basic_url, lottery_type):
|
|||
continue
|
||||
|
||||
if __name__ == '__main__':
|
||||
issue = "23107"
|
||||
issue = "23108"
|
||||
url = f"https://kaijiang.500.com/shtml/pls/{issue}.shtml"
|
||||
get_data(url, lottery_type='pls')
|
||||
# for y in range(23, 24):
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import requests
|
||||
import json
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from datetime import date, datetime
|
||||
|
||||
from model.football_league import FootballLeague
|
||||
|
||||
_engine = create_engine("mysql+pymysql://test:123456@localhost/lottery?charset=utf8")
|
||||
_DbSession = sessionmaker(bind=_engine)
|
||||
db = _DbSession()
|
||||
|
||||
url = "https://webapi.sporttery.cn/gateway/jc/football/getMatchResultV1.qry?matchPage=1&matchBeginDate=2023-04-28&matchEndDate=2023-04-28&leagueId=&pageSize=30&pageNo=1&isFix=0&pcOrWap=1"
|
||||
r = requests.get(url)
|
||||
|
||||
data = json.loads(r.text)
|
||||
league_list = data["value"]["leagueList"]
|
||||
|
||||
for item in league_list:
|
||||
result = db.query(FootballLeague).filter_by(league_name=item["leagueAbbName"]).first()
|
||||
if result is None:
|
||||
league = FootballLeague()
|
||||
league.league_id = item["leagueId"]
|
||||
league.league_name = item["leagueAbbName"]
|
||||
league.league_all_name = item["leagueAllName"]
|
||||
league.created_at = datetime.now()
|
||||
db.add(league)
|
||||
db.commit()
|
||||
print(f"id:{league.id}")
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
import re
|
||||
from datetime import date
|
||||
from datetime import date, datetime
|
||||
|
||||
from model.pls import PLS
|
||||
from model.plw import PLW
|
||||
|
|
@ -29,7 +29,7 @@ class Lottery(object):
|
|||
raise Exception("未知的lottery_type")
|
||||
|
||||
def _get_db_session(self):
|
||||
_engine = create_engine("mysql+pymysql://test:123456@localhost/lottery?charset=utf8")
|
||||
_engine = create_engine("mysql+pymysql://test:123456@localhost/lottery?charset=utf8", pool_pre_ping=True, pool_recycle=3600)
|
||||
_DbSession = sessionmaker(bind=_engine)
|
||||
return _DbSession()
|
||||
|
||||
|
|
@ -39,6 +39,7 @@ class Lottery(object):
|
|||
record = self._Model()
|
||||
record.draw_issue = draw_issue
|
||||
record.draw_code = draw_code
|
||||
record.created_at = datetime.now()
|
||||
m1 = re.match(self._pat1, draw_date)
|
||||
m2 = re.match(self._pat2, draw_date)
|
||||
if m1 or m2 :
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# coding: utf-8
|
||||
from sqlalchemy import Column, DateTime, Integer, text
|
||||
from sqlalchemy.dialects.mysql import VARCHAR
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
metadata = Base.metadata
|
||||
|
||||
|
||||
class FootballLeague(Base):
|
||||
__tablename__ = 'football_league'
|
||||
__table_args__ = {'comment': '足球联赛信息表'}
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
league_id = Column(Integer, comment='联赛id')
|
||||
league_name = Column(VARCHAR(255), comment='联赛名称')
|
||||
league_all_name = Column(VARCHAR(255), comment='联赛全称')
|
||||
created_at = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"))
|
||||
12
model/pls.py
12
model/pls.py
|
|
@ -1,18 +1,20 @@
|
|||
# coding: utf-8
|
||||
from sqlalchemy import Column, Date, Integer, String, DateTime
|
||||
from sqlalchemy import Column, Date, DateTime, Integer, text
|
||||
from sqlalchemy.dialects.mysql import VARCHAR
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
metadata = Base.metadata
|
||||
|
||||
|
||||
class PLS(Base):
|
||||
class Pl(Base):
|
||||
__tablename__ = 'pls'
|
||||
__table_args__ = {'comment': '排列三统计表'}
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
draw_issue = Column(String(25, 'utf8mb4_general_ci'))
|
||||
draw_issue = Column(VARCHAR(25))
|
||||
draw_date = Column(Date)
|
||||
draw_code = Column(String(10, 'utf8mb4_general_ci'))
|
||||
draw_code = Column(VARCHAR(10))
|
||||
hundred = Column(Integer)
|
||||
ten = Column(Integer)
|
||||
one = Column(Integer)
|
||||
|
|
@ -27,4 +29,4 @@ class PLS(Base):
|
|||
sum_hundred_one = Column(Integer, comment='百位各位和')
|
||||
sum_single_double = Column(Integer, comment='总和奇偶')
|
||||
sum_big_small = Column(Integer, comment='总和大小')
|
||||
created_at = Column(DateTime)
|
||||
created_at = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"))
|
||||
|
|
|
|||
21
model/plw.py
21
model/plw.py
|
|
@ -1,23 +1,25 @@
|
|||
# coding: utf-8
|
||||
from sqlalchemy import Column, Integer, String, Date
|
||||
from sqlalchemy import Column, Date, DateTime, Integer, text
|
||||
from sqlalchemy.dialects.mysql import VARCHAR
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
metadata = Base.metadata
|
||||
|
||||
|
||||
class PLW(Base):
|
||||
class Plw(Base):
|
||||
__tablename__ = 'plw'
|
||||
__table_args__ = {'comment': '排列五统计表'}
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
draw_issue = Column(String(25, 'utf8mb4_general_ci'))
|
||||
draw_issue = Column(VARCHAR(25))
|
||||
draw_date = Column(Date)
|
||||
draw_code = Column(String(10, 'utf8mb4_general_ci'))
|
||||
ten_thousand = Column(Integer)
|
||||
thousand = Column(Integer)
|
||||
hundred = Column(Integer)
|
||||
ten = Column(Integer)
|
||||
one = Column(Integer)
|
||||
draw_code = Column(VARCHAR(10))
|
||||
ten_thousand = Column(Integer, comment='万')
|
||||
thousand = Column(Integer, comment='千')
|
||||
hundred = Column(Integer, comment='百')
|
||||
ten = Column(Integer, comment='十')
|
||||
one = Column(Integer, comment='个')
|
||||
code_big = Column(Integer)
|
||||
code_small = Column(Integer)
|
||||
code_single = Column(Integer)
|
||||
|
|
@ -28,3 +30,4 @@ class PLW(Base):
|
|||
sum_hundred_one = Column(Integer, comment='百位各位和')
|
||||
sum_single_double = Column(Integer, comment='总和奇偶')
|
||||
sum_big_small = Column(Integer, comment='总和大小')
|
||||
created_at = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
|
||||
|
|
|
|||
31
pls.py
31
pls.py
|
|
@ -5,11 +5,11 @@ import pandas as pd
|
|||
a = np.arange(1000)
|
||||
|
||||
l = set([ "".join(sorted(f"{i:03d}")) for i in a ])
|
||||
f1 = lambda number: True if '4' in number or '7' in number else False
|
||||
f2 = lambda number: True if sum(map(int, number)) in [10,12, 13, 14, 16, 17] else False
|
||||
f1 = lambda number: True if '0' in number or '3' in number else False
|
||||
f2 = lambda number: True if sum(map(int, number)) in [10, 13, 14, 16, 17] else False
|
||||
arr1 = list(filter(f1, l))
|
||||
print(len(arr1))
|
||||
print(arr1)
|
||||
# print(len(arr1))
|
||||
# print(arr1)
|
||||
|
||||
arr2 = list(filter(f2, arr1))
|
||||
print(len(arr2))
|
||||
|
|
@ -44,18 +44,18 @@ for i in sum_group6_dict.keys():
|
|||
f1 = lambda number: len([i for i in number if int(i) %2 == 0]) != 0
|
||||
f2 = lambda number: len([i for i in number if int(i) %2 == 1]) != 0
|
||||
f3 = lambda n: True if int(n[1]) - int(n[0]) == 1 or int(n[2]) - int(n[1]) == 1 else False
|
||||
f4 = lambda number: True if 'a' not in number else False
|
||||
f5 = lambda number: True if '5' in number or '1' in number or '9' in number else False
|
||||
f4 = lambda number: True if '3' not in number else False
|
||||
f5 = lambda number: True if '0' in number or '3' in number else False
|
||||
f6 = lambda number: True if len(set('279').difference(number)) == 2 else False
|
||||
# if i in [12, 14, 15, 16, 17]:
|
||||
# # result = sum_group6_dict[i] + sum_group3_dict[i]
|
||||
# result = sum_group3_dict[i]
|
||||
# print("-"*15 + "组三" + "-"*15)
|
||||
# print(i, list(filter(f5, result)))
|
||||
# result = sum_group6_dict[i]
|
||||
# print("-"*15 + "组六" + "-"*15)
|
||||
# print(i, list(filter(f5, result)))
|
||||
# print()
|
||||
if i in [13, 14, 15, 16, 17]:
|
||||
# result = sum_group6_dict[i] + sum_group3_dict[i]
|
||||
result = sum_group3_dict[i]
|
||||
print("-"*15 + "组三" + "-"*15)
|
||||
print(i, list(filter(f4, result)))
|
||||
result = sum_group6_dict[i]
|
||||
print("-"*15 + "组六" + "-"*15)
|
||||
print(i, list(filter(f4, result)))
|
||||
print()
|
||||
|
||||
|
||||
# 连号
|
||||
|
|
@ -76,3 +76,4 @@ arr = set([ "".join(sorted(f"{i:03d}")) for i in filter(f, result_1)])
|
|||
# print(len(arr))
|
||||
# print(len(result_2))
|
||||
# print(result_2[:20])
|
||||
# 299669
|
||||
|
|
@ -259,7 +259,7 @@ class Chrome(object):
|
|||
with Chrome() as chrome:
|
||||
# chrome.balance()
|
||||
# 组选
|
||||
result = ['348', '249', '168', '267', '078', '458', '368', '269', '089', '158', '239']
|
||||
result = ['059', '158', '167', '058', '067', '049', '256', '247', '148', '458', '269', '089', '278', '467', '069', '168', '249', '267', '258', '078']
|
||||
chrome.pls(result = result, multiple=2)
|
||||
# 直选
|
||||
# result = ['246', '264', '291', '219', '169']
|
||||
|
|
|
|||
Loading…
Reference in New Issue