diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
index f842bf8..13fea9e 100644
--- a/application/api/controller/Article.php
+++ b/application/api/controller/Article.php
@@ -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.']);
}
diff --git a/application/api/controller/Auto.php b/application/api/controller/Auto.php
index 8d48294..64a4cbb 100644
--- a/application/api/controller/Auto.php
+++ b/application/api/controller/Auto.php
@@ -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');
@@ -38,10 +38,9 @@ class Auto extends Controller {
$this->user_log_obj = Db::name('user_log');
$this->reviewer_info_obj = Db::name('user_reviewer_info');
}
-
-
- public function testEmail(){
- $journal_info = $this->journal_obj->where('journal_id',4)->find();
+
+ 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";
@@ -50,23 +49,20 @@ class Auto extends Controller {
// 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)
+ ->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 '
';
var_dump($list);
echo '';
die;
}
-
/**
* 推送邮件给审稿人提醒审稿人
@@ -92,8 +88,11 @@ class Auto extends Controller {
$tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "
";
$tt .= "On " . date("d D Y", $v["ctime"]) . " we sent you a request to review a paper title " . $cache_article['title'] . ".
";
$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.
";
- $tt .= "If you would like to review this paper, please click this link.
";
- $tt .= "If you do not wish to review this paper, please click this link.
";
+ $tt .= 'Click here to review the article
';
+ $tt .= 'Click on the link to reject the review of this manuscript
';
+ $tt .= 'Your username:'.$cache_reviewer['account'].'
';
+ $tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "forgot password".
';
+
$tt .= 'Sincerely,
Editorial Office
' . $cache_journal['title'] . '
';
$tt .= 'Email: ' . $cache_journal['email'] . '
';
$tt .= 'Website:' . $cache_journal['website'] . '';
@@ -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'] . "
";
+ $tt .= "Title:" . $cache_article['title'] . "
";
+ $tt .= "Dear Dr. " . ($cache_reviewer["realname"] == "" ? $cache_reviewer["account"] : $cache_reviewer["realname"]) . "
";
+ $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.
";
+ $tt .= 'Click here to review the article
';
+ $tt .= 'Click on the link to reject the review of this manuscript
';
+ $tt .= 'Sincerely,
Editorial Office
' . $cache_journal['title'] . '
';
+ $tt .= 'Email: ' . $cache_journal['email'] . '
';
+ $tt .= 'Website:' . $cache_journal['website'] . '';
+
+ $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;
+ }
+
/**
* 推送邮件提醒作者修回稿件
*/
@@ -123,7 +164,7 @@ class Auto extends Controller {
//查找作者信息
$cache_author = $this->user_obj->where("user_id", $v['user_id'])->find();
- $tt = "Dear Dr. ".($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]).",
";
+ $tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",
";
$tt .= "We have send you the email about revision of your manuscript. According to our records you are almost reaching the deadline now. We look forward to receiving your revised article.
";
$tt .= "When preparing your revised manuscript, you are asked to carefully consider the reviewers' comments which are attached, and submit a revised versionand a list of responses to the comments before deadline. The revised parts in the manuscript should be highlighted with blue color.
";
$tt .= "If you feel that you will require more time to complete your revision, please let me know and I will update our records accordingly. If I can provide any further advice or assistance, please do not hesitate to contact me.
";
@@ -145,7 +186,7 @@ class Auto extends Controller {
//查找作者信息
$cache_author = $this->user_obj->where("user_id", $v['user_id'])->find();
- $tt = "Dear Dr. ".($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]).",
";
+ $tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",
";
$tt .= "We have send you the email about revision of your manuscript. According to our records you are almost reaching the deadline now. We look forward to receiving your revised article.
";
$tt .= "When preparing your revised manuscript, you are asked to carefully consider the reviewers' comments which are attached, and submit a revised versionand a list of responses to the comments before deadline. The revised parts in the manuscript should be highlighted with blue color.
";
$tt .= "If you feel that you will require more time to complete your revision, please let me know and I will update our records accordingly. If I can provide any further advice or assistance, please do not hesitate to contact me.
";
diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php
index 3bdbf02..5e16add 100644
--- a/application/api/controller/Special.php
+++ b/application/api/controller/Special.php
@@ -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,14 +41,15 @@ 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');
}
-
+
/**
* 注册功能
*/
public function register() {
$data = $this->request->post();
-
+
//检测是否用户名和密码已经占用
$account = $data['username'];
$email = $data['email'];
@@ -73,7 +75,7 @@ class Special extends Controller {
sendEmail($email, 'Dear ' . $data['realname'], 'TMR', $content,);
return json($inser_data);
}
-
+
/**
* 登录功能
* @return type
@@ -81,55 +83,58 @@ class Special extends Controller {
public function checkLogin() {
$data = $this->request->post();
//判断是否管理员登录
- if ($data['username'] == 'superadmin'||$data['username'] == 'wuxiongzhi2') {
+ if ($data['username'] == 'superadmin' || $data['username'] == 'wuxiongzhi2') {
$where_admin['account'] = $data['username'];
$where_admin['password'] = md5($data['password']);
$admin_info = $this->admin_obj->where($where_admin)->find();
- if($admin_info==null){
- return json(['code'=>1]);
- }else{
+ if ($admin_info == null) {
+ return json(['code' => 1]);
+ } else {
$up_admin['last_login_time'] = time();
$up_admin['last_login_ip'] = $this->request->ip();
- $this->admin_obj->where('admin_id = '.$admin_info['admin_id'])->update($up_admin);
- return json(['code'=>0,'userinfo'=>$admin_info]);
+ $this->admin_obj->where('admin_id = ' . $admin_info['admin_id'])->update($up_admin);
+ 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 {//登陆成功
- $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]);
}
+ //黑名单验证
+ $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]);
}
}
-
+
/**
* 获取文章
*/
- public function getArticles(){
+ public function getArticles() {
$data = $this->request->post();
$list = $this->article_obj
- ->where('special_num',$data['special_id'])
- ->where('user_id',$data['user_id'])
- ->where('state',0)->select();
-
+ ->where('special_num', $data['special_id'])
+ ->where('user_id', $data['user_id'])
+ ->where('state', 0)->select();
+
$re['articles'] = $list;
- return json(['code'=>0,'data'=>['articles'=>$re]]);
+ return json(['code' => 0, 'data' => ['articles' => $re]]);
}
-
-
+
/**
* 添加文章(作者)
*/
public function addArticle() {
//接受参数,查询信息
$data = $this->request->post();
-
+
// $data['authorList'] = [
// [
// 'address'=>'111',
@@ -171,8 +176,8 @@ class Special extends Controller {
// $data['picturesAndTables'] = '';
// $data['totalpage'] = '';
// $data['manuscirpt'] = '20210122/e08e82edcabe5dc9d9409d1947fccc82.png';
-
-
+
+
$user_res = $this->user_obj->where('account', $data['username'])->find();
$journal_info = $this->journal_obj->where('issn', $data['journal_issn'])->find();
@@ -187,11 +192,11 @@ class Special extends Controller {
$inset_data['fund'] = $data['fund'];
$inset_data['special_num'] = $data['special_id'];
$inset_data['special_title'] = $data['special_title'];
- $inset_data['accept_sn'] = getArticleSN($journal_info['abbr'],$data['type']);
+ $inset_data['accept_sn'] = getArticleSN($journal_info['abbr'], $data['type']);
$inset_data['type'] = $data['type'];
$inset_data['major_id'] = $data['major'];
$inset_data['cmajor_id'] = $data['cmajor'];
- $inset_data['approval'] = $data['approval']=='true'?1:0;
+ $inset_data['approval'] = $data['approval'] == 'true' ? 1 : 0;
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
$inset_data['ctime'] = time();
@@ -213,11 +218,11 @@ class Special extends Controller {
$i['email'] = $v['email'];
$i['address'] = $v['address'];
$i['is_super'] = $v['isSuper'] == 'true' ? 1 : 0;
- $i['is_report'] = $v['isReport'] == 'true'?1:0;
+ $i['is_report'] = $v['isReport'] == 'true' ? 1 : 0;
$authors[] = $i;
}
$res_author = $this->article_author_obj->insertAll($authors);
-
+
//增加转投信息
$transr = true;
// if($data['istransfer']=='true'){
@@ -228,18 +233,17 @@ 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');
$res_file4 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['totalpage'], 'totalpage');
$res_file3 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
-
+
//发送邮件到编辑,提醒有待审文章
- $editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
+ $editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
$tt = 'Dear editor,
';
$tt .= 'Please check the new manuscript in the submission system.';
- sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
+ sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//增加用户操作log
$log_data['user_id'] = $user_res['user_id'];
@@ -259,7 +263,7 @@ class Special extends Controller {
return json(['code' => 1]);
}
}
-
+
/**
* 上传文章的文件
*/
@@ -274,24 +278,24 @@ class Special extends Controller {
}
}
}
-
+
/**
* 获取领域分类
*/
- public function getMajor(){
- $majors = $this->reviewer_major_obj->where('pid',0)->select();
- return json(['code'=>0,'data'=>$majors]);
+ public function getMajor() {
+ $majors = $this->reviewer_major_obj->where('pid', 0)->select();
+ return json(['code' => 0, 'data' => $majors]);
}
-
+
/**
* 获取major子项目
*/
- public function majorChild(){
+ public function majorChild() {
$majorid = $this->request->post('majorid');
- $ds = $this->reviewer_major_obj->where('pid',$majorid)->select();
- return json(['code'=>0,'data'=>$ds]);
+ $ds = $this->reviewer_major_obj->where('pid', $majorid)->select();
+ return json(['code' => 0, 'data' => $ds]);
}
-
+
/**
* 获取城市
*/
@@ -299,8 +303,8 @@ class Special extends Controller {
$res = $this->country_obj->order('en_name')->select();
return json($res);
}
-
- public function test(){
+
+ public function test() {
echo strtotime('2021-1-1');
}
@@ -312,11 +316,11 @@ class Special extends Controller {
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) {
return true;
- }else if($type_name=='picturesAndTables' && $url == ''){
+ } else if ($type_name == 'picturesAndTables' && $url == '') {
return true;
- }else if($type_name=='coverLetter' && $url == ''){
+ } else if ($type_name == 'coverLetter' && $url == '') {
return true;
- }else if($type_name=='totalpage' && $url = ''){
+ } else if ($type_name == 'totalpage' && $url = '') {
return true;
}
$insert_data['article_id'] = $article_id;
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index eccd026..408d5c3 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -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');
}
/**
@@ -62,10 +64,9 @@ class User extends Controller {
*/
public function checkLogin() {
$data = $this->request->post();
- 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'] == '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,28 +87,32 @@ class User extends Controller {
->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
- } else {//登陆成功
- $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);
- $roles = $this->getUserRoles($user_info['account']);
-
- $re['roles'] = $roles;
- $re['userinfo'] = $user_info;
- return jsonSuccess($re);
}
+ //黑名单验证
+ $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);
+ $roles = $this->getUserRoles($user_info['account']);
+
+ $re['roles'] = $roles;
+ $re['userinfo'] = $user_info;
+ return jsonSuccess($re);
}
}
-
+
/**
* 为所有用户发送邮件
*/
- public function pushEmail(){
+ public function pushEmail() {
die;
- $list = $this->user_obj->where('state',0)->select();
+ $list = $this->user_obj->where('state', 0)->select();
//发送邮件通知审稿人
- foreach($list as $v){
- $content = "Dear Researcher,
";
+ foreach ($list as $v) {
+ $content = "Dear Researcher,
";
$content .= "We sincerely invite you to subscribe to our journal Traditional Medicine Research (TMR) (ISSN 2413-3973).
";
$content .= "If you are interested in our journal,it is easy to subscribe to journals and topics on our official website. Please click here:
";
$content .= "https://www.tmrjournals.com/draw_up.html?issn=2413-3973
";
@@ -121,10 +126,104 @@ class User extends Controller {
$maidata['content'] = $content;
$maidata['tmail'] = "tmrweb@tmrjournals.com";
$maidata['tpassword'] = "Wu999999tmrwe";
- Queue::push( 'app\api\job\mail@fire' , $maidata , "tmail" );
+ Queue::push('app\api\job\mail@fire', $maidata, "tmail");
}
}
-
+
+ /**
+ * @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 申请期刊审稿人对于审稿人
@@ -136,15 +235,15 @@ class User extends Controller {
* @param name:journal_id type:int require:1 desc:期刊id
*
*/
- public function applyReviewerForReviewer(){
+ public function applyReviewerForReviewer() {
$data = $this->request->post();
$user_info = $this->user_obj->where('account', trim($data['username']))->find();
- $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
- $editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
- $reviewer_info_info = $this->user_reviewer_info_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
- $check = $this->reviewer_to_journal_obj->where("reviewer_id",$user_info['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
- $check1 = $this->user_reviewer_obj->where('name',trim($data['username']))->where('journal_id',$data['journal_id'])->find();
- if($check||$check1){
+ $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
+ $editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
+ $reviewer_info_info = $this->user_reviewer_info_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
+ $check = $this->reviewer_to_journal_obj->where("reviewer_id", $user_info['user_id'])->where('journal_id', $data['journal_id'])->where('state', 0)->find();
+ $check1 = $this->user_reviewer_obj->where('name', trim($data['username']))->where('journal_id', $data['journal_id'])->find();
+ if ($check || $check1) {
return jsonError("You are already in the reviewer list of this journal");
}
$insert_data['journal_id'] = $data['journal_id'];
@@ -166,7 +265,7 @@ class User extends Controller {
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送消息信息--编辑
add_usermsg($journal_info['editor_id'], '新增审稿人申请,申请人(' . $data['username'] . ')', '/reviewerApplyDetail?id=' . $res);
-
+
return jsonSuccess([]);
}
@@ -197,7 +296,7 @@ class User extends Controller {
// return json(['code' => 0, 'userinfo' => $user_info]);
// }
// }
-
+
/**
* @title 获取用户身份列表
* @description 获取用户身份列表
@@ -210,39 +309,39 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
- public function getUserRole(){
+ public function getUserRole() {
$data = $this->request->post();
$roles = $this->getUserRoles($data['account']);
$re['roles'] = $roles;
return jsonSuccess($re);
}
-
+
private function getUserRoles($account) {
- $user_info = $this->user_obj->where('account',$account)->find();
- if($user_info['type']==2){
+ $user_info = $this->user_obj->where('account', $account)->find();
+ if ($user_info['type'] == 2) {
$ros[] = 'editor';
return $ros;
}
$roles[] = 'author';
- $reviewer_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
- if($reviewer_res!=null){
+ $reviewer_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
+ if ($reviewer_res != null) {
$roles[] = 'reviewer';
}
- $yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('is_yboard',1)->where('state',0)->find();
- if($yboard_res!=null){
+ $yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('is_yboard', 1)->where('state', 0)->find();
+ if ($yboard_res != null) {
$roles[] = 'yboard';
}
- $chief_res = $this->chief_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
- if($chief_res != null){
+ $chief_res = $this->chief_to_journal_obj->where('user_id', $user_info['user_id'])->where('state', 0)->find();
+ if ($chief_res != null) {
$roles[] = 'chief';
}
- $board_res = $this->board_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
- if($board_res != null){
+ $board_res = $this->board_to_journal_obj->where('user_id', $user_info['user_id'])->where('state', 0)->find();
+ if ($board_res != null) {
$roles[] = 'board';
}
return $roles;
}
-
+
/**
* @title 升级审稿人至青年编委
* @description 升级审稿人至青年编委
@@ -256,12 +355,12 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
- public function upReviewerToYboard(){
+ public function upReviewerToYboard() {
$data = $this->request->post();
- $this->reviewer_to_journal_obj->where('journal_id',$data['journal_id'])->where('reviewer_id',$data['user_id'])->where('state',0)->update(['is_yboard'=>1]);
+ $this->reviewer_to_journal_obj->where('journal_id', $data['journal_id'])->where('reviewer_id', $data['user_id'])->where('state', 0)->update(['is_yboard' => 1]);
return jsonSuccess([]);
}
-
+
/**
* @title 降级青年编委至审稿人
* @description 降级青年编委至审稿人
@@ -275,9 +374,9 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
- public function downReviewerToYboard(){
+ public function downReviewerToYboard() {
$data = $this->request->post();
- $this->reviewer_to_journal_obj->where('journal_id',$data['journal_id'])->where('reviewer_id',$data['user_id'])->where('state',0)->update(['is_yboard'=>0]);
+ $this->reviewer_to_journal_obj->where('journal_id', $data['journal_id'])->where('reviewer_id', $data['user_id'])->where('state', 0)->update(['is_yboard' => 0]);
return jsonSuccess([]);
}
@@ -451,7 +550,6 @@ class User extends Controller {
return $nowcode == $mbcode ? true : false;
}
-
/**
* @title 获取审稿人列表
* @description 获取审稿人列表
@@ -467,28 +565,28 @@ class User extends Controller {
*/
public function getreviewerList() {
$data = $this->request->post();
- $editor_info = $this->user_obj->where('account',$data['username'])->where('state',0)->find();
+ $editor_info = $this->user_obj->where('account', $data['username'])->where('state', 0)->find();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$jous = [];
- if($data['journalId'] == 0){
- $jous = $this->journal_obj->where('editor_id',$editor_info['user_id'])->where('state',0)->column('journal_id');
- }else{
+ if ($data['journalId'] == 0) {
+ $jous = $this->journal_obj->where('editor_id', $editor_info['user_id'])->where('state', 0)->column('journal_id');
+ } else {
$jous[] = $data['journalId'];
}
$res = $this->reviewer_to_journal_obj
->field('t_reviewer_to_journal.is_yboard,t_user_reviewer_info.*,t_journal.*,t_user.*')
- ->join('t_journal','t_journal.journal_id = t_reviewer_to_journal.journal_id','left')
- ->join('t_user','t_user.user_id = t_reviewer_to_journal.reviewer_id','left')
+ ->join('t_journal', 't_journal.journal_id = t_reviewer_to_journal.journal_id', 'left')
+ ->join('t_user', 't_user.user_id = t_reviewer_to_journal.reviewer_id', 'left')
->join('t_user_reviewer_info', 't_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id', 'LEFT')
- ->where('t_reviewer_to_journal.journal_id','in',$jous)
- ->where('t_reviewer_to_journal.state',0)
- ->limit($limit_start,$data['pageSize'])
+ ->where('t_reviewer_to_journal.journal_id', 'in', $jous)
+ ->where('t_reviewer_to_journal.state', 0)
+ ->limit($limit_start, $data['pageSize'])
->select();
- $count = $this->reviewer_to_journal_obj->where('t_reviewer_to_journal.journal_id','in',$jous)->where('t_reviewer_to_journal.state',0)->count();
+ $count = $this->reviewer_to_journal_obj->where('t_reviewer_to_journal.journal_id', 'in', $jous)->where('t_reviewer_to_journal.state', 0)->count();
return json(['code' => 0, 'data' => $res, 'total' => $count]);
-
-
-
+
+
+
// $where['t_user.is_reviewer'] = 1;
// if ($data['journalId'] == 0) {
// $subQuery = $this->user_obj->field('user_id')->where('account', $data['username'])->buildSql();
@@ -574,7 +672,7 @@ class User extends Controller {
return json(['code' => 1]);
}
}
-
+
/**
* @title 获取作者转审稿人列表
* @description 获取作者转审稿人列表
@@ -587,27 +685,27 @@ class User extends Controller {
*
* @return reviewerTrans:列表#
*/
- public function getAuthorToReviewerList(){
+ public function getAuthorToReviewerList() {
$data = $this->request->post();
- $user_info = $this->user_obj->where('account',$data['username'])->find();
- $journals = $this->journal_obj->where("editor_id",$user_info['user_id'])->where('state',0)->column("journal_id");
-
+ $user_info = $this->user_obj->where('account', $data['username'])->find();
+ $journals = $this->journal_obj->where("editor_id", $user_info['user_id'])->where('state', 0)->column("journal_id");
+
$where['t_reviewer_from_author.rfa_state'] = 0;
- if($data['journal_id']==0){
- $where['t_reviewer_from_author.journal_id'] = ["in",$journals];
- }else{
+ if ($data['journal_id'] == 0) {
+ $where['t_reviewer_from_author.journal_id'] = ["in", $journals];
+ } else {
$where['t_reviewer_from_author.journal_id'] = $data['journal_id'];
}
$list = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
- ->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
- ->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
+ ->join("t_article_author", "t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id", "left")
+ ->join("t_journal", "t_journal.journal_id = t_reviewer_from_author.journal_id", "left")
->where($where)
->select();
$re['reviewerTrans'] = $list;
return jsonSuccess($re);
}
-
+
/**
* @title 获取作者转审稿人详情
* @description 获取作者转审稿人详情
@@ -619,19 +717,19 @@ class User extends Controller {
*
* @return reviewerTrans:列表#
*/
- public function getAuthorToReviewerDetail(){
+ public function getAuthorToReviewerDetail() {
$data = $this->request->post();
$detail = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
- ->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
- ->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
- ->where("rfa_id",$data['rfa_id'])
+ ->join("t_article_author", "t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id", "left")
+ ->join("t_journal", "t_journal.journal_id = t_reviewer_from_author.journal_id", "left")
+ ->where("rfa_id", $data['rfa_id'])
->find();
-
+
$re['reviewerTran'] = $detail;
return jsonSuccess($re);
}
-
+
/**
* @title 作者转审稿人提交信息并通过
* @description 作者转审稿人提交信息并通过
@@ -652,24 +750,24 @@ class User extends Controller {
*
*
*/
- public function ReviewerFromAuthorAdopt(){
+ public function ReviewerFromAuthorAdopt() {
$data = $this->request->post();
- $rfa_info = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->find();
- $journal_info = $this->journal_obj->where('journal_id',$rfa_info['journal_id'])->find();
- $art_aut_info = $this->article_author_obj->where('art_aut_id',$rfa_info['art_aut_id'])->find();
- $user_info = $this->user_obj->where('email',$art_aut_info['email'])->where('state',0)->find();
- if(!$user_info){
+ $rfa_info = $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->find();
+ $journal_info = $this->journal_obj->where('journal_id', $rfa_info['journal_id'])->find();
+ $art_aut_info = $this->article_author_obj->where('art_aut_id', $rfa_info['art_aut_id'])->find();
+ $user_info = $this->user_obj->where('email', $art_aut_info['email'])->where('state', 0)->find();
+ if (!$user_info) {
return jsonError("user no find!");
}
-
- $check = $this->reviewer_to_journal_obj->where("journal_id",$journal_info['journal_id'])->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
-
- if($check){
+
+ $check = $this->reviewer_to_journal_obj->where("journal_id", $journal_info['journal_id'])->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
+
+ if ($check) {
return jsonError("has reviewer");
}
-
+
Db::startTrans();
-
+
$insert_info['reviewer_id'] = $user_info['user_id'];
$insert_info['gender'] = $data['gender'];
$insert_info['technical'] = $data['author_title'];
@@ -680,17 +778,17 @@ class User extends Controller {
$insert_info['field'] = $data['field'];
$insert_info['qualifications'] = $data['qualifications'];
$res = $this->user_reviewer_info_obj->insertGetId($insert_info);
-
+
$insert_to['reviewer_id'] = $user_info['user_id'];
$insert_to['journal_id'] = $rfa_info['journal_id'];
$insert_to['account'] = $user_info['account'];
$insert_to['journal_title'] = $journal_info['title'];
$insert_to['ctime'] = time();
$res1 = $this->reviewer_to_journal_obj->insertGetId($insert_to);
-
- $res2 = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>1]);
-
- if($res && $res1 && $res2){
+
+ $res2 = $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->update(['rfa_state' => 1]);
+
+ if ($res && $res1 && $res2) {
Db::commit();
return jsonSuccess([]);
} else {
@@ -698,7 +796,7 @@ class User extends Controller {
return jsonError("system error!");
}
}
-
+
/**
* @title 作者转审稿人拒绝
* @description 作者转审稿人拒绝
@@ -710,9 +808,9 @@ class User extends Controller {
*
*
*/
- public function ReviewerFromAuthorReject(){
+ public function ReviewerFromAuthorReject() {
$data = $this->request->post();
- $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>2]);
+ $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->update(['rfa_state' => 2]);
return jsonSuccess([]);
}
@@ -724,12 +822,12 @@ class User extends Controller {
$where['reviewer_apply_id'] = $reviewerId;
$apply_info = $this->user_reviewer_obj->where($where)->find();
$journal_info = $this->journal_obj->where('journal_id', $apply_info['journal_id'])->find();
- $has_res = $this->user_obj->where('account', $apply_info['name'])->whereOr("email",$apply_info['email'])->find();
+ $has_res = $this->user_obj->where('account', $apply_info['name'])->whereOr("email", $apply_info['email'])->find();
//检测是否已经存在此审稿人
- if($has_res){
- $check = $this->reviewer_to_journal_obj->where('reviewer_id',$has_res['user_id'])->where('journal_id',$journal_info['journal_id'])->where('state',0)->find();
- if($check){
- $this->user_reviewer_obj->where($where)->update(['state'=>1]);
+ if ($has_res) {
+ $check = $this->reviewer_to_journal_obj->where('reviewer_id', $has_res['user_id'])->where('journal_id', $journal_info['journal_id'])->where('state', 0)->find();
+ if ($check) {
+ $this->user_reviewer_obj->where($where)->update(['state' => 1]);
return jsonError("has reviewer!");
}
}
@@ -838,7 +936,7 @@ class User extends Controller {
return json(['code' => 0]);
}
}
-
+
/**
* @title 审查用户是否是审稿人
* @description 审查用户是否是审稿人
@@ -851,15 +949,15 @@ class User extends Controller {
* @return is:0否1是
*
*/
- public function checkUserIsReviewer(){
+ public function checkUserIsReviewer() {
$data = $this->request->post();
- $user_info = $this->user_obj->where('account',$data['username'])->find();
- $check = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
-
- $re['is'] = $check==null?0:1;
+ $user_info = $this->user_obj->where('account', $data['username'])->find();
+ $check = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
+
+ $re['is'] = $check == null ? 0 : 1;
return jsonSuccess($re);
}
-
+
/**
* @title 审查用户是否存在通过用户名或邮箱
* @description 审查用户是否存在通过用户名或邮箱
@@ -872,11 +970,11 @@ class User extends Controller {
* @return has:0无1有
*
*/
- public function checkUserByAccountOrEmail(){
+ public function checkUserByAccountOrEmail() {
$data = $this->request->post();
- $check_info = $this->user_obj->where("account|email",$data['username'])->where("state",0)->find();
-
- $re['has'] = $check_info==null?0:1;
+ $check_info = $this->user_obj->where("account|email", $data['username'])->where("state", 0)->find();
+
+ $re['has'] = $check_info == null ? 0 : 1;
return jsonSuccess($re);
}
@@ -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']);