def show_users_list():
    qry_pid = request.form.get('pid', '')
    Where = ""
    if qry_pid:
        Where = " and pid = %s" % qry_pid
    channel = session['select_channel']

    sql_oper = SqlOperate()

    black_search_sql = """SELECT pid, game_count, total_recharge_rmb, total_withdraw, coin, counter, remark 
                FROM admin_black_list where 1 = 1 %s""" % (Where)
    black_tuple = LogQry(channel).qry(black_search_sql)

    white_search_sql = """SELECT pid, game_count, total_recharge_rmb, total_withdraw, coin, counter, remark 
                FROM admin_white_list where 1 = 1 %s""" % (Where)
    white_tuple = LogQry(channel).qry(white_search_sql)

    datas = dict()
    if len(black_tuple) > 0:
        black_list = list()
        for pid, game_count, total_recharge, total_withdraw, coin, counter, remark in black_tuple:
            data_dict = dict()
            data_dict['pid'] = pid
            data_dict['game_count'] = game_count
            data_dict['total_recharge'] = total_recharge
            data_dict['total_withdraw'] = total_withdraw
            data_dict['coin'] = game_util.coin_translate(channel, coin)
            data_dict['counter'] = game_util.coin_translate(channel, counter)
            data_dict['remark'] = remark
            black_list.append(data_dict)
        datas['black_list'] = black_list

    if len(white_tuple) > 0:
        white_list = list()
        for pid, game_count, total_recharge, total_withdraw, coin, counter, remark in white_tuple:
            data_dict = dict()
            data_dict['pid'] = pid
            data_dict['game_count'] = game_count
            data_dict['total_recharge'] = total_recharge
            data_dict['total_withdraw'] = total_withdraw
            data_dict['coin'] = game_util.coin_translate(channel, coin)
            data_dict['counter'] = game_util.coin_translate(channel, counter)
            data_dict['remark'] = remark
            white_list.append(data_dict)
        datas['white_list'] = white_list

    status_msg = dict()
    status_msg['pid'] = qry_pid

    return render_template('black_white_list.html',
                           status_msg=status_msg,
                           datas=datas)
Example #2
0
def html(channel, pid, name, stype, val, subgame):
    if stype == ALARM_PLAYER_STAKE_COIN:
        [gameid, stake_coin, alarm_val] = val.split(",")
        return u"玩家%s在%s中单局押注金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            blue_html(game_parameter.get_subgame_by_id(subgame, int(gameid))), red_html(coin_translate(channel, stake_coin)), 
            red_html(coin_translate(channel, alarm_val)))
    elif stype == ALARM_PLAYER_OUTPUT_COIN:
        [gameid, win_coin, alarm_val] = val.split(",")
        return u"玩家%s在%s中单局盈利金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            blue_html(game_parameter.get_subgame_by_id(subgame, int(gameid))), red_html(coin_translate(channel, win_coin)), 
                red_html(coin_translate(channel, alarm_val)))
    elif stype == ALARM_PLAYER_OUTPUT_COIN_TODAY:
        [win_coin, alarm_val] = val.split(",")
        return u"玩家%s今日游戏盈利金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(coin_translate(channel, win_coin)), red_html(coin_translate(channel, alarm_val)))
    elif stype == ALARM_REG_SAME_IP:
        [count, alarm_val] = val.split(",")
        return u"%s今日注册账号数达到%s,高于%s的预警值" % (red_html(pid), red_html(count), red_html(alarm_val))
    elif stype == ALARM_REG_SAME_DEVICE:
        [count, alarm_val] = val.split(",")
        return u"%s今日注册账号数达到%s,高于%s的预警值" % (red_html(pid), red_html(count), red_html(alarm_val))
    elif stype == ALARM_PLAYER_OUT_STAKE_COIN_RATE:
        [gameid, count, alarm_val] = val.split(",")
        return u"玩家%s在%s中游戏中奖倍数达到%s,高于%s的预警值" % (pid_html(pid, name), \
            blue_html(game_parameter.get_subgame_by_id(subgame, int(gameid))), red_html(count), red_html(alarm_val))
    elif stype == ALARM_PLAYER_RECHARGE:
        [recharge, alarm_val] = val.split(",")
        return u"玩家%s今日单笔充值金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(recharge), red_html(alarm_val))
    elif stype == ALARM_PLAYER_RECHARGE_TODAY:
        [total_recharge, alarm_val] = val.split(",")
        return u"玩家%s今日总充值金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(total_recharge), red_html(alarm_val))
    elif stype == ALARM_PLAYER_WITHDRAW:
        [withdraw, alarm_val] = val.split(",")
        return u"玩家%s今日单笔提现金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(withdraw), red_html(alarm_val))
    elif stype == ALARM_PLAYER_WITHDRAW_TODAY:
        [total_withdraw, alarm_val] = val.split(",")
        return u"玩家%s今日总充值金额达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(total_withdraw), red_html(alarm_val))
    elif stype == ALARM_PLAYER_PRESENT:
        [present, alarm_val] = val.split(",")
        return u"玩家%s今日单笔赠送金币达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(present), red_html(alarm_val))
    elif stype == ALARM_PLAYER_PRESENT_TODAY:
        [total_present, alarm_val] = val.split(",")
        return u"玩家%s今日总赠送金币达到%s,高于%s的预警值" % (pid_html(pid, name), \
            red_html(total_present), red_html(alarm_val))
    return ""
Example #3
0
def maniplate_full_handicaper_query():
    channel = session['select_channel']

    status = int(request.form.get("subgame"))  # 用于保存选中的游戏状态

    page = deepcopy(full_page)
    page["other_qry"] = full_query_html(status=status)
    page["channel"] = channel
    page["subgame"] = request.form.get("subgame")

    ll = GameWeb(channel).post("/api/subgame_ctl_list",
                               {"gameid": request.form.get("subgame")})
    ll.sort(key=lambda x: x["room_type"])
    page["datas"] = ll

    for ele in ll:
        ele["pump"] = game_util.coin_translate(channel, ele["pump"])
        ele["robot_win"] = game_util.coin_translate(channel, ele["robot_win"])
        ele["water"] = game_util.coin_translate(channel, ele["water"])
        ele["accwater"] = game_util.coin_translate(channel, ele["accwater"])

    return render_template('maniplate_full_handicaper.html', page=page)
Example #4
0
def game_position_detail_retrieve():
    """对局详情查询"""

    # 获取参数
    auto_id = request.args.get('auto_id')
    time = request.args.get('time')
    channel = session['select_channel']

    # 处理参数
    data_table_name = log_table.get_table_log_subgame(int(time))

    # 从数据库获取数据
    retrieve_sql = """
        SELECT gameid, detail 
        FROM %s 
        WHERE auto_id=%s;
    """ % (data_table_name, auto_id)
    gameid, detail = LogQry(int(channel)).qry(retrieve_sql)[0]

    dd = []
    detail_config = game_parameter.detail_config()
    define = game_parameter.detail_define()
    try:
        ll = json.loads(detail)

        ## 遍历每条记录
        for line in ll:
            ## 对每条记录继续遍历
            ss = []
            for k, v in line:
                try:
                    df = define[int(k)]
                    if df["type"] == "coin":
                        ss.append(
                            "【%s】: %s" %
                            (df["txt"],
                             str(game_util.coin_translate(
                                 int(channel), int(v)))))
                    elif df["type"] == "pid":
                        if int(v) < 90001:
                            ss.append("【%s】: %s" % (df["txt"], str(v)))
                        else:
                            sql = "select account_id from player where id = %s" % v
                            acc = LogQry(int(channel)).qry(sql)[0][0]
                            ss.append("【%s】: %s(%s)" %
                                      (df["txt"], str(v), acc))
                    elif df["type"] == "desc":
                        ss.append("【%s】: %s" % (df["txt"], df["kv"][int(v)]))
                    elif df["type"] == "config":
                        ## 此处需要解析配置
                        v = v if type(v) == type([]) else [v]
                        tl = []
                        for ele in v:
                            try:
                                tl.append(detail_config[gameid][ele])
                            except BaseException, e:
                                print "game_detail_config...", gameid, ele
                                tl.append(str(ele))

                        ss.append("【%s】: %s" % (df["txt"], " ".join(tl)))
                    else:
                        ss.append("【%s】: %s" % (df["txt"], str(v)))
                except BaseException, e:
                    print "game_detail", k, v
                    ss.append("【%s】: %s" % (str(k), str(v)))
Example #5
0
def search_player_money_detail():
    """玩家搜索"""

    access_level = session['access_level']
    PID = request.args.get('PlayerID', '')
    NickName = request.args.get('NickName', '')
    # 接收渠道id
    channel = session['select_channel']

    print access_level, "access_level"

    status_msg = dict()
    status_msg['beginDate'] = False
    status_msg['endDate'] = False
    status_msg['access_level'] = access_level
    status_msg['PlayerID'] = PID
    status_msg['NickName'] = NickName
    status_msg['channel'] = channel
    status_msg['date1'] = time_util.formatDate(time_util.now_sec() - 7 * 86400)
    status_msg['date2'] = time_util.formatDate(time_util.now_sec())

    WHERE = ""
    if PID:
        WHERE += " and id = %s" % PID
    if NickName:
        WHERE += " and nick = '%s'" % NickName

    if not WHERE:
        return render_template('player_monies.html',
                               status_msg=status_msg,
                               base_player={})

    sql = '''
        select id, nick, reg_time, client_id, reg_ip,
            coin, counter, device, did, last_login_ip,
            phone, last_login_time, did, subgame, total_recharge_rmb,
            total_withdraw, time_long, (select count(1) from t_player_general where pid = a.id),
                ifnull((select p_code from player_agent where pid = a.id), ""),
                ifnull((select invite_code from player_agent where pid = a.id), ""),
            ban, account_id
        from player a
        where 1=1 %s
    ''' % WHERE

    base_player = {}
    for line in LogQry(channel).qry(sql):
        status_msg['PlayerID'] = line[0]
        base_player["id"] = line[0]
        base_player["nick"] = line[1]
        base_player["reg_time"] = time_util.formatDateTime(line[2])
        base_player["channel_id"] = line[3]
        base_player["reg_ip"] = line[4]
        base_player["account_id"] = line[21]

        coin = GameWeb(channel).post("/api/get_player_info",
                                     {'pid': int(line[0])})['result']['coin']
        bank = GameWeb(channel).post("/api/get_player_info",
                                     {'pid': int(line[0])})['result']['dep']
        base_player["coin"] = game_util.coin_translate(channel, coin)
        base_player["banker"] = game_util.coin_translate(channel, bank)

        base_player["platform"] = line[7]
        base_player["did"] = line[8]
        base_player["last_login_ip"] = line[9]

        base_player["phone"] = line[10]
        base_player["last_login_time"] = time_util.formatDateTime(line[11])
        base_player["did"] = line[12]

        base_player["subgame"] = game_parameter.get_subgame_name(line[13])
        base_player["total_recharge_rmb"] = line[14]

        base_player["total_withdraw"] = line[15]
        base_player["time_long"] = line[16]
        base_player["game_count"] = line[17]
        base_player["p_code"] = line[18]
        base_player["invite_code"] = line[19]
        base_player["status"] = get_player_state(line[20])

        ## 查询新手卡数
        sql = '''
            select count(1)
            from log_activity
            where activity_type = 4
            and detail like '%%%d,%%'
        ''' % line[0]
        base_player["newbie_card"] = LogQry(channel).qry(sql)[0][0]

    return render_template('player_monies.html',
                           status_msg=status_msg,
                           base_player=base_player)
Example #6
0
def search_game_user_detail():
    PID = request.args.get('PlayerID', '')
    NickName = request.args.get('NickName', '')
    Account = request.args.get('Account', '')
    # 接收渠道id
    channel = session['select_channel']

    if (PID and NickName) or (PID and Account) or (NickName and Account):
        return jsonify(result=0, msg=u'玩家ID、玩家昵称、玩家账号只能输入其一!')

    WHERE = ""
    if PID:
        WHERE += " and id = %s" % PID
    if NickName:
        WHERE += " and nick = '%s'" % NickName
    if Account:
        WHERE += " and account_id = '%s'" % Account

    if not WHERE:
        return jsonify(result='failed', msg=u'请输入玩家ID或玩家昵称或玩家账号!')

    sql = '''
        select id, nick, reg_time, client_id, reg_ip,
            coin, account_id, device, did, last_login_ip,
            phone, last_login_time, did, subgame, total_recharge_rmb,
            total_withdraw, time_long, 
                (select ifnull(sum(game_count), 0) from t_player_subgame where pid = a.id)
        from player a
        where 1=1 %s
    ''' % WHERE

    base_player = {}
    for line in LogQry(channel).qry(sql):
        base_player["id"] = line[0]
        base_player["nick"] = line[1]
        base_player["reg_time"] = time_util.formatDateTime(line[2])
        base_player["channel_id"] = line[3]
        base_player["reg_ip"] = line[4]
        base_player["account_id"] = line[6]

        base_player["phone"] = line[10]

        try:
            r = GameWeb(channel).post("/api/get_player_info",
                                      {'pid': int(line[0])})
            coin = r['result']['coin']
            bank = r['result']['dep']
            base_player["coin"] = game_util.coin_translate(channel, coin)
            base_player["banker"] = game_util.coin_translate(channel, bank)
            vip = r["result"]['vip']
            counter = r['result']["counter"]
            counter = "".join([struct.pack("B", int(x)) for x in counter])
            bank, acc, name, addr = game_util.get_bank_info(counter)
            base_player["bank_no"] = "%s/%s/%s" % (bank, acc, addr)
            base_player["bank_acc"] = name
            acc, name = game_util.get_zfb_info(counter)
            base_player["zfb"] = "%s/%s" % (acc, name)
            status = r['result']["ban"]
            status = "".join([struct.pack("B", int(x)) for x in status])
            base_player["status"] = get_player_state(status)
            sql = 'select member_level_name from admin_member_level where id = %d' % int(
                vip)
            base_player["vip"] = LogQry(channel).qry(sql)[0][0]
        except BaseException as e:
            print "qry user detail..", e
            pass

        base_player["platform"] = line[7]
        base_player["did"] = line[8]
        base_player["last_login_ip"] = line[9]
        base_player["last_login_time"] = time_util.formatDateTime(line[11])
        base_player["did"] = line[12]

        base_player["subgame"] = game_parameter.get_subgame_name(line[13])
        base_player["total_recharge_rmb"] = line[14]

        base_player["total_withdraw"] = line[15]
        base_player["time_long"] = line[16] / 60
        base_player["game_count"] = int(line[17])

        ## 查询新手卡数
        sql = '''
            select count(1)
            from log_activity
            where activity_type = 4
            and detail like '[%s,[%%'
        ''' % line[0]
        base_player["newbie_card"] = LogQry(channel).qry(sql)[0][0]

        ## 查询代理相关信息
        sql = '''
            select (select level_name from admin_agent_level where id = agent_level), status
            from admin_agent_list a
            where pid = %d
        ''' % line[0]
        try:
            agent_lv, agent_status = LogQry(channel).qry(sql)[0]
            base_player["agent_status"] = map_agent_status[int(agent_status)]
            base_player["agent_lv"] = agent_lv
        except:
            base_player["agent_status"] = ""
            base_player["agent_lv"] = ""

        ## 查询推广玩家数
        sql = '''
            select p_code, invite_id, invite_code, (select count(1) from player_agent where invite_id = %d)
            from player_agent
            where pid = %d
        ''' % (line[0], line[0])
        try:
            (p_code, invite_id, invite_code,
             invite_count) = LogQry(channel).qry(sql)[0]
            base_player["p_code"] = p_code
            base_player["invite_id"] = invite_id
            base_player["invite_code"] = invite_code
            base_player["invite_count"] = invite_count
        except BaseException as e:
            # print "qry agent info...", e
            base_player["p_code"] = ""
            base_player["invite_id"] = 0
            base_player["invite_code"] = ""
            base_player["invite_count"] = 0

    return jsonify(result="ok", data=base_player)
Example #7
0
def maniplate_single_player_post():
    page = deepcopy(single_player_page)

    data = request.form

    PlayerStatus = int(data.get("playerstatus"))
    PlayerID = data.get("PlayerID").strip()
    NickName = data.get("NickName")
    Channel = session['select_channel']
    TotalWin = data.get("totalwin").strip()
    ProtectStatus = int(data.get("protectstatus"))
    IP = data.get("ip").strip()

    ctl_info = get_total_ctl_info(Channel)
    page["winControlNum"] = int(float(ctl_info[0]))
    page["winControlMoney"] = game_util.coin_translate(Channel,
                                                       int(ctl_info[1]))
    page["loseControlNum"] = int(float(ctl_info[2]))
    page["loseControlMoney"] = game_util.coin_translate(
        Channel, int(ctl_info[3]))

    if PlayerStatus == 1:
        ## 查询在线玩家  那没办法 只能去erlang那边请求了
        payLoad = {
            "PlayerID": PlayerID,
            "NickName": NickName,
            "TotalWin": TotalWin,
            "ProtectStatus": ProtectStatus,
            "IP": IP
        }
        page["datas"] = GameWeb(Channel).post("/api/player_ctl_qry", payLoad)
    elif PlayerStatus == 0:
        ## 查询游戏列表
        subgamelist = game_parameter.get_subgame_list()

        ## 全部 那好吧 去游戏服的mysql查吧
        sql = '''
            select id, nick, coin, total_output - total_stake, today_output - today_stake, 
                "", water, set_water, acc_water, (select invite_id from player_agent where pid = id), 
                time_long, subgame, last_login_ip, last_set_water_time, ban
            from player
            where 1 = 1
        '''

        if PlayerID != "":
            sql += " and id = %s" % PlayerID
        if NickName != "":
            sql += " and nick = '%s'" % NickName
        if ProtectStatus == 1:
            sql += " and water <> 0"
        elif ProtectStatus == 2:
            sql += " and water = 0"
        if IP != "":
            sql += " and last_login_ip = '%s'" % IP

        QueryData = LogQry(Channel).qry(sql)
        if TotalWin != "":
            sql = '''
                select pid
                from (
                    select pid, (sum(output_coin - stake_coin)) as val
                    from t_player_subgame
                    where pid in ('%s')
                    group by pid
                    ) as a
                where val >= %s
            ''' % (",".join([str(i[0]) for i in QueryData]), TotalWin)
            pids = [i[0] for i in LogQry(Channel).qry(sql)]
            Datas = [i for i in QueryData if i[0] in pids]
        else:
            Datas = QueryData

        ## 处理玩家在线状态问题
        FinalDatas = []
        for item in Datas:
            item = list(item)
            subgame = erl.binary_to_term(item[11])
            if subgame[0] == "subgame_info":
                item[11] = game_parameter.get_subgame_by_id(
                    subgamelist, subgame[1])
            else:
                item[11] = u""
                ban = erl.binary_to_term(item[14])
                for k, v in ban:
                    if k == "online" and v == 1:
                        item[14] = u"在线"
            item.pop()
            FinalDatas.append(item)

        page["datas"] = FinalDatas

    return jsonify(result='ok', data=page)