146 lines
4.9 KiB
PHP
146 lines
4.9 KiB
PHP
<?php
|
||
namespace app\api\controller;
|
||
use think\Controller;
|
||
use think\Db;
|
||
|
||
class Super extends Controller{
|
||
|
||
protected $article_obj = '';
|
||
protected $user_obj = '';
|
||
protected $user_act_obj = '';
|
||
protected $journal_obj = '';
|
||
protected $user_log_obj = '';
|
||
protected $reviewer_major_obj = '';
|
||
protected $reviewer_to_journal_obj = '';
|
||
protected $article_msg_obj = '';
|
||
protected $article_file_obj = '';
|
||
protected $article_reviewer_obj = '';
|
||
protected $article_author_obj = '';
|
||
protected $article_transfer_obj = '';
|
||
protected $staff_obj = '';
|
||
protected $staff_level_obj = '';
|
||
protected $staff_log_obj = '';
|
||
protected $staff_to_journal_obj = '';
|
||
|
||
public function __construct(\think\Request $request = null) {
|
||
parent::__construct($request);
|
||
$this->user_obj = Db::name('user');
|
||
$this->user_act_obj = Db::name('user_act');
|
||
$this->article_obj = Db::name('article');
|
||
$this->journal_obj = Db::name('journal');
|
||
$this->user_log_obj = Db::name('user_log');
|
||
$this->reviewer_major_obj = Db::name('reviewer_major');
|
||
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
|
||
$this->article_msg_obj = Db::name('article_msg');
|
||
$this->article_file_obj = Db::name('article_file');
|
||
$this->article_reviewer_obj = Db::name('article_reviewer');
|
||
$this->article_author_obj = Db::name('article_author');
|
||
$this->article_transfer_obj = Db::name('article_transfer');
|
||
$this->staff_obj = Db::name('staff');
|
||
$this->staff_level_obj = Db::name('staff_level');
|
||
$this->staff_log_obj = Db::name('staff_log');
|
||
$this->staff_to_journal_obj = Db::name('staff_to_journal');
|
||
}
|
||
|
||
public function main() {
|
||
$list = $this->journal_obj->where('state',0)->select();
|
||
foreach ($list as $k => $v){
|
||
$list[$k]['LYL'] = $this->getLYL($v['journal_id']);
|
||
$list[$k]['CC'] = $this->getCC($v['journal_id']);
|
||
$list[$k]['WS'] = $this->getWS($v['journal_id']);
|
||
$list[$k]['SJ'] = $this->getSJ($v['journal_id']);
|
||
}
|
||
return jsonSuccess($list);
|
||
}
|
||
|
||
public function getAllArticle(){
|
||
$list = $this->journal_obj->where('state',0)->select();
|
||
foreach ($list as $k => $v){
|
||
$list[$k]['SJ'] = $this->article_obj->where('journal_id',$v['journal_id'])->count();
|
||
}
|
||
return jsonSuccess($list);
|
||
}
|
||
|
||
|
||
/**
|
||
* 获取录用率
|
||
*/
|
||
private function getLYL($journalId){
|
||
$res = $this->article_obj->field('state,count(state) as num')->where('journal_id',$journalId)->where('state','in','3,5')->group('state')->select();
|
||
$js = 0;
|
||
$jj = 0;
|
||
foreach ( $res as $v){
|
||
if($v['state']==3){
|
||
$jj = $v['num'];
|
||
} else {
|
||
$js = $v['num'];
|
||
}
|
||
}
|
||
return $js/($js+$jj);
|
||
}
|
||
|
||
/**
|
||
* 获取查重异常
|
||
*/
|
||
private function getCC($journalId){
|
||
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
|
||
$low = 0;
|
||
$low1 = 0;
|
||
$mid = 0;
|
||
$high = 0;
|
||
foreach ($res as $v){
|
||
if($v['repetition']<20){
|
||
$low++;
|
||
}elseif($v['repetition']>=20 && $v['repetition']<30){
|
||
$low1++;
|
||
}elseif($v['repetition']>=30 && $v['repetition']<50){
|
||
$mid++;
|
||
}else{
|
||
$high++;
|
||
}
|
||
}
|
||
$re['low'] = $low;
|
||
$re['low1'] = $low1;
|
||
$re['mid'] = $mid;
|
||
$re['high'] = $high;
|
||
|
||
return $re;
|
||
}
|
||
|
||
/**
|
||
* 获取外审异常
|
||
*/
|
||
private function getWS($journalId){
|
||
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
|
||
$np =0;
|
||
foreach ( $res as $v){
|
||
$ca = $this->article_reviewer_obj->where('article_id',$v['article_id'])->count();
|
||
if($ca<2){
|
||
$np++;
|
||
}
|
||
}
|
||
|
||
$re['all'] = count($res);
|
||
$re['np'] = $np;
|
||
return $re;
|
||
}
|
||
|
||
/**
|
||
* 获取时间异常
|
||
*/
|
||
private function getSJ($journalId){
|
||
//文章提交至接收超过48小时
|
||
$res['t48'] = $this->article_obj->where('journal_id',$journalId)->where('state',0)->count();
|
||
//文章接受时间小于15天
|
||
$res['j15'] = $this->article_obj->where('journal_id',$journalId)->where('state',5)->where('rtime','>',0)->where('(rtime-ctime)','<',3600*24*15)->count();
|
||
//文章接收时间大于120天
|
||
$res['j120'] = $this->article_obj->where('journal_id',$journalId)->where('state',5)->where('rtime','>',0)->where('(rtime-ctime)','>',3600*24*120)->count();
|
||
//with editor时间超过三天(预留)
|
||
|
||
//获取全部总数
|
||
$res['al'] = $this->article_obj->where('journal_id',$journalId)->count();
|
||
return $res;
|
||
}
|
||
|
||
}
|