diff --git a/.env b/.env
index 39fcbb1..aa97d0f 100644
--- a/.env
+++ b/.env
@@ -4,4 +4,8 @@ send_email = tmrweb@tmrjournals.com
send_email_password = Wu999999tmrwe
;审核建议邮箱
-editor_email = publisher@tmrjournals.com
\ No newline at end of file
+editor_email = publisher@tmrjournals.com
+
+[journal]
+;官网服务器地址
+base_url = http://journalapi.tmrjournals.com/public/index.php
\ No newline at end of file
diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php
index 9f35b7d..fff3204 100644
--- a/application/api/controller/Special.php
+++ b/application/api/controller/Special.php
@@ -6,6 +6,7 @@ use think\Controller;
use think\Db;
use think\Env;
use think\Queue;
+use think\Validate;
class Special extends Controller {
@@ -142,6 +143,27 @@ class Special extends Controller {
return json(['code' => 0, 'data' => ['articles' => $re]]);
}
+ /**
+ * 获取期刊的专刊列表
+ */
+ public function getSpecialByIssn(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ 'journal_issn' => 'require'
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $base_url = Env::get('journal.base_url');
+ $res = object_to_array(json_decode(myPost($base_url."/master/Special/getSpecialByIssn",['journal_issn'=>$data['journal_issn']])));
+ $specials = $res['data']['specials'];
+ foreach($specials as $k => $v){
+ unset($specials[$k]['journal_id']);
+ }
+ $re['specials'] = $specials;
+ return jsonSuccess($re);
+ }
+
/**
* 添加文章(作者)
*/
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 516739d..c5a8e2d 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -8,12 +8,14 @@ use think\captcha;
use think\Cache;
use think\Env;
use think\Queue;
+use think\Validate;
/**
* @title 用户相关接口
* @description 用户相关接口
*/
-class User extends Controller {
+class User extends Controller
+{
protected $user_obj = '';
protected $captcha_obj = '';
@@ -31,7 +33,8 @@ class User extends Controller {
protected $article_author_obj = '';
protected $user_black_obj = '';
- public function __construct(\think\Request $request = null) {
+ public function __construct(\think\Request $request = null)
+ {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
@@ -63,7 +66,8 @@ class User extends Controller {
* @return userinfo:用户信息#
* @return roles:角色列表#
*/
- public function checkLogin() {
+ 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.']);
@@ -81,17 +85,17 @@ class User extends Controller {
$this->admin_obj->where('admin_id = ' . $admin_info['admin_id'])->update($up_admin);
return json(['code' => 0, 'userinfo' => $admin_info]);
}
- } else {//用户登录
+ } else { //用户登录
$user_info = $this->user_obj
- ->where('account|email', $data['username'])
- ->where('password', md5($data['password']))
- ->find();
- if ($user_info == null) {//登陆失败
+ ->where('account|email', $data['username'])
+ ->where('password', md5($data['password']))
+ ->find();
+ if ($user_info == null) { //登陆失败
return json(['code' => 1]);
}
//黑名单验证
- $blackCheck = $this->user_black_obj->where('user_id',$user_info['user_id'])->where('black_state',0)->find();
- if($blackCheck){
+ $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();
@@ -108,7 +112,8 @@ class User extends Controller {
/**
* 为所有用户发送邮件
*/
- public function pushEmail() {
+ public function pushEmail()
+ {
die;
$list = $this->user_obj->where('state', 0)->select();
//发送邮件通知审稿人
@@ -145,20 +150,21 @@ class User extends Controller {
* @return users:用户列表#
* @return count:总数
*/
- public function getAllUser() {
+ public function getAllUser()
+ {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
- $black_list = $this->user_black_obj->where('black_state',0)->column("user_id");
+ $black_list = $this->user_black_obj->where('black_state', 0)->column("user_id");
$frag = [];
$count = 0;
if ($data['username'] == "") {
- $frag = $this->user_obj->where('state', 0)->where("user_id","not in",$black_list)->limit($limit_start, $data['pageSize'])->select();
- $count = $this->user_obj->where('state', 0)->where("user_id","not in",$black_list)->count();
+ $frag = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->limit($limit_start, $data['pageSize'])->select();
+ $count = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->count();
} else {
- $frag = $this->user_obj->where('state', 0)->where("user_id","not in",$black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->limit($limit_start, $data['pageSize'])->select();
- $count = $this->user_obj->where('state', 0)->where("user_id","not in",$black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->count();
+ $frag = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->limit($limit_start, $data['pageSize'])->select();
+ $count = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->count();
}
- foreach($frag as $k => $v){
+ foreach ($frag as $k => $v) {
$frag[$k]['roles'] = $this->getUserRoles($v['account']);
}
$re['users'] = $frag;
@@ -177,10 +183,11 @@ class User extends Controller {
* @param name:reason type:string require:1 desc:拉黑原因
*
*/
- public function pushUserToBlack() {
+ public function pushUserToBlack()
+ {
$data = $this->request->post();
- $check_black = $this->user_black_obj->where('user_id',$data['user_id'])->where('black_state',0)->find();
- if($check_black){
+ $check_black = $this->user_black_obj->where('user_id', $data['user_id'])->where('black_state', 0)->find();
+ if ($check_black) {
return jsonError("repeat !");
}
$insert['user_id'] = $data['user_id'];
@@ -203,20 +210,54 @@ class User extends Controller {
* @return blacks:黑名单列表#
* @return count:总数
*/
- public function getUserBlackList() {
+ 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.realname,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();
+ ->field("t_user.account,t_user.email,t_user.realname,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);
}
+ /**
+ * 添加用户
+ */
+ public function addUser()
+ {
+ $data = $this->request->post();
+ $rules = new Validate([
+ 'account' => 'require|alphaNum|min:5',
+ 'email' => 'require|email',
+ 'password' => 'require',
+ ]);
+ if (!$rules->check($data)) {
+ return jsonError($rules->getError());
+ }
+
+
+ $check = $this->user_obj
+ ->where('state', 0)
+ ->where('account = "'.$data['account'].'" or email = "'.$data['email'].'"')
+ ->find();
+ if ($check) {
+ return jsonError('用户已经存在');
+ }
+ $inser_data['account'] = $data['account'];
+ $inser_data['password'] = md5($data['password']);
+ $inser_data['email'] = $data['email'];
+ $inser_data['phone'] = isset($data['phone']) ? $data['phone'] : '';
+ $inser_data['realname'] = isset($data['realname']) ? $data['realname'] : '';
+ $inser_data['ctime'] = time();
+ $this->user_obj->insertGetId($inser_data);
+ return jsonSuccess([]);
+ }
+
/**
* @title 消除黑名单
* @description 消除黑名单
@@ -227,7 +268,8 @@ class User extends Controller {
* @param name:black_id type:int require:1 desc:黑名单id
*
*/
- public function clearBlack() {
+ public function clearBlack()
+ {
$data = $this->request->post();
$this->user_black_obj->where("black_id", $data['black_id'])->update(['black_state' => 1]);
return jsonSuccess([]);
@@ -244,7 +286,8 @@ 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();
@@ -269,21 +312,21 @@ class User extends Controller {
$insert_data['ctime'] = time();
$res = $this->user_reviewer_obj->insertGetId($insert_data);
//发送email-》编辑
- $sendEditor=[
- 'title'=>$journal_info['title'], // 邮件标题
- 'content'=>'Dear editor,
Please check the new reviewer application.',//邮件内容
- 'user_id'=>$journal_info['editor_id'], //收件人ID
- 'email'=>$editor_info['email'],// 收件人邮箱
- 'journal_id'=>$journal_info['journal_id'], // 期刊ID
- 'sendEmail'=>$journal_info['email'], // 期刊邮箱
- 'sendPassword'=>$journal_info['epassword'], // 期刊密码
- 'from_name'=>$journal_info['title']
+ $sendEditor = [
+ 'title' => $journal_info['title'], // 邮件标题
+ 'content' => 'Dear editor,
Please check the new reviewer application.', //邮件内容
+ 'user_id' => $journal_info['editor_id'], //收件人ID
+ 'email' => $editor_info['email'], // 收件人邮箱
+ 'journal_id' => $journal_info['journal_id'], // 期刊ID
+ 'sendEmail' => $journal_info['email'], // 期刊邮箱
+ 'sendPassword' => $journal_info['epassword'], // 期刊密码
+ 'from_name' => $journal_info['title']
];
// Queue::push('app\api\job\domail@fire',$sendEditor,'domail');
- $tt = 'Dear editor,
';
- $tt .= 'Please check the new reviewer application.';
- sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
+ $tt = 'Dear editor,
';
+ $tt .= 'Please check the new reviewer application.';
+ 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);
@@ -302,21 +345,21 @@ class User extends Controller {
*
* @return userinfo:用户信息#
*/
-// public function reviewer_login() {
-// $data = $this->request->post();
-// $user_info = $this->user_obj
-// ->where('account|email', $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]);
-// }
-// }
+ // public function reviewer_login() {
+ // $data = $this->request->post();
+ // $user_info = $this->user_obj
+ // ->where('account|email', $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]);
+ // }
+ // }
/**
* @title 获取用户身份列表
@@ -330,14 +373,16 @@ 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) {
+ private function getUserRoles($account)
+ {
$user_info = $this->user_obj->where('account', $account)->find();
if ($user_info['type'] == 2) {
$ros[] = 'editor';
@@ -376,7 +421,8 @@ 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]);
return jsonSuccess([]);
@@ -395,7 +441,8 @@ 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]);
return jsonSuccess([]);
@@ -404,7 +451,8 @@ class User extends Controller {
/**
* 获取orcid
*/
- public function checkOrcid() {
+ public function checkOrcid()
+ {
$data = $this->request->post();
$account = $data['account'];
$user = $this->user_obj->where('account', $account)->find();
@@ -414,7 +462,8 @@ class User extends Controller {
/**
* 根据account获取用户信息
*/
- public function getUserdata() {
+ public function getUserdata()
+ {
$account = $this->request->post('account');
$where['account'] = $account;
if ($account == 'superadmin') {
@@ -432,7 +481,8 @@ class User extends Controller {
/**
* 注册功能
*/
- public function register() {
+ public function register()
+ {
$data = $this->request->post();
//检测是否用户名和邮箱已经占用
$account = $data['username'];
@@ -460,16 +510,16 @@ class User extends Controller {
$tt .= "Username:$account
";
$tt .= "Password:" . $data['password'] . '
';
$tt .= "Many thanks
TMR Publishing Group";
- sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt);
- $sendUser=[
- 'title'=>'Dear ' . $data['name'], // 邮件标题
- 'content'=>$tt,//邮件内容
- 'user_id'=>$id, //收件人ID
- 'email'=>$email,// 收件人邮箱
- 'journal_id'=>0, // 期刊ID
- 'sendEmail'=>Env::get('email.send_email'), // 期刊邮箱
- 'sendPassword'=>Env::get('email.send_email_password'), // 期刊密码
- 'from_name'=>'TMR'
+ sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt);
+ $sendUser = [
+ 'title' => 'Dear ' . $data['name'], // 邮件标题
+ 'content' => $tt, //邮件内容
+ 'user_id' => $id, //收件人ID
+ 'email' => $email, // 收件人邮箱
+ 'journal_id' => 0, // 期刊ID
+ 'sendEmail' => Env::get('email.send_email'), // 期刊邮箱
+ 'sendPassword' => Env::get('email.send_email_password'), // 期刊密码
+ 'from_name' => 'TMR'
];
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
return json($inser_data);
@@ -478,7 +528,8 @@ class User extends Controller {
/**
* 获取验证码图片(用户注册)
*/
- public function testCaptcha() {
+ public function testCaptcha()
+ {
$data = $this->request->get();
$config = config('captcha');
$capt = new captcha\Captcha($config);
@@ -488,7 +539,8 @@ class User extends Controller {
/**
* 修改密码
*/
- public function retrieve() {
+ public function retrieve()
+ {
$data = $this->request->post();
//获取act信息
$act_where['act_key'] = $data['actkey'];
@@ -507,7 +559,8 @@ class User extends Controller {
/**
* 获取验证码图片(密码找回)
*/
- public function retrieveCaptcha() {
+ public function retrieveCaptcha()
+ {
$data = $this->request->get();
$config = config('captcha_retrieve');
$capt = new captcha\Captcha($config);
@@ -517,15 +570,16 @@ class User extends Controller {
/**
* 找回密码第一步,获取邮箱
*/
- public function retrieveGetEmail() {
+ public function retrieveGetEmail()
+ {
$data = $this->request->post();
//验证验证码
if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
return json(['code' => 1, 'msg' => '验证码错误']);
}
$res = $this->user_obj
- ->where('account|email', $data['username'])
- ->find();
+ ->where('account|email', $data['username'])
+ ->find();
if ($res == null) {
return json(['code' => 1, 'msg' => '查无此人']);
} else {
@@ -536,7 +590,8 @@ class User extends Controller {
/**
* 找回密码第二部,发送邮件
*/
- public function retrievePushEmail() {
+ public function retrievePushEmail()
+ {
$email = $this->request->post('email');
$where['email'] = $email;
$user = $this->user_obj->where($where)->field('realname,user_id')->find();
@@ -552,19 +607,19 @@ class User extends Controller {
$title = 'Your request to reset your password [TMR Publishing Group]';
$content = "$realname, we've received your request to reset your password.Please click the link below to change your password. $url";
//$res = sendEmail($email, $title, 'TMR', $content);
- $sendUser=[
- 'title'=>$title, // 邮件标题
- 'content'=>$content,//邮件内容
- 'user_id'=>$user['user_id'], //收件人ID
- 'email'=>$email,// 收件人邮箱
- 'journal_id'=>0, // 期刊ID
- 'sendEmail'=>Env::get('email.send_email'), // 期刊邮箱
- 'sendPassword'=>Env::get('email.send_email_password'), // 期刊密码
- 'from_name'=>'TMR'
+ $sendUser = [
+ 'title' => $title, // 邮件标题
+ 'content' => $content, //邮件内容
+ 'user_id' => $user['user_id'], //收件人ID
+ 'email' => $email, // 收件人邮箱
+ 'journal_id' => 0, // 期刊ID
+ 'sendEmail' => Env::get('email.send_email'), // 期刊邮箱
+ 'sendPassword' => Env::get('email.send_email_password'), // 期刊密码
+ 'from_name' => 'TMR'
];
// $isUserPushed = Queue::push('app\api\job\domail@fire',$sendUser,'domail');
// if ($isUserPushed) {//成功
- return json(['code' => 0, 'msg' => 'success']);
+ return json(['code' => 0, 'msg' => 'success']);
// } else {//失败
// return json(['code' => 1, 'msg' => 'fail']);
// }
@@ -573,7 +628,8 @@ class User extends Controller {
/**
* 验证修改密码页面的合法性
*/
- public function checkActkey() {
+ public function checkActkey()
+ {
$actkey = $this->request->post('actkey');
$where['act_key'] = $actkey;
$where['state'] = 0;
@@ -588,7 +644,8 @@ class User extends Controller {
/**
* 自定义验证验证码
*/
- public function my_checkcaptcha($code, $id) {
+ public function my_checkcaptcha($code, $id)
+ {
$nowcode = Cache::get(md5($id));
$mbcode = authcode($code);
return $nowcode == $mbcode ? true : false;
@@ -607,7 +664,8 @@ class User extends Controller {
* @param name:pageSize type:int require:1 desc:每页是数据条数
*
*/
- public function getreviewerList() {
+ public function getreviewerList()
+ {
$data = $this->request->post();
$editor_info = $this->user_obj->where('account', $data['username'])->where('state', 0)->find();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
@@ -618,46 +676,47 @@ class User extends Controller {
$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_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'])
- ->select();
+ ->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_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'])
+ ->select();
$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();
-// $journals = $this->journal_obj->where("editor_id in $subQuery")->column('journal_id');
-// $uids = $this->reviewer_to_journal_obj->where('journal_id', 'in', $journals)->where('state', 0)->column('reviewer_id');
-// $where['t_user.user_id'] = ['in', $uids];
-// } else {
-// $uids = $this->reviewer_to_journal_obj->where('journal_id', $data['journalId'])->where('state', 0)->column('reviewer_id');
-// $where['t_user.user_id'] = ['in', $uids];
-// }
-// $res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*')
-// ->join('t_user_reviewer_info', 't_user_reviewer_info.reviewer_id = t_user.user_id', 'LEFT')
-// ->where($where)
-// ->limit($limit_start, $data['pageSize'])
-// ->select();
-// $total = $this->user_obj->where($where)->count();
-// if ($res) {
-// return json(['code' => 0, 'data' => $res, 'total' => $total]);
-// } else {
-// return json(['code' => 1]);
-// }
+ // $where['t_user.is_reviewer'] = 1;
+ // if ($data['journalId'] == 0) {
+ // $subQuery = $this->user_obj->field('user_id')->where('account', $data['username'])->buildSql();
+ // $journals = $this->journal_obj->where("editor_id in $subQuery")->column('journal_id');
+ // $uids = $this->reviewer_to_journal_obj->where('journal_id', 'in', $journals)->where('state', 0)->column('reviewer_id');
+ // $where['t_user.user_id'] = ['in', $uids];
+ // } else {
+ // $uids = $this->reviewer_to_journal_obj->where('journal_id', $data['journalId'])->where('state', 0)->column('reviewer_id');
+ // $where['t_user.user_id'] = ['in', $uids];
+ // }
+ // $res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*')
+ // ->join('t_user_reviewer_info', 't_user_reviewer_info.reviewer_id = t_user.user_id', 'LEFT')
+ // ->where($where)
+ // ->limit($limit_start, $data['pageSize'])
+ // ->select();
+ // $total = $this->user_obj->where($where)->count();
+ // if ($res) {
+ // return json(['code' => 0, 'data' => $res, 'total' => $total]);
+ // } else {
+ // return json(['code' => 1]);
+ // }
}
/**
*
*/
- public function deleteArticleReviewer() {
+ public function deleteArticleReviewer()
+ {
$data = $this->request->post();
$this->reviewer_to_journal_obj->where('reviewer_id', $data['reviewer_id'])->where('journal_id', $data['journal_id'])->update(['state' => 1]);
return jsonSuccess([]);
@@ -666,7 +725,8 @@ class User extends Controller {
/**
*
*/
- public function getReviewerForDel() {
+ public function getReviewerForDel()
+ {
$data = $this->request->post();
$user_info = $this->user_obj->where('user_id', $data['reviewer_id'])->find();
$editor_info = $this->user_obj->where('account', $data['editor_account'])->find();
@@ -682,7 +742,8 @@ class User extends Controller {
/**
* 获取审核员申请列表
*/
- public function getReviewerApplyList() {
+ public function getReviewerApplyList()
+ {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$where['state'] = 0;
@@ -701,15 +762,16 @@ class User extends Controller {
/**
* 获取申请详情
*/
- public function getApplyDetail() {
+ public function getApplyDetail()
+ {
$reviewerId = $this->request->post('reviewerApplyId');
$where['t_user_reviewer_apply.reviewer_apply_id'] = $reviewerId;
$res = $this->user_reviewer_obj
- ->field('t_user_reviewer_apply.*,t_journal.title journal,t_reviewer_major.title major_title')
- ->join('t_journal', 't_journal.journal_id = t_user_reviewer_apply.journal_id', 'left')
- ->join('t_reviewer_major', 't_user_reviewer_apply.major = t_reviewer_major.major_id', 'LEFT')
- ->where($where)
- ->find();
+ ->field('t_user_reviewer_apply.*,t_journal.title journal,t_reviewer_major.title major_title')
+ ->join('t_journal', 't_journal.journal_id = t_user_reviewer_apply.journal_id', 'left')
+ ->join('t_reviewer_major', 't_user_reviewer_apply.major = t_reviewer_major.major_id', 'LEFT')
+ ->where($where)
+ ->find();
if ($res) {
return json(['code' => 0, 'data' => $res]);
} else {
@@ -729,7 +791,8 @@ 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");
@@ -741,11 +804,11 @@ class User extends Controller {
$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")
- ->where($where)
- ->select();
+ ->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($where)
+ ->select();
$re['reviewerTrans'] = $list;
return jsonSuccess($re);
}
@@ -761,14 +824,15 @@ 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'])
- ->find();
+ ->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'])
+ ->find();
$re['reviewerTran'] = $detail;
return jsonSuccess($re);
@@ -794,7 +858,8 @@ 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();
@@ -852,7 +917,8 @@ 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]);
return jsonSuccess([]);
@@ -861,7 +927,8 @@ class User extends Controller {
/**
* 通过审稿人
*/
- public function reviewerAdopt() {
+ public function reviewerAdopt()
+ {
$reviewerId = $this->request->post('reviewerApplyId');
$where['reviewer_apply_id'] = $reviewerId;
$apply_info = $this->user_reviewer_obj->where($where)->find();
@@ -922,19 +989,19 @@ class User extends Controller {
$res = $this->reviewer_to_journal_obj->insert($insert_rtj);
//发送email
$content = "Thank you for registering as a " . $journal_info['title'] . " reviewer
"
- . "At present, you have passed our examination
";
+ . "At present, you have passed our examination
";
$content .= 'Submission System
';
$content .= '
username:' . $apply_info['name'] . '
'; $content .= 'Original Password: 123456qwe
'; //$has_res ? '' : 'password:123456qwe
'; - $sendUser=[ - 'title'=> $journal_info['title'], // 邮件标题 - 'content'=>$content,//邮件内容 - 'user_id'=>$has_res['user_id'], //收件人ID - 'email'=>$apply_info['email'],// 收件人邮箱 - 'journal_id'=>$journal_info['journal_id'], // 期刊ID - 'sendEmail'=>$journal_info['email'], // 期刊邮箱 - 'sendPassword'=>$journal_info['epassword'], // 期刊密码 - 'from_name'=>$journal_info['title'] + $sendUser = [ + 'title' => $journal_info['title'], // 邮件标题 + 'content' => $content, //邮件内容 + 'user_id' => $has_res['user_id'], //收件人ID + 'email' => $apply_info['email'], // 收件人邮箱 + 'journal_id' => $journal_info['journal_id'], // 期刊ID + 'sendEmail' => $journal_info['email'], // 期刊邮箱 + 'sendPassword' => $journal_info['epassword'], // 期刊密码 + 'from_name' => $journal_info['title'] ]; // Queue::push('app\api\job\domail@fire',$sendUser,'domail'); sendEmail($apply_info['email'], $journal_info['title'], $journal_info['title'], $content, $journal_info['email'], $journal_info['epassword']); @@ -951,17 +1018,18 @@ class User extends Controller { /** * 获取用户消息 */ - public function getUserMsg() { + public function getUserMsg() + { //接收参数 $data = $this->request->post(); $user_info = $this->user_obj->where('account', $data['account'])->find(); //查询msglist $list = $this->user_msg_obj - ->where('user_id', $user_info['user_id']) - ->where('state', 0) - ->order('user_msg_id desc') - ->select(); + ->where('user_id', $user_info['user_id']) + ->where('state', 0) + ->order('user_msg_id desc') + ->select(); return json($list); } @@ -969,19 +1037,21 @@ class User extends Controller { /** * 更改用户消息状态 */ - public function changeMsgState() { + public function changeMsgState() + { //接收参数 $id = $this->request->post('id'); $this->user_msg_obj - ->where('user_msg_id', $id) - ->update(['state' => 1]); + ->where('user_msg_id', $id) + ->update(['state' => 1]); return json(['code' => 0]); } /** * 审核人审查去重 */ - public function checkReviewer() { + public function checkReviewer() + { $username = $this->request->post('username'); $userres = $this->user_obj->where('account', $username)->find(); $applyres = $this->user_reviewer_obj->where("name = '$username' and state <> 2")->find(); @@ -1004,7 +1074,8 @@ 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(); @@ -1025,7 +1096,8 @@ 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(); @@ -1037,31 +1109,32 @@ class User extends Controller { /** * 审查用户通过邮箱 */ - public function checkUserByEmail(){ + public function checkUserByEmail() + { $data = $this->request->post(); $check_info = $this->user_obj->where("email", $data['email'])->where("state", 0)->find(); $re['has'] = $check_info == null ? 0 : 1; return jsonSuccess($re); - } /** * 审查用户通过账号 */ - public function checkUserByAccount(){ + public function checkUserByAccount() + { $data = $this->request->post(); $check_info = $this->user_obj->where("account", $data['account'])->where("state", 0)->find(); $re['has'] = $check_info == null ? 0 : 1; return jsonSuccess($re); - } /** * 拒绝审核人 */ - public function reviewerRejec() { + public function reviewerRejec() + { $reviewerId = $this->request->post('reviewerApplyId'); $where['reviewer_apply_id'] = $reviewerId; $this->user_reviewer_obj->where($where)->update(['state' => 2]); @@ -1081,7 +1154,8 @@ class User extends Controller { * * @return data:领域列表# */ - public function getMajorList() { + public function getMajorList() + { $res = $this->reviewer_major_obj->select(); return json(['code' => 0, 'data' => $res]); } @@ -1089,7 +1163,8 @@ class User extends Controller { /** * orcid登陆 */ - public function OrcidLogin() { + public function OrcidLogin() + { $data = $this->request->post(); $url = 'https://orcid.org/oauth/token'; $param['client_id'] = "APP-PKF0BGRP6DWM6FUB"; @@ -1120,7 +1195,8 @@ class User extends Controller { /** * 登陆后绑定orcid账号 */ - public function OrcidBinding() { + public function OrcidBinding() + { $data = $this->request->post(); $url = 'https://orcid.org/oauth/token'; $param['client_id'] = "APP-PKF0BGRP6DWM6FUB"; @@ -1142,7 +1218,8 @@ class User extends Controller { /** * 绑定orcid到系统内的用户 */ - public function orcidBind() { + public function orcidBind() + { $data = $this->request->post(); //确定系统内部有此账户 $serch['account'] = trim($data['username']); @@ -1168,7 +1245,8 @@ class User extends Controller { /** * 注册绑定orcid至我们的账户 */ - public function orcidRegister() { + public function orcidRegister() + { $data = $this->request->post(); $cache = Cache::get($data['orcid']); $res = $this->object2array(json_decode($cache)); @@ -1197,7 +1275,8 @@ class User extends Controller { /** * 授权码转化成令牌,并存贮 */ - public function sq_to_lp() { + public function sq_to_lp() + { $url = 'https://orcid.org/oauth/token'; $param['client_id'] = "APP-PKF0BGRP6DWM6FUB"; $param['client_secret'] = "755a0e59-9282-44d0-afb4-ef9771942bab"; @@ -1209,7 +1288,8 @@ class User extends Controller { echo $r->orcid; } - private function myUrl($url, $param) { + private function myUrl($url, $param) + { $header = array('Accept: application/json', 'Content-type:application/x-www-form-urlencoded'); $pp = http_build_query($param); $httph = curl_init($url); @@ -1230,7 +1310,8 @@ class User extends Controller { /** * 项目转数组 */ - private function object2array($object) { + private function object2array($object) + { if (is_object($object)) { foreach ($object as $key => $value) { $array[$key] = $value; @@ -1244,8 +1325,9 @@ class User extends Controller { /** * curl -i -H "Accept: application/vnd.orcid+xml" -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' 'https://api.sandbox.orcid.org/v2.1/0000-0002-9227-8514/education/22423' */ - public function geturl() { -// $url = "https://api.orcid.org/v3.0/0000-0003-3278-0964/record"; + public function geturl() + { + // $url = "https://api.orcid.org/v3.0/0000-0003-3278-0964/record"; $url = "https://pub.orcid.org/v3.0/expanded-search/?q=0000-0003-3440-7901"; $headerArray = array("Content-type: application/vnd.orcid+json", "Authorization: Bearer 28924261-b2a9-4ed0-952c-e2647843d1ba"); $ch = curl_init(); @@ -1266,7 +1348,6 @@ class User extends Controller { echo ''; die; die; -// return $output; + // return $output; } - }