This commit is contained in:
wangjinlei
2022-08-05 11:18:52 +08:00
parent a23e9640b3
commit c88aa8bb2f
5 changed files with 64 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Validate;
/**
* @title 文章接口
@@ -1165,6 +1166,39 @@ class Article extends Controller {
return json(['code' => 0]);
}
/**
* 获取文章文件
*/
public function getFilesForArticle(){
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require',
'type'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$type = '';
switch($data['type']){
case "m":
$type = 'manuscirpt';
break;
case "c":
$type = 'coverLetter';
break;
case "p";
$type = 'picturesAndTables';
break;
default:
$type = 'manuscirpt';
break;
}
$files = $this->article_file_obj->where('article_id',$data['article_id'])->where('state',0)->where('type_name',$type)->order('ctime')->select();
$re['files'] = $files;
return jsonSuccess($re);
}