Exemplo n.º 1
0
func UpdateScheduleResult(schedule_bet_date string, schedule_float_info map[string]float32, schedule_string_info map[string]string) {
	Schedule := new(myinit.Schedule)
	Schedule.ScheduleScore = schedule_string_info["schedule_score"]
	Schedule.ScheduleSpfResult = schedule_string_info["schedule_spf_result"]
	Schedule.ScheduleSpfOdd = schedule_float_info["schedule_spf_odd"]
	Schedule.ScheduleRqspfResult = schedule_string_info["schedule_rqspf_result"]
	Schedule.ScheduleRqspfOdd = schedule_float_info["schedule_rqspf_odd"]
	Schedule.ScheduleZjqResult = schedule_string_info["schedule_zjq_result"]
	Schedule.ScheduleZjqOdd = schedule_float_info["schedule_zjq_odd"]
	Schedule.ScheduleBqcResult = schedule_string_info["schedule_bqc_result"]
	Schedule.ScheduleBqcOdd = schedule_float_info["schedule_bqc_odd"]
	update_affected, update_err :=
		myinit.Engine.
			Cols("schedule_score", "schedule_spf_result", "schedule_spf_odd", "schedule_rqspf_result", "schedule_rqspf_odd", "schedule_zjq_result", "schedule_zjq_odd", "schedule_bqc_result", "schedule_bqc_odd").
			Where("schedule_result_no=? AND schedule_date=? ", schedule_string_info["schedule_result_no"], schedule_bet_date).Update(Schedule)
	fmt.Println(update_affected)
	fmt.Println(update_err)
}
Exemplo n.º 2
0
func Add(schedule_int_info map[string]int, schedule_string_info map[string]string) {
	myinit.Myinit()
	has := CheckExists(schedule_string_info["schedule_date"], schedule_string_info["schedule_no"])
	fmt.Println(has)

	if has {
		fmt.Println(schedule_string_info["schedule_home"] + " vs " + schedule_string_info["schedule_guest"] + "已存在!")
	} else {
		Schedule := new(myinit.Schedule)

		//		Schedule.ScheduleBetDate = schedule_string_info["schedule_bet_date"]
		Schedule.ScheduleDate = schedule_string_info["schedule_date"]
		Schedule.ScheduleNo = schedule_string_info["schedule_no"]
		Schedule.ScheduleResultNo = schedule_string_info["schedule_result_no"]
		Schedule.ScheduleLeague = schedule_string_info["schedule_league"]
		Schedule.ScheduleHome = schedule_string_info["schedule_home"]
		Schedule.ScheduleGuest = schedule_string_info["schedule_guest"]
		Schedule.ScheduleWeekDay = schedule_string_info["schedule_week_day"]
		Schedule.ScheduleFenxiId = schedule_int_info["schedule_fenxi_id"]
		Schedule.ScheduleBetEndTime = schedule_string_info["schedule_bet_end_time"]
		Schedule.ScheduleRqNum = schedule_string_info["schedule_rq_num"]

		affected, _ := myinit.Engine.Insert(Schedule)
		fmt.Println(affected)
		fmt.Println(Schedule.ScheduleId)
	}
}
Exemplo n.º 3
0
func calcScheduleResult(schedule_int_info map[string]int, schedule_string_info map[string]string) {
	predict1_json := make(map[string]interface{})
	predict2_json := make(map[string]interface{})

	sql1 := "select predict1_result,count(*) as predict1_cnt from `pk_asia_pan_log` where schedule_date = ? and schedule_no=? group by predict1_result"
	res_map, _ := myinit.Engine.Query(sql1, schedule_string_info["schedule_date"], schedule_string_info["schedule_no"])

	for _, row := range res_map {
		json_key := ""
		json_val := ""
		for colName, colValue := range row {

			value := common.BytesToString(colValue)
			fmt.Println("colName")
			fmt.Println(colName)
			fmt.Println("value")
			fmt.Println(value)
			if colName == "predict1_result" {
				json_key = value
			}
			if colName == "predict1_cnt" {
				json_val = value
			}
		}
		predict1_json[json_key] = json_val

	}

	sql2 := "select predict2_result,count(*) as predict2_cnt from `pk_asia_pan_log` where schedule_date = ? and schedule_no=? group by predict2_result"
	res2_map, _ := myinit.Engine.Query(sql2, schedule_string_info["schedule_date"], schedule_string_info["schedule_no"])

	for _, row2 := range res2_map {
		json_key2 := ""
		json_val2 := ""
		for colName2, colValue2 := range row2 {

			value2 := common.BytesToString(colValue2)
			if colName2 == "predict2_result" {
				json_key2 = value2
			}
			if colName2 == "predict2_cnt" {
				json_val2 = value2
			}
		}
		predict2_json[json_key2] = json_val2

	}

	//		predict1_string, _ := json.Marshal(predict1_json)
	//		fmt.Println(string(predict1_string))

	//		predict2_string, _ := json.Marshal(predict2_json)
	//		fmt.Println(string(predict2_string))

	predict_json := make(map[string]interface{})
	predict_json["predict1"] = predict1_json
	predict_json["predict2"] = predict2_json

	predict_json_string, _ := json.Marshal(predict_json)

	exist_schedule := new(myinit.Schedule)
	exist_schedule.ScheduleAlResult = string(predict_json_string)
	update_affected, update_err :=
		myinit.Engine.Cols("schedule_al_result").
			Where("schedule_fenxi_id=? AND schedule_date = ? and schedule_no=? ", schedule_int_info["schedule_fenxi_id"], schedule_string_info["schedule_date"], schedule_string_info["schedule_no"]).Update(exist_schedule)

	fmt.Println(update_affected)
	fmt.Println(update_err)
}