|
|
|
@ -64,6 +64,7 @@ def get_random_index(): |
|
|
|
|
random_low = random.randint(1, 6 - random_high) |
|
|
|
|
random_middle = 6 - random_high - random_low |
|
|
|
|
print('分布区间(高概率区,中概率区,低概率区):', random_high, random_middle, random_low) |
|
|
|
|
red_index_group = [int(random_high), int(random_middle), int(random_low)] |
|
|
|
|
high_red_index_list = [(n[0] - 1) for n in new_num(1, 11, random_high)[0:random_high]] |
|
|
|
|
middle_red_index_list = [(n[0] - 1) for n in new_num(12, 22, random_middle)[0:random_middle]] |
|
|
|
|
low_red_index_list = [(n[0] - 1) for n in new_num(23, 33, random_low)[0:random_low]] |
|
|
|
@ -71,17 +72,19 @@ def get_random_index(): |
|
|
|
|
print(middle_red_index_list) |
|
|
|
|
print(low_red_index_list) |
|
|
|
|
red_index_list = sorted(high_red_index_list + middle_red_index_list + low_red_index_list) |
|
|
|
|
red_index_list = [int(n) for n in red_index_list] |
|
|
|
|
print(f"排序后结果") |
|
|
|
|
print(red_index_list) |
|
|
|
|
return red_index_list |
|
|
|
|
return red_index_group, red_index_list |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_index_from_db(_mode): |
|
|
|
|
index_list = db_red_index(_mode) |
|
|
|
|
def get_index_from_db(): |
|
|
|
|
index_list = db_red_get_index() |
|
|
|
|
print(index_list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_forecast_red(_red_data): |
|
|
|
|
index_list = get_random_index() |
|
|
|
|
index_group, index_list = get_random_index() |
|
|
|
|
forecast_red_list = [] |
|
|
|
|
_red_data_list = list(_red_data.items()) |
|
|
|
|
for i in index_list: |
|
|
|
@ -89,19 +92,42 @@ def get_forecast_red(_red_data): |
|
|
|
|
forecast_red_list = sorted(forecast_red_list) |
|
|
|
|
print('随机红球推荐:') |
|
|
|
|
print(forecast_red_list) |
|
|
|
|
return forecast_red_list |
|
|
|
|
return {'forecast': forecast_red_list, 'group': index_group, 'index': index_list} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_forecast_red_by_db_index(_red_data, _mode='history'): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def insert_red_data(_all_data, _history, _history_random, _last, _last_random): |
|
|
|
|
print(_history_random) |
|
|
|
|
print(_last_random) |
|
|
|
|
_insert_data = dict() |
|
|
|
|
_insert_data['dateId'] = _all_data[-1]['dateId'] |
|
|
|
|
_insert_data['history'] = json.dumps(_history) |
|
|
|
|
_insert_data['history_random'] = json.dumps(_history_random['forecast']) |
|
|
|
|
_insert_data['history_random_index'] = json.dumps(_history_random['index']) |
|
|
|
|
_insert_data['history_random_index_group'] = json.dumps(_history_random['group']) |
|
|
|
|
_insert_data['last'] = json.dumps(_last) |
|
|
|
|
_insert_data['last_random'] = json.dumps(_last_random['forecast']) |
|
|
|
|
_insert_data['last_random_index'] = json.dumps(_last_random['index']) |
|
|
|
|
_insert_data['last_random_index_group'] = json.dumps(_last_random['group']) |
|
|
|
|
print(_insert_data) |
|
|
|
|
result = db_red_insert(_insert_data) |
|
|
|
|
if result > 0: |
|
|
|
|
print(f"输入数据成功,插入{result}条数据") |
|
|
|
|
else: |
|
|
|
|
print("数据插入失败") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
all_data = get_all_data() |
|
|
|
|
all_red_delta = get_all_red_delta(all_data) |
|
|
|
|
history_red_delta = get_all_red_delta(all_data) |
|
|
|
|
# print(all_red_delta) |
|
|
|
|
last_red_delta = get_last_red_delta(get_all_red_in_last(all_data)) |
|
|
|
|
# print(last_red_delta) |
|
|
|
|
print_data([all_red_delta, last_red_delta]) |
|
|
|
|
forecast_red_history = get_forecast_red(all_red_delta) |
|
|
|
|
forecast_red_last = get_forecast_red(last_red_delta) |
|
|
|
|
print_data([history_red_delta, last_red_delta]) |
|
|
|
|
forecast_red_history_data = get_forecast_red(history_red_delta) |
|
|
|
|
forecast_red_last_data = get_forecast_red(last_red_delta) |
|
|
|
|
insert_red_data(all_data, history_red_delta, forecast_red_history_data, last_red_delta, forecast_red_last_data) |
|
|
|
|
get_index_from_db() |
|
|
|
|