diff --git a/.env b/.env index 2ae14cb..ffee274 100644 --- a/.env +++ b/.env @@ -47,20 +47,6 @@ pre = ' - Home - page - | - Scientist - Community - | - Database - | - Submission - System diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index e2e2020..0f892ee 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -193,10 +193,7 @@ class Production extends Controller 'title' => 'require', 'type' => 'require', 'icon' => 'require', - 'tradition_tag' => 'require', - 'tradition' => 'require', 'acknowledgment' => 'require', - 'abbreviation' =>'require', 'keywords' => 'require', 'author_contribution'=>'require', 'abbr' => 'require' @@ -212,14 +209,14 @@ class Production extends Controller $update['journal_stage_id'] = $data['journal_stage_id']; $update['type'] = trim($data['type']); $update['icon'] = trim($data['icon']); - $update['tradition_tag'] = trim($data['tradition_tag']); - $update['tradition'] = trim($data['tradition']); + $update['tradition_tag'] = isset($data['tradition_tag'])?trim($data['tradition_tag']):''; + $update['tradition'] = isset($data['tradition'])?trim($data['tradition']):''; $update['author_contribution'] = trim($data['author_contribution']); $update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : ''; $update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : ''; // $update['abstract'] = trim($data['abstract']); $update['keywords'] = trim($data['keywords']); - $update['abbreviation'] = trim($data['abbreviation']); + $update['abbreviation'] = isset($data['abbreviation'])?trim($data['abbreviation']):''; $update['acknowledgment'] = trim($data['acknowledgment']); $update['abbr'] = trim($data['abbr']); // $update['pub_date'] = trim($data['pub_date']); @@ -375,7 +372,7 @@ class Production extends Controller if (!$rule->check($data)) { return jsonError($rule->getError()); } - $update['abstract'] = trim($data['abstract']); + $updata['abstract'] = trim($data['abstract']); $updata['doi'] = $data['doi']; $updata['pub_date'] = $data['pub_date']; $this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($updata); @@ -423,6 +420,23 @@ class Production extends Controller $pra['doi'] = $p_info['doi']; $pra['abstract'] = $p_info['abstract']; $pra['pub_date'] = $p_info['pub_date']; + $pra['abbr'] = $p_info['abbr']; + $pra['icon'] = $p_info['icon']; + if($p_info['file_sub']!=''){ + $pra['file_sub'] = $p_info['file_sub']; + } + if($p_info['file_sub2']!=''){ + $pra['file_sub2'] = $p_info['file_sub2']; + } + if($p_info['file_cdf']!=''){ + $pra['file_cdf'] = $p_info['file_cdf']; + } + if($p_info['endnote']!=''){ + $pra['endnote'] = $p_info['endnote']; + } + if($p_info['bibtex']!=''){ + $pra['bibtex'] = $p_info['bibtex']; + } $pra['file_pdf'] = $p_info['file_pdf']; $pra['keywords'] = $p_info['keywords']; $pra['npp'] = $p_info['npp']; @@ -475,7 +489,7 @@ class Production extends Controller $corrauthor = ''; $corremail = ''; foreach($corr_authors as $v){ - $corrauthor .= $v['first_name']. ' '.$v['last_name'].'. '; + $corrauthor .= trim($v['first_name']). ' '.trim($v['last_name']).'. '; $corremail .= $v['email'].'. '; } $typesetInfo['authorCorresponding'] = substr(trim($corrauthor),0,-1); @@ -658,9 +672,9 @@ class Production extends Controller $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); $insert['p_article_id'] = $data['p_article_id']; $insert['article_id'] = $p_info['article_id']; - $insert['author_name'] = $data['first_name'] . ' ' . $data['last_name']; - $insert['first_name'] = $data['first_name']; - $insert['last_name'] = $data['last_name']; + $insert['author_name'] = trim($data['first_name']) . ' ' . trim($data['last_name']); + $insert['first_name'] = trim($data['first_name']); + $insert['last_name'] = trim($data['last_name']); $insert['orcid'] = isset($data['orcid']) ? $data['orcid'] : ''; $insert['author_country'] = $data['author_country']; $insert['is_first'] = $data['is_first']; @@ -953,11 +967,18 @@ class Production extends Controller } } + $first_num = 0;//第一作者的总数 + foreach($authors as $v){ + if($v['is_first']==1){ + $first_num++; + } + } + //构建数组字符串 $author = ''; foreach ($authors as $v) { - $cache_str = $v['first_name'] . ' ' . $v['last_name'] . ''; + $cache_str = trim($v['first_name']) . ' ' . trim($v['last_name']) . ''; $cac = $this->production_article_author_to_organ_obj ->field('t_production_article_organ.*') ->join('t_production_article_organ','t_production_article_organ.p_article_organ_id = t_production_article_author_to_organ.p_article_organ_id','left') @@ -965,15 +986,16 @@ class Production extends Controller ->where('t_production_article_author_to_organ.state',0) ->select(); foreach ($cac as $val) { - $cache_str .= (intval(search_array_val($address, $val['organ_name'])) + 1) . " "; - } - if ($v['is_first'] == 1) { - $cache_str .= '*'; - } - if ($v['is_report'] == 1) { - $cache_str .= '#'; + $cache_str .= (intval(search_array_val($address, $val['organ_name'])) + 1) . ", "; } $cache_str = trim($cache_str); + $cache_str = substr($cache_str,0,-1); + if ($first_num>1&&$v['is_first'] == 1) { + $cache_str .= '#'; + } + if ($v['is_report'] == 1) { + $cache_str .= '*'; + } $cache_str .= ''; $author .= $cache_str; } diff --git a/application/api/controller/Publish.php b/application/api/controller/Publish.php index d7b52b3..ba3740b 100644 --- a/application/api/controller/Publish.php +++ b/application/api/controller/Publish.php @@ -73,5 +73,25 @@ class Publish extends Controller $this->online_obj = Db::name('online'); } + /** + * 获取online文章列表 + */ + public function getOnlineList(){ + $data = $this->request->post(); + $rule = new Validate([ + 'issn'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $t_journal_info = $this->journal_obj->where('issn',$data['issn'])->find(); + + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getOnlineArticleForSubmit'; + $pra = []; + $pra['issn'] = $t_journal_info['issn']; + $res = object_to_array(json_decode(myPost($url, $pra))); + $re['stages'] = $res['data']['stages']; + return jsonSuccess($re); + } } diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index a08585e..36d11b2 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -174,7 +174,12 @@ class Reviewer extends Controller $res[$k]['cmajor'] = $cmajor['title']; } - $count = $this->article_reviewer_obj->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT')->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id'])->where('t_article_reviewer.state', 'in', [1, 2, 3, 4])->where("t_article.article_id", ">", 0)->count(); + $count = $this->article_reviewer_obj + ->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT') + ->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id']) + ->where('t_article_reviewer.state', 'in', [1, 2, 3, 4]) + ->where("t_article.article_id", ">", 0) + ->count(); $re['lists'] = $res; $re['count'] = $count; return jsonSuccess($re); diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 6d04440..0765d1a 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -35,6 +35,7 @@ class User extends Controller protected $user_to_special_obj = ''; protected $user_index_obj = ''; protected $user_email_index_obj = ''; + protected $user_register_check_obj = ''; public function __construct(\think\Request $request = null) { @@ -57,6 +58,7 @@ class User extends Controller $this->user_to_special_obj = Db::name('user_to_special'); $this->user_index_obj = Db::name('user_index'); $this->user_email_index_obj = Db::name('user_email_index'); + $this->user_register_check_obj = Db::name('user_register_check'); } public function pstest(){ @@ -103,6 +105,10 @@ class User extends Controller if ($user_info == null) { //登陆失败 return json(['code' => 1]); } + + if($user_info['register_check']==0){ + return jsonError('Please click on the link sent to your email inbox to complete your registration.'); + } //黑名单验证 $blackCheck = $this->user_black_obj->where('user_id', $user_info['user_id'])->where('black_state', 0)->find(); if ($blackCheck) { @@ -113,6 +119,7 @@ class User extends Controller $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); @@ -698,6 +705,9 @@ class User extends Controller return json('errcaptcha'); } + $code = get_str(); + + Db::startTrans(); //存入数据 $inser_data['account'] = trim($account); $inser_data['password'] = md5($data['password']); @@ -706,27 +716,52 @@ class User extends Controller $inser_data['realname'] = $data['name']; $inser_data['ctime'] = time(); $id = $this->user_obj->insertGetId($inser_data); + + //存储注册验证信息 + $insert_check['user_id'] = $id; + $insert_check['code'] = $code; + $insert_check['ctime'] = time(); + $i_res = $this->user_register_check_obj->insert($insert_check); + //发送注册成功邮件 - $tt = 'Hello,

'; - $tt .= 'Your account has been created. You may check on the status of your manuscript using this submission and tracking system: https://submission.tmrjournals.com
'; - $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' - ]; - // Queue::push('app\api\job\domail@fire',$sendUser,'domail'); - return json($inser_data); + $tt = "Hello,

"; + $tt .= "To protect the email relationship unobstructed.

"; + $tt .= "Please verify your email address to complete the account registration:

"; + $tt .= "https://submission.tmrjournals.com/login?code=".$code."

"; + $tt .= "Thank you.
TMR Publishing Group
https://www.tmrjournals.com"; + + if($id&&$i_res){ + Db::commit(); + sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt); + return jsonSuccess([]); + }else{ + Db::rollback(); + return jsonError("system error"); + } } + /** + * 审核注册验证码 + */ + public function checkRegisterCode(){ + $data = $this->request->post(); + $rule = new Validate([ + 'code'=>'require' + ]); + if(!$rule->check($data)){ + return jsonSuccess($rule->getError()); + } + $check_info = $this->user_register_check_obj->where('code',$data['code'])->where('state',0)->find(); + if(!$check_info){ + return jsonError('not find this code'); + } + $this->user_obj->where('user_id',$check_info['user_id'])->update(['register_check'=>1]); + $this->user_register_check_obj->where('user_rc_id',$check_info['user_rc_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + + + /** * 获取验证码图片(用户注册) */ diff --git a/application/common.php b/application/common.php index 2b60682..5891fc2 100644 --- a/application/common.php +++ b/application/common.php @@ -112,6 +112,20 @@ function object_to_array($obj) { return $obj; } +function get_str(){ + + $length = 32; + $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + $len = strlen($str)-1; + $randstr = ''; + for ($i=0;$i<$length;$i++) { + $num=mt_rand(0,$len); + $randstr .= $str[$num]; + } + return md5($randstr.time()); + +} + /** * 生成文章sn号 * @return type