This commit is contained in:
Administrator
2022-03-25 15:42:31 +08:00
parent 44cbb62a4e
commit 98f1944b39
4 changed files with 347 additions and 184 deletions

View File

@@ -32,6 +32,7 @@ class Article extends Controller {
protected $reviewer_from_author_obj = '';
protected $article_dialog_obj = '';
protected $article_proposal_obj = '';
protected $user_black_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -56,6 +57,7 @@ class Article extends Controller {
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
$this->article_dialog_obj = Db::name('article_dialog');
$this->article_proposal_obj = Db::name('article_proposal');
$this->user_black_obj = Db::name('user_black');
}
/**
@@ -1068,6 +1070,12 @@ class Article extends Controller {
$data = $this->request->post();
$user_res = $this->user_obj->where('account', $data['username'])->find();
//确定用户是否属于黑名单
$black_check = $this->user_black_obj->where('user_id', $user_res['user_id'])->where('black_state', 0)->find();
if ($black_check) {
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
if($user_res['account']=='fariba'||$user_res['account']=='zc'||$user_res['account']=='Mohammad Hossein'||$user_res['account']=='xiaoyueyue'||$user_res['account']=='sethlee000'||$user_res['account']=='yuanying9908'){
return json(['code'=>1,'msg'=>'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']);
}

View File

@@ -20,6 +20,7 @@ class Auto extends Controller {
protected $rev_to_jour_obj = '';
protected $reviewer_obj = '';
protected $journal_obj = '';
protected $login_auto_obj = '';
protected $article_msg_obj = '';
protected $user_log_obj = '';
protected $reviewer_info_obj = '';
@@ -29,8 +30,7 @@ class Auto extends Controller {
$this->article_obj = Db::name('article');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_obj = Db::name('user');
$this->login_auto_obj = Db::name('login_auto');
$this->rev_to_jour_obj = Db::name('reviewer_to_journal');
$this->journal_obj = Db::name('journal');
$this->reviewer_obj = Db::name('article_reviewer');
@@ -39,7 +39,6 @@ class Auto extends Controller {
$this->reviewer_info_obj = Db::name('user_reviewer_info');
}
public function testEmail() {
$journal_info = $this->journal_obj->where('journal_id', 4)->find();
$maidata['email'] = "751475802@qq.com";
@@ -51,8 +50,6 @@ class Auto extends Controller {
sendEmail($maidata['email'], $journal_info['title'], $journal_info['title'], $maidata['title'], $journal_info['email'], $journal_info['epassword']);
}
public function resetReviewerPassword() {
$list = $this->user_obj
->field("t_user.*")
@@ -67,7 +64,6 @@ class Auto extends Controller {
die;
}
/**
* 推送邮件给审稿人提醒审稿人
*/
@@ -92,8 +88,11 @@ class Auto extends Controller {
$tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "<br><br>";
$tt .= "On " . date("d D Y", $v["ctime"]) . " we sent you a request to review a paper title " . $cache_article['title'] . ".<br><br>";
$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 .= "If you would like to review this paper, please click <a href='https://submission.tmrjournals.com/'>this link</a>.<br><br>";
$tt .= "If you do not wish to review this paper, please click <a href='http://api.tmrjournals.com/public/index.php/api/Reviewer/refusereview/aid/" . $v['art_rev_id'] . "'>this link</a>.<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 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>';
@@ -108,6 +107,48 @@ class Auto extends Controller {
}
}
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();
$tt = "Manuscript ID: " . $cache_article['accept_sn'] . "<br>";
$tt .= "Title:" . $cache_article['title'] . "<br>";
$tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "<br><br>";
$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, $cache_article['art_rev_id']) . '">Click here to review the article</a><br>';
$tt .= '<a href="' . $this->creatRejectUrlForReviewer($cache_reviewer, $cache_article['art_rev_id']) . '">Click on the link to reject the review of this manuscript</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>';
$maidata['email'] = $cache_reviewer['email'];
$maidata['title'] = "Invitation to review manuscript for " . $cache_journal['title'] . " - Reminder";
$maidata['content'] = $tt;
$maidata['tmail'] = $cache_journal['email'];
$maidata['tpassword'] = $cache_journal['epassword'];
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
}
private function creatLoginUrlForreviewer($user, $article_id) {
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
$insert['user_id'] = $user['user_id'];
$insert['code'] = $code;
$insert['ctime'] = time();
$this->login_auto_obj->insert($insert);
$url = 'https://submission.tmrjournals.com/per_text?Art_id=' . $article_id . '&act=' . $code;
return $url;
}
private function creatRejectUrlForReviewer($user, $article_id) {
$code = md5(time() . rand(1000, 9999) . 'thinkphp');
$insert['user_id'] = $user['user_id'];
$insert['code'] = $code;
$insert['ctime'] = time();
$this->login_auto_obj->insert($insert);
$url = 'https://submission.tmrjournals.com/per_text_fail?Art_id=' . $article_id . '&act=' . $code;
return $url;
}
/**
* 推送邮件提醒作者修回稿件
*/

View File

@@ -22,6 +22,7 @@ class Special extends Controller {
protected $user_msg_obj = '';
protected $article_file_obj = '';
protected $user_log_obj = '';
protected $user_black_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -40,6 +41,7 @@ class Special extends Controller {
$this->article_author_obj = Db::name('article_author');
$this->article_file_obj = Db::name('article_file');
$this->user_log_obj = Db::name('user_log');
$this->user_black_obj = Db::name('user_black');
}
/**
@@ -94,19 +96,23 @@ class Special extends Controller {
return json(['code' => 0, 'userinfo' => $admin_info]);
}
} else {//用户登录
$where['account'] = $data['username'];
$where['password'] = md5($data['password']);
$user_info = $this->user_obj->where($where)->find();
// $where['account'] = $data['username'];
// $where['password'] = md5($data['password']);
$user_info = $this->user_obj->where('account|email', trim($data['username']))->where('password', md5($data['password']))->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
} else {//登陆成功
}
//黑名单验证
$blackCheck = $this->user_black_obj->where('user_id',$user_info['user_id'])->where('black_state',0)->find();
if($blackCheck){
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$up_data['last_login_time'] = time();
$up_data['last_login_ip'] = $this->request->ip();
$this->user_obj->where('user_id = ' . $user_info['user_id'])->update($up_data);
return json(['code' => 0, 'userinfo' => $user_info]);
}
}
}
/**
* 获取文章
@@ -122,7 +128,6 @@ class Special extends Controller {
return json(['code' => 0, 'data' => ['articles' => $re]]);
}
/**
* 添加文章(作者)
*/
@@ -228,7 +233,6 @@ class Special extends Controller {
// $transr = $transr?$this->article_transfer_obj->insert($trans_insert):false;
// }
// }
//增加articlefile表的信息
$res_file1 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter');
$res_file2 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['picturesAndTables'], 'picturesAndTables');

View File

@@ -28,6 +28,7 @@ class User extends Controller {
protected $board_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_author_obj = '';
protected $user_black_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -45,6 +46,7 @@ class User extends Controller {
$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');
}
/**
@@ -65,7 +67,6 @@ class User extends Controller {
if ($data['username'] == 'fariba' || $data['username'] == 'zc' || $data['username'] == 'Mohammad Hossein' || $data['username'] == 'xiaoyueyue' || $data['username'] == 'sethlee000' || $data['username'] == 'yuanying9908') {
return json(['code' => 1, 'msg' => 'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']);
}
//判断是否管理员登录
if ($data['username'] == 'superadmin' || $data['username'] == 'wuxiongzhi2') {
$where_admin['account'] = $data['username'];
@@ -86,7 +87,12 @@ class User extends Controller {
->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
} else {//登陆成功
}
//黑名单验证
$blackCheck = $this->user_black_obj->where('user_id',$user_info['user_id'])->where('black_state',0)->find();
if($blackCheck){
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$up_data['last_login_time'] = time();
$up_data['last_login_ip'] = $this->request->ip();
$this->user_obj->where('user_id = ' . $user_info['user_id'])->update($up_data);
@@ -97,7 +103,6 @@ class User extends Controller {
return jsonSuccess($re);
}
}
}
/**
* 为所有用户发送邮件
@@ -125,6 +130,100 @@ class User extends Controller {
}
}
/**
* @title 获取所有用户
* @description 获取所有用户
* @author wangjinlei
* @url /api/User/getAllUser
* @method POST
*
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
* @param type:username type:string require:1 desc:用户名或邮箱
*
* @return users:用户列表#
* @return count:总数
*/
public function getAllUser() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$frag = [];
$count = 0;
if ($data['username'] == "") {
$frag = $this->user_obj->where('state', 0)->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->count();
} else {
$frag = $this->user_obj->where('state', 0)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->count();
}
$re['users'] = $frag;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 拉黑用户
* @description 拉黑用户
* @author wangjinlei
* @url /api/User/pushUserToBlack
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:reason type:string require:1 desc:拉黑原因
*
*/
public function pushUserToBlack() {
$data = $this->request->post();
$insert['user_id'] = $data['user_id'];
$insert['reason'] = trim($data['reason']);
$insert['black_ctime'] = time();
$this->user_black_obj->insert($insert);
return jsonSuccess($data);
}
/**
* @title 获取黑名单列表
* @description 获取黑名单列表
* @author wangjinlei
* @url /api/User/getUserBlackList
* @method POST
*
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return blacks:黑名单列表#
* @return count:总数
*/
public function getUserBlackList() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->user_black_obj
->field("t_user.account,t_user.email,t_user_black.*")
->join('t_user', 't_user.user_id = t_user_black.user_id', 'left')
->where('t_user_black.black_state', 0)
->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_black_obj->where('black_state', 0)->count();
$re['blacks'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 消除黑名单
* @description 消除黑名单
* @author wangjinlei
* @url /api/User/clearBlack
* @method POST
*
* @param name:black_id type:int require:1 desc:黑名单id
*
*/
public function clearBlack() {
$data = $this->request->post();
$this->user_black_obj->where("black_id", $data['black_id'])->update(['black_state' => 1]);
return jsonSuccess([]);
}
/**
* @title 申请期刊审稿人对于审稿人
* @description 申请期刊审稿人对于审稿人
@@ -451,7 +550,6 @@ class User extends Controller {
return $nowcode == $mbcode ? true : false;
}
/**
* @title 获取审稿人列表
* @description 获取审稿人列表
@@ -926,6 +1024,11 @@ class User extends Controller {
if ($user == null) {
Cache::set($r->orcid, $res, 3600);
}
//确定用户是否属于黑名单
$black_check = $this->user_black_obj->where('user_id', $user['user_id'])->where('black_state', 0)->find();
if ($black_check) {
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$roles = $this->getUserRoles($user['account']);
$re['roles'] = $roles;
$re['userinfo'] = $user;
@@ -989,6 +1092,13 @@ class User extends Controller {
$data = $this->request->post();
$cache = Cache::get($data['orcid']);
$res = $this->object2array(json_decode($cache));
$check1 = $this->user_obj->where("account", trim($data['username']))->where("state", 0)->find();
$check2 = $this->user_obj->where("email", trim($data['email']))->where("state", 0)->find();
if ($check1 || $check2) {
return jsonError("User has registed");
}
$insert['account'] = trim($data['username']);
$insert['password'] = md5($data['password']);
$insert['realname'] = trim($data['name']);