This commit is contained in:
wangjinlei
2023-07-03 13:14:56 +08:00
parent b251027249
commit bfa6734af4
4 changed files with 91 additions and 2 deletions

View File

@@ -52,5 +52,31 @@ class Web extends Base
$re['articles'] = $list;
return jsonSuccess($re);
}
public function getRefers(){
$data = $this->request->post();
$rule = new Validate([
"w_article_id"=>"require",
"doi"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$production_info = $this->production_article_obj->where('w_article_id',$data['w_article_id'])->find();
if (!$production_info){//一次验证如果w_article_id获取失败
$production_info = $this->production_article_obj->where('doi',$data['doi'])->where('state',0)->find();
}
if(!$production_info){//如果两次获取都失败
$refers = [];
return jsonSuccess(['refer'=>$refers]);
}
$list = $this->production_article_refer_obj->where('p_article_id',$production_info['p_article_id'])->where('state',0)->order('index')->select();
$re['refers'] = $list;
return jsonSuccess($re);
}
}
?>