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,9 +39,8 @@ 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();
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";
@@ -51,15 +50,13 @@ class Auto extends Controller {
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 '<pre>';
var_dump($list);
@@ -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;
}
/**
* 推送邮件提醒作者修回稿件
*/
@@ -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"]).",<br>";
$tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",<br>";
$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.<br><br>";
$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.<br><br>";
$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.<br><br><br>";
@@ -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"]).",<br>";
$tt = "Dear Dr. " . ($cache_author["realname"] == "" ? $cache_author["account"] : $cache_author["realname"]) . ",<br>";
$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.<br><br>";
$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.<br><br>";
$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.<br><br><br>";

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');
}
/**
@@ -81,48 +83,51 @@ 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]]);
}
/**
* 添加文章(作者)
*/
@@ -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,7 +218,7 @@ 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);
@@ -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');
@@ -236,10 +240,10 @@ class Special extends Controller {
$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,<br>';
$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'];
@@ -278,18 +282,18 @@ 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]);
}
/**
@@ -300,7 +304,7 @@ class Special extends Controller {
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;

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');
}
/**
@@ -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<br/><br/>";
foreach ($list as $v) {
$content = "Dear Researcher<br/><br/>";
$content .= "We sincerely invite you to subscribe to our journal <b>Traditional Medicine Research</b> (TMR) (ISSN 2413-3973).<br/>";
$content .= "If you are interested in our journalit is easy to subscribe to journals and topics on our official website. Please click here:<br/>";
$content .= "<a href='https://www.tmrjournals.com/draw_up.html?issn=2413-3973'>https://www.tmrjournals.com/draw_up.html?issn=2413-3973</a><br/><br/>";
@@ -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'];
@@ -210,7 +309,7 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
public function getUserRole(){
public function getUserRole() {
$data = $this->request->post();
$roles = $this->getUserRoles($data['account']);
$re['roles'] = $roles;
@@ -218,26 +317,26 @@ class User extends Controller {
}
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;
@@ -256,9 +355,9 @@ 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([]);
}
@@ -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,24 +565,24 @@ 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]);
@@ -587,21 +685,21 @@ 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;
@@ -619,13 +717,13 @@ 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;
@@ -652,19 +750,19 @@ 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();
$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){
if ($check) {
return jsonError("has reviewer");
}
@@ -688,9 +786,9 @@ class User extends Controller {
$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]);
$res2 = $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->update(['rfa_state' => 1]);
if($res && $res1 && $res2){
if ($res && $res1 && $res2) {
Db::commit();
return jsonSuccess([]);
} else {
@@ -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!");
}
}
@@ -851,12 +949,12 @@ 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();
$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;
$re['is'] = $check == null ? 0 : 1;
return jsonSuccess($re);
}
@@ -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();
$check_info = $this->user_obj->where("account|email", $data['username'])->where("state", 0)->find();
$re['has'] = $check_info==null?0:1;
$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']);