1
This commit is contained in:
@@ -889,6 +889,38 @@ class Article extends Base
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
/**获取用户所投的文章
|
||||
* @return \think\response\Json|void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function getArticlesByArticle(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id" => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
$list = $this->article_obj->field("t_article.*,t_journal.title journal_title")->join("t_journal","t_journal.journal_id = t_article.journal_id","left")->where("t_article.user_id",$article_info['user_id'])->select();
|
||||
$re['user_articles'] = $list;
|
||||
$authors = $this->article_author_obj->where('article_id',$data['article_id'])->where('state',0)->select();
|
||||
foreach ($authors as $k => $v){
|
||||
if($v['email']!=""&&$v['email']!="empty"){
|
||||
$as = $this->article_obj->field("t_article.*,t_journal.title journal_title")->join("t_article_author","t_article.article_id = t_article_author.article_id","left")->join("t_journal","t_journal.journal_id = t_article.journal_id","left")->where("t_article.article_id","<>",$data['article_id'])->where("t_article_author.state",0)->where("t_article_author.email",$v['email'])->select();
|
||||
}else{
|
||||
$as = null;
|
||||
}
|
||||
$authors[$k]["articles"] = $as;
|
||||
|
||||
}
|
||||
$re['author_articles'] = $authors;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章的作者(作者)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user