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() { $data = $this->request->post(); $start_time = strtotime($data['start']); $end_time = strtotime($data['end'].' 23:59:59'); $list = $this->journal_obj->where('state',0)->select(); foreach ($list as $k => $v){ $list[$k]['LYL'] = $this->getLYL($v['journal_id'],$start_time,$end_time); $list[$k]['CC'] = $this->getCC($v['journal_id'],$start_time,$end_time); $list[$k]['WS'] = $this->getWS($v['journal_id'],$start_time,$end_time); $list[$k]['SJ'] = $this->getSJ($v['journal_id'],$start_time,$end_time); } return jsonSuccess($list); } public function getAllArticle(){ $data = $this->request->post(); $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']) ->where('ctime','>',$data['start']) ->where('ctime','<=',$data['end']) ->count(); } return jsonSuccess($list); } /** * 获取查重文章 */ public function getCCArticles(){ $data = $this->request->post(); // $data['issn'] = '2522-6371'; // $data['type'] = "low"; // $data['start'] = '2021-01-01'; // $data['end'] = '2021-04-08'; $journal_info = $this->journal_obj->where('issn',$data['issn'])->find(); $where['journal_id'] = $journal_info['journal_id']; $where['ctime'] = [['>', strtotime($data['start'])],['<', strtotime($data['end'].' 23:59:59')]]; $where['state'] = 5; if($data['type']=='low'){ $where['repetition'] = ['<=',20]; }elseif($data['type']=='low1'){ $where['repetition'] = [['>',20],['<=',30]]; }elseif($data['type']=='mid'){ $where['repetition'] = [['>',30],['<=',50]]; }else{ $where['repetition'] = ['>',50]; } $list = $this->article_obj->where($where)->select(); // echo $this->article_obj->getLastSql(); $re['articles'] = $list; return jsonSuccess($re); } /** * 获取录用率 */ private function getLYL($journalId,$start_time,$end_time){ $res = $this->article_obj ->field('state,count(state) as num') ->where('journal_id',$journalId) ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->where('state','in','3,5') ->group('state') ->select(); //获取全部总数 $all = $this->article_obj ->where('journal_id',$journalId) ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->count(); $js = 0; $jj = 0; foreach ( $res as $v){ if($v['state']==3){ $jj = $v['num']; } else { $js = $v['num']; } } return $all==0?0:$js/$all; } /** * 获取查重异常 */ private function getCC($journalId,$start_time,$end_time){ $res = $this->article_obj ->where('journal_id',$journalId) ->where('ctime','>=',$start_time) ->where('ctime','<=',$end_time) ->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,$start_time,$end_time){ $res = $this->article_obj ->where('journal_id',$journalId) ->where('state',5) ->where('type','<>','N') ->where('type','<>','T') ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->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; } public function mutest(){ $start_time = strtotime('2021-01-01'); $end_time = strtotime('2021-04-15 23:59:59'); $res = $this->getSJ(1, $start_time, $end_time); echo '
';
        var_dump($res);
        echo '
'; die; } public function mmmyyy(){ $start = strtotime('2021-01-01'); $end = strtotime('2021-04-22 11:30:12'); $res = $this->getSJ(8, $start, $end); echo '
';
        var_dump($res);
        echo '
'; die; } /** * 获取时间异常 */ private function getSJ($journalId,$start_time,$end_time){ //文章提交至接收超过48小时 $res['t48'] = $this->article_obj ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->where('journal_id',$journalId) ->where('state',0) ->count(); //文章接受时间小于15天 $res['j15'] = $this->article_obj ->where('journal_id',$journalId) ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->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('ctime','>',$start_time) ->where('ctime','<',$end_time) ->where('rtime','>',0) ->where('(rtime-ctime) > '.(3600*24*120)) ->count(); //with editor时间超过三天(预留) $journal_info = $this->journal_obj->where('journal_id',$journalId)->find(); $zc_num = $this->article_obj->where('accept_sn','like',$journal_info['abbr'].'%')->where('journal_id','<>',$journalId)->where('ctime','>',$start_time)->where('ctime','<',$end_time)->count(); $zr_num = $this->article_obj->where('accept_sn','not like',$journal_info['abbr'].'%')->where('journal_id',$journalId)->where('ctime','>',$start_time)->where('ctime','<',$end_time)->count(); //获取全部总数 $mq_num = $this->article_obj ->where('journal_id',$journalId) ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->count(); $res['mq'] = $mq_num;//文章总数 $res['zc'] = $zc_num;//转出文章数 $res['zr'] = $zr_num;//转入文章数 return $res; } }