Ejemplo n.º 1
0
def setted(rs):

    #   获取开奖号码
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    mysql = "update lq_match set Match_JS=2 where Match_ID=" + rs['Match_ID']
    cur.execute(mysql)
    con.commit()
    cur.close()
    con.close()
    #   未结算的注单
    con = MySQLdb.connect(DB_HOST,
                          DB_USER_P,
                          DB_PASSWD_P,
                          DB_NAME_PRI,
                          charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    cur.execute(
        "select * from k_bet where match_id=" + rs['Match_ID'] +
        "  and  point_column in ( 'match_ho','match_ao','match_dxdpl','match_dxxpl','match_dxdpl','match_dxxpl','match_bd10','match_bd20','match_bd21','match_bd30','match_bd31','match_bd32','match_bd40','match_bd41','match_bd42','match_bd43','match_bdg10','match_bdg20','match_bdg21','match_bdg30','match_bdg31','match_bdg32','match_bdg40','match_bdg41','match_bdg42','match_bdg43','match_bd00','match_bd11','match_bd22','match_bd33','match_bd44','match_bdup5','match_total01pl','match_total23pl','match_total46pl','match_total7uppl','match_bzm','match_bzg','match_bzh','match_bqmm','match_bqmh','match_bqmg','match_bqhm','match_bqhh','match_bqhg','match_bqgm','match_bqgh','match_bqgg','match_dsdpl','match_dsspl' ) and lose_ok =1 and status=0"
    )
    rows = cur.fetchall()
    print rows
    for row in rows:
        MB_Inball = TG_Inball = MB_Inball_HR = TG_Inball_HR = ""
        MB_Inball = row['MB_Inball']
        TG_Inball = row['TG_Inball']
        match_nowscore = 'unneed'
        t = sportsalgorithm.make_point(row['point_column'].lower(), MB_Inball,
                                       TG_Inball, MB_Inball_HR, TG_Inball_HR,
                                       row['match_type'],
                                       row['match_showtype'], row['match_rgg'],
                                       row['match_dxgg'], match_nowscore)
        print t
        if (t["status"] == 1
                and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (t["ben_add"] + row[15]) * row[13]
            res = sportsalgorithm.win_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 2
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = 0
            res = sportsalgorithm.lost_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 3
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.invalid_bet_ds(row, t['mb_inball'],
                                                 t['tg_inball'])
        elif (t["status"] == 4
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (1 + row[15] / 2) * row[13]
            res = sportsalgorithm.halfwin_ds(row, t['mb_inball'],
                                             t['tg_inball'])
        elif (t["status"] == 5
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13] / 2
            res = sportsalgorithm.halflost_ds(row, t['mb_inball'],
                                              t['tg_inball'])
        elif (t["status"] == 8
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.tie_bet_ds(row, t['mb_inball'],
                                             t['tg_inball'])
#   未结算的串关注单
    cur.execute("select * from k_bet_cg where match_id=" + rs['Match_ID'] +
                "  and status=0")
    rows = cur.fetchall()
    if (rows):
        for row in rows:
            if not (row['point_column'] in [
                    'match_bmdy', 'match_bgdy', 'match_bhdy', 'match_bho',
                    'match_bao', 'match_bdpl', 'match_bxpl'
            ]):
                t = sportsalgorithm.make_point(
                    row['point_column'].lower(), row['MB_Inball'],
                    row['TG_Inball'], '', '', '', row['match_showtype'],
                    row['match_rgg'], row['match_dxgg'], row['match_nowscore'])
            else:
                t = sportsalgorithm.make_point(
                    row['point_column'].lower(), '', '', row['MB_Inball'],
                    row['TG_Inball'], '', row['match_showtype'],
                    row['match_rgg'], row['match_dxgg'], row['match_nowscore'])


####################################################结算单式##################################################
            if not (t['mb_inball'] == None or t['tg_inball'] == None):
                sportsalgorithm.cg_bet_ds(t, row)
                #####################################################结算串式##########################################################
                sportsalgorithm.cg_bet(row)
    con.commit()
    cur.close()
    con.close()
    #   根据期数读取未结算的注单
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    try:
        mysql = "update lq_match set Match_JS=1 where Match_ID=" + rs[
            'Match_ID']
        cur.execute(mysql)
        con.commit()
    except MySQLdb.Error, e:
        print "期数修改失败!!!"
        quit()
Ejemplo n.º 2
0
def setted(rs):

    #   获取开奖号码
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    mysql = "update tennis_match set Match_JS=2 where Match_ID=" + rs[
        'Match_ID']
    cur.execute(mysql)
    con.commit()
    cur.close()
    con.close()
    #   未结算的注单
    con = MySQLdb.connect(DB_HOST,
                          DB_USER_P,
                          DB_PASSWD_P,
                          DB_NAME_PRI,
                          charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    cur.execute(
        "select * from k_bet where match_id=" + rs['Match_ID'] +
        "  and  point_column in ( 'match_ho','match_ao','match_dxdpl','match_dxxpl','match_dxdpl','match_dxxpl','match_bd10','match_bd20','match_bd21','match_bd30','match_bd31','match_bd32','match_bd40','match_bd41','match_bd42','match_bd43','match_bdg10','match_bdg20','match_bdg21','match_bdg30','match_bdg31','match_bdg32','match_bdg40','match_bdg41','match_bdg42','match_bdg43','match_bd00','match_bd11','match_bd22','match_bd33','match_bd44','match_bdup5' ) and lose_ok =1 and status=0"
    )
    rows = cur.fetchall()
    print rows
    for row in rows:
        MB_Inball = TG_Inball = MB_Inball_HR = TG_Inball_HR = ""
        if (row['MB_Inball'] == None or row['TG_Inball'] == None):
            mysql = "Update `k_bet` set MB_Inball='" + str(
                rs['MB_Inball']) + "',TG_Inball='" + str(
                    rs['TG_Inball']) + "' where bid = " + str(row['bid'])
            cur.execute(mysql)
            con.commit()
            MB_Inball = str(rs['MB_Inball'])
            TG_Inball = str(rs['TG_Inball'])
        else:
            MB_Inball = row['MB_Inball']
            TG_Inball = row['TG_Inball']
        t = sportsalgorithm.make_point(row['point_column'].lower(), MB_Inball,
                                       TG_Inball, MB_Inball_HR, TG_Inball_HR,
                                       row['match_type'],
                                       row['match_showtype'], row['match_rgg'],
                                       row['match_dxgg'],
                                       row['match_nowscore'])
        print t
        if (t["status"] == 1
                and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (t["ben_add"] + row[15]) * row[13]
            res = sportsalgorithm.win_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 2
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = 0
            res = sportsalgorithm.lost_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 3
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.invalid_bet_ds(row, t['mb_inball'],
                                                 t['tg_inball'])
        elif (t["status"] == 4
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (1 + row[15] / 2) * row[13]
            res = sportsalgorithm.halfwin_ds(row, t['mb_inball'],
                                             t['tg_inball'])
        elif (t["status"] == 5
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13] / 2
            res = sportsalgorithm.halflost_ds(row, t['mb_inball'],
                                              t['tg_inball'])
        elif (t["status"] == 8
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.tie_bet_ds(row, t['mb_inball'],
                                             t['tg_inball'])
    con.commit()
    cur.close()
    con.close()
    #   根据期数读取未结算的注单
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    try:
        mysql = "update tennis_match set Match_JS=1 where Match_ID=" + rs[
            'Match_ID']
        cur.execute(mysql)
        con.commit()
    except MySQLdb.Error, e:
        print "期数修改失败!!!"
        quit()
Ejemplo n.º 3
0
def setted(rs):

    #   获取开奖号码
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    mysql = "update bet_match set Match_SBJS=2 where Match_ID=" + rs['Match_ID']
    print mysql
    cur.execute(mysql)
    con.commit()
    cur.close()
    con.close()
    #   未结算的注单
    con = MySQLdb.connect(DB_HOST,
                          DB_USER_P,
                          DB_PASSWD_P,
                          DB_NAME_PRI,
                          charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    cur.execute(
        "select * from k_bet where match_id=" + rs['Match_ID'] +
        " and point_column in ( 'match_bmdy','match_bgdy','match_bhdy','match_bho','match_bao','match_bdpl','match_bxpl' ) and lose_ok =1 and status=0"
    )
    rows = cur.fetchall()
    print rows
    for row in rows:
        MB_Inball = TG_Inball = MB_Inball_HR = TG_Inball_HR = ""
        #MB_Inball_HR = row['MB_Inball']
        #TG_Inball_HR = row['TG_Inball']
        if (row['MB_Inball'] == None or row['TG_Inball'] == None):
            mysql = "Update `k_bet` set MB_Inball='" + str(
                rs['MB_Inball_HR']) + "',TG_Inball='" + str(
                    rs['TG_Inball_HR']) + "' where bid = " + str(row['bid'])
            cur.execute(mysql)
            con.commit()
            MB_Inball_HR = str(rs['MB_Inball_HR'])
            TG_Inball_HR = str(rs['TG_Inball_HR'])
        else:
            MB_Inball_HR = row['MB_Inball']
            TG_Inball_HR = row['TG_Inball']
        t = sportsalgorithm.make_point(row['point_column'].lower(), MB_Inball,
                                       TG_Inball, MB_Inball_HR, TG_Inball_HR,
                                       row['match_type'],
                                       row['match_showtype'], row['match_rgg'],
                                       row['match_dxgg'],
                                       row['match_nowscore'])
        print t
        if (t["status"] == 1
                and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (t["ben_add"] + row[15]) * row[13]
            res = sportsalgorithm.win_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 2
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = 0
            res = sportsalgorithm.lost_ds(row, t['mb_inball'], t['tg_inball'])
        elif (t["status"] == 3
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.invalid_bet_ds(row, t['mb_inball'],
                                                 t['tg_inball'])
        elif (t["status"] == 4
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = (1 + row[15] / 2) * row[13]
            res = sportsalgorithm.halfwin_ds(row, t['mb_inball'],
                                             t['tg_inball'])
        elif (t["status"] == 5
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13] / 2
            res = sportsalgorithm.halflost_ds(row, t['mb_inball'],
                                              t['tg_inball'])
        elif (t["status"] == 8
              and not (t['mb_inball'] == None or t['tg_inball'] == None)):
            #win = row[13]
            res = sportsalgorithm.tie_bet_ds(row, t['mb_inball'],
                                             t['tg_inball'])


#   未结算的串关注单
    cur.execute(
        "select * from k_bet_cg where match_id=" + rs['Match_ID'] +
        " and point_column in ( 'match_bmdy','match_bgdy','match_bhdy','match_bho','match_bao','match_bdpl','match_bxpl' ) and status=0  "
    )
    rows = cur.fetchall()
    if (rows):
        for row in rows:
            if (row['MB_Inball'] == None or row['TG_Inball'] == None):
                mysql = "Update `k_bet_cg` set MB_Inball='" + str(
                    rs['MB_Inball_HR']) + "',TG_Inball='" + str(
                        rs['TG_Inball_HR']) + "' where bid = " + str(
                            row['bid'])
                cur.execute(mysql)
                con.commit()
                MB_Inball_HR = str(rs['MB_Inball_HR'])
                TG_Inball_HR = str(rs['TG_Inball_HR'])
            else:
                MB_Inball_HR = row['MB_Inball']
                TG_Inball_HR = row['TG_Inball']
            t = sportsalgorithm.make_point(row['point_column'].lower(), '', '',
                                           MB_Inball_HR, TG_Inball_HR, '',
                                           row['match_showtype'],
                                           row['match_rgg'], row['match_dxgg'],
                                           row['match_nowscore'])
            ####################################################结算单式##################################################
            if not (t['mb_inball'] == None or t['tg_inball'] == None):
                sportsalgorithm.cg_bet_ds(t, row)
                #####################################################结算串式##########################################################
                sportsalgorithm.cg_bet(row)
    con.commit()
    cur.close()
    con.close()
    #   根据期数读取未结算的注单
    con = MySQLdb.connect(DB_HOST, DB_USER, DB_PASSWD, DB_NAME, charset='utf8')
    cur = con.cursor(cursorclass=MySQLdb.cursors.DictCursor)
    try:
        mysql = "update bet_match set Match_SBJS=1 where Match_ID=" + rs[
            'Match_ID']
        print mysql
        cur.execute(mysql)
        con.commit()
    except MySQLdb.Error, e:
        print "期数修改失败!!!"
        quit()