This commit is contained in:
wangjinlei
2021-07-26 14:27:01 +08:00
parent 8ea54fdcc2
commit 3ae9be1e60
7 changed files with 163 additions and 67 deletions

View File

@@ -343,8 +343,8 @@ class Admin extends Controller {
//验证数据完整性
if ($v['username'] == '' || $v['email'] == '' || $v['realname'] == '' || $v['major'] == '' || $v['username'] == null || $v['email'] == null || $v['realname'] == null || $v['major'] == null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'username' => trim($v['username']),
'realname' => trim($v['realname']),
'email' => $v['email'],
'reason' => 'Missing data'
];
@@ -354,8 +354,8 @@ class Admin extends Controller {
$major = self::get_major($v['major']);
if ($major === null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'username' => trim($v['username']),
'realname' => trim($v['realname']),
'email' => $v['email'],
'reason' => 'major is error'
];
@@ -366,8 +366,8 @@ class Admin extends Controller {
$mme = self::get_userByEmail($v['email']);
if ($this_reviewer == null && $mme != null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'username' => trim($v['username']),
'realname' => trim($v['realname']),
'email' => $v['email'],
'reason' => 'Email occupied,and username is:'.$mme['account']
];
@@ -384,8 +384,8 @@ class Admin extends Controller {
}
if ($this_reviewer != null && self::get_retojo($this_reviewer['user_id'], $journal) != null) {
$su_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'username' => trim($v['username']),
'realname' => trim($v['realname']),
'email' => $v['email'],
'reason' => 'success(has register)'
];
@@ -399,7 +399,7 @@ class Admin extends Controller {
$cache_reviewer['account'] = trim($v['username']);
$cache_reviewer['password'] = md5('123456qwe');
$cache_reviewer['email'] = $v['email'];
$cache_reviewer['realname'] = $v['realname'];
$cache_reviewer['realname'] = trim($v['realname']);
$cache_reviewer['is_reviewer'] = 1;
$cache_reviewer['ctime'] = time();
$cache_id = $this->user_obj->insertGetId($cache_reviewer);
@@ -429,32 +429,37 @@ class Admin extends Controller {
//存储关系表信息
$cache_insert_rtj['reviewer_id'] = $this_reviewer == null ? $cache_id : $this_reviewer['user_id'];
$cache_insert_rtj['journal_id'] = $journal;
$cache_insert_rtj['account'] = $v['username'];
$cache_insert_rtj['account'] = trim($v['username']);
$cache_insert_rtj['journal_title'] = $journal_info['title'];
$cache_insert_rtj['ctime'] = time();
$this->reviewer_to_journal_obj->insert($cache_insert_rtj);
//增加成功信息
$su_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'username' => trim($v['username']),
'realname' => trim($v['realname']),
'email' => $v['email'],
'reason' => 'success'
];
//发送邮件提醒审稿人
$tt = 'Dear Reviewer,<br>';
$tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.<br>';
$tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.<br>';
$tt .= 'You could log in with your account in submission.tmrjournals.com .<br>';
$tt .= 'Your username:'.$v['username'].'<br>';
$tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)<br>';
$tt .= 'Thank you so much for your kindly support.<br><br>';
$tt .= $journal_info['title'].'<br>';
$tt .= date('Y-m-d');
// $tt = 'Dear Reviewer,<br>';
// $tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.<br>';
// $tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.<br>';
// $tt .= 'You could log in with your account in submission.tmrjournals.com .<br>';
// $tt .= 'Your username:'.$v['username'].'<br>';
// $tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)<br>';
// $tt .= 'Thank you so much for your kindly support.<br><br>';
// $tt .= $journal_info['title'].'<br>';
// $tt .= date('Y-m-d');
$content = "Thank you for registering as a " . $journal_info['title'] . " reviewer<br/>". "At present, you have passed our examination<br/>";
$content .= '<a href="https://submission.tmrjournals.com">SubmissionSystem</a><br>';
$content .= '<p>username:' . trim($v['username']) . '</p>';
$content .= '<p>Original Password: 123456qwe</p>';//$has_res ? '' : '<p>password:123456qwe</p>';
$maidata['email'] = $v['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $tt;
$maidata['content'] = $content;
$maidata['tmail'] = $journal_info['email'];
$maidata['tpassword'] = $journal_info['epassword'];
Queue::push( 'app\api\job\mail@fire' , $maidata , "tmail" );
@@ -605,31 +610,5 @@ class Admin extends Controller {
phpinfo();
}
public function testmail() {
$jobHandlerClassName = 'app\api\job\mail@fire';
$jobQueueName = "mail";
$data = [];
// $data['email'] = '751475802@qq.com';
$data['email'] = '13662001490@126.com';
$data['title'] = 'ttttssdsadsadsadasdss';
$tt = 'Dear Reviewer,<br>';
$tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.<br>';
$tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.<br>';
$tt .= 'You could log in with your account in submission.tmrjournals.com .<br>';
$tt .= 'Your username:aaasssss<br>';
$tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)<br>';
$tt .= 'Thank you so much for your kindly support.<br><br>';
$tt .= 'tmr<br>';
$tt .= date('Y-m-d');
$data['content'] = $tt;
$data['tmail'] = 'ghr@tmrjournals.com';
$data['tpassword'] = 'Wu999999gh';
$isPushed = Queue::push( $jobHandlerClassName , $data , $jobQueueName );
echo '<pre>';
var_dump($isPushed);
echo '</pre>';
die;
// sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
}

View File

@@ -932,7 +932,7 @@ class Article extends Controller {
public function getArticleReviewerList() {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
$revids = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->column('reviewer_id');
$revids = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->where('state',0)->column('reviewer_id');
$noids = $this->article_reviewer_obj->where('article_id', $data['articleId'])->column('reviewer_id');
if ($noids != null) {

View File

@@ -23,9 +23,6 @@ class Img extends Controller {
public function reviewerImport() {
//接收信息
$data = $this->request->post();
// $data['url'] = 'zhengshu/import/20210610/e7a3ae0879619862f0f5584d674ffc69.xlsx';
// $data['course'] = 'ZYMR';
//读取excel
$path = ROOT_PATH . 'public' . DS . $data['url'];
$arr = self::readExcel($path);
@@ -39,13 +36,8 @@ class Img extends Controller {
Queue::push('app\api\job\img@fire', $datae, "img");
}
// $this->imgCL($arr,$data['course']);
}
// public function t(){
// Queue::push( 'app\api\job\img@fire',[], "img" );
// }
/**
* 接收导入文件
@@ -195,11 +187,8 @@ class Img extends Controller {
} else {
$zip->open($zipName, \ZIPARCHIVE::CREATE);
}
$dir = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $data['course'] . '/';
$files = scandir($dir);
foreach ($files as $val) {
if ($val == '.' || $val == '..') {
continue;
@@ -211,14 +200,55 @@ class Img extends Controller {
}
}
$zip->close(); //关闭
if (!file_exists($zipName)) {
exit("无法找到文件"); //即使创建,仍有可能失败
}
$re['url'] = 'public/zhengshu' . DS . 'zip' . DS . $data['course'] . '.zip';
return jsonSuccess($re);
}
public function testaaa(){
$this->imgZL('王金磊', 'ZLLJ');
}
/**
* 获取当前证书流水号最大值
*/
private function getmax($course) {
$dir = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img/' . $course . DS;
$res = scandir($dir);
$big = 0;
foreach ($res as $v) {
if ($v == '.' || $v == '..') {
continue;
}
$cac = intval(substr($v, 0, stripos($v, '_')));
if ($cac > $big) {
$big = $cac;
}
}
return $big;
}
/**
* 处理图片主方法
*/
public function imgZL($name, $course) {
$max = $this->getmax($course);
$lim = [];
if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 9) {
$lim = [640, 890];
} else if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 6) {
$lim = [670, 890];
} else {
$left = (730 - ((35 * strlen($name)) / 2));
$lim = [$left, 890];
}
$template = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'template1.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$image = \think\Image::open($template);
$image->text($name, $ziti, 50, '#00000000', $lim)
->text('NO.ZLLJ' . (20210807001 + $max), $ziti, 30, '#00000000', [573, 660])
->save(ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $course . DS . (1 + $max) . '_' . $name . '.png');
}
/**
* 读取excel数据

View File

@@ -255,7 +255,8 @@ class Reviewer extends Controller {
//发送email->编辑
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new comments from the reviewer.';
$tt .= 'Please check the new comments from the reviewer.<br>';
$tt .= 'Journal:'.$journal_info['title'].' and article title:'.$article_info['title'];
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//发送email感谢reviewer并携带附件

View File

@@ -250,13 +250,17 @@ class User extends Controller {
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)->column('reviewer_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'])->column('reviewer_id');
$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();
$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]);
@@ -264,6 +268,31 @@ class User extends Controller {
return json(['code' => 1]);
}
}
/**
*
*/
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([]);
}
/**
*
*/
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();
$journals = $this->journal_obj->where("editor_id",$editor_info['user_id'])->column('journal_id');
$rtjs = $this->reviewer_to_journal_obj->where('journal_id', 'in', $journals)->where('reviewer_id',$data['reviewer_id'])->where('state',0)->select();
foreach($rtjs as $k => $v){
$rtjs[$k]['reviewer'] = $user_info;
$rtjs[$k]['journal'] = $this->journal_obj->where('journal_id',$v['journal_id'])->find();
}
return jsonSuccess($rtjs);
}
/**
* 获取审核员申请列表

View File

@@ -10,7 +10,11 @@ class img {
public function fire(Job $job, $data) {
// $this->tttt($data['name']);
$this->imgCL($data['name'], $data['course']);
if ($data['course'] == 'ZYMR') {
$this->imgCL($data['name'], $data['course']);
} else {
$this->imgZL($data['name'], $data['course']);
}
$job->delete();
}
@@ -38,7 +42,29 @@ class img {
$image->text($name, $ziti, 50, '#000000', $lim)
->text('NO.ZYMR' . (20210619001 + $max), $ziti, 25, '#000000', [573, 650])
->save(ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $course . DS . (1 + $max) . '_' . $name . '.png');
}
/**
* 处理图片主方法
*/
public function imgZL($name, $course) {
$max = $this->getmax($course);
$lim = [];
if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 9) {
$lim = [640, 890];
} else if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 6) {
$lim = [670, 890];
} else {
$left = (730 - ((35 * strlen($name)) / 2));
$lim = [$left, 890];
}
$template = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'template1.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$image = \think\Image::open($template);
$image->text($name, $ziti, 50, '#000000', $lim)
->text('NO.ZLLJ' . (20210807001 + $max), $ziti, 30, '#000000', [573, 660])
->save(ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $course . DS . (1 + $max) . '_' . $name . '.png');
}
/**
* 获取当前证书流水号最大值

31
application/extra/doc.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
return [
'title' => "APi接口文档", //文档title
'version'=>'1.0.0', //文档版本
'copyright'=>'Powered By Zhangweiwei', //版权信息
'password' => '', //访问密码,为空不需要密码
//静态资源路径--默认为云上路径解决很多人nginx配置问题
//可将assets目录拷贝到public下面具体路径课自行配置
'static_path' => '',
'controller' => [
//需要生成文档的类
'app\index\controller\demo'
],
'filter_method' => [
//过滤 不解析的方法名称
'_empty'
],
'return_format' => [
//数据格式
'status' => "200/300/301/302",
'message' => "提示信息",
],
'public_header' => [
//全局公共头部参数
//如:['name'=>'version', 'require'=>1, 'default'=>'', 'desc'=>'版本号(全局)']
],
'public_param' => [
//全局公共请求参数,设置了所以的接口会自动增加次参数
//如:['name'=>'token', 'type'=>'string', 'require'=>1, 'default'=>'', 'other'=>'' ,'desc'=>'验证(全局)')']
],
];