Ejemplo n.º 1
0
def get_all_notice():
    notice_db_path = os.path.join(settings.DB_PATH, 'notice')
    notice_file_list = common.get_all_file(notice_db_path)
    print(notice_file_list)
    notice_list = []
    for notice in notice_file_list:
        notice_list.append(dbhandler.select(notice, 'notice'))
    return notice_list
Ejemplo n.º 2
0
def check_all_school():
    '''

    :return:
    '''
    base_dir_school = os.path.join(settings.BASE_DB, 'school')
    school_list = common.get_all_file(base_dir_school)
    return school_list
Ejemplo n.º 3
0
def get_all_download_record():
    download_record_db_path = os.path.join(settings.DB_PATH, 'download_record')
    download_record_file_list = common.get_all_file(download_record_db_path)
    print(download_record_file_list)
    record_list = []
    for download_record in download_record_file_list:
        record_list.append(dbhandler.select(download_record,
                                            'download_record'))
    return record_list
def check_notice(user_dic):
    path = os.path.join(setting.BASE_DB, 'notice')
    if not os.path.exists(path):
        return {'flag': False, 'msg': '暂无公告'}
    notice_list = common.get_all_file(path)
    back_notice_list = []
    if notice_list:  # 不为空,继续查询,为空直接返回false
        for m in notice_list:
            notice = models.Notice.get_obj_by_name(m)
            back_notice_list.append({notice.name: notice.content})
        return {'flag': True, 'notice_list': back_notice_list}
    else:
        return {'flag': False, 'msg': '暂无公告'}
Ejemplo n.º 5
0
def get_all_movie():
    movie_db_path = os.path.join(settings.DB_PATH, 'movie')
    movie_file_list = common.get_all_file(movie_db_path)
    print(movie_file_list)
    movie_list = []
    # aa3 = dbhandler.select('aa3','movie')
    # print(aa3)
    for movie in movie_file_list:
        movie_list.append(dbhandler.select(movie, 'movie'))
    return movie_list


# if __name__ == '__main__':
#     get_all_movie()
def get_movie_list(user_dic):
    movie_list = common.get_all_file(setting.BASE_MOVIE_LIST)
    back_movie_list = []
    if movie_list:  # 不为空,继续查询,为空直接返回false
        for m in movie_list:
            movie = models.Movie.get_obj_by_name(m)
            if not movie.is_delete:
                back_movie_list.append(
                    [movie.name, '免费' if movie.is_free else '收费'])
        if back_movie_list:
            return {'flag': True, 'movie_list': back_movie_list}
        else:
            return {'flag': False, 'msg': '暂无可删除影片'}
    else:
        return {'flag': False, 'msg': '暂无影片'}
Ejemplo n.º 7
0
def check_all_course():
    base_dir_course = os.path.join(setting.BASE_DB, 'course')
    course_list = common.get_all_file(base_dir_course)
    return course_list