申请青年编委加CV验证

This commit is contained in:
chengxl
2025-11-10 14:00:49 +08:00
parent 4ac84c199e
commit fd37191930

View File

@@ -3133,4 +3133,167 @@ class User extends Base
die;
// return $output;
}
/**
* 获取用户信息
*/
public function getUser(){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//获取用户ID
$iUserId = empty($aParam['user_id']) ? 0 : $aParam['user_id'];
if(empty($iUserId)){
return json_encode(['status' => 2,'msg' => 'Please select the user']);
}
//获取主信息
$aWhere = ['user_id' => $iUserId,'state' => 0];
$aUser = Db::name('user')->field('user_id,account,email,phone,realname')->where($aWhere)->find();
if(empty($aUser)){
return json_encode(['status' => 2,'msg' => 'User does not exist','data' => []]);
}
//查询用户CV
$aCv = Db::name('user_cv')->field('user_cv_id,cv')->where($aWhere)->select();
$aUser['cv'] = empty($aCv) ? [] : $aCv;
//获取附属信息
$aWhere = ['reviewer_id' => $iUserId,'state' => 0];
$aUserInfo = Db::name('user_reviewer_info')->field('technical,country,introduction,company,website,field')->where($aWhere)->find();
if(!empty($aUserInfo)){
$aUser += $aUserInfo;
}
return json_encode(['status' => 1,'data' => $aUser]);
}
/**
* 同意青年科学家申请
*/
public function agreeYboardApplyNew(){
//获取参数
$data = empty($aParam) ? $this->request->post() : $aParam;
//必填信息验证
$aField = ['ap_yboard_id','year','realname','technical','country','field','company'];
$sMsg = '';
$aUserUpdate = $aUserReviewer = [];
foreach ($aField as $key => $value) {
if(empty($data[$value])){
$sMsg = 'Incomplete information';
break;
}
if(!in_array($value, ['ap_yboard_id','year','realname'])){
$aUserReviewer[$value] = $data[$value];
}
if($value == 'realname'){
$aUser['realname'] = $data[$value];
}
}
if(!empty($sMsg)){
return jsonError($sMsg);
}
//查询申请记录
$start_time = time();
$app_info = $this->apply_yboard_obj->where('ap_yboard_id',$data['ap_yboard_id'])->find();
if(empty($app_info)){
return jsonError('No application record found');
}
$user_info = $this->user_obj->where('user_id',$app_info['user_id'])->find();
if(empty($user_info)){
return jsonError('Basic user information not found');
}
//获取期刊信息
$journal_info = $this->journal_obj->where('journal_id',$app_info['journal_id'])->find();
if(empty($journal_info)){
return jsonError('No journal information found or journal closed');
}
//查询是否申请过
$check = $this->user_to_yboard_obj->where('user_id',$app_info['user_id'])->where('journal_id',$app_info['journal_id'])->where('start_date',"<=",$start_time)->where('end_date',">=",$start_time)->where('state',0)->find();
if($check){
return jsonError("Already exists");
}
//数据处理组装
if(isset($data['phone'])){
$aUser['phone'] = $data['phone'];
}
if(isset($data['website'])){
$aUserReviewer['website'] = $data['website'];
}
if(isset($data['introduction'])){
$aUserReviewer['introduction'] = $data['introduction'];
}
Db::startTrans();
//更新用户表user
if(!empty($aUser)){
$aWhere = ['user_id' => $app_info['user_id']];
$user_result = Db::name('user')->where($aWhere)->limit(1)->update($aUser);
}
//更新用户附属表user_reviewer_info
if(!empty($aUserReviewer)){
$aWhere = ['reviewer_id' => $app_info['user_id']];
$aUserReviewerInfo = Db::name('user_reviewer_info')->field('reviewer_id')->where($aWhere)->find();
if(empty($aUserReviewerInfo)){
$user_reviewer_result = Db::name('user_reviewer_info')->insert($aUserReviewer);
}
if(!empty($aUserReviewerInfo)){
$user_reviewer_result = Db::name('user_reviewer_info')->where($aWhere)->limit(1)->update($aUserReviewer);
}
}
$icon = self::createYboardCert($user_info,$journal_info,$start_time,$data['year']);
$insert['user_id'] = $app_info['user_id'];
$insert['journal_id'] = $app_info['journal_id'];
$insert['start_date'] = $start_time;
$insert['end_date'] = strtotime("+ ".$data['year']." year",$start_time);
$insert['icon'] = $icon;
$insert['ctime'] = $start_time;
$this->user_to_yboard_obj->insert($insert);
$this->apply_yboard_obj->where('ap_yboard_id',$data['ap_yboard_id'])->update(['state'=>1]);
//同意成为青年科学家后,将其添加到审稿人
$check_reviewer = $this->reviewer_to_journal_obj->where('journal_id',$app_info['journal_id'])->where('reviewer_id',$app_info['user_id'])->find();
if(!$check_reviewer){//如果不存在那么添加审稿人到对应期刊下面
$insert_reviewer['reviewer_id'] = $app_info['user_id'];
$insert_reviewer['journal_id'] = $app_info['journal_id'];
$insert_reviewer['account'] = $user_info['account'];
$insert_reviewer['journal_title'] = $journal_info['title'];
$insert_reviewer['ctime'] = time();
$this->reviewer_to_journal_obj->insert($insert_reviewer);
}
Db::commit();
//发送邮件提醒用户//发送邮件给用户
$realname = empty($data['realname']) ? $user_info['realname'] : $data['realname'];
$dd = "Dear Dr. ".$realname.",<br/><br/>";
$dd .= "It is my great pleasure to extend my warmest congratulations to you on being selected as a Young Scientist Board Member for <i>".$journal_info['title']."</i> Journal.<br/><br/>";
$dd .= "As a member of the Young Scientist Board, you will be an integral part of the peer-review process and will play a crucial role in ensuring the quality and rigor of the journal's content. Your contributions will be invaluable in shaping the direction of the journal and advancing scholarship in your field.<br/><br/>";
$dd .= "You can download the Young Scientist Board certificate from the personal center system: https://submission.tmrjournals.com/<br/><br/>";
$dd .= "The rights and duties of the members of the Young Scientist Board are as follows:<br/><br/>";
$dd .= "Rights:<br/><br/>";
$dd .= "1. Electronic Certificate: As a Young Scientist Board Member, you will receive an electronic certificate to acknowledge your position in our publication.<br/>";
$dd .= "2. Opportunity for Advancement: Outstanding Youth Editorial Board Members may be considered as potential candidates for the Editorial Board.<br/>";
$dd .= "3. Special Issues: You will have the opportunity to apply for a special Issue to expand your influence and that of your team.<br/><br/>";
$dd .= "Obligations:<br/><br/>";
$dd .= "1. Peer Review: As a Youth Scientist Board Member, you will be required to review and assess 3-5 manuscripts per year, based on your area of research.<br/>";
$dd .= "2. Active Promotion: You should actively promote our publication in your academic and professional circles and recommend quality manuscripts to scholars in your network.<br/>";
$dd .= "3. Provide Feedback: You should provide constructive feedback and suggestions to improve the direction and style of our publication. If feasible, you may also attend small forums or conferences to represent our publication.<br/><br/>";
$dd .= "We look forward to working with you and benefiting from your insights, expertise, and dedication. We are confident that your contributions will make a significant impact on the journal and the academic community as a whole.<br/><br/>";
$dd .= "Once again, congratulations on your appointment as a Young Scientist Board Member for <i>".$journal_info['title']."</i>. We are honored to have you on board and look forward to collaborating with you.<br/><br/>";
$dd .= 'Sincerely,<br>Editorial Office<br>';
$dd .= $journal_info['title'] . '<br>';
$dd .= 'Email: ' . $journal_info['email'] . '<br>';
$dd .= 'Website: ' . $journal_info['website'] . '<br>';
$maidata['email'] = $user_info['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $dd;
$maidata['tmail'] = $journal_info['email'];
$maidata['tpassword'] = $journal_info['epassword'];
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
return jsonSuccess([]);
}
}