作者 何书鹏

PC二开

... ... @@ -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)
... ...
... ... @@ -682,7 +682,7 @@ class User extends Api
$path_ttf = ROOT_PATH.'public/assets/fonts/PingFang.ttf';
$year = date('Y');
//证书编号
$text = 'TJAG'.$year.$data['studynum'];
$text = 'TJAG'.$year.$data['studynum'].$id;
//培训单位盖章
$text1 = '培训单位盖章';
... ... @@ -704,6 +704,9 @@ class User extends Api
$image->text($text1,$path_ttf,30,'#000000',[1188,772]);
$image->save(ROOT_PATH . 'public' . DS . 'uploads' . DS . $file_path,'png',100);
// 将编号存入数据库
Db::name('third_exam')->where('id',$id)->update(['certificate_sn'=>$text]);
$answer['qrcodeurl'] = request()->domain().'/uploads/'.$id.'.png';
$answer['score'] = $data['score'];
$this->success('success',$answer);
... ...