user_obj = Db::name('user'); $this->captcha_obj = Db::name('captcha'); $this->article_obj = Db::name('article'); $this->user_act_obj = Db::name('user_act'); $this->admin_obj = Db::name('admin'); $this->user_reviewer_obj = Db::name('user_reviewer_apply'); $this->journal_obj = Db::name('journal'); $this->reviewer_major_obj = Db::name('reviewer_major'); $this->reviewer_to_journal_obj = Db::name('reviewer_to_journal'); $this->user_reviewer_info_obj = Db::name('user_reviewer_info'); $this->user_msg_obj = Db::name('user_msg'); $this->chief_to_journal_obj = Db::name('chief_to_journal'); $this->board_to_journal_obj = Db::name('board_to_journal'); $this->reviewer_from_author_obj = Db::name('reviewer_from_author'); $this->article_author_obj = Db::name('article_author'); $this->user_black_obj = Db::name('user_black'); $this->user_to_special_obj = Db::name('user_to_special'); $this->user_register_check_obj = Db::name('user_register_check'); $this->user_cert_obj = Db::name('user_cert'); $this->apply_board_obj = Db::name('apply_board'); $this->apply_yboard_obj = Db::name('apply_yboard'); $this->user_author_obj = Db::name('user_author'); $this->user_score_log_obj = Db::name('user_score_log'); $this->user_index_log_obj = Db::name('user_index_log'); $this->article_reviewer_obj = Db::name('article_reviewer'); $this->user_ash_obj = Db::name('user_ash'); $this->major_obj = Db::name('major'); $this->user_to_yboard_obj = Db::name('user_to_yboard'); $this->country_obj = Db::name('country'); $this->user_log_obj = Db::name('user_log'); $this->article_reviewer_question_obj = Db::name('article_reviewer_question'); $this->article_msg_obj = Db::name('article_msg'); $this->article_file_obj = Db::name('article_file'); $this->article_transfer_obj = Db::name('article_transfer'); $this->login_auto_obj = Db::name('login_auto'); $this->major_to_journal_obj = Db::name('major_to_journal'); $this->article_dialog_obj = Db::name('article_dialog'); $this->article_proposal_obj = Db::name('article_proposal'); $this->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer'); $this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend'); $this->email_log_obj = Db::name('email_log'); $this->email_template_obj = Db::name('email_template'); $this->production_article_obj = Db::name('production_article'); $this->company_top_obj = Db::name('company_top'); $this->user_cv_obj = Db::name('user_cv'); $this->ts_obj = Db::name('ts'); $this->ts_refer_obj = Db::name('ts_refer'); $this->ts_frag_obj = Db::name('ts_frag'); $this->online_obj = Db::name('online'); $this->article_reviewer_file_obj = Db::name('article_reviewer_file'); $this->production_article_obj = Db::name('production_article'); $this->production_article_author_obj = Db::name('production_article_author'); $this->production_article_organ_obj = Db::name('production_article_organ'); $this->production_article_refer_obj = Db::name('production_article_refer'); $this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ'); $this->production_article_frag_obj = Db::name('production_article_frag'); $this->production_article_main_obj = Db::name('production_article_main'); $this->production_article_main_img_obj = Db::name("production_article_main_img"); $this->apply_reviewer_obj = Db::name("apply_reviewer"); $this->promotion_obj = Db::name("promotion"); $this->promotion_email_obj = Db::name("promotion_email"); } public function pdfAddProof($article_id) { $p_info = $this->production_article_obj->where('article_id', $article_id)->where('state', 0)->find(); vendor('fpdf.fpdf'); vendor('fpdi/fpdi'); $pdf = new \FPDI(); $pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS . $p_info['file_pdf']); for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { $templateId = $pdf->importPage($pageNo); $size = $pdf->getTemplateSize($templateId); if ($size['w'] > $size['h']) $pdf->AddPage('L', array($size['w'], $size['h'])); else $pdf->AddPage('P', array($size['w'], $size['h'])); $pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80); $pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80); $pdf->useTemplate($templateId); } $pdf->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . '.pdf'); if ($p_info['file_sub'] != '' && substr($p_info['file_sub'], strripos($p_info['file_sub'], '.') + 1) == 'pdf') { $pdf1 = new \FPDI(); $pageCount1 = $pdf1->setSourceFile(ROOT_PATH . 'public' . DS . "articleSUB" . DS . $p_info['file_sub']); for ($pageNo = 1; $pageNo <= $pageCount1; $pageNo++) { $templateId1 = $pdf1->importPage($pageNo); $size = $pdf1->getTemplateSize($templateId1); if ($size['w'] > $size['h']) $pdf1->AddPage('L', array($size['w'], $size['h'])); else $pdf1->AddPage('P', array($size['w'], $size['h'])); $pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80); $pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80); $pdf1->useTemplate($templateId1); } $pdf1->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . 'SUB.pdf'); } } public function createYboardCert($user_info, $journal_info, $start_time, $year) { if (!is_dir(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id'])) { mkdir(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id']); } $sj_num = rand(1000, 9999); $template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'yboard_template.png'; $ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf'; $ziti1 = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'Georgia0.ttf'; $image = \think\Image::open($template); $ys = date("F Y", $start_time) . " to " . date("F Y", strtotime("+ " . $year . " year", $start_time)); $image->text($user_info['realname'], $ziti, 45, '#000000', [1060, 750]) ->text($ys, $ziti1, 32, '#C49A6C', [1370, 1015]) ->text(date("Y.m.d", $start_time), $ziti, 25, '#000000', [500, 1280]) ->text($journal_info['title'], $ziti1, 36, '#C49A6C', [860, 930]) ->save(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id'] . DS . $user_info['user_id'] . '_yboard_' . date('Y', $start_time) . $sj_num . '.png'); return $journal_info['journal_id'] . DS . $user_info['user_id'] . '_yboard_' . date('Y', $start_time) . $sj_num . '.png'; } public function majorids($major_id) { $frag[] = $major_id; $list = $this->major_obj->where('pid', $major_id)->select(); foreach ($list as $v) { $cache = self::majorids($v['major_id']); $frag = array_merge($frag, $cache); } return $frag; } public function getMajorShu($major) { if ($major == 0) { return ''; } $res = $this->major_obj->where('major_id', $major)->find(); if ($res['pid'] == 1) { return $res['major_id']; } $p = self::getMajorShu($res['pid']); return $p . ',' . $res['major_id']; } public function getMajorStr($major_id) { $frag = ''; $major_info = $this->major_obj->where('major_id', $major_id)->find(); if ($major_info == null) { return ''; } if ($major_info['major_level'] == 1) { return 'Medicine'; } else { $frag = $this->getMajorStr($major_info['pid']) . ' > ' . $major_info['major_title']; } return $frag; } public function getMajorOne($major_id){ $major_info = $this->major_obj->where('major_id', $major_id)->find(); return $major_info['major_title']; } public function save_article_file($article_id, $user_id, $username, $url, $type_name) { //首先确定数据库里面是否存在此数据 $res = $this->article_file_obj->where(['file_url' => $url])->find(); if ($res) { //编辑的时候不能重复存储 return true; } else if ($type_name == 'picturesAndTables' && trim($url) == '') { return true; } else if ($type_name == 'coverLetter' && trim($url) == '') { return true; } else if ($type_name == 'totalpage' && trim($url) == '') { return true; } else if ($type_name == "supplementary" && trim($url) == '') { return true; } $insert_data['article_id'] = $article_id; $insert_data['user_id'] = $user_id; $insert_data['username'] = $username; $insert_data['file_url'] = $url; $insert_data['type_name'] = $type_name; $insert_data['ctime'] = time(); return $this->article_file_obj->insertGetId($insert_data); } public function getArticleAuthors($article_id) { $res = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select(); $frag = ''; foreach ($res as $v) { $frag .= $v['firstname'] . $v['lastname'] . ','; } return substr($frag, 0, -1); } public function getCvs($user_id) { $list = $this->user_cv_obj->where('user_id', $user_id)->where('state', 0)->select(); return $list; } /**获取标准化用户库的人 * @return void */ public function getLibraryList($lib, $type, $body, $china_type, $pageIndex, $pageSize) { $frag = []; if ($lib == "user") {//正式库 $where["t_user.state"] = 0; $where["t_user.no_email"] = 0; if ($type == "major") { $where['t_user_reviewer_info.major'] = ["in", $this->majorids($body)]; } else { $where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"]; } if($china_type==1){ $where['t_user_reviewer_info.country'] = "China"; }elseif ($china_type==2){ $where['t_user_reviewer_info.country'] = ["<>","China"]; } $list = $this->user_obj ->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left') ->where($where) ->page($pageIndex, $pageSize) ->select(); //规整化数据整理 foreach ($list as $v) { $ca['email'] = $v['email']; $ca['name'] = $v['realname'] == "" ? $v['account'] : $v['realname']; $ca['type'] = "user"; $ca['id'] = $v['user_id']; $ca['major'] = $v['major']; $frag[] = $ca; } } elseif ($lib == 'author') {//作者库 $exist = "select * from t_user_author where user_id = t_user.user_id"; $where["t_user.state"] = 0; $where["t_user.no_email"] = 0; if ($type == "major") { $where['t_user_reviewer_info.major'] = ["in", $this->majorids($body)]; } else { $where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"]; } if($china_type==1){ $where['t_user_reviewer_info.country'] = "China"; }elseif ($china_type==2){ $where['t_user_reviewer_info.country'] = ["<>","China"]; } $list = $this->user_obj ->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left') ->where($where) ->whereExists($exist) ->page($pageIndex, $pageSize) ->select(); //规整化数据整理 foreach ($list as $v) { $ca['email'] = $v['email']; $ca['name'] = $v['realname'] == "" ? $v['account'] : $v['realname']; $ca['type'] = "user"; $ca['id'] = $v['user_id']; $ca['major'] = $v['major']; $frag[] = $ca; } } else {//灰库 $list = []; $where['state'] = 0; $where['no_email'] = 0; if ($type == "major") { $where['major'] = ["in", $this->majorids($body)]; } else { $where['field'] = ["like", "%" . $body . "%"]; } if($china_type==1){ $where['country'] = "China"; }elseif ($china_type==2){ $where['country'] = ["<>","China"]; } $list = $this->user_ash_obj ->where($where) ->page($pageIndex, $pageSize) ->select(); //规整化数据整理 foreach ($list as $v) { $ca['email'] = $v['email']; $ca['name'] = $v['name']; $ca['type'] = "ash"; $ca['id'] = $v['ash_id']; $ca['major'] = $v['major']; $frag[] = $ca; } } return $frag; } public function getJournalCycle($journal_id) { $journal_info = $this->journal_obj->where('journal_id', $journal_id)->find(); $frag = ""; if ($journal_info['cycle'] == 1) { $frag = "Monthly"; } elseif ($journal_info['cycle'] == 2) { $frag = "Bimonthly"; } elseif ($journal_info['cycle'] == 3) { $frag = "Quarterly"; } else { $frag = "Continuities"; } return $frag; } public function creatUserCode($str){ $hashids = hashids::instance(8,"tmrjournals"); return $hashids->encode($str); } } ?>