예제 #1
0
def book_chapter_data():
    book_id = request.args.get('book_id', 0, int)
    url = current_app.config['STATS_URL'] + '/admin/book_chapter_data'
    ret = requests_all(url, request.args.to_dict(),'get').json()
    if ret['code'] != 0:
        return json.dumps(ret)
    else:
        ret = ret['data']
    data_list = []
    for chapter_id in ret.keys():
        bc = BookChapters.query.filter_by(book_id=book_id, chapter_id=chapter_id).first()
        data = ret[chapter_id]
        data['chapter_name'] = bc.chapter_name if bc else 'unknow'
        data['need_fee'] = bc.money if bc else 0
        data_list.append(data)
    return json.dumps({'code':0, 'data': data_list})
예제 #2
0
def realtime():
    url = current_app.config['CHANNEL_URL']
    realtime_type = request.args.get('type', '')
    type_list = [
        'bind_realtime', 'activate_realtime', 'regist_realtime',
        'pay_realtime', 'pay_number', 'click_realtime', 'display_realtime',
        'newcommer_pay_number', 'newcommer_pay_realtime'
    ]
    if realtime_type not in type_list:
        return json.dumps({
            'code': 1,
            'msg': 'type error. type=%s' % (realtime_type)
        })
    else:
        tmp_url = url + '/statistics/' + realtime_type
        return requests_all(tmp_url, request.args.to_dict(), 'get').text
예제 #3
0
def book_data():
    url = current_app.config['STATS_URL'] + '/admin/book_data'
    ret = requests_all(url, request.args.to_dict(),'get').json()
    if ret['code'] != 0:
        return json.dumps(ret)
    else:
        ret = ret['data']
    data_list = []
    for book_id in ret.keys():
        bk = Book.query.filter_by(book_id=book_id).first()
        data = ret[book_id]
        data['book_name'] = bk.book_name if bk else 'unknow'
        data['author_name'] = bk.author_name if bk else 'unknow'
        data['source'] = bk.source if bk else 'unknow'
        if bk:
            data['cate_id'] = bk.to_admin_dict()['cate_id']
        else:
            data['cate_id'] = 'unknow'
        data['book_id'] = book_id
        if book_id == '0':
            data['book_name'] = u'所有'
        data_list.append(data)
    return json.dumps({'code':0, 'data': data_list})
예제 #4
0
def get_activate_recharge():
    url = current_app.config['CHANNEL_URL'] + '/analysis/get_activate_recharge'
    return requests_all(url, request.args.to_dict(), 'get').text
예제 #5
0
def get_remain_num():
    url = current_app.config['CHANNEL_URL'] + '/analysis/get_remain_num'
    return requests_all(url, request.args.to_dict(), 'get').text
예제 #6
0
def get_recharge_detail_info():
    url = current_app.config[
        'CHANNEL_URL'] + '/analysis/get_recharge_detail_info'
    return requests_all(url, request.args.to_dict(), 'get').text
예제 #7
0
def get_channels():
    url = current_app.config['CHANNEL_URL'] + '/analysis/channels'
    return requests_all(url, request.args.to_dict(), 'get').text
예제 #8
0
def channel_data_detail():
    url = current_app.config['CHANNEL_URL'] + '/statistics/channel_data_detail'
    return requests_all(url, request.args.to_dict(), 'get').text
예제 #9
0
def add_channel():
    url = current_app.config['CHANNEL_URL'] + '/admin/add_channel'
    return requests_all(url, request.form.to_dict(), 'post').text
예제 #10
0
def channel_list():
    url = current_app.config['CHANNEL_URL'] + '/admin/channel_list'
    return requests_all(url, request.args.to_dict(), 'get').text