This commit is contained in:
@@ -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,<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'];
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user