• 课程章节页面


    具体课程章节页面

    1.获取具体课程章节 信息

    1.1 路由地址

    http://192.168.56.100:8888/course/course/2/

    • 返回效果展示
    {
    "id": 2,
    "chapters": [
    {
    "id": 1,
    "sections": [
    {
    "id": 1,
    "create_time": "2020-10-11T01:57:03.431870Z",
    "update_time": "2020-10-11T02:03:47.543988Z",
    "title": "Linux基本概念介绍",
    "serial_num": 1,
    "learn_time": 1,
    "video":
    "http://192.168.56.100:8888/media/videos/20201011/07.%E6%A3%80%E6%9F%A5%E7%94%A8%
    E6%88%B7%E5%90%8D%E6%98%AF%E5%90%A6%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3.mp4",
    "seq_num": 1,
    "chapters": 1
    }
    ],
    "create_time": "2020-10-11T01:53:59.821333Z",
    "update_time": "2020-10-11T01:53:59.821395Z",
    "title": "Linux 系统简介",
    "serial_num": 1,
    "course": 2
    }
    ],
    "create_time": "2020-10-11T01:46:26.000141Z",
    "update_time": "2020-10-11T02:23:03.753819Z",
    "title": "Linux基础入门",
    "desc": "要在实验楼愉快地学习,先要熟练地使用 Linux,本实验介绍 Linux 基本操作,shell
    环境下的常用命令。",
    "img": "http://192.168.56.100:8888/media/course/linux.jpg",
    "status": "1",
    "attention": 10,
    "learner": 100,
    "course_type": 2,
    "course_tag": [
    4
    ]
    }
    

    视频接口

    1.视频播放页面接口开发

    1.1 course/urls.py 添加路由

    router.register(r'sections', views.SectionsViewSet)

    1.2 course/serializers.py 写序列化器

    from rest_framework import serializers 
    from course.models import Sections
    
    class SectionsSerializer(serializers.ModelSerializer):
        class Meta:
            model=Sections
            fields='__all__'
    

    1.3 course/views.py 添加视图函数

    class SectionsViewSet(viewsets.ModelViewSet):
        queryset = Sections.objects.all()
        serializer_class = SectionsSerializer
    

    1.4测试接口

    Http://192.168.56.100:8888/course/sections/

  • 相关阅读:
    2 行为型模式之
    1 行为型模式之
    WinSCP无法连接 ubuntu 的解决方法
    command 'x86_64-linux-gnu-gcc' failed with exit status 1错误及解决方案
    Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel
    CentOS 7 安装、配置、使用 PostgreSQL 9.5及PostGIS2.2
    R实战之热点图(HeatMap)
    Windows下Eclipse连接hadoop
    Ubuntu下eclipse开发hadoop应用程序环境配置
    Hadoop集群环境搭建
  • 原文地址:https://www.cnblogs.com/sq1995liu/p/14171209.html
Copyright © 2020-2023  润新知