diff --git a/application/api/controller/Admin.php b/application/api/controller/Admin.php
index 333aeea..8ec63df 100644
--- a/application/api/controller/Admin.php
+++ b/application/api/controller/Admin.php
@@ -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,
';
- $tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.
';
- $tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.
';
- $tt .= 'You could log in with your account in submission.tmrjournals.com .
';
- $tt .= 'Your username:'.$v['username'].'
';
- $tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)
';
- $tt .= 'Thank you so much for your kindly support.
';
- $tt .= $journal_info['title'].'
';
- $tt .= date('Y-m-d');
+// $tt = 'Dear Reviewer,
';
+// $tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.
';
+// $tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.
';
+// $tt .= 'You could log in with your account in submission.tmrjournals.com .
';
+// $tt .= 'Your username:'.$v['username'].'
';
+// $tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)
';
+// $tt .= 'Thank you so much for your kindly support.
';
+// $tt .= $journal_info['title'].'
';
+// $tt .= date('Y-m-d');
+ $content = "Thank you for registering as a " . $journal_info['title'] . " reviewer
". "At present, you have passed our examination
";
+ $content .= 'Submission System
';
+ $content .= '
username:' . trim($v['username']) . '
'; + $content .= 'Original Password: 123456qwe
';//$has_res ? '' : 'password:123456qwe
'; + $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,'; - var_dump($isPushed); - echo ''; - die; -// sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']); - } } diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 60e3507..12a869e 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -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) { diff --git a/application/api/controller/Img.php b/application/api/controller/Img.php index 302a26f..be12c91 100644 --- a/application/api/controller/Img.php +++ b/application/api/controller/Img.php @@ -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数据 diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index bbc559d..9504b48 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -255,7 +255,8 @@ class Reviewer extends Controller { //发送email->编辑 $tt = 'Dear editor,