Ejemplo n.º 1
0
def get_subgame_name(SubGame):
    subgamelist = get_subgame_list()
    subgame = erl.binary_to_term(SubGame)
    if subgame[0] == "subgame_info":
        subgame = subgamelist[subgame[1]]
        return subgame

    return ""
Ejemplo n.º 2
0
def get_bank_coin(Counter):
    Counter = erl.binary_to_term(Counter)
    for k, v in Counter:
        if k == 14001:
            for kk, vv in v:
                if kk == "deposit":
                    return vv
    return 0
Ejemplo n.º 3
0
def get_zfb_info(Counter):
    acc = ""
    name = ""
    Counter = erl.binary_to_term(Counter)
    for k, v in Counter:
        if k == 11010:
            for kk, vv in v:
                if kk == "zfb_reg_name":
                    name = vv
                elif kk == "zfb_acc":
                    acc = vv
    return acc, name
Ejemplo n.º 4
0
def get_bank_info(Counter):
    acc = ""
    name = ""
    bank = ""
    addr = ""
    Counter = erl.binary_to_term(Counter)
    for k, v in Counter:
        if k == 11010:
            for kk, vv in v:
                if kk == "bank_reg_name":
                    name = vv
                elif kk == "bank_acc":
                    acc = vv
                elif kk == 'bank_name':
                    bank = vv
                elif kk == "bank_detail":
                    addr = vv
    return bank, acc, name, addr
Ejemplo n.º 5
0
def get_player_state(Data):
    val = erl.binary_to_term(Data)
    s = []
    reason = ""
    time = ""
    try:
        for k, v in val:
            if k == "reason":
                reason = v
            elif k == "time":
                time = time_util.formatDateTime(int(v))
            elif v == 1:
                s.append(player_state_d[k])
        if not s:
            return ""
        ss = "/".join(s)
        if reason:
            return "%s(%s %s)" % (ss, reason, time)
        return ss
    except:
        return ""
Ejemplo n.º 6
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)