...
|
...
|
@@ -16,7 +16,7 @@ use think\Validate; |
|
|
*/
|
|
|
class Lists extends Api
|
|
|
{
|
|
|
protected $noNeedLogin = ['get_list','type_title','type_list','ke_list','index','policy','download','index_info','policy_info','video_list','video_detail','study','password_login','find_pwd','ke_list_detail','getcode','verify'];
|
|
|
protected $noNeedLogin = ['get_list','type_title','type_list','ke_list','index','policy','download','index_info','policy_info','download_info','video_list','video_detail','study','password_login','find_pwd','ke_list_detail','getcode','verify'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -375,6 +375,58 @@ class Lists extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (下载专区详情)
|
|
|
* @ApiSummary (下载专区详情)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/lists/download_info)
|
|
|
*
|
|
|
* @ApiParams (name="id", type="int", required=true, description="下载专区ID")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1571492001",
|
|
|
"data": {
|
|
|
"id"://ID
|
|
|
"title"://标题
|
|
|
"from"://转载于
|
|
|
"content"://内容详情
|
|
|
"file_name"://附件名称
|
|
|
"file"://附件
|
|
|
"is_up"://是否上架0否1是
|
|
|
"createtime"://创建时间
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function download_info()
|
|
|
{
|
|
|
$qiniu = get_addon_config('qiniu')['cdnurl'];
|
|
|
$id = $this->request->param('id');
|
|
|
if(empty($id)){
|
|
|
$this->error('缺少必要参数');
|
|
|
}
|
|
|
$data = Db::name('download')
|
|
|
->where('id',$id)
|
|
|
->field('updatetime',true)
|
|
|
->find();
|
|
|
if(!empty($data['file'])){
|
|
|
$base_url = $data['file'];
|
|
|
$qiniu_url = $qiniu.$data['file'];
|
|
|
$a = file_get_contents($qiniu_url);
|
|
|
$path = './uploads/'.explode('/',$base_url)[2].'/';
|
|
|
if(!file_exists($path)) {
|
|
|
mkdir($path,0777,true);
|
|
|
}
|
|
|
file_put_contents('.'.$base_url,$a);
|
|
|
$data['file'] = request()->domain().$base_url;
|
|
|
}else{
|
|
|
$data['file'] = '';
|
|
|
}
|
|
|
$data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
|
|
|
$this->success('success',$data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (优选课程列表)
|
|
|
* @ApiSummary (优选课程列表)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
|