This commit is contained in:
wangjinlei
2024-09-04 11:31:11 +08:00
parent 13c974a9d4
commit ec95437a3e

View File

@@ -84,6 +84,37 @@ class Monitor extends Base
return jsonSuccess($re);
}
public function getArticleNumByYearForEditor(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journal_list = $this->journal_obj->where("editor_id",$data['user_id'])->where("state",0)->select();
if(count($journal_list)==0){
return jsonError("期刊为空");
}
$j_sql = '';
foreach ($journal_list as $v){
$j_sql .= "accept_sn like '".$v['abbr']."%' or ";
}
$j_sql = substr($j_sql,0,-4);
$year = Date("Y")-5;
$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($j_sql)->count();
$frag[$year] = $n;
$year++;
}
$re['articles'] = $frag;
return jsonSuccess($re);
}
/**获取文章数量通过年度分期刊
* @return void
*/
@@ -118,6 +149,45 @@ class Monitor extends Base
return jsonSuccess($re);
}
public function getArticleNumByYearAndJournalForEditor(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journals = $this->journal_obj->where("state",0)->where("editor_id",$data['user_id'])->select();
$flag = [];
foreach ($journals as $k => $v){
$year = date("Y")-5;
$frag = [];
while ($year<=date("Y")){
$s_time = strtotime($year."-1-1");
$e_time = strtotime($year."-12-31");
$abbr = $v['abbr'];
if($abbr=="NTA"&&$year<2024){
$abbr = "MHM";
}
if($abbr=="PD"&&$year<2024){
$abbr = "PR";
}
$n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->count();
$nj = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->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
*/
@@ -149,6 +219,42 @@ class Monitor extends Base
return jsonSuccess($re);
}
public function getArticleNumByMonthAndJournalForEditor(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journals = $this->journal_obj->where("state",0)->where("editor_id",$data['user_id'])->select();
$flag = [];
foreach ($journals as $v){
$year = date("Y")-1;
$month = 1;
$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
@@ -162,7 +268,45 @@ class Monitor extends Base
$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)->count();
$frag[$year."-".$month."sql"] = $this->article_obj->getLastSql();
// $frag[$year."-".$month."sql"] = $this->article_obj->getLastSql();
$frag[$year."-".$month] = $n;
if($month==12){
$year++;
$month =1;
}else{
$month++;
}
}
$re['articles'] = $frag;
return jsonSuccess($re);
}
public function getArticleNumByMonthForEditor(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journal_list = $this->journal_obj->where("editor_id",$data['user_id'])->where("state",0)->select();
if(count($journal_list)==0){
return jsonError("期刊为空");
}
$j_sql = '';
foreach ($journal_list as $v){
$j_sql .= "accept_sn like '".$v['abbr']."%' or ";
}
$j_sql = substr($j_sql,0,-4);
$year = date("Y")-1;
$month = 1;
$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($j_sql)->count();
$frag[$year."-".$month] = $n;
if($month==12){
$year++;