[关闭]
@chenwei123 2016-08-11T13:20:40.000000Z 字数 27438 阅读 861

课程文档

益安


1.1. 创建课程

Description

用户创建课程信息

Method and URL Structure

Method Resource URL
POST /education/courses/

Request Parameters

Name Description Required Default
name 课程名 Yes
description 课程描述 No
category 分类资源的pk/id No
picture 课程图片 No
amount 课程价格 No
grade 课程分级 No junior
pay_course 课程是否付费 No recommend
property_course 课程属性 No develop
  • grade 课程等级分为三级,初级课程(junior)、中级课程(middle)、高级课程(senior),默认是初级课程
  • pay_course 课程种类分为三级,推荐课程(recommend)、免费课程(free)、优惠课程(discount),默认是推荐课程
  • property_course 课程属性分为四种,开发(develop)、运维(operation)、测试(test)、网络(network)

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "name":"English",
  3. "description":"这是一门课",
  4. "category":1,
  5. "picture":"http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg",
  6. "amount":"100.00",
  7. "grade":"junior",
  8. "pay_course":"recommend",
  9. "property_course":"develop",
  10. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 7309fa07c22e0a00eada158989b89ffe839ef' -d 'name=collection的使用&description=这是一个关于瀑布流开发的视频课程&category=9&picture=http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg&amount=100.00&grade=junior&pay_course=recommend&property_course=develop' http://127.0.0.1:8000/education/courses/

JSON Response

  1. {
  2. "pk":9,
  3. "owner":"teacher",
  4. "category":9,
  5. "name":"collection的使用",
  6. "description":"这是一个关于瀑布流开发的视频课程",
  7. "picture":"http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg",
  8. "amount":"100.00",
  9. "grade":"junior",
  10. "pay_course":"recommend",
  11. "property_course":"develop",
  12. "click":0,
  13. "payment_count":0,
  14. "create_time":"2016-04-27T06:28:12.440931Z"
  15. }

1.2. 修改课程

Description

用户修改课程信息

Method and URL Structure

Method Resource URL
PUT /education/courses/${pk}/

Request Parameters

Name Description Required Default
name 课程名 Yes
description 课程描述 No
category 分类资源pk/id No
picture 课程图片 No
amount 课程价格 No
grade 课程分级 No junior
pay_course 课程是否付费 No recommend
property_course 课程属性 No develop

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "name":"数学",
  3. "description":"这是一门课",
  4. "category":1,
  5. "picture":"http://example.com/1.jpg",
  6. "amount":"101.00",
  7. "grade":"junior",
  8. "pay_course":"recommend",
  9. "property_course":"develop",
  10. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'name=数学&description=math&category=1&picture=http://baidu.com/1.jpg&amount=101.00&grade=junior&pay_course=recommend&property_course=develop' http://127.0.0.1:8000/education/courses/1/

JSON Response

  1. {
  2. "pk":3,
  3. "owner":"teacher",
  4. "category":1,
  5. "name":"English",
  6. "description":"this is an lession.",
  7. "picture":"http://baidu.com/1.jpg",
  8. "amount":"101.00",
  9. "grade":"junior",
  10. "pay_course":"recommend",
  11. "property_course":"develop",
  12. "click":0,
  13. "payment_count":0,
  14. "create_time":"2016-04-12 10:30:20",
  15. }

1.3. 删除课程

Description

用户删除课程信息

Method and URL Structure

Method Resource URL
DELETE /education/courses/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/courses/1/

JSON Response

Name Description Default
detail 失败原因 Not found
status 成功 204

1.4. 查看具体课程

Description

用户查询某一课程信息

Method and URL Structure

Method Resource URL
GET /education/courses/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/courses/1/

JSON Response

  1. {
  2. "pk": 6,
  3. "owner": null,
  4. "name": "超越满意-基于客户口碑的忠诚度管理(NPS)",
  5. "lecturer_describe": "",
  6. "description": "孙健\r\n曾任职于中国石化集团齐鲁石化公司、英国石油(BP上海赛科)公司 开发设计的《忠诚度净值(NPS)管理》荣获得2015年全国优秀课程奖 多年企业管理实战经验的积累、沉淀,孙健老师在培训和咨询服务项目中尤其善长:客户关系管理、企业赢利模式、企业文化、领导力、执行力、流程诊断、风险管理(MOR)、危机决策、问题解决、创新与敏捷项目、绩效管理(ISPI)、培训课程设计(6D)之类课题的定制化交付。",
  7. "picture": "http://www.51ean.com/res/attachment/adv/201605250917400977.jpg",
  8. "amount": "0.01",
  9. "original_price": "0.00",
  10. "grade": "junior",
  11. "click": 0,
  12. "payment_count": 0,
  13. "create_time": "2016-05-04T01:40:52.602954Z",
  14. "category": {
  15. "pk": 1,
  16. "name": "公开课",
  17. "parent": -1,
  18. "desc": "",
  19. "poster": ""
  20. },
  21. "course_type": "develop",
  22. "course_type_display": "开发",
  23. "authenticated": true,
  24. "support_exam": true,
  25. "free_course": false,
  26. "discount_course": true,
  27. "recommend": true,
  28. "videos": [
  29. {
  30. "pk": 8,
  31. "owner": "13264247066",
  32. "course": 6,
  33. "title": "ceshi2",
  34. "video_link": "https://media.html5media.info/video.mp4",
  35. "video_duration": "dddddd",
  36. "lecturer": "ddddd",
  37. "create_time": "2016-07-28T08:32:06.730000Z",
  38. "actual_study_number": 4,
  39. "is_audition": true
  40. },
  41. {
  42. "pk": 6,
  43. "owner": "root",
  44. "course": 6,
  45. "title": "NPS3",
  46. "video_link": "",
  47. "video_duration": "",
  48. "lecturer": "",
  49. "create_time": "2016-05-06T02:34:26.499576Z",
  50. "actual_study_number": 0,
  51. "is_audition": false
  52. },
  53. {
  54. "pk": 5,
  55. "owner": "root",
  56. "course": 6,
  57. "title": "NPS2",
  58. "video_link": "",
  59. "video_duration": "",
  60. "lecturer": "",
  61. "create_time": "2016-05-05T12:23:39.786396Z",
  62. "actual_study_number": 0,
  63. "is_audition": false
  64. },
  65. {
  66. "pk": 1,
  67. "owner": "root",
  68. "course": 6,
  69. "title": "NPS",
  70. "video_link": "",
  71. "video_duration": "",
  72. "lecturer": "",
  73. "create_time": "2016-05-05T06:40:41.895790Z",
  74. "actual_study_number": 0,
  75. "is_audition": false
  76. }
  77. ],
  78. "examRule": []
  79. }

1.5. 获取所有课程

Description

用户查看所有课程信息

Method and URL Structure

Method Resource URL
GET /education/courses/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1
category 课程分类资源的pk/id No
  • 如果有category字段,且值不为空,得到的是某分类下所有课程
  • 如果没有category字段,得到到是所有的课程信息

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/courses/?category=1

JSON Response

  1. {
  2. "count": 10,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 10,
  8. "owner": null,
  9. "name": "Linux web渗透测试",
  10. "description": "系统安全,渗透测试",
  11. "picture": "http://www.51ean.com/res/attachment//store/3/goods/201607011753236704_small.jpg",
  12. "amount": "200.00",
  13. "grade": "junior",
  14. "click": 0,
  15. "payment_count": 0,
  16. "create_time": "2016-07-04T15:53:51.716707Z",
  17. "category": {
  18. "pk": 10,
  19. "name": "系统安全",
  20. "parent": 3
  21. },
  22. "course_type": "develop",
  23. "course_type_display": "开发",
  24. "authenticated": false,
  25. "support_exam": true,
  26. "free_course": false,
  27. "discount_course": false,
  28. "recommend": true,
  29. "videos": [],
  30. "examRule": [
  31. {
  32. "pk": 5,
  33. "title": "linuxweb渗透考试2016",
  34. "description": "111111111111111111111111111111",
  35. "point": 2,
  36. "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg",
  37. "price": "2.00",
  38. "exercise_number": 10
  39. }
  40. ]
  41. },
  42. {
  43. "pk": 9,
  44. "owner": null,
  45. "name": "网络通讯协议",
  46. "description": "网络通讯协议",
  47. "picture": "http://www.51ean.com/res/attachment//store/3/goods/201605251843243761_small.jpg",
  48. "amount": "14.00",
  49. "grade": "junior",
  50. "click": 0,
  51. "payment_count": 0,
  52. "create_time": "2016-07-04T15:27:17.008638Z",
  53. "category": {
  54. "pk": 3,
  55. "name": "网络与系统安全",
  56. "parent": -1
  57. },
  58. "course_type": "develop",
  59. "course_type_display": "开发",
  60. "authenticated": false,
  61. "support_exam": false,
  62. "free_course": false,
  63. "discount_course": false,
  64. "recommend": false,
  65. "videos": [],
  66. "examRule": [
  67. {
  68. "pk": 6,
  69. "title": "网络通讯协议考试2016",
  70. "description": "网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016",
  71. "point": 2,
  72. "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg",
  73. "price": "2.00",
  74. "exercise_number": 5
  75. }
  76. ]
  77. }
  78. ]
  79. }

2.1. 创建课程分类

Description

用户创建课程分类

Method and URL Structure

Method Resource URL
POST /education/categorys/

Request Parameters

Name Description Required Default
name 分类名称 Yes
parent 所属父级分类资源的pk/id Yes -1

parent 字段默认是-1,代表一级分类,parent字段为某分类的pk/id时,代表该分类下的子分类

Request Header

Name Description Required Default
Authorization Token 320a37f43fa80f52af27abe3b468d74204ccd180 Yes

*Authorization的值为登录成功后返回值

JSON Request

  1. {
  2. "name":"ios开发",
  3. "parent":1,
  4. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 320a37f43fa80f52af27abe3b468d74204ccd180' -d 'name=开发&parent=1' http://127.0.0.1:8000/education/categorys/

JSON Response

  1. {
  2. "pk":7,
  3. "name":"ios开发",
  4. "parent":1,
  5. }

2.2. 获取所有课程分类

Description

用户获取所有课程分类

Method and URL Structure

Method Resource URL
GET /education/categorys/

Request Parameters

Name Description Required Default
parent 某分类资源的pk/id Yes

parent 为-1时得到的是一级分类,为其他时得到是该分类下的子分类

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Ton 320a37f43fa80f52af27abe3b468d74204ccd180' http://127.0.0.1:8000/education/categorys/?parent=-1

JSON Response

  1. [
  2. {"pk":1,"name":"开发","parent":-1},
  3. {"pk":2,"name":"测试","parent":-1},
  4. {"pk":3,"name":"运维","parent":-1},
  5. {"pk":4,"name":"安全","parent":-1}
  6. ]

3.1. 创建视频

Description

用户创建课程视频

Method and URL Structure

Method Resource URL
POST /education/videos/

Request Parameters

Name Description Required Default
title 视频标题 Yes
video_link 视频地址 Yes
video_duration 视频时长 No
lecturer 讲师 No
course 课程资源的pk/id Yes

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "title":"密码学",
  3. "video_link":"http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  4. "course":1,
  5. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'title=密码学应用&video_link=http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25&course=1' http://127.0.0.1:8000/education/videos/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": 1,
  5. "title": "密码学应用",
  6. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  7. "video_duration": null,
  8. "lecturer": null,
  9. "create_time": "2016-04-19T08:54:22.719390Z"
  10. }

3.2. 修改视频信息

Description

用户修改具体视频信息

Method and URL Structure

Method Resource URL
PUT /education/videos/${pk}/

Request Parameters

Name Description Required Default
title 视频标题 Yes
video_link 视频地址 Yes
video_duration 视频时长 No
lecturer 讲师 No

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "title":"密码",
  3. "video_link":"http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  4. "video_duration":"01:30:30",
  5. "lecturer":"小红",
  6. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'title=密码&video_link=http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25&video_duration=01:30:30&lecturer=小红' http://127.0.0.1:8000/education/videos/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": 1,
  5. "title": "密码",
  6. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  7. "video_duration": "01:30:30",
  8. "lecturer": "小红",
  9. "create_time": "2016-04-19T08:54:22.719390Z"
  10. }

3.3. 删除视频

Description

用户删除视频

Method and URL Structure

Method Resource URL
DELETE /education/videos/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/videos/1/

JSON Response

Name Description Default
detail 失败原因 Not found
status 成功 204

3.4. 查看具体视频信息

Description

用户查询某一视频信息

Method and URL Structure

Method Resource URL
GET /education/videos/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/videos/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": 1,
  5. "title": "密码",
  6. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  7. "video_duration": "01:30:30",
  8. "lecturer": "小红",
  9. "create_time": "2016-04-19T08:54:22.719390Z"
  10. }

3.5. 获取某一课程下所有视频

Description

用户查看所有视频信息

Method and URL Structure

Method Resource URL
GET /education/videos/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1
course 课程资源的pk/id Yes

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/videos/?course=1

JSON Response

  1. {
  2. "count": 3,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 3,
  8. "owner": "teacher",
  9. "course": 1,
  10. "title": "密码学应用",
  11. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  12. "video_duration": null,
  13. "lecturer": null,
  14. "create_time": "2016-04-19T09:42:46.729442Z"
  15. },
  16. {
  17. "pk": 2,
  18. "owner": "teacher",
  19. "course": 1,
  20. "title": "密码学应用",
  21. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  22. "video_duration": null,
  23. "lecturer": null,
  24. "create_time": "2016-04-19T09:42:42.842879Z"
  25. },
  26. {
  27. "pk": 1,
  28. "owner": "teacher",
  29. "course": 1,
  30. "title": "密码",
  31. "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25",
  32. "video_duration": "01:30:30",
  33. "lecturer": "小红",
  34. "create_time": "2016-04-19T08:54:22.719390Z"
  35. }
  36. ]
  37. }

4.1. 创建评价

Description

用户创建课程评价

Method and URL Structure

Method Resource URL
POST /education/evaluates/

Request Parameters

Name Description Required Default
score 评分 Yes
content 评价内容 No
course 课程资源的pk/id Yes
  • score, 5代表优, 3代表良, 1代表差

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "score":5,
  3. "content":"very good",
  4. "course":1,
  5. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'score=5&content=very good&course=1' http://127.0.0.1:8000/education/evaluates/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": {
  5. "pk": 1,
  6. "owner": "teacher",
  7. "category": 1,
  8. "name": "数学",
  9. "description": "math",
  10. "picture": "http://123.jpg",
  11. "amount": "20.00",
  12. "grade": "junior",
  13. "pay_course": "recommend",
  14. "property_course":"develop",
  15. "click": 0,
  16. "payment_count": 0,
  17. "create_time": "2016-04-11T07:42:40.097367Z"
  18. },
  19. "score": 5,
  20. "content": "very good",
  21. "create_time": "2016-04-30T14:57:40.062543Z"
  22. }

4.2. 修改评价信息

Description

用户修改具体评论信息

Method and URL Structure

Method Resource URL
PUT /education/evaluates/${pk}/

Request Parameters

Name Description Required Default
score 评分 Yes 0
content 评价内容 No

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

Request

  1. {
  2. "score":3,
  3. "content":"not bad",
  4. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'score=3&content=not bad' http://127.0.0.1:8000/education/evaluates/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": {
  5. "pk": 1,
  6. "owner": "teacher",
  7. "category": 1,
  8. "name": "数学",
  9. "description": "math",
  10. "picture": "http://123.jpg",
  11. "amount": "20.00",
  12. "grade": "junior",
  13. "pay_course": "recommend",
  14. "property_course":"develop",
  15. "click": 0,
  16. "payment_count": 0,
  17. "create_time": "2016-04-11T07:42:40.097367Z"
  18. },
  19. "score": 3,
  20. "content": "not bad",
  21. "create_time": "2016-04-30T14:57:40.062543Z"
  22. }

4.3. 删除评论

Description

用户删除评论

Method and URL Structure

Method Resource URL
DELETE /education/evaluates/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/evaluates/1/

JSON Response

Name Description Default
detail 失败原因 Not found
status 成功 204

4.4. 查看具体评论信息

Description

用户查询某一评论信息

Method and URL Structure

Method Resource URL
GET /education/evaluates/${pk}/

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/evaluates/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "owner": "teacher",
  4. "course": {
  5. "pk": 1,
  6. "owner": "teacher",
  7. "category": 1,
  8. "name": "数学",
  9. "description": "math",
  10. "picture": "http://123.jpg",
  11. "amount": "20.00",
  12. "grade": "junior",
  13. "pay_course": "recommend",
  14. "property_course":"develop",
  15. "click": 0,
  16. "payment_count": 0,
  17. "create_time": "2016-04-11T07:42:40.097367Z"
  18. },
  19. "score": 3,
  20. "content": "not bad",
  21. "create_time": "2016-04-30T14:57:40.062543Z"
  22. }

5.5. 获取某一课程下所有评论

Description

用户查看所有评论信息

Method and URL Structure

Method Resource URL
GET /education/evaluates/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1
course 课程资源的pk/id Yes

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/evaluates/?course=1

JSON Response

  1. {
  2. "count": 1,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 1,
  8. "owner": "teacher",
  9. "course": {
  10. "pk": 1,
  11. "owner": "teacher",
  12. "category": 1,
  13. "name": "数学",
  14. "description": "math",
  15. "picture": "http://123.jpg",
  16. "amount": "20.00",
  17. "grade": "junior",
  18. "pay_course": "recommend",
  19. "property_course":"develop",
  20. "click": 0,
  21. "payment_count": 0,
  22. "create_time": "2016-04-11T07:42:40.097367Z"
  23. },
  24. "score": 3,
  25. "content": "not bad",
  26. "create_time": "2016-04-30T14:57:40.062543Z"
  27. }
  28. ]
  29. }

01. 获取我购买的课程

Description

用户查看所有课程信息

Method and URL Structure

Method Resource URL
GET /education/my_courses/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/my_courses/?page=1

JSON Response

  1. {
  2. "count": 6,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 6,
  8. "owner": "teacher",
  9. "category": null,
  10. "name": "物理",
  11. "description": null,
  12. "picture": "",
  13. "amount": "0.00",
  14. "grade": "junior",
  15. "pay_course": "recommend",
  16. "property_course":"develop",
  17. "click": 0,
  18. "payment_count": 0,
  19. "create_time": "2016-04-16T10:41:40.439941Z"
  20. },
  21. {
  22. "pk": 5,
  23. "owner": "teacher",
  24. "category": 1,
  25. "name": "物理",
  26. "description": "",
  27. "picture": "",
  28. "amount": "0.00",
  29. "grade": "junior",
  30. "pay_course": "recommend",
  31. "property_course":"develop",
  32. "click": 0,
  33. "payment_count": 0,
  34. "create_time": "2016-04-13T06:29:39.353072Z"
  35. },
  36. {
  37. "pk": 4,
  38. "owner": "teacher",
  39. "category": 1,
  40. "name": "物理",
  41. "description": "",
  42. "picture": "",
  43. "amount": "0.00",
  44. "grade": "junior",
  45. "pay_course": "recommend",
  46. "property_course":"develop",
  47. "click": 0,
  48. "payment_count": 0,
  49. "create_time": "2016-04-12T03:38:46.946221Z"
  50. },
  51. {
  52. "pk": 3,
  53. "owner": "root",
  54. "category": 1,
  55. "name": "英语",
  56. "description": "",
  57. "picture": "http://123.jpg",
  58. "amount": "0.00",
  59. "grade": "junior",
  60. "pay_course": "recommend",
  61. "property_course":"develop",
  62. "click": 0,
  63. "payment_count": 0,
  64. "create_time": "2016-04-12T03:36:39.933083Z"
  65. },
  66. {
  67. "pk": 2,
  68. "owner": "teacher",
  69. "category": 1,
  70. "name": "英语",
  71. "description": "this is an english lession",
  72. "picture": "http://123.jpg",
  73. "amount": "100.00",
  74. "grade": "junior",
  75. "pay_course": "recommend",
  76. "property_course":"develop",
  77. "click": 0,
  78. "payment_count": 0,
  79. "create_time": "2016-04-12T03:26:53.544948Z"
  80. },
  81. {
  82. "pk": 1,
  83. "owner": "teacher",
  84. "category": 1,
  85. "name": "数学",
  86. "description": "math",
  87. "picture": "http://123.jpg",
  88. "amount": "20.00",
  89. "grade": "junior",
  90. "pay_course": "recommend",
  91. "property_course":"develop",
  92. "click": 0,
  93. "payment_count": 0,
  94. "create_time": "2016-04-11T07:42:40.097367Z"
  95. }
  96. ]
  97. }

02. 搜索课程

Description

用户根据课程名/课程属性搜索课程

Method and URL Structure

Method Resource URL
GET /education/courses_search/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1
keyword 课程名称关键字/课程属性 Yes

课程属性为:开发(develop)、运维(operation)、测试(test)、网络(network)
课程属性:推荐课程(recommend)、免费课程(free)、优惠课程(discount)

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/courses_search/?keyword=语

JSON Response

  1. {
  2. "count":2,
  3. "next":null,
  4. "previous":null,
  5. "results":
  6. [
  7. {
  8. "pk":3,
  9. "owner":"root",
  10. "category":1,
  11. "name":"英语",
  12. "description":"",
  13. "picture":"http://123.jpg",
  14. "amount":"0.00",
  15. "grade":"junior",
  16. "pay_course":"recommend",
  17. "property_course":"develop",
  18. "click":0,
  19. "payment_count":0,
  20. "create_time":"2016-04-12T03:36:39.933083Z"
  21. },
  22. {
  23. "pk":2,
  24. "owner":"teacher",
  25. "category":1,
  26. "name":"英语",
  27. "description":"this is an english lession",
  28. "picture":"http://123.jpg","amount":"100.00",
  29. "grade":"junior",
  30. "pay_course":"recommend",
  31. "property_course":"develop",
  32. "click":0,
  33. "payment_count":0,
  34. "create_time":"2016-04-12T03:26:53.544948Z"
  35. }
  36. ]
  37. }

03. 用户是否购买课程的验证

Description

用户根据课程id/pk,判断自己是否购买了此课程

Method and URL Structure

Method Resource URL
GET /education/course_verify/

Request Parameter

Name Description Required Default
course 课程id/pk Yes
video_id 视频id/pk Yes

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' http://127.0.0.1:8000/education/course_verify/?course=6&video_id=8

JSON Response

  1. {
  2. "pk": 8,
  3. "owner": "13264247066",
  4. "course": 6,
  5. "title": "ceshi2",
  6. "video_link": "https://media.html5media.info/video.mp4",
  7. "video_duration": "dddddd",
  8. "lecturer": "ddddd",
  9. "create_time": "2016-07-28T08:32:06.730000Z",
  10. "actual_study_number": 4,
  11. "is_audition": true
  12. }

Error JSON Response

  1. {
  2. "status": 0,
  3. "message": "没有购买该课程"
  4. }

04. 获取我购买的课程以及评价

Description

用户查看所有课程信息

Method and URL Structure

Method Resource URL
GET /education/my_list_courses/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1

Request Header

Name Description Required Default
Authorization Token 7309fabd207c22e0a00eada158989b89ffe839ef Yes

*Authorization的值为登录成功后返回值

cURL Example

  1. curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/my_list_courses/?page=1

JSON Response

  1. {
  2. "results": [
  3. {
  4. "status": "你还没有评价",
  5. "picture": "",
  6. "description": null,
  7. "grade": "junior",
  8. "property_course": "develop",
  9. "pay_course": "recommend",
  10. "create_time": "2016-04-16T10:41:40.439Z",
  11. "owner": "teacher",
  12. "click": 0,
  13. "name": "物理",
  14. "amount": "0.00",
  15. "pk": 6,
  16. "payment_count": 0
  17. },
  18. {
  19. "status": "你还没有评价",
  20. "picture": "",
  21. "description": "",
  22. "grade": "junior",
  23. "property_course": "develop",
  24. "pay_course": "recommend",
  25. "create_time": "2016-04-13T06:29:39.353Z",
  26. "owner": "teacher",
  27. "click": 0,
  28. "name": "物理",
  29. "amount": "0.00",
  30. "pk": 5,
  31. "payment_count": 0
  32. },
  33. {
  34. "status": "你还没有评价",
  35. "picture": "",
  36. "description": "",
  37. "grade": "junior",
  38. "property_course": "develop",
  39. "pay_course": "recommend",
  40. "create_time": "2016-04-12T03:38:46.946Z",
  41. "owner": "teacher",
  42. "click": 0,
  43. "name": "物理",
  44. "amount": "0.00",
  45. "pk": 4,
  46. "payment_count": 0
  47. },
  48. {
  49. "status": "你还没有评价",
  50. "picture": "http://123.jpg",
  51. "description": "",
  52. "grade": "junior",
  53. "property_course": "develop",
  54. "pay_course": "recommend",
  55. "create_time": "2016-04-12T03:36:39.933Z",
  56. "owner": "root",
  57. "click": 0,
  58. "name": "英语",
  59. "amount": "0.00",
  60. "pk": 3,
  61. "payment_count": 0
  62. },
  63. {
  64. "status": "你还没有评价",
  65. "picture": "http://123.jpg",
  66. "description": "this is an english lession",
  67. "grade": "junior",
  68. "property_course": "develop",
  69. "pay_course": "recommend",
  70. "create_time": "2016-04-12T03:26:53.544Z",
  71. "owner": "teacher",
  72. "click": 0,
  73. "name": "英语",
  74. "amount": "100.00",
  75. "pk": 2,
  76. "payment_count": 0
  77. },
  78. {
  79. "status": "已评价",
  80. "picture": "http://123.jpg",
  81. "description": "math",
  82. "grade": "junior",
  83. "property_course": "develop",
  84. "pay_course": "recommend",
  85. "create_time": "2016-04-11T07:42:40.097Z",
  86. "owner": "teacher",
  87. "click": 0,
  88. "name": "数学",
  89. "content": "not bad",
  90. "amount": "20.00",
  91. "score": 3,
  92. "pk": 1,
  93. "payment_count": 0
  94. }
  95. ]
  96. }

05. 过滤课程

Description

用户根据课程类型/课程是否付费/课程是否推荐过滤课程

Method and URL Structure

Method Resource URL
GET /education/courses_filter/

Request Parameters

默认分页取数据库中最新的10条数据

Name Description Required Default
page page Number Yes 1

课程类型为:开发(develop)、运维(operation)、测试(test)、网络(network)
课程是否付费:免费课程(free)、优惠课程(discount)

cURL Example

  1. 1:(课程类型)developoperationtestnetwork
  2. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop
  3. 2:(推荐课程)
  4. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?recommend=1
  5. 3:(免费课程)
  6. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?free_course=1
  7. 4:(优惠课程)
  8. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?discount_course=1
  9. 5:(某课程类型下课程的免费课程)
  10. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop&free_course=1
  11. 6:(某课程类型下推荐课程)
  12. curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop&recommend=1

JSON Response

  1. {
  2. "count": 1,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 5,
  8. "owner": "",
  9. "name": "构建云数据一体化运维体系",
  10. "description": "康楠 中国联通集团云数据公司运维与服务部总经理 现任中国联通集团云数据公司运维与服务部总经理。中央党校研究生院经济学专业研究生学历、高级工程师。原中国软件运营服务(SaaS)专家顾问团成员。中国数据中心产业发展联盟常务理事、专家委员,技术委员会主任,ODCA开放数据中心联盟工作组成员,工信部云计算发展与政策论坛专家委员,中国通信标准化协会(CCSA)数据中心联盟副理事长、江苏信息服务产业基地专家委员、呼和浩特市云计算产业专家顾问组专家委员、北京电子学会专家委员、MDC Club专家委员、中国工程建设标准化协会专家委员。《通信产业报》、《通信世界周刊》、中国信息产业网CNII、中国通信网、《现代数据中心》特约撰稿人。近年来,参与完成十余项研究、规划、标准课题项目,在行业刊物上发表学术性文章数十篇,编著《数据中心系统工程及应用》、参著《运维菜鸟到大咖你还有多远》。",
  11. "picture": "http://pic.huodongjia.com/event/2015-07-02/event1435804641.08.jpg",
  12. "amount": "0.01",
  13. "grade": "junior",
  14. "click": 1,
  15. "payment_count": 2,
  16. "create_time": "2016-04-20T15:48:21.104130Z",
  17. "category": {
  18. "pk": 9,
  19. "name": "网络安全",
  20. "parent": 3
  21. },
  22. "course_type": "develop",
  23. "course_type_display": "开发",
  24. "authenticated": false,
  25. "support_exam": true,
  26. "free_course": false,
  27. "discount_course": true,
  28. "recommend": false,
  29. "videos": [
  30. {
  31. "pk": 4,
  32. "owner": "18672767274",
  33. "course": 5,
  34. "title": "构建云数据2",
  35. "video_link": "http://m.iqiyi.com/edu/20130408/bcd5628b900832a3.html#vfrm=2-3-0-1",
  36. "video_duration": "",
  37. "lecturer": "",
  38. "create_time": "2016-05-05T08:00:59.501492Z",
  39. "actual_study_number": 0
  40. },
  41. {
  42. "pk": 3,
  43. "owner": "18672767274",
  44. "course": 5,
  45. "title": "构建云数据课程1 超越满意-基于客户口碑的忠诚度管理(NPS)",
  46. "video_link": "http://m.iqiyi.com/edu/20130408/bcd5628b900832a3.html#vfrm=2-3-0-1",
  47. "video_duration": "",
  48. "lecturer": "",
  49. "create_time": "2016-05-05T07:08:27.597660Z",
  50. "actual_study_number": 0
  51. },
  52. {
  53. "pk": 2,
  54. "owner": "18672767274",
  55. "course": 5,
  56. "title": "云数据",
  57. "video_link": "http://m.iqiyi.com/edu/20130408/dd6dbf70e90322bb.html#vfrm=2-3-0-1",
  58. "video_duration": "",
  59. "lecturer": "",
  60. "create_time": "2016-05-05T06:43:06.163020Z",
  61. "actual_study_number": 0
  62. }
  63. ],
  64. "examRule": [
  65. {
  66. "pk": 4,
  67. "title": "构建云数据一体化数据考试2016",
  68. "description": "构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016",
  69. "point": 2,
  70. "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg",
  71. "price": "2.00",
  72. "exercise_number": 10
  73. },
  74. {
  75. "pk": 2,
  76. "title": "测试1",
  77. "description": "范德萨范德萨",
  78. "point": 0,
  79. "picture": "http://test.ean.haorenao.cn:8080/admin/education/examrule/add/",
  80. "price": "0.00",
  81. "exercise_number": 10
  82. }
  83. ]
  84. }
  85. ]
  86. }

05. 查询相关课程

Description

通过传入某个课程的id和分类id查询与该课程相关的课程列表

Method and URL Structure

Method Resource URL
GET /education/course_related/

Request Parameters

Name Description Required Default
category 课程分类id Yes 1
course_pk 课程id Yes 1

cURL Example

curl -X GET http://127.0.0.1:8000/education/course_related/?category=2&course_pk=7

  1. ### JSON Response
  2. ``` json
  3. {
  4. "count": 2,
  5. "next": null,
  6. "previous": null,
  7. "results": [
  8. {
  9. "pk": 7,
  10. "owner": null,
  11. "name": "云计算时代的内容管理",
  12. "lecturer_describe": null,
  13. "description": "内容管理,云计算",
  14. "picture": "http://www.51ean.com/res/attachment//store/3/goods/201607011513497853_small.jpg",
  15. "amount": "15.00",
  16. "original_price": "0.00",
  17. "grade": "junior",
  18. "click": 0,
  19. "payment_count": 0,
  20. "create_time": "2016-07-04T15:22:52.535651Z",
  21. "category": {
  22. "pk": 2,
  23. "name": "云计算与大数据",
  24. "parent": -1,
  25. "desc": "",
  26. "poster": ""
  27. },
  28. "course_type": "develop",
  29. "course_type_display": "开发",
  30. "authenticated": false,
  31. "support_exam": false,
  32. "free_course": false,
  33. "discount_course": false,
  34. "recommend": false,
  35. "videos": [],
  36. "examRule": []
  37. },
  38. {
  39. "pk": 2,
  40. "owner": "小小明",
  41. "name": "云\"动\"未来—世纪互联云战略解读",
  42. "lecturer_describe": null,
  43. "description": "沈寓实 世纪互联集团副总裁、(云)首席技术官/中国云体系联盟秘书长 沈寓实,博士,MBA,教授。在ICT领域将近20年的科研、研发和管理经验,云计算、视频编解码和无线通信领域国际专家,跨国公司高管,华人和科技社团领袖。现任世纪互联集团副总裁、(云)首席技术官,是中国云体系产业创新战略联盟的主要发起人之一和现任秘书长。",
  44. "picture": "http://img2.imgtn.bdimg.com/it/u=585892028,1905396312&fm=15&gp=0.jpg",
  45. "amount": "0.00",
  46. "original_price": "0.00",
  47. "grade": "junior",
  48. "click": 0,
  49. "payment_count": 0,
  50. "create_time": "2016-04-20T15:48:09.028755Z",
  51. "category": {
  52. "pk": 2,
  53. "name": "云计算与大数据",
  54. "parent": -1,
  55. "desc": "",
  56. "poster": ""
  57. },
  58. "course_type": "develop",
  59. "course_type_display": "开发",
  60. "authenticated": false,
  61. "support_exam": false,
  62. "free_course": false,
  63. "discount_course": false,
  64. "recommend": false,
  65. "videos": [],
  66. "examRule": []
  67. }
  68. ]
  69. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注