1
This commit is contained in:
@@ -11,7 +11,8 @@ use think\Queue;
|
||||
*
|
||||
* @author jgll2
|
||||
*/
|
||||
class Auto extends Controller {
|
||||
class Auto extends Controller
|
||||
{
|
||||
|
||||
//put your code here
|
||||
protected $article_obj = '';
|
||||
@@ -27,7 +28,8 @@ class Auto extends Controller {
|
||||
protected $reviewer_info_obj = '';
|
||||
protected $user_cv_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
public function __construct(\think\Request $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->article_obj = Db::name('article');
|
||||
$this->article_reviewer_obj = Db::name('article_reviewer');
|
||||
@@ -43,39 +45,119 @@ class Auto extends Controller {
|
||||
$this->user_cv_obj = Db::name('user_cv');
|
||||
}
|
||||
|
||||
public function phpinfo(){
|
||||
public function phpinfo()
|
||||
{
|
||||
phpinfo();
|
||||
}
|
||||
|
||||
public function testEmail() {
|
||||
public function testEmail()
|
||||
{
|
||||
$journal_info = $this->journal_obj->where('journal_id', 4)->find();
|
||||
$maidata['email'] = "751475802@qq.com";
|
||||
$maidata['title'] = "test email";
|
||||
$maidata['content'] = "test content";
|
||||
$maidata['tmail'] = $journal_info['email'];
|
||||
$maidata['tpassword'] = $journal_info['epassword'];
|
||||
// Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||||
// Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||||
sendEmail($maidata['email'], $journal_info['title'], $journal_info['title'], $maidata['title'], $journal_info['email'], $journal_info['epassword']);
|
||||
}
|
||||
|
||||
public function resetReviewerPassword() {
|
||||
public function resetReviewerPassword()
|
||||
{
|
||||
$list = $this->user_obj
|
||||
->field("t_user.*")
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||||
->where("t_user_reviewer_info.reviewer_info_id", ">", 0)
|
||||
->where("t_user.password", "e9f5c5240c0bb39488e6dbfbdb1517e0")
|
||||
->where("t_user.state", 0)
|
||||
->select();
|
||||
->field("t_user.*")
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||||
->where("t_user_reviewer_info.reviewer_info_id", ">", 0)
|
||||
->where("t_user.password", "e9f5c5240c0bb39488e6dbfbdb1517e0")
|
||||
->where("t_user.state", 0)
|
||||
->select();
|
||||
echo '<pre>';
|
||||
var_dump($list);
|
||||
echo '</pre>';
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
public function pctest1()
|
||||
{
|
||||
$url1 = "https://sky.yangtzeu.edu.cn/szdw/zzjs.htm";
|
||||
$url2 = "https://sky.yangtzeu.edu.cn/szdw/dsyl.htm";
|
||||
$result1 = self::pcread($url1);
|
||||
$result2 = self::pcread($url2);
|
||||
$preg = '/<a .*?href="(.*?)".*?>/is';
|
||||
preg_match_all($preg, $result1, $array1);
|
||||
preg_match_all($preg, $result2, $array2);
|
||||
$arr = array_merge($array1[1],$array2[1]);
|
||||
$array = [];
|
||||
foreach ($arr as $v) {
|
||||
if (stripos($v, '1009')) {
|
||||
if(!stripos($v,'yangtzeu.edu')){
|
||||
$array[] = "https://sky.yangtzeu.edu.cn/".substr($v,3);
|
||||
}else{
|
||||
$array[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$frag = [];
|
||||
|
||||
foreach($array as $v){
|
||||
$res = self::pcread($v);
|
||||
preg_match('/一、基本信息<\/span>.*?<\/div>/is',$res,$r);
|
||||
if(!isset($r[0])){
|
||||
continue;
|
||||
}
|
||||
$str = strip_tags($r[0]);
|
||||
$res_arr = explode(PHP_EOL,$str);
|
||||
$cache = [];
|
||||
$chc = [];
|
||||
foreach($res_arr as $val){
|
||||
if(stripos($val,'mail')){
|
||||
$cache['email'] = str_replace(" ",' ',$val);
|
||||
}else{
|
||||
$chc[] = str_replace(" ",' ',$val);
|
||||
}
|
||||
|
||||
}
|
||||
$cache['name'] = str_replace(" ",' ',$res_arr[1]);
|
||||
|
||||
$cache['all'] = $chc;
|
||||
|
||||
$frag[] = $cache;
|
||||
}
|
||||
dump($frag);
|
||||
|
||||
// $res = self::pcread($array[1]);
|
||||
|
||||
// preg_match('/一、基本信息<\/span>.*?<\/div>/is',$res,$r);
|
||||
// $str = strip_tags($r[0]);
|
||||
// $res_arr = explode(PHP_EOL,$str);
|
||||
|
||||
|
||||
|
||||
// dump(explode(PHP_EOL,$str));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function pcread($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止调用时就输出获取到的数据
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送邮件给审稿人提醒审稿人
|
||||
*/
|
||||
public function pushEmailForReviewer() {
|
||||
public function pushEmailForReviewer()
|
||||
{
|
||||
//筛选数据
|
||||
$list = $this->article_reviewer_obj->where("state", "in", [0, 5])->select();
|
||||
foreach ($list as $v) {
|
||||
@@ -88,8 +170,8 @@ class Auto extends Controller {
|
||||
$cache_journal = $this->journal_obj->where("journal_id", $cache_article['journal_id'])->find();
|
||||
//查找审稿人信息
|
||||
$cache_reviewer = $this->user_obj
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||||
->where("t_user.user_id", $v['reviewer_id'])->find();
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", "left")
|
||||
->where("t_user.user_id", $v['reviewer_id'])->find();
|
||||
|
||||
$tt = "Manuscript ID: " . $cache_article['accept_sn'] . "<br>";
|
||||
$tt .= "Title:" . $cache_article['title'] . "<br>";
|
||||
@@ -98,9 +180,9 @@ class Auto extends Controller {
|
||||
$tt .= "We have not yet received a response from you, possibly because the original invitation went astray. We would be grateful if you could let us know if you can carry out this review.<br><br>";
|
||||
$tt .= '<a href="' . $this->creatLoginUrlForreviewer($cache_reviewer, $v['art_rev_id']) . '">Click here to review the article</a><br>';
|
||||
$tt .= '<a href="' . $this->creatRejectUrlForReviewer($cache_reviewer, $v['art_rev_id']) . '">Click on the link to reject the review of this manuscript</a><br>';
|
||||
$tt .= 'Your username:'.$cache_reviewer['account'].'<br><br>';
|
||||
$tt .= 'Your username:' . $cache_reviewer['account'] . '<br><br>';
|
||||
$tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "<a href="https://submission.tmrjournals.com/retrieve">forgot password</a>".<br>';
|
||||
|
||||
|
||||
$tt .= 'Sincerely,<br>Editorial Office<br>' . $cache_journal['title'] . '<br>';
|
||||
$tt .= 'Email: ' . $cache_journal['email'] . '<br>';
|
||||
$tt .= 'Website:<a href="' . $cache_journal['website'] . '">' . $cache_journal['website'] . '</a>';
|
||||
@@ -127,7 +209,8 @@ class Auto extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function pushTestEmail() {
|
||||
public function pushTestEmail()
|
||||
{
|
||||
$cache_reviewer = $this->user_obj->where('user_id', 54)->find();
|
||||
$cache_journal = $this->journal_obj->where('journal_id', 1)->find();
|
||||
$cache_article = $this->article_obj->where("article_id", 1700)->find();
|
||||
@@ -169,33 +252,36 @@ class Auto extends Controller {
|
||||
// dump($list);
|
||||
// }
|
||||
|
||||
public function getUserqqqq(){
|
||||
public function getUserqqqq()
|
||||
{
|
||||
$num = $this->request->post('num');
|
||||
$limit_start = ($num - 1) * 1000;
|
||||
$users = $this->user_obj->join("t_user_reviewer_info",'t_user_reviewer_info.reviewer_id = t_user.user_id','left')->limit($limit_start,1000)->select();
|
||||
$users = $this->user_obj->join("t_user_reviewer_info", 't_user_reviewer_info.reviewer_id = t_user.user_id', 'left')->limit($limit_start, 1000)->select();
|
||||
$re['list'] = $users;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function qqqq(){
|
||||
public function qqqq()
|
||||
{
|
||||
$extension_obj = Db::name('exten');
|
||||
$data = $this->request->post();
|
||||
$num = $data['num'];
|
||||
|
||||
|
||||
$limit_start = ($num - 1) * 1000;
|
||||
$list = $extension_obj->limit($limit_start,1000)->select();
|
||||
$list = $extension_obj->limit($limit_start, 1000)->select();
|
||||
$re['list'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function pppp(){
|
||||
public function pppp()
|
||||
{
|
||||
$journal_abbr_obj = Db::name('journal_abbr');
|
||||
$file = "D://bbbb.xlsx";
|
||||
$res = $this->readExcel($file);
|
||||
$f = [];
|
||||
foreach($res as $v){
|
||||
foreach ($res as $v) {
|
||||
$cache['full_name'] = $v['full'];
|
||||
$cache['little_name'] = $v['aa'];
|
||||
$f[] = $cache;
|
||||
@@ -206,7 +292,8 @@ class Auto extends Controller {
|
||||
// $extension_obj->insertAll($res);
|
||||
}
|
||||
|
||||
private function readExcel($path) {
|
||||
private function readExcel($path)
|
||||
{
|
||||
$extension = substr($path, strrpos($path, '.') + 1);
|
||||
vendor("PHPExcel.PHPExcel");
|
||||
if ($extension == 'xlsx') {
|
||||
@@ -224,12 +311,12 @@ class Auto extends Controller {
|
||||
for ($i = 0; $i <= $highestRow; $i++) {
|
||||
$full = $objPHPExcel->getActiveSheet()->getCell("A" . $i)->getValue();
|
||||
$aa = $objPHPExcel->getActiveSheet()->getCell("B" . $i)->getValue();
|
||||
if($aa==''){
|
||||
if ($aa == '') {
|
||||
continue;
|
||||
}
|
||||
// if(!in_array($aa,$frag1)){
|
||||
// $frag1[] = $aa;
|
||||
// $frag[] = ['email'=>$aa];
|
||||
// $frag1[] = $aa;
|
||||
// $frag[] = ['email'=>$aa];
|
||||
// }
|
||||
$ch['full'] = $full;
|
||||
$ch['aa'] = $aa;
|
||||
@@ -238,7 +325,8 @@ class Auto extends Controller {
|
||||
return $frag;
|
||||
}
|
||||
|
||||
private function creatLoginUrlForreviewer($user, $article_id) {
|
||||
private function creatLoginUrlForreviewer($user, $article_id)
|
||||
{
|
||||
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
|
||||
$insert['user_id'] = $user['user_id'];
|
||||
$insert['code'] = $code;
|
||||
@@ -248,7 +336,8 @@ class Auto extends Controller {
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function creatRejectUrlForReviewer($user, $article_id) {
|
||||
private function creatRejectUrlForReviewer($user, $article_id)
|
||||
{
|
||||
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
|
||||
$insert['user_id'] = $user['user_id'];
|
||||
$insert['code'] = $code;
|
||||
@@ -263,7 +352,8 @@ class Auto extends Controller {
|
||||
/**
|
||||
* 推送邮件提醒作者修回稿件
|
||||
*/
|
||||
public function pushEmailForAuthor() {
|
||||
public function pushEmailForAuthor()
|
||||
{
|
||||
//筛选数据
|
||||
$list = $this->article_obj->where("state", 4)->select();
|
||||
foreach ($list as $v) {
|
||||
@@ -346,7 +436,8 @@ class Auto extends Controller {
|
||||
/**
|
||||
* 自动审稿主方法
|
||||
*/
|
||||
public function initAutoReview() {
|
||||
public function initAutoReview()
|
||||
{
|
||||
//查找对应状态的article列表
|
||||
$alist = $this->article_obj->where('state', 2)->select();
|
||||
foreach ($alist as $v) {
|
||||
@@ -354,15 +445,17 @@ class Auto extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function testrev() {
|
||||
public function testrev()
|
||||
{
|
||||
$a = $this->article_obj->where('article_id', 261)->find();
|
||||
// $this->checkrev($a);
|
||||
// $this->checkrev($a);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理过期审稿
|
||||
*/
|
||||
public function overdue_reviewer() {
|
||||
public function overdue_reviewer()
|
||||
{
|
||||
die('Temporarily Out of Service');
|
||||
$where['state'] = 0;
|
||||
$where['ctime'] = ['lt', time() - 3600 * 24 * 14];
|
||||
@@ -375,7 +468,8 @@ class Auto extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function testmail() {
|
||||
public function testmail()
|
||||
{
|
||||
$maidata['email'] = '751475802@qq.com';
|
||||
$maidata['title'] = 'testdsdsasaddsasdaadsasd' . date('Ymd His', time());
|
||||
$maidata['content'] = 'dsadsaas';
|
||||
@@ -384,14 +478,16 @@ class Auto extends Controller {
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
|
||||
}
|
||||
|
||||
public function mytest() {
|
||||
public function mytest()
|
||||
{
|
||||
echo 'okokokook!!!!';
|
||||
}
|
||||
|
||||
/**
|
||||
* 审查文章审稿人状态,返回结果
|
||||
*/
|
||||
public function checkrev($data) {
|
||||
public function checkrev($data)
|
||||
{
|
||||
die;
|
||||
//查找审稿案例状态
|
||||
$rev_list = $this->reviewer_obj->where('article_id', $data['article_id'])->where('state', '<>', 4)->select();
|
||||
@@ -423,10 +519,10 @@ class Auto extends Controller {
|
||||
$this->add_reviewer($data);
|
||||
return true;
|
||||
} elseif ($all == 2) {
|
||||
if ($s_num > 0) {//不做任何处理
|
||||
if ($s_num > 0) { //不做任何处理
|
||||
return true;
|
||||
}
|
||||
if ($p_num == 2) {//通过
|
||||
if ($p_num == 2) { //通过
|
||||
//更新文章状态
|
||||
$this->article_obj->where('article_id', $data['article_id'])->update(['state' => 4, 'editor_act' => 1]);
|
||||
//添加文章msg信息
|
||||
@@ -450,19 +546,19 @@ class Auto extends Controller {
|
||||
$tt .= 'Email: ' . $journal_info['email'] . '<br>';
|
||||
$tt .= 'Website: ' . $journal_info['website'];
|
||||
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||||
} elseif ($np_num == 2) {//不通过
|
||||
} elseif ($np_num == 2) { //不通过
|
||||
//发送邮件通知编辑
|
||||
$tt = 'Reviewers final opinions on the manuscript ID' . $data['accept_sn'] . ' are rejection. Please login and deal with the next step of this manuscript manually.';
|
||||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||||
} else {//一样一个增加一个审稿案例
|
||||
} else { //一样一个增加一个审稿案例
|
||||
$this->add_reviewer($data);
|
||||
return true;
|
||||
}
|
||||
} elseif ($all == 3) {
|
||||
if ($s_num > 0) {//不做任何处理
|
||||
if ($s_num > 0) { //不做任何处理
|
||||
return true;
|
||||
}
|
||||
if ($p_num == 2) {//通过
|
||||
if ($p_num == 2) { //通过
|
||||
//更新文章状态
|
||||
$this->article_obj->where('article_id', $data['article_id'])->update(['state' => 4, 'editor_act' => 1]);
|
||||
//添加文章msg信息
|
||||
@@ -486,7 +582,7 @@ class Auto extends Controller {
|
||||
$tt .= 'Email: ' . $journal_info['email'] . '<br>';
|
||||
$tt .= 'Website: ' . $journal_info['website'];
|
||||
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||||
} else {//不通过
|
||||
} else { //不通过
|
||||
//发送邮件通知编辑
|
||||
$tt = 'Reviewers final opinions on the manuscript ID' . $data['accept_sn'] . ' are rejection. Please login and deal with the next step of this manuscript manually.';
|
||||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||||
@@ -497,21 +593,22 @@ class Auto extends Controller {
|
||||
/**
|
||||
* 增加一个审稿人
|
||||
*/
|
||||
public function add_reviewer($article) {
|
||||
public function add_reviewer($article)
|
||||
{
|
||||
$journal_info = $this->journal_obj->where('journal_id', $article['journal_id'])->find();
|
||||
$editor_info = $this->user_obj->where('user_id', $article['editor_id'])->find();
|
||||
//根据文章筛选候选人
|
||||
$reviewer = $this->chose_reviewer($article);
|
||||
|
||||
$sendUser=[
|
||||
'title'=> $journal_info['title'], // 邮件标题
|
||||
'journal_id'=>$article['journal_id'], // 期刊ID
|
||||
'sendEmail'=>$journal_info['email'], // 期刊邮箱
|
||||
'sendPassword'=>$journal_info['epassword'], // 期刊密码
|
||||
'from_name'=>$journal_info['title']
|
||||
$sendUser = [
|
||||
'title' => $journal_info['title'], // 邮件标题
|
||||
'journal_id' => $article['journal_id'], // 期刊ID
|
||||
'sendEmail' => $journal_info['email'], // 期刊邮箱
|
||||
'sendPassword' => $journal_info['epassword'], // 期刊密码
|
||||
'from_name' => $journal_info['title']
|
||||
];
|
||||
|
||||
if ($reviewer == null) {//没有查询到审稿人,执行提醒操作
|
||||
if ($reviewer == null) { //没有查询到审稿人,执行提醒操作
|
||||
//发送邮件到编辑,提醒需要手动添加审稿案例
|
||||
$tt = 'Dear editor,<br>';
|
||||
$tt .= 'There are no enough research area related reviewers in the reviewer list for manuscript ID ' . $article['accept_sn'] . ', please add reviewers for your journal or manual deal with this problem.<br><br>';
|
||||
@@ -522,7 +619,7 @@ class Auto extends Controller {
|
||||
$sendUser['content'] = $tt;
|
||||
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
|
||||
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
|
||||
} else {//查询到审稿人,执行添加操作
|
||||
} else { //查询到审稿人,执行添加操作
|
||||
//将审稿时间定义至现在
|
||||
$this->user_obj->where('user_id', $reviewer['user_id'])->update(['rtime' => time()]);
|
||||
|
||||
@@ -551,9 +648,9 @@ class Auto extends Controller {
|
||||
$tt = $article_info['accept_sn'] . '<br>';
|
||||
$tt .= 'Dear Dr. ' . ($reviewer_info['realname'] == '' ? $reviewer_info['account'] : $reviewer_info['realname']) . '<br><br>';
|
||||
$tt .= 'The manuscript entitled “' . $article_info['title'] . '” has'
|
||||
. ' been submitted to the journal ' . $journal_info['title'] . '. The Editor-in-Chief would'
|
||||
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
|
||||
. ' in the journal ' . $journal_info['title'] . '. <br>';
|
||||
. ' been submitted to the journal ' . $journal_info['title'] . '. The Editor-in-Chief would'
|
||||
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
|
||||
. ' in the journal ' . $journal_info['title'] . '. <br>';
|
||||
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.<br><br>';
|
||||
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
|
||||
$tt .= '<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">Reviewer Center</a><br>';
|
||||
@@ -585,19 +682,19 @@ class Auto extends Controller {
|
||||
/**
|
||||
* 筛选一个审稿人
|
||||
*/
|
||||
public function chose_reviewer($article) {
|
||||
public function chose_reviewer($article)
|
||||
{
|
||||
//筛选符合期刊
|
||||
$rev_list = $this->rev_to_jour_obj->where('journal_id', $article['journal_id'])->column('reviewer_id');
|
||||
$fie_list = $this->reviewer_info_obj->where('major', $article['major_id'])->column('reviewer_id');
|
||||
$u_list = $this->user_obj
|
||||
->where('user_id', ['in', $rev_list], ['in', $fie_list])//审核人属于某期刊,并且属于某个领域
|
||||
->where('rtime', '<', time() - 3600 * 24 * 15)//审核人间隔时间
|
||||
->order('rs_num desc')->select();
|
||||
->where('user_id', ['in', $rev_list], ['in', $fie_list]) //审核人属于某期刊,并且属于某个领域
|
||||
->where('rtime', '<', time() - 3600 * 24 * 15) //审核人间隔时间
|
||||
->order('rs_num desc')->select();
|
||||
if ($u_list) {
|
||||
return $u_list[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user