初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\live;
|
||||
|
||||
use app\common\controller\Api;
|
||||
|
||||
/**
|
||||
* 直播课件
|
||||
*/
|
||||
class Courseware extends Api
|
||||
{
|
||||
// 无需登录的接口,*表示全部
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
|
||||
protected $modal;
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->modal = new \app\api\model\live\Courseware;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取课件列表
|
||||
* @return void
|
||||
*/
|
||||
public function getCoursewareList(){
|
||||
$courseId = input('course_id');
|
||||
|
||||
//判断是否已订阅
|
||||
if(!\app\common\model\user\Subscription::getSubscriptionAuth($this->auth->id,$courseId)){
|
||||
$this->error("暂未订阅该课程");
|
||||
}
|
||||
|
||||
$list = $this->modal->where([
|
||||
'course_id'=>$courseId
|
||||
])
|
||||
->field(['file_type as filetype','file_name as filename','file_path as fullurl','file_size as filesize'])
|
||||
->order("createtime",'desc')
|
||||
->select();
|
||||
|
||||
$this->success("获取成功",$list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user