diff --git a/application/mobile/controller/Course.php b/application/mobile/controller/Course.php index bd3a206..9289ac5 100644 --- a/application/mobile/controller/Course.php +++ b/application/mobile/controller/Course.php @@ -128,8 +128,7 @@ class Course extends Api "video": { //一节课视频地址 "cover": "http://www.enterprise.top/assets/img/bg-middle.jpg", //视频封面 "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频 - }, - "is_buy": 0 //是否已购买:0=否,1=是 + } } }) */ @@ -155,13 +154,6 @@ class Course extends Api $video = $catalog_child['video']; } $info['video'] = $video; - // 是否已购买 - $order = CourseOrder::where('user_id',$this->auth->id) - ->where('course_id',$course_id) - ->where('pay_status','1') - ->field('id') - ->find(); - $info['is_buy'] = !empty($order) ? 1 : 0; $this->success('成功',$info->visible([ 'id', 'title', @@ -169,8 +161,7 @@ class Course extends Api 'current_price', 'original_price' ])->append([ - 'video', - 'is_buy' + 'video' ])); } @@ -183,19 +174,25 @@ class Course extends Api * @ApiParams (name="course_id", type="int", required=true, description="课程ID") * * @ApiReturn({ - "code": 1, - "msg": "成功", - "time": "1599908189", - "data": [{ - "id": 1, //一级目录ID - "name": "第一章", - "childlist": [{ //二级目录列表 - "id": 2, //二级目录ID - "name": "第一章-第一节", //二级目录名称 - "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频地址 - }] - }] - }) + "code": 1, + "msg": "成功", + "time": "1600927297", + "data": { + "is_buy": 0, //是否已购买:0=否,1=是 + "list": [{ + "id": 1, //一级目录ID + "name": "第一章", //一级目录名称 + "childlist": [{ //二级目录列表 + "id": 2, //二级目录ID + "name": "第一章-第一节", //二级目录名称 + "video": { //视频信息 + "cover": "http://www.enterprise.top/assets/img/bg-middle.jpg", //封面 + "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频 + } + }] + }] + } + }) */ public function catalog() { @@ -218,7 +215,14 @@ class Course extends Api } $v['childlist'] = $childlist; } - $this->success('成功',$list); + // 是否已购买 + $order = CourseOrder::where('user_id',$this->auth->id) + ->where('course_id',$course_id) + ->where('pay_status','1') + ->field('id') + ->find(); + $is_buy = !empty($order) ? 1 : 0; + $this->success('成功',compact('is_buy','list')); } /** @@ -232,16 +236,12 @@ class Course extends Api * @ApiReturn({ "code": 1, "msg": "成功", - "time": "1599908189", - "data": [{ - "id": 1, //一级目录ID - "name": "第一章", - "childlist": [{ //二级目录列表 - "id": 2, //二级目录ID - "name": "第一章-第一节", //二级目录名称 - "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频地址 - }] - }] + "time": "1600927509", + "data": { + "teacher_avatar": "/uploads/20200814/a8df375d64ec5f828a38ded72f42333e.jpg", //老师头像 + "teacher_name": "杰克", //老师名称 + "teacher_desc": "汤姆包与杰克鼠" //老师介绍 + } }) */ public function teacher() diff --git a/public/mobile.html b/public/mobile.html index d30e37b..917a2f1 100644 --- a/public/mobile.html +++ b/public/mobile.html @@ -5794,8 +5794,7 @@ "video": { //一节课视频地址 "cover": "http://www.enterprise.top/assets/img/bg-middle.jpg", //视频封面 "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频 - }, - "is_buy": 0 //是否已购买:0=否,1=是 + } } }</pre> </div> @@ -5936,19 +5935,25 @@ <div class="row"> <div class="col-md-12"> <pre id="sample_response29">{ - "code": 1, - "msg": "成功", - "time": "1599908189", - "data": [{ - "id": 1, //一级目录ID - "name": "第一章", - "childlist": [{ //二级目录列表 - "id": 2, //二级目录ID - "name": "第一章-第一节", //二级目录名称 - "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频地址 - }] - }] - }</pre> + "code": 1, + "msg": "成功", + "time": "1600927297", + "data": { + "is_buy": 0, //是否已购买:0=否,1=是 + "list": [{ + "id": 1, //一级目录ID + "name": "第一章", //一级目录名称 + "childlist": [{ //二级目录列表 + "id": 2, //二级目录ID + "name": "第一章-第一节", //二级目录名称 + "video": { //视频信息 + "cover": "http://www.enterprise.top/assets/img/bg-middle.jpg", //封面 + "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频 + } + }] + }] + } + }</pre> </div> </div> </div><!-- #sample --> @@ -6089,16 +6094,12 @@ <pre id="sample_response30">{ "code": 1, "msg": "成功", - "time": "1599908189", - "data": [{ - "id": 1, //一级目录ID - "name": "第一章", - "childlist": [{ //二级目录列表 - "id": 2, //二级目录ID - "name": "第一章-第一节", //二级目录名称 - "video": "https://vd2.bdstatic.com/mda-jkptk0q9euab5v41/sc/mda-jkptk0q9euab5v41.mp4?auth_key=1599909914-0-0-1b5b778ac7883d30cf78883ff8884b7e&bcevod_channel=searchbox_feed&pd=1&pt=3" //视频地址 - }] - }] + "time": "1600927509", + "data": { + "teacher_avatar": "/uploads/20200814/a8df375d64ec5f828a38ded72f42333e.jpg", //老师头像 + "teacher_name": "杰克", //老师名称 + "teacher_desc": "汤姆包与杰克鼠" //老师介绍 + } }</pre> </div> </div> @@ -16216,7 +16217,7 @@ <div class="row mt0 footer"> <div class="col-md-6" align="left"> - Generated on 2020-09-24 13:48:45 </div> + Generated on 2020-09-24 14:06:13 </div> <div class="col-md-6" align="right"> <a href="./" target="_blank">企智帮</a> </div>