Пример #1
0
func checkPanUseableFromAjax(idx int, schedule_fenxi_id int) (res bool) {
	odd_html := myinit.GetOddItemFromAjax(idx, schedule_fenxi_id)
	table_string := "<table>" + odd_html + "</table>"
	html_obj, _ := goquery.ParseString(table_string)

	odds_tr := html_obj.Find("table tbody tr")
	for i := 0; i < odds_tr.Length(); i++ {
		tr_item := odds_tr.Eq(i)
		td_of_company := tr_item.Find("td").Eq(1)
		if td_of_company.Find("p a").Attr("title") == "" {
			continue
		}
		is_useable := checkPanTr(tr_item, schedule_fenxi_id)
		if is_useable == false {
			return false
		}
	}
	if odds_tr.Length() >= 30 {
		ajax_res := checkPanUseableFromAjax(idx+30, schedule_fenxi_id)
		if ajax_res == false {
			return false
		}
	}
	return true
}
Пример #2
0
func ParsePanUrlFromAjax(idx int, schedule_fenxi_id int, pan_html_string_info map[string]string) (res bool) {
	pan_int_info := make(map[string]int)
	pan_float_info := make(map[string]float32)
	pan_string_info := make(map[string]string)

	odd_html := myinit.GetOddItemFromAjax(idx, schedule_fenxi_id)

	table_string := "<table>" + odd_html + "</table>"
	html_obj, _ := goquery.ParseString(table_string)

	odds_tr := html_obj.Find("table tbody tr")

	pan_int_info["schedule_fenxi_id"] = schedule_fenxi_id
	pan_string_info["schedule_date"] = pan_html_string_info["schedule_date"]
	pan_string_info["schedule_no"] = pan_html_string_info["schedule_no"]
	pan_string_info["schedule_result_no"] = pan_html_string_info["schedule_result_no"]
	pan_string_info["schedule_league"] = pan_html_string_info["schedule_league"]

	pan_string_info["schedule_home"] = pan_html_string_info["schedule_home"]
	pan_string_info["schedule_guest"] = pan_html_string_info["schedule_guest"]
	pan_string_info["schedule_game_desc"] = pan_html_string_info["schedule_game_desc"]
	pan_string_info["schedule_date_desc"] = pan_html_string_info["schedule_date_desc"]

	for i := 0; i < odds_tr.Length(); i++ {
		tr_item := odds_tr.Eq(i)

		td_of_company := tr_item.Find("td").Eq(1)
		if td_of_company.Find("p a").Attr("title") == "" {
			continue
		}

		parse_res := doParsePanTr(tr_item, schedule_fenxi_id, pan_int_info, pan_float_info, pan_string_info, true)
		if parse_res == false {
			return false
		}
	}
	if odds_tr.Length() >= 30 {
		ajax_res := ParsePanUrlFromAjax(idx+30, schedule_fenxi_id, pan_html_string_info)
		if ajax_res == false {
			return false
		}
	}

	return true
}