This commit is contained in:
wangjinlei
2024-03-18 10:57:59 +08:00
parent f648752c16
commit ddba364cca
2 changed files with 76 additions and 5 deletions

View File

@@ -84,6 +84,64 @@ class Monitor extends Base
return jsonSuccess($re);
}
/**获取文章数量通过年度分期刊
* @return void
*/
public function getArticleNumByYearForJournal(){
$journals = $this->journal_obj->where("state",0)->select();
$flag = [];
foreach ($journals as $k => $v){
$year = 2020;
$frag = [];
while ($year<=date("Y")){
$s_time = strtotime($year."-1-1");
$e_time = strtotime($year."-12-31");
$n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr'])->count();
$nj = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->where("journal_id","<>",$v['journal_id'])->count();
// $frag[$year."-".$month] = $n."/".$nj;
// $n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("journal_id",$v['journal_id'])->count();
$frag[$year] = $n."/".$nj;
$year++;
}
$f['journal'] = $v;
$f['articles'] = $frag;
$flag[] = $f;
}
$re['data'] = $flag;
return jsonSuccess($re);
}
/**获取文章数量通过月份分期刊
* @return void
*/
public function getArticleNumByMonthForJournal(){
$journals = $this->journal_obj->where("state",0)->select();
$flag = [];
foreach ($journals as $v){
$year = 2020;
$month = 8;
$frag = [];
while ($year<date("Y")||($year==date("Y")&&$month<=date("m"))){
$s_time = strtotime($year."-".$month."-1");
$e_time = strtotime("+1 month", $s_time) - 1;
$n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr'])->count();
$nj = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->where("journal_id","<>",$v['journal_id'])->count();
$frag[$year."-".$month] = $n."/".$nj;
if($month==12){
$year++;
$month =1;
}else{
$month++;
}
}
$f["journal"] = $v;
$f['articles'] = $frag;
$flag[] = $f;
}
$re['data'] = $flag;
return jsonSuccess($re);
}
/**获取期刊月投稿量
* @return bool